From 2f81be2bbc08a1779c1d2276fb0ea668ffc46c19 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 25 Aug 2014 19:36:12 +0000 Subject: [PATCH] Media modal: when inserting content, prefer the editor id passed while opening the modal. wpActiveEditor can change in the background. (Includes some precommit prefixed selectors.) Fixes #28173 git-svn-id: https://develop.svn.wordpress.org/trunk@29603 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/css/common.css | 1 + src/wp-admin/css/list-tables.css | 1 + src/wp-includes/js/media-editor.js | 14 ++++++++++---- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css index 8772e6b0f7..d7d76d2e46 100644 --- a/src/wp-admin/css/common.css +++ b/src/wp-admin/css/common.css @@ -1003,6 +1003,7 @@ th.action-links { } .filter-links .current { + -webkit-box-shadow: none; box-shadow: none; border-bottom: 4px solid #666; color: #222; diff --git a/src/wp-admin/css/list-tables.css b/src/wp-admin/css/list-tables.css index abdf01e586..08d6b19a5b 100644 --- a/src/wp-admin/css/list-tables.css +++ b/src/wp-admin/css/list-tables.css @@ -1347,6 +1347,7 @@ div.action-links, float: right; clear: right; width: 65%; + width: -webkit-calc( 100% - 180px ); width: calc( 100% - 180px ); } diff --git a/src/wp-includes/js/media-editor.js b/src/wp-includes/js/media-editor.js index 5579550b7d..2db4440da4 100644 --- a/src/wp-includes/js/media-editor.js +++ b/src/wp-includes/js/media-editor.js @@ -1,4 +1,4 @@ -/* global getUserSetting, tinymce, QTags, wpActiveEditor */ +/* global getUserSetting, tinymce, QTags */ // WordPress, TinyMCE, and Media // ----------------------------- @@ -757,10 +757,15 @@ * @param {string} html Content to send to the editor */ insert: function( html ) { - var editor, + var editor, wpActiveEditor, hasTinymce = ! _.isUndefined( window.tinymce ), - hasQuicktags = ! _.isUndefined( window.QTags ), + hasQuicktags = ! _.isUndefined( window.QTags ); + + if ( this.activeEditor ) { + wpActiveEditor = window.wpActiveEditor = this.activeEditor; + } else { wpActiveEditor = window.wpActiveEditor; + } // Delegate to the global `send_to_editor` if it exists. // This attempts to play nice with any themes/plugins that have @@ -921,7 +926,7 @@ } // If an empty `id` is provided, default to `wpActiveEditor`. - id = wpActiveEditor; + id = window.wpActiveEditor; // If that doesn't work, fall back to `tinymce.activeEditor.id`. if ( ! id && ! _.isUndefined( window.tinymce ) && tinymce.activeEditor ) { @@ -1053,6 +1058,7 @@ options = options || {}; id = this.id( id ); + this.activeEditor = id; workflow = this.get( id );