jenkins-bot has submitted this change and it was merged.
Change subject: Fixing the behaviour of resizable images so that redlinked
images, inline and block, can be represented properly
......................................................................
Fixing the behaviour of resizable images so that redlinked images, inline and
block, can be represented properly
Change-Id: I2ff34db8178c901110fd395658000623a675e202
---
M src/ce/ve.ce.ResizableNode.js
1 file changed, 29 insertions(+), 0 deletions(-)
Approvals:
Esanders: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ce/ve.ce.ResizableNode.js b/src/ce/ve.ce.ResizableNode.js
index b6f68e7..3020f18 100644
--- a/src/ce/ve.ce.ResizableNode.js
+++ b/src/ce/ve.ce.ResizableNode.js
@@ -24,6 +24,7 @@
// Properties
this.$resizable = $resizable || this.$element;
this.resizing = false;
+ this.enabled = !!this.$resizable.length;
this.$resizeHandles = $( '<div>' );
this.snapToGrid = config.snapToGrid !== undefined ? config.snapToGrid :
10;
this.outline = !!config.outline;
@@ -37,6 +38,9 @@
}
this.resizableOffset = null;
this.resizableSurface = null;
+ if ( !this.enabled ) {
+ return;
+ }
// Events
this.connect( this, {
@@ -107,6 +111,10 @@
/** */
ve.ce.ResizableNode.prototype.setOriginalDimensions = function ( dimensions ) {
+ if ( !this.enabled ) {
+ return;
+ }
+
var scalable = this.model.getScalable();
scalable.setOriginalDimensions( dimensions );
@@ -121,7 +129,12 @@
* Hide the size label
*/
ve.ce.ResizableNode.prototype.hideSizeLabel = function () {
+ if ( !this.enabled ) {
+ return;
+ }
+
var node = this;
+
// Defer the removal of this class otherwise other DOM changes may cause
// the opacity transition to not play out smoothly
setTimeout( function () {
@@ -137,6 +150,9 @@
* Update the contents and position of the size label
*/
ve.ce.ResizableNode.prototype.updateSizeLabel = function () {
+ if ( !this.enabled ) {
+ return;
+ }
if ( !this.showSizeLabel && !this.canShowScaleLabel ) {
return;
}
@@ -187,6 +203,10 @@
* @param {string[]} [handles] List of handles to show: 'nw', 'ne', 'sw',
'se'. Show all if undefined.
*/
ve.ce.ResizableNode.prototype.showHandles = function ( handles ) {
+ if ( !this.enabled ) {
+ return;
+ }
+
var i, len,
add = [],
remove = [],
@@ -407,6 +427,10 @@
* @method
*/
ve.ce.ResizableNode.prototype.setResizableHandlesSizeAndPosition = function ()
{
+ if ( !this.enabled ) {
+ return;
+ }
+
var width = this.$resizable.width(),
height = this.$resizable.height();
@@ -439,6 +463,10 @@
* @method
*/
ve.ce.ResizableNode.prototype.setResizableHandlesPosition = function () {
+ if ( !this.enabled ) {
+ return;
+ }
+
var offset = this.getResizableOffset();
this.$resizeHandles.css( {
@@ -562,6 +590,7 @@
*/
ve.ce.ResizableNode.prototype.getAttributeChanges = function ( width, height )
{
var attrChanges = {};
+
if ( this.model.getAttribute( 'width' ) !== width ) {
attrChanges.width = width;
}
--
To view, visit https://gerrit.wikimedia.org/r/213812
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I2ff34db8178c901110fd395658000623a675e202
Gerrit-PatchSet: 3
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: SuchetaG <[email protected]>
Gerrit-Reviewer: Esanders <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits