import TinyMCE from "./index.js";

const mceInit = TinyMCE(tinymce, $);
window.initMce = mceInit;

// Auto-initialize after all synchronous scripts have run.
// If PHP outputted tinyMCEPreInit + called initMce(), enhancedRichTextEditing
// will already be set and we skip. Otherwise we use the DOM fallback.
setTimeout(function () {
  if (!window.enhancedRichTextEditing) {
    mceInit();
  }
}, 0);