MCPcopy
hub / github.com/tinymce/tinymce / initEditors

Function initEditors

modules/tinymce/src/core/main/ts/api/EditorManager.ts:423–466  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

421 };
422
423 const initEditors = () => {
424 let initCount = 0;
425 const editors: Editor[] = [];
426 let targets: HTMLElement[];
427
428 const createEditor = (id: string, options: RawEditorOptions, targetElm: HTMLElement) => {
429 const editor: Editor = new Editor(id, options, self);
430 editors.push(editor);
431
432 editor.on('init', () => {
433 if (++initCount === targets.length) {
434 provideResults(editors);
435 }
436 });
437
438 editor.targetElm = editor.targetElm || targetElm;
439 editor.render();
440 };
441
442 DOM.unbind(window, 'ready', initEditors);
443 execCallback('onpageload');
444
445 targets = Arr.unique(findTargets(options));
446
447 Tools.each(targets, (elm) => {
448 purgeDestroyedEditor(self.get(elm.id));
449 });
450
451 targets = Tools.grep(targets, (elm) => {
452 return !self.get(elm.id);
453 });
454
455 if (targets.length === 0) {
456 provideResults([]);
457 } else {
458 each(targets, (elm) => {
459 if (isInvalidInlineTarget(options, elm)) {
460 ErrorReporter.initError('Could not initialize inline editor on invalid inline target element', elm);
461 } else {
462 createEditor(createId(elm), options, elm);
463 }
464 });
465 }
466 };
467
468 DOM.bind(window, 'ready', initEditors);
469

Callers

nothing calls this directly

Calls 11

execCallbackFunction · 0.85
purgeDestroyedEditorFunction · 0.85
provideResultsFunction · 0.85
isInvalidInlineTargetFunction · 0.85
createIdFunction · 0.85
unbindMethod · 0.80
eachMethod · 0.80
findTargetsFunction · 0.70
createEditorFunction · 0.70
getMethod · 0.65
eachFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…