TinyMCE, inline link dialog:

- Reset the internal state when doing `unlink`, pressing `Escape`, and clicking elsewhere in the editor.
- Add the unlink shortcut from the wplink plugin as it triggers the new `wp_unlink` command.

Fixes #36781, #36732, #37153.
Built from https://develop.svn.wordpress.org/trunk@37906


git-svn-id: http://core.svn.wordpress.org/trunk@37847 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2016-06-29 09:42:30 +00:00
parent 41369b1ced
commit c4af09a2b9
6 changed files with 18 additions and 8 deletions

View File

@ -540,7 +540,6 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
q: 'mceBlockQuote',
u: 'InsertUnorderedList',
o: 'InsertOrderedList',
s: 'unlink',
m: 'WP_Medialib',
z: 'WP_Adv',
t: 'WP_More',

File diff suppressed because one or more lines are too long

View File

@ -300,13 +300,18 @@
if ( ! editToolbar.tempHide ) {
inputInstance.reset();
removePlaceholders();
editor.focus();
editToolbar.tempHide = false;
}
} );
// WP default shortcut
editor.addCommand( 'wp_unlink', function() {
editor.execCommand( 'unlink' );
editToolbar.tempHide = false;
editor.execCommand( 'wp_link_cancel' );
} );
// WP default shortcuts
editor.addShortcut( 'access+a', '', 'WP_Link' );
editor.addShortcut( 'access+s', '', 'wp_unlink' );
// The "de-facto standard" shortcut, see #27305
editor.addShortcut( 'meta+k', '', 'WP_Link' );
@ -367,6 +372,10 @@
// 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.keyCode === 27 ) { // Esc
editor.execCommand( 'wp_link_cancel' );
}
if ( event.altKey || ( tinymce.Env.mac && ( ! event.metaKey || event.ctrlKey ) ) ||
( ! tinymce.Env.mac && ! event.ctrlKey ) ) {
@ -560,6 +569,8 @@
toolbar.$el.find( '.wp-link-preview a' ).removeClass( 'wplink-url-error' ).attr( 'title', null );
}
}
} else {
editor.execCommand( 'wp_link_cancel' );
}
} );
@ -572,7 +583,7 @@
editor.addButton( 'wp_link_remove', {
tooltip: 'Remove',
icon: 'dashicon dashicons-no',
cmd: 'unlink'
cmd: 'wp_unlink'
} );
editor.addButton( 'wp_link_advanced', {

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.6-alpha-37905';
$wp_version = '4.6-alpha-37906';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.