Skip to content

Instantly share code, notes, and snippets.

@kramapet
Created October 28, 2014 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kramapet/d57b812ab7514885399e to your computer and use it in GitHub Desktop.
Save kramapet/d57b812ab7514885399e to your computer and use it in GitHub Desktop.
Destroy instance of WYMeditor
/**
* destroy instance of wymeditor:
* - updates content between iframe and textarea
* - remove iframe
* - show textarea
* - replace element with undefined (to trick jQuery.getWymeditorByTextarea(el))
* @see https://github.com/wymeditor/wymeditor/blob/master/src/wymeditor/core.js#L520
* @param {WYMeditor.editor} instance
*/
var wymeditor_destroy = function (instance) {
instance.update();
instance._box.remove();
instance._element.show();
instance._element[0] = undefined;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment