Commit 8199247d authored by webchick's avatar webchick
Browse files

Issue #1954246 by Wim Leers: Fixed Underlying content visible in the editing...

Issue #1954246 by Wim Leers: Fixed Underlying content visible in the editing area while using PropertyEditor widget that uses padding.
parent 1a170765
...@@ -212,7 +212,8 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({ ...@@ -212,7 +212,8 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({
this._widthAttributeIsEmpty = true; this._widthAttributeIsEmpty = true;
this.$el this.$el
.addClass('edit-animate-disable-width') .addClass('edit-animate-disable-width')
.css('width', this.$el.width()); .css('width', this.$el.width())
.css('background-color', this._getBgColor(this.$el));
} }
// 2) Add padding; use animations. // 2) Add padding; use animations.
...@@ -243,7 +244,8 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({ ...@@ -243,7 +244,8 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({
if (this._widthAttributeIsEmpty) { if (this._widthAttributeIsEmpty) {
this.$el this.$el
.addClass('edit-animate-disable-width') .addClass('edit-animate-disable-width')
.css('width', ''); .css('width', '')
.css('background-color', '');
} }
// 2) Remove padding; use animations (these will run simultaneously with) // 2) Remove padding; use animations (these will run simultaneously with)
...@@ -268,6 +270,28 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({ ...@@ -268,6 +270,28 @@ Drupal.edit.views.PropertyEditorDecorationView = Backbone.View.extend({
}, 0); }, 0);
}, },
/**
* Gets the background color of an element (or the inherited one).
*
* @param $e
* A DOM element.
*/
_getBgColor: function($e) {
var c;
if ($e === null || $e[0].nodeName === 'HTML') {
// Fallback to white.
return 'rgb(255, 255, 255)';
}
c = $e.css('background-color');
// TRICKY: edge case for Firefox' "transparent" here; this is a
// browser bug: https://bugzilla.mozilla.org/show_bug.cgi?id=635724
if (c === 'rgba(0, 0, 0, 0)' || c === 'transparent') {
return this._getBgColor($e.parent());
}
return c;
},
/** /**
* Gets the top and left properties of an element and convert extraneous * Gets the top and left properties of an element and convert extraneous
* values and information into numbers ready for subtraction. * values and information into numbers ready for subtraction.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment