TinyMCE wpView:

- Fix opening the media modal on clicking Edit in Firefox.
- Fix range errors when restoring the selection bookmark in IE11 after editing a view.
See #28595.
Built from https://develop.svn.wordpress.org/trunk@29298


git-svn-id: http://core.svn.wordpress.org/trunk@29080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-07-25 00:56:15 +00:00
parent eccb5a7e9c
commit 9436186ee4
3 changed files with 12 additions and 22 deletions

View File

@ -115,7 +115,7 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
dom = editor.dom;
// Bail if node is already selected.
if ( viewNode === selected ) {
if ( ! viewNode || viewNode === selected ) {
return;
}
@ -295,34 +295,24 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
if ( view ) {
event.stopPropagation();
// Hack to try and keep the block resize handles from appearing. They will show on mousedown and then be removed on mouseup.
if ( Env.ie <= 10 ) {
deselect();
if ( event.type === 'mousedown' && ! event.metaKey && ! event.ctrlKey ) {
if ( editor.dom.hasClass( event.target, 'edit' ) ) {
wp.mce.views.edit( view );
editor.focus();
return false;
} else if ( editor.dom.hasClass( event.target, 'remove' ) ) {
removeView( view );
return false;
}
}
select( view );
if ( event.type === 'click' && ! event.metaKey && ! event.ctrlKey ) {
if ( editor.dom.hasClass( event.target, 'edit' ) ) {
wp.mce.views.edit( view );
} else if ( editor.dom.hasClass( event.target, 'remove' ) ) {
removeView( view );
}
}
// Returning false stops the ugly bars from appearing in IE11 and stops the view being selected as a range in FF.
// Unfortunately, it also inhibits the dragging of views to a new location.
return false;
} else {
// Fix issue with deselecting a view in IE8. Without this hack, clicking content above the view wouldn't actually deselect it
// and the caret wouldn't be placed at the mouse location
if ( Env.ie && Env.ie <= 8 ) {
deselectEventType = 'mouseup';
} else {
deselectEventType = 'mousedown';
}
if ( event.type === deselectEventType ) {
if ( event.type === 'mousedown' ) {
deselect();
}
}

File diff suppressed because one or more lines are too long