TinyMCE: views: correct cursor position after paste
Fixes #33174. Built from https://develop.svn.wordpress.org/trunk@33484 git-svn-id: http://core.svn.wordpress.org/trunk@33451 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a5ed94ab62
commit
926006ea56
|
@ -421,23 +421,29 @@
|
||||||
*/
|
*/
|
||||||
replaceMarkers: function() {
|
replaceMarkers: function() {
|
||||||
this.getMarkers( function( editor, node ) {
|
this.getMarkers( function( editor, node ) {
|
||||||
|
var selected = node === editor.selection.getNode(),
|
||||||
|
$viewNode;
|
||||||
|
|
||||||
if ( ! this.loader && $( node ).text() !== this.text ) {
|
if ( ! this.loader && $( node ).text() !== this.text ) {
|
||||||
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.dom.replace(
|
$viewNode = editor.$(
|
||||||
editor.dom.createFragment(
|
'<div class="wpview-wrap" data-wpview-text="' + this.encodedText + '" data-wpview-type="' + this.type + '">' +
|
||||||
'<div class="wpview-wrap" data-wpview-text="' + this.encodedText + '" data-wpview-type="' + this.type + '">' +
|
'<p class="wpview-selection-before">\u00a0</p>' +
|
||||||
'<p class="wpview-selection-before">\u00a0</p>' +
|
'<div class="wpview-body" contenteditable="false">' +
|
||||||
'<div class="wpview-body" contenteditable="false">' +
|
'<div class="wpview-content wpview-type-' + this.type + '"></div>' +
|
||||||
'<div class="wpview-content wpview-type-' + this.type + '"></div>' +
|
'</div>' +
|
||||||
'</div>' +
|
'<p class="wpview-selection-after">\u00a0</p>' +
|
||||||
'<p class="wpview-selection-after">\u00a0</p>' +
|
'</div>'
|
||||||
'</div>'
|
|
||||||
),
|
|
||||||
node
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
editor.$( node ).replaceWith( $viewNode );
|
||||||
|
|
||||||
|
if ( selected ) {
|
||||||
|
editor.wp.setViewCursor( false, $viewNode[0] );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -729,6 +729,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
|
||||||
// Add to editor.wp
|
// Add to editor.wp
|
||||||
editor.wp = editor.wp || {};
|
editor.wp = editor.wp || {};
|
||||||
editor.wp.getView = getView;
|
editor.wp.getView = getView;
|
||||||
|
editor.wp.setViewCursor = setViewCursor;
|
||||||
|
|
||||||
// Keep for back-compat.
|
// Keep for back-compat.
|
||||||
return {
|
return {
|
||||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.3-beta4-33483';
|
$wp_version = '4.3-beta4-33484';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue