TinyMCE wpView: when pasting/inserting content before a view, add new paragraph above it and insert the content there.
Merges [29766] to the 4.0 branch. props avryl. fixes #29380. Built from https://develop.svn.wordpress.org/branches/4.0@30257 git-svn-id: http://core.svn.wordpress.org/branches/4.0@30257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c943b712b3
commit
5add2ed4b1
|
@ -12,7 +12,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
|||
firstFocus = true,
|
||||
_noop = function() { return false; },
|
||||
isios = /iPad|iPod|iPhone/.test( navigator.userAgent ),
|
||||
cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView;
|
||||
cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView, execCommandBefore;
|
||||
|
||||
function getView( node ) {
|
||||
return getParent( node, 'wpview-wrap' );
|
||||
|
@ -649,8 +649,8 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
|||
var node = editor.selection.getNode(),
|
||||
view;
|
||||
|
||||
if ( node && ( node.className === 'wpview-selection-before' || node.className === 'wpview-selection-after' ) && ( view = getView( node ) ) ) {
|
||||
handleEnter( view );
|
||||
if ( node && ( ( execCommandBefore = node.className === 'wpview-selection-before' ) || node.className === 'wpview-selection-after' ) && ( view = getView( node ) ) ) {
|
||||
handleEnter( view, execCommandBefore );
|
||||
execCommandView = view;
|
||||
}
|
||||
});
|
||||
|
@ -665,11 +665,11 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
|||
}
|
||||
|
||||
if ( execCommandView ) {
|
||||
node = execCommandView.nextSibling;
|
||||
node = execCommandView[ execCommandBefore ? 'previousSibling' : 'nextSibling' ];
|
||||
|
||||
if ( node && node.nodeName === 'P' && editor.dom.isEmpty( node ) ) {
|
||||
editor.dom.remove( node );
|
||||
setViewCursor( false, execCommandView );
|
||||
setViewCursor( execCommandBefore, execCommandView );
|
||||
}
|
||||
|
||||
execCommandView = false;
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue