From b253355d2c14ade0364faa1cbb7869638e3338eb Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 9 Apr 2014 00:57:46 +0000 Subject: [PATCH] Fix TinyMCE Views in IE8 and 7: - Add fallback background images for dashicons. - Fix hiding the clipboard while still allowing the contents to be selected. - Work around lack of border-box in gallery styles. (Includes precommit cleanup for theme.js) Props gcorne, fixes 27546 git-svn-id: https://develop.svn.wordpress.org/trunk@28062 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/theme.js | 6 +-- .../js/tinymce/plugins/wpview/plugin.js | 22 ++++++-- .../skins/wordpress/images/dashicon-edit.png | Bin 0 -> 251 bytes .../wordpress/images/dashicon-no-alt.png | Bin 0 -> 164 bytes .../js/tinymce/skins/wordpress/wp-content.css | 50 ++++++++++++++++-- 5 files changed, 68 insertions(+), 10 deletions(-) create mode 100644 src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-edit.png create mode 100644 src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png diff --git a/src/wp-admin/js/theme.js b/src/wp-admin/js/theme.js index 1598420073..79fe3c8d86 100644 --- a/src/wp-admin/js/theme.js +++ b/src/wp-admin/js/theme.js @@ -551,7 +551,7 @@ themes.view.Theme = wp.Backbone.View.extend({ }); this.listenTo( preview, 'preview:close', function() { - self.current = self.model + self.current = self.model; }); }, @@ -755,8 +755,8 @@ themes.view.Preview = themes.view.Details.extend({ html: themes.template( 'theme-preview' ), render: function() { - var data = this.model.toJSON(), - self = this; + var data = this.model.toJSON(); + this.$el.html( this.html( data ) ); themes.router.navigate( themes.router.baseUrl( '?theme=' + this.model.get( 'id' ) ), { replace: true } ); diff --git a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js index 75f704788a..337b3d2b2e 100644 --- a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js @@ -265,12 +265,20 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { }); editor.dom.bind( editor.getBody(), 'mousedown mouseup click', function( event ) { - var view = getParentView( event.target ); + var view = getParentView( event.target ), + deselectEventType; // Contain clicks inside the view wrapper 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 ( tinymce.Env.ie <= 10 ) { + deselect(); + } + + select( view ); + if ( event.type === 'click' && ! event.metaKey && ! event.ctrlKey ) { if ( editor.dom.hasClass( event.target, 'edit' ) ) { wp.mce.views.edit( view ); @@ -278,12 +286,20 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { editor.dom.remove( view ); } } - 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 { - if ( event.type === 'mousedown' ) { + + // 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( tinymce.Env.ie <= 8 ) { + deselectEventType = 'mouseup'; + } else { + deselectEventType = 'mousedown'; + } + + if ( event.type === deselectEventType ) { deselect(); } } diff --git a/src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-edit.png b/src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-edit.png new file mode 100644 index 0000000000000000000000000000000000000000..9b2c54de4206ee3e9518a0e0befddffd760953f7 GIT binary patch literal 251 zcmVyHtgEWIxwyu~#nRHz-rn8m>FMyiA%gX%Q~ejtA{lGpuzw;_iNg9-x`0RZ?JOq6)YF>L?<002ovPDHLkV1k)7 BZxH|h literal 0 HcmV?d00001 diff --git a/src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png b/src/wp-includes/js/tinymce/skins/wordpress/images/dashicon-no-alt.png new file mode 100644 index 0000000000000000000000000000000000000000..cc0f927350fc00597fec4558c7478add58df14d7 GIT binary patch literal 164 zcmeAS@N?(olHy`uVBq!ia0vp^av;pY3?xs=ZJr3E_yc@GT)Eg7Vxl8