Make WordPress Core

Changeset 22644


Ignore:
Timestamp:
11/18/2012 06:04:20 PM (13 years ago)
Author:
azaozz
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin_src.js

    r22602 r22644  
    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
Note: See TracChangeset for help on using the changeset viewer.