Skip to content

Commit

Permalink
JavaScript: Correctly await the TinyMCE initialization and avoid Tiny…
Browse files Browse the repository at this point in the history
…MCE double initialization.
  • Loading branch information
thet committed Apr 21, 2023
1 parent da85401 commit 0d6526e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Changelog
3.1.1 (unreleased)
------------------

- Correctly await the TinyMCE initialization and avoid TinyMCE double initialization.
[thet]

- Remove ``plonetheme.barceloneta`` dependency. (Not needed)
[toalba]

Expand Down
4 changes: 3 additions & 1 deletion resources/js/mosaic.tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "regenerator-runtime/runtime"; // needed for ``await`` support
import $ from "jquery";
import utils from "@plone/mockup/src/core/utils";
import mosaic_utils from "./utils";
import events from "@patternslib/patternslib/src/core/events";
import logging from "@patternslib/patternslib/src/core/logging";
import Modal from "@plone/mockup/src/pat/modal/modal";
import Registry from "@patternslib/patternslib/src/core/registry";
Expand Down Expand Up @@ -992,7 +993,8 @@ class Tile {
tiny_options["tiny"]["placeholder"] = _placeholder;

const tiny_instance = new TinyMCE($content, tiny_options);
await tiny_instance.init()
// wait until ready.
await events.await_pattern_init(tiny_instance);
self.tinymce = tiny_instance.instance.tiny;

// Set editor class
Expand Down

0 comments on commit 0d6526e

Please sign in to comment.