Home > front end >  Apply tinymce 6.0 to a class of textareas
Apply tinymce 6.0 to a class of textareas

Time:01-29

In tinymce 5.0, my init contained

mode : "specific_textareas",
editor_selector : "mceEditor",

in order to convert any textarea with the class "mceEditor" into a tinymce editor. In 6.0, that doesn't seem to work. It seems that "mode" is no longer used, and I found some docs on their site that said you can now select a single textarea using an ID by specifying:

selector : "textarea#elementid"

but I wasn't able to find any info on selecting textareas by class. On a whim, I tried the following:

selector : "textarea.elementclass"

and it seemed to work. But since I didn't see any docs referencing selection by class, I wanted to find out if this truly is the way to select multiple textareas based on their class.

Thanks!

CodePudding user response:

It is actually mentioned in the documentation. The selector option utilizes the default CSS selector syntax:

Selector configuration is required for TinyMCE integration. Selector configuration uses CSS selector syntax to determine which elements on the page are editable through TinyMCE.

Therefore, you were right when using

selector : "textarea.elementclass"
  • Related