Make WordPress Core

Ticket #19389: 19389-2.patch

File 19389-2.patch, 944 bytes (added by azaozz, 11 years ago)
  • wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js

     
    102102                        ed.wpGetImgCaption = function(content) {
    103103                                return t._get_shcode(content);
    104104                        };
     105
     106                        // When inserting content, if the caret is inside a caption create new paragraph under
     107                        // and move the caret there
     108                        ed.onBeforeExecCommand.add(function(ed, cmd, ui, val) {
     109                                var node, p;
     110
     111                                if ( cmd == 'mceInsertContent' ) {
     112                                        node = ed.dom.getParent(ed.selection.getNode(), 'div.mceTemp');
     113
     114                                        if ( !node )
     115                                                return;
     116
     117                                        p = ed.dom.create('p');
     118                                        ed.dom.insertAfter( p, node );
     119                                        ed.selection.setCursorLocation(p, 0);
     120                                }
     121                        });
    105122                },
    106123
    107124                _do_shcode : function(content) {