Skip to content

Commit

Permalink
TinyMCE wpView:
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
azaozz committed Jul 25, 2014
1 parent eccb5a7 commit 9436186
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
26 changes: 8 additions & 18 deletions wp-includes/js/tinymce/plugins/wpview/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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();
}

select( view );

if ( event.type === 'click' && ! event.metaKey && ! event.ctrlKey ) {
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 );

// 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();
}
}
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/tinymce/plugins/wpview/plugin.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified wp-includes/js/tinymce/wp-tinymce.js.gz
Binary file not shown.

0 comments on commit 9436186

Please sign in to comment.