MCPcopy Index your code
hub / github.com/tinymce/tinymce / remove

Function remove

modules/tinymce/src/core/main/ts/EditorRemove.ts:45–77  ·  view source on GitHub ↗
(editor: Editor)

Source from the content-addressed store, hash-verified

43};
44
45const remove = (editor: Editor): void => {
46 if (!editor.removed) {
47 const { _selectionOverrides, editorUpload } = editor;
48 const body = editor.getBody();
49 const element = editor.getElement();
50 if (body) {
51 editor.save({ is_removing: true });
52 }
53 editor.removed = true;
54 editor.unbindAllNativeEvents();
55
56 // Remove any hidden input
57 if (editor.hasHiddenInput && Type.isNonNullable(element?.nextSibling)) {
58 DOM.remove(element.nextSibling);
59 }
60
61 Events.fireRemove(editor);
62 editor.editorManager.remove(editor);
63
64 if (!editor.inline && body) {
65 restoreOriginalStyles(editor);
66 }
67
68 Events.fireDetach(editor);
69
70 DOM.remove(editor.getContainer());
71
72 safeDestroy(_selectionOverrides);
73 safeDestroy(editorUpload);
74
75 editor.destroy();
76 }
77};
78
79const destroy = (editor: Editor, automatic?: boolean): void => {
80 const { selection, dom } = editor;

Callers

nothing calls this directly

Calls 9

restoreOriginalStylesFunction · 0.85
safeDestroyFunction · 0.85
getBodyMethod · 0.80
getElementMethod · 0.80
saveMethod · 0.80
unbindAllNativeEventsMethod · 0.80
getContainerMethod · 0.80
removeMethod · 0.65
destroyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…