Created
December 30, 2010 20:18
-
-
Save laszlokorte/760242 to your computer and use it in GitHub Desktop.
TinyMCE fix for leaving definition-lists with the enter key
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup : function(ed) { | |
ed.onKeyPress.addToTop(function(ed, e) { | |
if(e.keyIdentifier =='Enter' && ed.selection) | |
{ | |
var element = ed.selection.getNode(), | |
tagname = element.tagName.toLowerCase(), | |
contentLength = element.textContent.length; | |
if( contentLength==0 && (tagname=='dt' || tagname=='dd')) | |
{ | |
ed.execCommand("formatBlock",false, 'p'); | |
e.stopPropagation(); | |
e.preventDefault(); | |
return false; | |
} | |
} | |
}); | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment