开发者

Applying multiple CSS classes to same text in TinyMCE

开发者 https://www.devze.com 2023-01-15 06:53 出处:网络
I am having some issues getting TinyMCE to be as flexible as I need it to be.In my editor (used in a cakePHP-based app) I am not allowing users to edit the html, so we are relying entirely on the WYSI

I am having some issues getting TinyMCE to be as flexible as I need it to be. In my editor (used in a cakePHP-based app) I am not allowing users to edit the html, so we are relying entirely on the WYSIWYG. Unfortunately, TinyMCE is currently not allowing users to apply two CSS classes to the same text. Whichever style is applied last wipes out the original.

开发者_JS百科To give an example: If a user wants to designate a line of text to be both 'huge' and 'highlighted' (both CSS classes), they would highlight the text and choose 'huge' from the CSS style dropdown, then highlight the same text again and choose 'highlighted'. What results is text that only has the 'highlighted' class applied to it.

I can work around this problem currently by just adding an extra character to the text I am trying to style, apply the 'huge' class to that, apply the 'highlighted' class to the original text, and then delete the extra character. But, this really is far from an ideal solution.

Does anyone know of a way to resolve this issue?


You will have to write your own plugin looking similar to the style plugin. When the user selects a class from the dropdown you just add it to the selected text instead of replacing it.

0

精彩评论

暂无评论...
验证码 换一张
取 消