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

git-svn-id: https://develop.svn.wordpress.org/trunk@22644 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2012-11-18 18:04:20 +00:00
parent b706fe2780
commit 37a39cbefa
1 changed files with 17 additions and 0 deletions

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) {