* Resets the editors content, undo/redo history and dirty state. If `initialContent` isn't specified, then * the editor is reset back to the initial start content. * * @method resetContent * @param {String} initialContent An optional string to use as the initial content of the editor.
(initialContent?: string)
| 907 | * @param {String} initialContent An optional string to use as the initial content of the editor. |
| 908 | */ |
| 909 | public resetContent(initialContent?: string): void { |
| 910 | // Set the editor content |
| 911 | if (initialContent === undefined) { |
| 912 | // editor.startContent is generated by using the `raw` format, so we should set it the same way |
| 913 | EditorContent.setContent(this, this.startContent, { initial: true, format: 'raw' }); |
| 914 | } else { |
| 915 | EditorContent.setContent(this, initialContent, { initial: true }); |
| 916 | } |
| 917 | |
| 918 | // Update the editor/undo manager state |
| 919 | this.undoManager.reset(); |
| 920 | this.setDirty(false); |
| 921 | |
| 922 | // Fire a node change event |
| 923 | this.nodeChanged(); |
| 924 | } |
| 925 | |
| 926 | /** |
| 927 | * Returns true/false if the editor is dirty or not. It will get dirty if the user has made modifications to the contents. |
no test coverage detected