mirror of
https://github.com/WordPress/WordPress.git
synced 2024-07-12 06:46:07 +02:00
TinyMCE, inline link: when doing undo/redo with keyboard shortcut, do not focus the inline dialog. Cannot do consecutive undo/redo if the focus is moved away from the editor.
See #33301. Built from https://develop.svn.wordpress.org/trunk@36982 git-svn-id: http://core.svn.wordpress.org/trunk@36949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
dee2f6ccb7
commit
c495d3b2b3
|
@ -90,6 +90,8 @@
|
||||||
var previewInstance;
|
var previewInstance;
|
||||||
var inputInstance;
|
var inputInstance;
|
||||||
var linkNode;
|
var linkNode;
|
||||||
|
var doingUndoRedo;
|
||||||
|
var doingUndoRedoTimer;
|
||||||
var $ = window.jQuery;
|
var $ = window.jQuery;
|
||||||
|
|
||||||
function getSelectedLink() {
|
function getSelectedLink() {
|
||||||
|
@ -166,9 +168,11 @@
|
||||||
element.value = window.wpLink.getUrlFromSelection( selection );
|
element.value = window.wpLink.getUrlFromSelection( selection );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( ! doingUndoRedo ) {
|
||||||
element.focus();
|
element.focus();
|
||||||
element.select();
|
element.select();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -301,6 +305,25 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// When doing undo and redo with keyboard shortcuts (Ctrl|Cmd+Z, Ctrl|Cmd+Shift+Z, Ctrl|Cmd+Y),
|
||||||
|
// set a flag to not focus the inline dialog. The editor has to remain focused so the users can do consecutive undo/redo.
|
||||||
|
editor.on( 'keydown', function( event ) {
|
||||||
|
if ( event.altKey || ( tinymce.Env.mac && ( ! event.metaKey || event.ctrlKey ) ) ||
|
||||||
|
( ! tinymce.Env.mac && ! event.ctrlKey ) ) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( event.keyCode === 89 || event.keyCode === 90 ) { // Y or Z
|
||||||
|
doingUndoRedo = true;
|
||||||
|
|
||||||
|
window.clearTimeout( doingUndoRedoTimer );
|
||||||
|
doingUndoRedoTimer = window.setTimeout( function() {
|
||||||
|
doingUndoRedo = false;
|
||||||
|
}, 500 );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
|
||||||
editor.addButton( 'wp_link_preview', {
|
editor.addButton( 'wp_link_preview', {
|
||||||
type: 'WPLinkPreview',
|
type: 'WPLinkPreview',
|
||||||
onPostRender: function() {
|
onPostRender: function() {
|
||||||
|
|
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.5-beta3-36981';
|
$wp_version = '4.5-beta3-36982';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
Block a user