Skip to content

Instantly share code, notes, and snippets.

@mattkenefick
Created October 23, 2012 18:06
Show Gist options
  • Save mattkenefick/3940402 to your computer and use it in GitHub Desktop.
Save mattkenefick/3940402 to your computer and use it in GitHub Desktop.
Escape blockquotes in the WYSIWYG
// escape blockquotes
if (
selectedNode.children &&
(lastNode = Array.prototype.slice.call(selectedNode['children'], -1)[0]).tagName == 'BR'
&& selectedNode.tagName == 'BLOCKQUOTE') {
// remove previous break
selectedNode.removeChild(lastNode);
// attach to something new
var invisibleSpace = document.createTextNode(wysihtml5.INVISIBLE_SPACE);
dom.insert(invisibleSpace).after(selectedNode);
composer.selection.selectNode(invisibleSpace);
return event.preventDefault();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment