Destroys the currently instantiated editor instance and releases all of its resources.
Note: The destroy method also destroys the dom element it was initially attached to.
In the first example below the dom element with the id 'editor-node'
.
To create a new editor you will need to recreate the dom element. See example 2 below.
.destroy()
editor = new window.__editor(undefined, document.getElementById('editor-node')); editor.startup({ serviceUrl: 'http://www.yourdomain.com/esd', licenseId: '===License ID===', ... }); editor.destroy(); // Editor can now be safely recreated as needed.
var editor = undefined; var node = document.getElementById('editor-node') function createEditor() { editor = new window.__editor(undefined, node); editor.startup({ serviceUrl: 'http://www.yourdomain.com/esd', licenseId: '===License ID===', ... }); } function recreateEditor() { var parent = node.parentElement; var nextSibling = node.nextElementSibling; node = document.createElement("div"); node.id = 'editorNode'; node.setAttribute('style', 'width:100%;height:100%'); parent.insertBefore(node, nextSibling); createEditor(); } createEditor(); editor.destroy(); recreateEditor(); // Editor can now be safely recreated as needed.