Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tinymce to version 5.x #593

Closed
benj0c opened this issue Sep 17, 2020 · 4 comments · Fixed by #644
Closed

Update tinymce to version 5.x #593

benj0c opened this issue Sep 17, 2020 · 4 comments · Fixed by #644

Comments

@benj0c
Copy link

benj0c commented Sep 17, 2020

Hi to all,

The package.json.NOTES file says that tinymce lib is" locked "on version 4.5.8. However in version 5.x tinymce has introduced a new plugin for the emoticons I need. I tried to do an update to 5.1.4 and everything seems to be working properly. However, there is one bug, and that is when everything is deleted from the input (backspace) and the input is left blank, for some reason the <span> element is deleted and re-created, but from that moment that element no longer works properly.

Does anyone have a similar experience? Any advice or something?

@bago
Copy link
Member

bago commented Sep 17, 2020

I tested a few versions of TinyMCE 5.x some weeks ago but it doesn't work well, yet. They still didn't fix the issues we reported since 4.6+. We guess they have no interest in fixing them. Last good version, in our opinion, is still 4.5.8.

@bago bago added the question label Sep 17, 2020
@bago
Copy link
Member

bago commented Sep 17, 2020

The issue you describe is one of the bugs we reported. Unfortunately we didn't find workarounds, so we can't update.

@benj0c
Copy link
Author

benj0c commented Sep 28, 2020

We need new emoji plugin (from 5.x version). Do you have any idea how to make it works?

@bago
Copy link
Member

bago commented Oct 21, 2020

this is a tinymce issue, I can't help as I don't know the differences in plugin format between tinymce 4.x and 5.x.
You can ask in their forum to understand how complex could be to backport the emoji plugin from 5.x to 4.x.

@bago bago closed this as completed Oct 21, 2020
bago added a commit that referenced this issue May 10, 2022
We found that most browser/tinymce bugs related to contenteditable are about editing non-DIV elements, so we try to change the template converter to always create an utility DIV and make it editable (Fix #429 and #362).

This should still work with 4.5.x (currently the last version supported by mosaico) and by updated releases.

Mosaico now supports multiple editing styles: the legacy styles are named "singleline" and "multiline" and they are automatically applied depending on the data-ko-editable element (td & div use "multiline", the other ones "singleline") but a data-ko-editor-style="newstyle" can be used to force the use of a different tinymce options set. This set will inherit ko.bindingHandlers.wysiwyg.standardOptions, ko.bindingHandlers.wysiwyg.fullOptions and then ko.bindingHandlers.wysiwyg.extendedOptions. (Fix #244)

This changeset also remove the support for ko.bindingHandlers.wysiwyg.getContentOptions and replaces it with a new option "_use_raw_format" that defines wether to use "raw" format when getting/setting the content from tinymce. The new default is to use "raw" format for the singleline style and non raw format for everything else (the raw in singleline is required in order to prevent tinymce from trimming contents). Note that previously mosaico used raw format for every style, so if you want to preserve the previous behaviour you need to set ko.bindingHandlers.wysiwyg.fullOptions._use_raw_format to true. (should fix #446)

Another breaking change is the default  "extended_valid_elements" option that changed from "strong/b,em/i,*[*]" to "strong/b,em/i" so to enable content filtering and strip unwanted tags (like scripts). You can revert it by setting that option to the old value but beware XSS vulnerabilities.

This changeset enable to upgrade of tinymce to newer 4.x (4.7.x, 4.9.x) and latest 5.x (Fix #593). For 5.x and 6.x we also had to update the scrollfix binding so that the toolbar is correclty moved when the edit area is scrolled.

TinyMCE 6.x compatibility requires more changes because they removed support for "forced_root_block = false" or "forced_root_block = ''" that is needed for the singleline editing. You can trick tinymce by usign "forced_root_block = 'unknownelementname'" but it will prevent use of "ENTER" to insert <br/>.

Issues #596 and #443 may be fixed by this changeset.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants