(editor: Editor)
| 43 | }; |
| 44 | |
| 45 | const 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 | |
| 79 | const destroy = (editor: Editor, automatic?: boolean): void => { |
| 80 | const { selection, dom } = editor; |
nothing calls this directly
no test coverage detected
searching dependent graphs…