Tips for expanding the capabilities of the tinyMCE table plugin

Is it possible to customize the TinyMCE table plugin so that the default template includes a column with a width of 200px? Currently, I am using the inlite theme and would like the default table template to look like this:

<table>
   <tr>
     <td width='200px'>The first column will always be set to 200px width</td>
     <td></td>
   </tr>
</table>

Answer №1

If you find yourself facing this issue, consider utilizing the BeforeSetContent event to access the table that has been inserted. [

tinymce.init({
        selector: '.tinymce' ,
        theme: 'inlite',
        plugins: 'table',
        insert_toolbar: 'quicktable',
        table_appearance_options: true,
        selection_toolbar: 'bold italic underline',
        nonbreaking_force_tab: true,
        inline: true,
        init_instance_callback: function (editor) {
            editor.on('BeforeSetContent', function (e) {
                if(e.content.indexOf('<td>')){
                    e.content = e.content.replace(/<td>/, "<td width='200'>");
                }
            });
        }
    });

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to access a promise's value in global scope within a reactjs application?

Currently tackling user authentication using web tokens in react. My approach involves utilizing the fetch() method to send a POST request to my backend, facilitating CORS. The issue arises when attempting to employ the setToken() hook within the .then() b ...

Approach for calculating the total of values during an iteration

I am working with the array $scope.otherDetailsData [0] object amount: 29.9 code: "012" currency: "BRL" payedDate: "2016-11-10" roDate: "2016-08-01" type:"OTHER" [1] object amount: 39.9 code: "013" currency: "BRL" payedDate: "2016-11-11" roDate: "2016- ...

validation using ajax and php

One question I have is, when I include document.getElementById('myPassword').value); in the validarDados function, it corresponds to valor. Then I need another variable, but valor1 isn't working as expected. The result of echoing $valor1; is ...

How can one effectively compare the value received from value.val() with a regular expression in search fields? Is it possible to use multiple

Feeling a bit overwhelmed. I have come up with this code that is working really well: HTML: <p class="no-result"> Nothing found. </p> JS: (JQuery) $("#itemSearch").on("keyup", function () { if ($("#itemSearch").val() == '') { ...

The drawing library (Google Maps) failed to load

I am looking to integrate drawing mode into Google Maps for my project. Below is the code snippet from my View: <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"> <me ...

Move a 'square' to a different page and display it in a grid format after clicking a button

I am currently developing a project that allows students or schools to add projects and search for collaborators. On a specific page, users can input project details with a preview square next to the fields for visualization. Once the user uploads the ...

Implementing HTML content within a jQuery image slider: A step-by-step guide

My goal is to create a unique page layout where the header, navigation bar, buttons, headings, paragraphs, and other content are all displayed on a slideshow. However, I'm facing an issue where when I add content to the div container or body, it doesn ...

Is it possible for me to rearrange the sequence of Apple, Banana, Mango, Pineapple, and Kiwi?

arrange() organizes the elements in a custom order: var fruits = new Array("Apple", "Banana", "Kiwi", "Ananas", "Mango"); Namen.arrange(); document.write(fruits); I don't want them alphabetically sort ...

How do I automatically redirect to a different URL after verifying that the user has entered certain words using Javascript?

I want to create a function where if a user input on the "comments" id matches any word in my FilterWord's array, they will be redirected to one URL. If the input does not match, they will be redirected to another URL. The checking process should onl ...

Automatically create CSS properties for left and top using absolute positioning

When looking at these websites as models: On each of them, I noticed that there is a well-organized column of boxes for every post. I attempted to recreate this using various methods, but couldn't achieve the exact layout on my own website. It seems ...

What is the best way to extract the value from a textangular editor within an ng-repeat loop

I am using the TextAngular editor within an ng-repeat loop. Within the HTML <ul ng-repeat="lecture in section.lectures"> <div class="col-md-12 article-show" > <form ng-submit="lecture_content('article', $index + 1, l ...

Stop the default drag behavior on an input range element in VueJS

Is there a way to disable the default drag functionality of an input range element without affecting the click feature? Users should be able to change values by clicking instead of dragging. <input type="range" min="0" max=& ...

Issue with MVC 4 Asynchronous File Upload: Controller Always Receiving Null Value

I'm encountering an issue while attempting to upload a file asynchronously from ajax to my controller. I am passing 3 variables - PictureId, PictureName, and PictureFile. The problem specifically lies with the "PictureFile" variable as it consistently ...

Change the attribute to read-only upon modification of the dropdown value

I have a dropdown menu with four options. My goal is to make the "number" input field readonly if the user selects either "option3" or "option4" from the dropdown. <select id="dropdown"> <option value="option1">option1</option> ...

preventing a nested JavaScript function from being executed multiple times

Trying to implement a JavaScript function to run only once has proven to be quite a challenge for me. Despite exploring previously asked questions like Function in javascript that can be called only once, none of the suggested solutions seem to work for me ...

Exploring techniques to query a Mongoose/Express array generated from a select multiple option

I am currently working on a search form that utilizes the select multiple attribute. Below is the code snippet for the form. <form action="/search" method="get"> <select name="q" multiple> <optgroup label="Fruit"> <option ...

It is not possible to make any further changes to the scene in THREE.js

Here is an example you can check out: Example Link I noticed that in newer versions of THREE.js, if the render function is called before adding additional objects to the scene, those objects will not be visible even with multiple subsequent calls to rend ...

React - z-index issue persists

My React App with Autocomplete feature is almost complete, but I need some assistance to double-check my code. https://i.stack.imgur.com/dhmck.png In the code snippet below, I have added a search box with the className "autocomplete" style. The issue I a ...

getting value of object property using a function that is located within the same object

I am attempting to access the 'context' property (or specifically 'context.settings') from within the 'ready' function in the same object. I am uncertain of the correct syntax to achieve this. Below is the code snippet: modu ...

Vue and Nuxt: Concealing a Variable in .env File Post-Build

     Within my Nuxtjs project, I have implemented a process in which I encrypt requests before they are sent to my Laravel API. Once the response is received, I decrypt it using specific global functions that have been defined... function encryptDataLa ...