[MediaWiki-commits] [Gerrit] Image insertion alignment fix - change (mediawiki...VisualEditor)

2013-07-23 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Image insertion alignment fix
..


Image insertion alignment fix

This removes the initial alignment (either left or right) from new
inserted images, letting the wiki decide the default positioning.
Also, it makes sure that VisualEditor positions the image properly
(according to wiki defaults tright/tleft for ltr/rtl) when editing.

Bug: 51851
Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
2 files changed, 24 insertions(+), 5 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index e52dfbc..fa9fcbb 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -63,9 +63,6 @@
// Type "frame", "thumb" and the default
this.$image.addClass( 'thumbimage' );
this.$thumb
-   .addClass(
-   ve.ce.MWBlockImageNode.static.cssClasses[ 
'default' ][ this.model.getAttribute( 'align' ) ]
-   )
.addClass( 'thumb' );
this.$a.appendTo( this.$thumbInner );
this.$thumbInner.appendTo( this.$thumb );
@@ -118,7 +115,8 @@
'right': 'tright',
'center' : 'tnone',
'none' : 'tnone',
-   'default': 'tright'
+   // Default is different between RTL and LTR wikis:
+   'default': ['tright', 'tleft']
},
'none': {
'left': 'floatleft',
@@ -130,6 +128,27 @@
 
 /* Methods */
 
+/**
+ * Override the default onSetup to add direction-dependent
+ * classes to the image thumbnail.
+ *
+ * @method
+ */
+ve.ce.MWBlockImageNode.prototype.onSetup = function ( ) {
+   var type = this.model.getAttribute( 'type' ),
+   isRTL;
+
+   if ( type !== 'none' && type !=='frameless' ) {
+   // get the proper alignment for the image inside the editor
+   isRTL = ( this.$.css( 'direction' ) === 'rtl' ) ? 1 : 0;
+   this.$thumb
+   .addClass(
+   ve.ce.MWBlockImageNode.static.cssClasses[ 
'default' ][ this.model.getAttribute( 'align' ) ][ isRTL ]
+   );
+   }
+
+};
+
 ve.ce.MWBlockImageNode.prototype.onAttributeChange = function ( key, from, to 
) {
var $element, type;
 
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
index 5e28613..d836f74 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
@@ -68,7 +68,7 @@
'type': 'mwBlockImage',
'attributes': {
'type': 'thumb',
-   'align': 'right',
+   'align': 'default',
//'href': info.descriptionurl,
'href': './' + this.item.title,
'src': info.thumburl,

-- 
To view, visit https://gerrit.wikimedia.org/r/75526
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo 
Gerrit-Reviewer: Catrope 
Gerrit-Reviewer: jenkins-bot

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] Image insertion alignment fix - change (mediawiki...VisualEditor)

2013-07-23 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/75526


Change subject: Image insertion alignment fix
..

Image insertion alignment fix

This removes the initial alignment (either left or right) from new
inserted images, letting the wiki decide the default positioning.

Bug: 51851
Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
1 file changed, 0 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor 
refs/changes/26/75526/1

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
index 5e28613..67c70a3 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
@@ -68,7 +68,6 @@
'type': 'mwBlockImage',
'attributes': {
'type': 'thumb',
-   'align': 'right',
//'href': info.descriptionurl,
'href': './' + this.item.title,
'src': info.thumburl,

-- 
To view, visit https://gerrit.wikimedia.org/r/75526
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b966cf6f2736437509ea7e70bfda1bdbc79021
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits