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

Include TinyMCE 4.7.6 #832

Merged
merged 2 commits into from Feb 28, 2018
Merged

Include TinyMCE 4.7.6 #832

merged 2 commits into from Feb 28, 2018

Conversation

frapell
Copy link
Sponsor Member

@frapell frapell commented Feb 28, 2018

No description provided.

@frapell
Copy link
Sponsor Member Author

frapell commented Feb 28, 2018

@frapell
Copy link
Sponsor Member Author

frapell commented Feb 28, 2018

The issue in #764 seems to have been because of a piece of code in tinymce.js as follows:

    getStyleSheetLoader(editor).loadAll(editor.contentCSS, function (_) {
      initEditor(editor);
    }, function (urls) {
      initEditor(editor);
    });

Which should call initEditor after it tries to load the content_css, however, it seems karma does not serve the css files, so tinymce doesn't find the content.min.css.
I modified the karma config so it would serve this css, and even though I am able to get to the resource manually if I go to its URL, for some reason tinymce still can't (From the tests).

Now, this initEditor does this:

  var initEditor = function (editor) {
    editor.bindPendingEventDelegates();
    editor.initialized = true;
    editor.fire('init');
    editor.focus(true);
    editor.nodeChanged({ initial: true });
    editor.execCallback('init_instance_callback', editor);
    autoFocus(editor);
  };

And it is being called fine when you load tinymce in the browser, but it is not when doing it from the tests (Because of the css issue I mentioned).

The problem with this, is that when .save() is called, it has this:

      ...
      if (!elm || !self.initialized || self.removed) {
        return;
      }
      ...

which is the reason on why the test was failing in #764 but when manually trying tinymce in the browser, everything worked fine.

In order to have the tests passing, I am doing this:

04a8905

As it can be seen, I was expecting to only do it in the tinymce test, and this worked fine, however this affects other tests, like the textareamimetypeselector...

I ended up adding the initialized flag in the pattern itself, this doesn't seem to bring any unwanted side effect, nor prevents the initEditor to be called, so I think it is pretty safe...

I don't know if this is a proper fix, or if someone has a better idea?

@thet or @vangheem could you guys review?

@thet thet merged commit a31ce59 into master Feb 28, 2018
@thet thet deleted the tinymce-4.7.6 branch February 28, 2018 22:42
@thet
Copy link
Member

thet commented Feb 28, 2018

LGTM for me too.

@thet thet mentioned this pull request Apr 26, 2018
@import (less) "@{bowerPath}/tinymce-builded/js/tinymce/skins/lightgray/Content.Objects.less";
@import (inline) "@{bowerPath}/tinymce-builded/js/tinymce/plugins/visualblocks/css/visualblocks.css";
@import (inline) "@{bowerPath}tinymce-builded/js/tinymce/skins/lightgray/skin.min.css";
@import (inline) "@{bowerPath}tinymce-builded/js/tinymce/skins/lightgray/content.min.css";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@frapell Would you rememer any specific reason for using (inline) instead of (css) here? I found out webpack builds failing, because (inline) makes less-leader import context to be the folder of pattern and webpack cannot find images and fonts below the skin folder. I wonder how normal Plone works with that.

Copy link
Sponsor Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@datakurre Honestly not... if you change it to (css) works? If so, I would say we can change it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants