TinyMCE: place the caret after/under images with captions when inserting content, fixes #19389

git-svn-id: http://core.svn.wordpress.org/trunk@22644 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2012-11-18 18:04:20 +00:00
parent 65c026bcc3
commit f630e12290

View File

@ -102,6 +102,23 @@
ed.wpGetImgCaption = function(content) {
return t._get_shcode(content);
};
// When inserting content, if the caret is inside a caption create new paragraph under
// and move the caret there
ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
var node, p;
if ( cmd == 'mceInsertContent' ) {
node = ed.dom.getParent(ed.selection.getNode(), 'div.mceTemp');
if ( !node )
return;
p = ed.dom.create('p');
ed.dom.insertAfter( p, node );
ed.selection.setCursorLocation(p, 0);
}
});
},
_do_shcode : function(content) {