Skip to content

Instantly share code, notes, and snippets.

@ryanmiglavs
Forked from duellj/gist:9957265
Last active August 29, 2015 14:07
Show Gist options
  • Save ryanmiglavs/8b446c6d995d2f18827c to your computer and use it in GitHub Desktop.
Save ryanmiglavs/8b446c6d995d2f18827c to your computer and use it in GitHub Desktop.
diff --git a/css/media.css b/css/media.css
index 92df514..0873b28 100644
--- a/css/media.css
+++ b/css/media.css
@@ -73,7 +73,6 @@
}
.media-item img {
- height: auto;
margin-bottom: 10px;
}
diff --git a/js/media.browser.js b/js/media.browser.js
index 3506263..42e0a10 100644
--- a/js/media.browser.js
+++ b/js/media.browser.js
@@ -26,7 +26,8 @@ Drupal.behaviors.MediaBrowser = {
// Instantiate the tabs.
$('#media-browser-tabset').tabs({
// Ensure that the modal resizes to the content on each tab switch.
- show: Drupal.media.browser.resizeIframe
+ show: Drupal.media.browser.resizeIframe,
+ activate: Drupal.media.browser.resizeIframe
});
$('.ui-tabs-nav li').mouseup(function() {
@@ -109,7 +110,7 @@ Drupal.media.browser.finalizeSelection = function () {
*/
Drupal.media.browser.resizeIframe = function (event) {
var h = $('body').height();
- $(parent.window.document).find('#mediaBrowser').height(h);
+ $(parent.window.document).find('.media-modal-frame:visible').height(h);
};
Drupal.media.browser.selectErrorTab = function() {
@@ -132,7 +133,7 @@ Drupal.media.browser.selectErrorTab = function() {
Drupal.media.browser.selectActiveTab = function() {
// Find the index of the last active tab.
setTimeout(function() {
- $('#media-browser-tabset').tabs('select', Drupal.media.browser.activeTab);
+ $('#media-browser-tabset').tabs('option', 'active', Drupal.media.browser.activeTab);
Drupal.media.browser.resizeIframe();
}, 10);
};
diff --git a/js/wysiwyg-media.js b/js/wysiwyg-media.js
index 5de03f9..e26ed9c 100644
--- a/js/wysiwyg-media.js
+++ b/js/wysiwyg-media.js
@@ -222,6 +222,10 @@ function create_element (html, info) {
}
var element = $(html);
+ if (element.prop('tagName') != 'IMG') {
+ element.attr('contenteditable', 'false');
+ }
+
// Move attributes from the file info array to the placeholder element.
if (info.attributes) {
$.each(Drupal.settings.media.wysiwyg_allowed_attributes, function(i, a) {
@ryanmiglavs
Copy link
Author

Critical fork!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment