[MediaWiki-commits] [Gerrit] Adding a MediaSizeWidget - change (VisualEditor/VisualEditor)

2014-01-11 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: Adding a MediaSizeWidget
..

Adding a MediaSizeWidget

The widget is responsible for presenting width/height values and storing
original media size values that aspect ratio is calculated from.

Change-Id: I3d0f9348a52ac39f68dd09394778369026928c9d
---
M modules/ve/i18n/en.json
M modules/ve/i18n/qqq.json
M modules/ve/ui/styles/ve.ui.Widget.css
A modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
4 files changed, 308 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/19/107019/1

diff --git a/modules/ve/i18n/en.json b/modules/ve/i18n/en.json
index 166bfa2..6ad8cbe 100644
--- a/modules/ve/i18n/en.json
+++ b/modules/ve/i18n/en.json
@@ -54,6 +54,10 @@
 visualeditor-languageinspector-widget-label-langcode: Language code,
 visualeditor-languageinspector-widget-label-language: Language,
 visualeditor-linkinspector-title: Hyperlink,
+visualeditor-mediasizewidget-button-originalDimensions: Set to original 
dimensions,
+visualeditor-mediasizewidget-label-defaulterror: Size values are 
invalid.,
+visualeditor-mediasizewidget-label-height: Height,
+visualeditor-mediasizewidget-label-width: Width,
 visualeditor-listbutton-bullet-tooltip: Bullet list,
 visualeditor-listbutton-number-tooltip: Numbered list,
 visualeditor-specialcharacter-button-tooltip: Special character,
@@ -61,4 +65,4 @@
 visualeditor-specialcharinspector-characterlist-insert: 
{\n\t\symbols\: {\n\t\t\−\: \−\,\n\t\t\—\: \—\,\n\t\t\°\: 
\°\,\n\t\t\″\: \″\,\n\t\t\′\: \′\,\n\t\t\←\: \←\,\n\t\t\→\: 
\→\,\n\t\t\·\: \·\,\n\t\t\§\: \§\\n\t},\n\t\accents\: {\n\t\t\à\: 
\à\,\n\t\t\á\: \á\,\n\t\t\â\: \â\,\n\t\t\ä\: \ä\,\n\t\t\ç\: 
\ç\,\n\t\t\è\: \è\,\n\t\t\é\: \é\,\n\t\t\ê\: \ê\,\n\t\t\ë\: 
\ë\,\n\t\t\ì\: \ì\,\n\t\t\í\: \í\,\n\t\t\î\: \î\,\n\t\t\ï\: 
\ï\,\n\t\t\ò\: \ò\,\n\t\t\ó\: \ó\,\n\t\t\ô\: \ô\,\n\t\t\ö\: 
\ö\,\n\t\t\ø\: \ø\,\n\t\t\ù\: \ù\,\n\t\t\ú\: \ú\,\n\t\t\û\: 
\û\,\n\t\t\ü\: \ü\\n\t},\n\t\math\: {\n\t\t\−\: \−\,\n\t\t\×\: 
\×\,\n\t\t\÷\: \÷\,\n\t\t\≈\: \≈\,\n\t\t\≠\: \≠\,\n\t\t\≤\: 
\≤\,\n\t\t\≥\: \≥\,\n\t\t\±\: \±\\n\t}\n},
 visualeditor-toolbar-insert: Insert,
 visualeditor-version-label: Version
-}
\ No newline at end of file
+}
diff --git a/modules/ve/i18n/qqq.json b/modules/ve/i18n/qqq.json
index 61e5979..bf983c1 100644
--- a/modules/ve/i18n/qqq.json
+++ b/modules/ve/i18n/qqq.json
@@ -59,9 +59,13 @@
 visualeditor-linkinspector-title: Title of the link inspector 
dialog.\n{{Identical|Hyperlink}},
 visualeditor-listbutton-bullet-tooltip: Tooltip text for the bullet 
list button,
 visualeditor-listbutton-number-tooltip: Tooltip text for the numbered 
list button,
+visualeditor-mediasizewidget-button-originalDimensions: Label for the 
button that sets media to its original dimensions.,
+visualeditor-mediasizewidget-label-defaulterror: An error label 
notifying the user the size inputs are invalid.,
+visualeditor-mediasizewidget-label-height: Label for the height input.,
+visualeditor-mediasizewidget-label-width: Label for the width input.,
 visualeditor-specialcharacter-button-tooltip: Tooltip text for the 
insert character button.\n{{Identical|Special character}},
 visualeditor-specialcharacterinspector-title: Used as title for special 
character inspector.\n{{Identical|Special character}},
 visualeditor-specialcharinspector-characterlist-insert: This is a JSON 
string defining the special characters that can be inserted using the special 
character insertion tool.\n{{doc-important|Please make sure it is a valid JSON 
string.}}\n{{Optional}},
 visualeditor-toolbar-insert: Label text for insert menu in 
toolbar.\n{{Identical|Insert}},
 visualeditor-version-label: Label text for version 
number\n{{Identical|Version}}
-}
\ No newline at end of file
+}
diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index e70ec20..ec19a5d 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -114,3 +114,8 @@
 .ve-ui-groupButtonWidget {
white-space: normal;
 }
+
+/* ve.ui.MediaSizeWidget */
+.ve-ui-MediaSizeWidget-input-hasError input[type='text'] {
+   background: #ffc2c2;
+}
diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
new file mode 100644
index 000..793441c
--- /dev/null
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -0,0 +1,293 @@
+/*!
+ * VisualEditor UserInterface MediaSizeWidget class.
+ *
+ * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Creates an ve.ui.MediaSizeWidget object.
+ *
+ * @class
+ * @extends OO.ui.TextInputWidget
+ *
+ * @constructor
+ * @param {Object} 

[MediaWiki-commits] [Gerrit] [wip] Add an ActionFieldLayout - change (oojs/ui)

2014-11-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [wip] Add an ActionFieldLayout
..

[wip] Add an ActionFieldLayout

Add an extension to FieldLayout that allows for an inline button
after the field. Demos added.

Change-Id: I2cdf9a43bc8fe9d681c12df6b427e25934a65200
---
M build/modules.json
M demos/pages/widgets.js
A src/layouts/ActionFieldLayout.js
M src/styles/core.less
A src/styles/layouts/ActionFieldLayout.less
5 files changed, 100 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/68/175568/1

diff --git a/build/modules.json b/build/modules.json
index 20bc694..c635b65 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -38,6 +38,7 @@
 
src/layouts/BookletLayout.js,
src/layouts/FieldLayout.js,
+   src/layouts/ActionFieldLayout.js,
src/layouts/FieldsetLayout.js,
src/layouts/FormLayout.js,
src/layouts/GridLayout.js,
diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js
index fabfe7f..1408404 100644
--- a/demos/pages/widgets.js
+++ b/demos/pages/widgets.js
@@ -432,6 +432,57 @@
align: 'top'
}
),
+   new OO.ui.ActionFieldLayout(
+   new OO.ui.TextInputWidget( { value: 'Text 
input' } ),
+   new OO.ui.ButtonWidget( {
+   label: 'Button'
+   } ),
+   {
+   label: 'ActionFieldLayout with text 
field',
+   help: 'I am an additional, helpful 
information. Lorem ipsum dolor sit amet, cibo definiebas pri ' +
+   'in, duo ex inimicus perpetua 
complectitur, mel periculis similique at.\u200E',
+   align: 'left'
+   }
+   ),
+   new OO.ui.ActionFieldLayout(
+   new OO.ui.DropdownWidget( {
+   label: 'Select one',
+   align: 'top',
+   menu: {
+   items: [
+   new 
OO.ui.MenuOptionWidget( {
+   data: 'a',
+   label: 'First'
+   } ),
+   new 
OO.ui.MenuOptionWidget( {
+   data: 'b',
+   label: 'Second'
+   } ),
+   new 
OO.ui.MenuOptionWidget( {
+   data: 'c',
+   label: 'Third'
+   } ),
+   new 
OO.ui.MenuOptionWidget( {
+   data: 'c',
+   label: 'The 
fourth option has a long label'
+   } ),
+   new 
OO.ui.MenuOptionWidget( {
+   data: 'd',
+   label: 'Fifth'
+   } )
+   ]
+   }
+   } ),
+   new OO.ui.ButtonWidget( {
+   label: 'Button'
+   } ),
+   {
+   label: 'ActionFieldLayout with drop 
down field',
+   help: 'I am an additional, helpful 
information. Lorem ipsum dolor sit amet, cibo definiebas pri ' +
+   'in, duo ex inimicus perpetua 
complectitur, mel periculis similique at.\u200E',
+   align: 'left'
+   }
+   ),
new OO.ui.FieldLayout(
new OO.ui.ButtonInputWidget( {
  

[MediaWiki-commits] [Gerrit] Correct placement of noinclude tags - change (mediawiki...TemplateData)

2014-11-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Correct placement of noinclude tags
..

Correct placement of noinclude tags

The noinclude tags should appear only if the page is not a subpage
and only around the tamplatedata tags.

Change-Id: I492bb35c8f2c70235f3ceefdddcc4df6548d7469
---
M modules/ext.templateDataGenerator.core.js
1 file changed, 10 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/61/175661/1

diff --git a/modules/ext.templateDataGenerator.core.js 
b/modules/ext.templateDataGenerator.core.js
index a3c120c..eabf99f 100644
--- a/modules/ext.templateDataGenerator.core.js
+++ b/modules/ext.templateDataGenerator.core.js
@@ -873,14 +873,16 @@
'templatedata\n' + 
tdOutput + '\n/templatedata'
);
} else {
-   // Add the templatedata
-   finalOutput = 
originalTemplateDataWikitext + '\ntemplatedata\n' +
-   tdOutput +
-   '\n/templatedata\n';
-
-   // If we are not in a subpage, 
add noinclude tags
-   if ( !isPageSubLevel ) {
-   finalOutput = 
'\nnoinclude' + finalOutput + '/noinclude\n';
+   if ( isPageSubLevel ) {
+   // Add the 
templatedata
+   finalOutput = 
originalTemplateDataWikitext + '\ntemplatedata\n' +
+   tdOutput +
+   
'\n/templatedata\n';
+   } else {
+   // If we are not in a 
subpage, add noinclude tags
+   finalOutput = 
originalTemplateDataWikitext + '\nnoinclude\ntemplatedata\n' +
+   tdOutput +
+   
'\n/templatedata\n/noinclude\n';
}
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I492bb35c8f2c70235f3ceefdddcc4df6548d7469
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [wip] Adding DragGroupElement and DragElement mixins - change (oojs/ui)

2014-11-10 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [wip] Adding DragGroupElement and DragElement mixins
..

[wip] Adding DragGroupElement and DragElement mixins

Adding a GroupDragElement and DragElement to ooui for a drag/drop
usability.

Change-Id: I04c2cecc36e639e7f2583b5a86dfc4d160892899
---
M build/modules.json
A src/elements/DragElement.js
A src/elements/DragGroupElement.js
M src/styles/core.less
A src/styles/elements/DragElement.less
A src/styles/elements/DragGroupElement.less
6 files changed, 339 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/21/172321/1

diff --git a/build/modules.json b/build/modules.json
index 6422127..ccec4d6 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -21,6 +21,8 @@
 
src/elements/ButtonElement.js,
src/elements/GroupElement.js,
+   src/elements/DragElement.js,
+   src/elements/DragGroupElement.js,
src/elements/IconElement.js,
src/elements/IndicatorElement.js,
src/elements/LabelElement.js,
diff --git a/src/elements/DragElement.js b/src/elements/DragElement.js
new file mode 100644
index 000..39dc0b1
--- /dev/null
+++ b/src/elements/DragElement.js
@@ -0,0 +1,104 @@
+/**
+ * A mixin for an element that can be dragged and dropped.
+ * Use in conjunction with DragGroupWidget
+ *
+ * @abstract
+ * @class
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
+ */
+OO.ui.DragElement = function OoUiDragElement( config ) {
+   // Configuration
+   config = config || {};
+
+   // Properties
+   this.index = null;
+
+   // Initialize and events
+   this.$element
+   .attr( 'draggable', true )
+   .addClass( 'oo-ui-dragElement' )
+   // This is only here until I figure out the CSS issue
+   // TODO: Remove this display rule - it should be in the css 
file
+   .css( 'display', 'inline-block' )
+   .on( {
+   dragstart: this.onDragStart.bind( this ),
+   dragover: this.onDragOver.bind( this ),
+   dragend: this.onDragEnd.bind( this ),
+   drop: this.onDrop.bind( this )
+   } );
+};
+
+/**
+ * Respond to dragstart event.
+ * @param {jQuery.event} event jQuery event
+ * @return {boolean} True
+ * @fires dragstart
+ */
+OO.ui.DragElement.prototype.onDragStart = function ( event ) {
+   // Define drop effect
+   event.originalEvent.dataTransfer.dropEffect = 'move';
+   event.originalEvent.dataTransfer.effectAllowed = 'move';
+
+   // Add dragging class
+   this.$element.addClass( 'oo-ui-dragElement-dragging' );
+
+   // Emit event
+   this.emit( 'dragstart', this );
+   return true;
+};
+
+/**
+ * Respond to dragend event.
+ * @param {jQuery.event} event jQuery event
+ * @return {boolean} False
+ * @fires dragend
+ */
+OO.ui.DragElement.prototype.onDragEnd = function () {
+   this.$element.removeClass( 'oo-ui-dragElement-dragging' );
+
+   this.emit( 'dragend' );
+   // Return false and prevent propogation
+   return false;
+};
+
+/**
+ * Handle drop event.
+ * @param {jQuery.event} event jQuery event
+ * @fires drop
+ */
+OO.ui.DragElement.prototype.onDrop = function () {
+   this.emit( 'drop', this );
+};
+
+/**
+ * In order for drag/drop to work, the dragover event must
+ * return false and stop propogation.
+ * @return {boolean} False
+ * @fires dragover
+ */
+OO.ui.DragElement.prototype.onDragOver = function () {
+   this.emit( 'dragover', this.index );
+   return false;
+};
+
+/**
+ * Set item index.
+ * Store it in the dom so we can access from the widget drag event
+ * @param {number} Item index
+ */
+OO.ui.DragElement.prototype.setIndex = function ( index ) {
+   if ( this.index !== index ) {
+   this.index = index;
+   this.$element.data( 'index', index );
+   }
+};
+
+/**
+ * Get item index
+ * @return {number} Item index
+ */
+OO.ui.DragElement.prototype.getIndex = function () {
+   return this.index;
+};
diff --git a/src/elements/DragGroupElement.js b/src/elements/DragGroupElement.js
new file mode 100644
index 000..9a5581f
--- /dev/null
+++ b/src/elements/DragGroupElement.js
@@ -0,0 +1,213 @@
+/**
+ * Element containing a sequence of child elements that can be dragged
+ * and dropped.
+ *
+ * @abstract
+ * @class
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
+ * @cfg {jQuery} [$group] Container node, assigned to #$group, omit to use a 
generated `div`
+ */
+OO.ui.DragGroupElement = function OoUiDragGroupElement( config ) {
+   // Configuration intialization
+   config = config || {};
+
+   // 

[MediaWiki-commits] [Gerrit] [wip] Adding DraggableGroupElement and DraggableElement mixins - change (oojs/ui)

2014-11-10 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [wip] Adding DraggableGroupElement and DraggableElement mixins
..

[wip] Adding DraggableGroupElement and DraggableElement mixins

Adding a GroupDragElement and DragElement to ooui for a drag/drop
usability.

Change-Id: I859ff276ea97628fde28327d200ed059d018c178
---
M build/modules.json
A src/elements/DraggableElement.js
A src/elements/DraggableGroupElement.js
M src/styles/core.less
A src/styles/elements/DraggableElement.less
A src/styles/elements/DraggableGroupElement.less
6 files changed, 339 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/25/172325/1

diff --git a/build/modules.json b/build/modules.json
index 6422127..b76b247 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -21,6 +21,8 @@
 
src/elements/ButtonElement.js,
src/elements/GroupElement.js,
+   src/elements/DraggableElement.js,
+   src/elements/DraggableGroupElement.js,
src/elements/IconElement.js,
src/elements/IndicatorElement.js,
src/elements/LabelElement.js,
diff --git a/src/elements/DraggableElement.js b/src/elements/DraggableElement.js
new file mode 100644
index 000..7bab9cf
--- /dev/null
+++ b/src/elements/DraggableElement.js
@@ -0,0 +1,104 @@
+/**
+ * A mixin for an element that can be dragged and dropped.
+ * Use in conjunction with DragGroupWidget
+ *
+ * @abstract
+ * @class
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
+ */
+OO.ui.DraggableElement = function OoUiDraggableElement( config ) {
+   // Configuration
+   config = config || {};
+
+   // Properties
+   this.index = null;
+
+   // Initialize and events
+   this.$element
+   .attr( 'draggable', true )
+   .addClass( 'oo-ui-DraggableElement' )
+   // This is only here until I figure out the CSS issue
+   // TODO: Remove this display rule - it should be in the css 
file
+   .css( 'display', 'inline-block' )
+   .on( {
+   dragstart: this.onDragStart.bind( this ),
+   dragover: this.onDragOver.bind( this ),
+   dragend: this.onDragEnd.bind( this ),
+   drop: this.onDrop.bind( this )
+   } );
+};
+
+/**
+ * Respond to dragstart event.
+ * @param {jQuery.Event} event jQuery event
+ * @return {boolean} True
+ * @fires dragstart
+ */
+OO.ui.DraggableElement.prototype.onDragStart = function ( event ) {
+   // Define drop effect
+   event.originalEvent.dataTransfer.dropEffect = 'move';
+   event.originalEvent.dataTransfer.effectAllowed = 'move';
+
+   // Add dragging class
+   this.$element.addClass( 'oo-ui-DraggableElement-dragging' );
+
+   // Emit event
+   this.emit( 'dragstart', this );
+   return true;
+};
+
+/**
+ * Respond to dragend event.
+ * @param {jQuery.Event} event jQuery event
+ * @return {boolean} False
+ * @fires dragend
+ */
+OO.ui.DraggableElement.prototype.onDragEnd = function () {
+   this.$element.removeClass( 'oo-ui-DraggableElement-dragging' );
+
+   this.emit( 'dragend' );
+   // Return false and prevent propogation
+   return false;
+};
+
+/**
+ * Handle drop event.
+ * @param {jQuery.Event} event jQuery event
+ * @fires drop
+ */
+OO.ui.DraggableElement.prototype.onDrop = function () {
+   this.emit( 'drop', this );
+};
+
+/**
+ * In order for drag/drop to work, the dragover event must
+ * return false and stop propogation.
+ * @return {boolean} False
+ * @fires dragover
+ */
+OO.ui.DraggableElement.prototype.onDragOver = function () {
+   this.emit( 'dragover', this.index );
+   return false;
+};
+
+/**
+ * Set item index.
+ * Store it in the dom so we can access from the widget drag event
+ * @param {number} Item index
+ */
+OO.ui.DraggableElement.prototype.setIndex = function ( index ) {
+   if ( this.index !== index ) {
+   this.index = index;
+   this.$element.data( 'index', index );
+   }
+};
+
+/**
+ * Get item index
+ * @return {number} Item index
+ */
+OO.ui.DraggableElement.prototype.getIndex = function () {
+   return this.index;
+};
diff --git a/src/elements/DraggableGroupElement.js 
b/src/elements/DraggableGroupElement.js
new file mode 100644
index 000..6db334f
--- /dev/null
+++ b/src/elements/DraggableGroupElement.js
@@ -0,0 +1,213 @@
+/**
+ * Element containing a sequence of child elements that can be dragged
+ * and dropped.
+ *
+ * @abstract
+ * @class
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
+ * @cfg {jQuery} [$group] Container node, assigned to #$group, omit to use a 
generated `div`
+ */

[MediaWiki-commits] [Gerrit] Change event listener for caption surface in media dialog - change (mediawiki...VisualEditor)

2014-11-26 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Change event listener for caption surface in media dialog
..

Change event listener for caption surface in media dialog

Make sure the dialog is listening to the correct event for when
caption surface changes.

Change-Id: I214947a440e4f78adf1541d8008599fe65ac8b2c
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index e6f9f46..09fa461 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -842,8 +842,8 @@
);
 
// Events
-   this.captionSurface.getSurface().getModel().connect( this, {
-   documentUpdate: this.checkChanged.bind( this )
+   captionDocument.connect( this, {
+   transact: this.checkChanged.bind( this )
} );
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I214947a440e4f78adf1541d8008599fe65ac8b2c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Set panels after everything is initialized in media dialog - change (mediawiki...VisualEditor)

2014-11-26 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Set panels after everything is initialized in media dialog
..

Set panels after everything is initialized in media dialog

Only change the panels (and focus the caption surface) after the
surface is actually appended and initialized.

Bug: T76074
Change-Id: I3d514f38b5fd9f794c4ff8c44a64f5f3475a84bd
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index e6f9f46..f36ca9b 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -632,14 +632,13 @@
 
this.resetCaption();
 
-   this.switchPanels( this.selectedNode ? 'edit' : 
'search' );
-
this.actions.setAbilities( { insert: false, apply: 
false } );
 
// Initialization
this.captionFieldset.$element.append( 
this.captionSurface.$element );
this.captionSurface.initialize();
 
+   this.switchPanels( this.selectedNode ? 'edit' : 
'search' );
}, this );
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3d514f38b5fd9f794c4ff8c44a64f5f3475a84bd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix image alignment in media dialog search - change (mediawiki...VisualEditor)

2014-12-11 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix image alignment in media dialog search
..

Fix image alignment in media dialog search

Make the image results align to the full width of the dialog. This
fix uses dynamic values of the width of the container rather than
a hard-coded value so it should work properly on all themes.

Bug: T78050
Change-Id: I05bb0d8a8b13c246840382b12e098d0579180016
---
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
1 file changed, 9 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index c8ceb2d..3dcf966 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
@@ -108,6 +108,15 @@
return;
}
 
+   // HACK: fit four images in the screen
+   // The -45 is here because the way the container is aligned, it
+   // is pushed behind the scrollbar. When we calculate the new size
+   // of the image results, we need to account for a bit thinner than
+   // the actual (partially hidden) width.
+   // Note: This will be fixed in an upcoming rewrite of the image
+   // search results.
+   this.size = ( this.results.$element.innerWidth() - 45 ) / 4;
+
// Reset message
this.$noItemsMessage.hide();
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05bb0d8a8b13c246840382b12e098d0579180016
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Separate appendItems from addItems in GroupElement - change (oojs/ui)

2014-11-13 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Separate appendItems from addItems in GroupElement
..

Separate appendItems from addItems in GroupElement

In some cases we want to append the items into the group in a different
manner. For example, this is done in the MediaSearchWidget, where we
append the result items into separate (resized) rows for better view.
This fix allows us to override only the way the items are being attached
and appended/prepended to the $group element when items are added without
touching the rest of the addItems method.

Change-Id: I5e6a27169bc5217432026835b7ae010e444d2269
---
M src/elements/GroupElement.js
1 file changed, 16 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/05/173105/1

diff --git a/src/elements/GroupElement.js b/src/elements/GroupElement.js
index 5d97be2..4cf3482 100644
--- a/src/elements/GroupElement.js
+++ b/src/elements/GroupElement.js
@@ -148,20 +148,33 @@
}
 
if ( index === undefined || index  0 || index = this.items.length ) {
-   this.$group.append( itemElements );
this.items.push.apply( this.items, items );
} else if ( index === 0 ) {
-   this.$group.prepend( itemElements );
this.items.unshift.apply( this.items, items );
} else {
-   this.items[index].$element.before( itemElements );
this.items.splice.apply( this.items, [ index, 0 ].concat( items 
) );
}
 
+   this.appendItems( itemElements, index );
return this;
 };
 
 /**
+ * Append items to the group element
+ * @param {jQuery[]} itemsElements An array of item elements
+ * @param {number} [index] Index to insert items at
+ */
+OO.ui.GroupElement.prototype.appendItems = function ( itemElements, index ) {
+   if ( index === undefined || index  0 || index = this.items.length ) {
+   this.$group.append( itemElements );
+   } else if ( index === 0 ) {
+   this.$group.prepend( itemElements );
+   } else {
+   this.items[index].$element.before( itemElements );
+   }
+};
+
+/**
  * Remove items.
  *
  * Items will be detached, not removed, so they can be used later.

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5e6a27169bc5217432026835b7ae010e444d2269
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Image caption should have parent document direction - change (mediawiki...VisualEditor)

2014-12-10 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Image caption should have parent document direction
..

Image caption should have parent document direction

Make sure all new caption surfaces are initialized with the language
and direction of the parent document, so the alignment is set up
correctly.

Bug: T71969
Change-Id: I6e5f003e18a9c5808d9a4b148eddf0d0f7e29e67
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
1 file changed, 7 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index 4993714..5e2e658 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -789,7 +789,7 @@
  */
 ve.ui.MWMediaDialog.prototype.resetCaption = function () {
var captionDocument,
-   doc = this.getFragment().getSurface().getDocument();
+   doc = this.getFragment().getDocument();
 
if ( this.captionSurface ) {
// Reset the caption surface if it already exists
@@ -824,7 +824,12 @@
{ type: '/paragraph' },
{ type: 'internalList' },
{ type: '/internalList' }
-   ] );
+   ],
+   // The ve.dm.Document constructor expects
+   // ( data, htmlDocument, parentDocument, internalList, 
innerWhitespace, lang, dir )
+   // as parameters. We are only interested in setting up 
language, hence the
+   // multiple 'null' values.
+   null, null, null, null, doc.getLang(), doc.getDir() );
}
 
this.store = doc.getStore();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6e5f003e18a9c5808d9a4b148eddf0d0f7e29e67
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Directiona adjustment to figure styling - change (mediawiki...VisualEditor)

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

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


Change subject: Directiona adjustment to figure styling
..

Directiona adjustment to figure styling

Adding @noflip to align-left and align-right in the figure css styling
rules and removing the need to resize the Branch Node div element on center.

Change-Id: Iec6e589ba9ecdf32c1a0934b9eb05ee3fd42af66
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ce/styles/ve.ce.Node.css
2 files changed, 4 insertions(+), 14 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 9bec405..38dc94a 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -237,18 +237,6 @@
'width': width + 5
} );
 
-   // A image that is centered must have dimensions
-   // to its node div wrapper
-   if ( this.alignment === 'center' ) {
-   this.$element
-   .css( {
-   'width': width
-   } );
-   } else {
-   this.$element.css( { 'width': 'auto' } );
-   }
-
-
// update:
this.size = {
height: height,
@@ -266,9 +254,9 @@
// Default is different between RTL and LTR wikis:
if ( type === 'default'  alignment === 'default' ) {
if ( this.$element.css( 'direction' ) === 'rtl' ) {
-   return 'tleft';
+   return 'mw-halign-left';
} else {
-   return 'tright';
+   return 'mw-halign-right';
}
} else {
return this.constructor.static.cssClasses[type][alignment];
diff --git a/modules/ve-mw/ce/styles/ve.ce.Node.css 
b/modules/ve-mw/ce/styles/ve.ce.Node.css
index dfb78af..e39471f 100644
--- a/modules/ve-mw/ce/styles/ve.ce.Node.css
+++ b/modules/ve-mw/ce/styles/ve.ce.Node.css
@@ -51,6 +51,7 @@
margin: 5px;
 }
 
+/* @noflip */
 figure[typeof*='mw:Image'].mw-halign-right {
clear: right;
float: right;
@@ -61,6 +62,7 @@
margin-right: auto;
 }
 
+/* @noflip */
 figure[typeof*='mw:Image'].mw-halign-left {
clear: left;
float: left;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iec6e589ba9ecdf32c1a0934b9eb05ee3fd42af66
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add a getDirectionFromRange Method to ve.ce.Document - change (mediawiki...VisualEditor)

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

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


Change subject: Add a getDirectionFromRange Method to ve.ce.Document
..

Add a getDirectionFromRange Method to ve.ce.Document

getDirectionFromRange returns the direction property of the ce nodes under
that range. That method is mostly useful to recognize the overall block
direction of a selection or fragment.

The method is currently used in the following locations:
* ve.ui.Toolbar onContextChange - as a means to recognize the current context's
  block direction for the icon directionality.
* ve.ui.MWExtensionInspector - if the selection is text and not an existing node
  the input directionality adjusts to the context direction.

Bug: 57421
Change-Id: Ifc01b8e5dc0a2fe39d221e59e452c5cfad709a2d
---
M modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
M modules/ve/ce/ve.ce.Document.js
M modules/ve/ui/ve.ui.Toolbar.js
3 files changed, 47 insertions(+), 20 deletions(-)


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

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
index 84a5ead..093001b 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
@@ -59,6 +59,9 @@
  * @inheritdoc
  */
 ve.ui.MWExtensionInspector.prototype.setup = function ( data ) {
+   var dir,
+   fragment = this.surface.getModel().getFragment( null, true );
+
// Parent method
ve.ui.Inspector.prototype.setup.call( this, data );
 
@@ -66,12 +69,16 @@
this.node = this.surface.getView().getFocusedNode();
this.input.setValue( this.node ? this.node.getModel().getAttribute( 
'mw' ).body.extsrc : '' );
 
+   // By default, the direction of the input element should be the same
+   // as the direction of the content it applies to
if ( this.node ) {
-   // Direction of the input textarea should correspond to the
-   // direction of the surrounding content of the node itself
-   // rather than the GUI direction:
-   this.input.setRTL( this.node.$element.css( 'direction' ) === 
'rtl' );
+   // The node is being edited
+   dir = this.node.$element.css( 'direction' );
+   } else {
+   // New insertion, base direction on the fragment range
+   dir = 
this.surface.getView().documentView.getDirectionFromRange( fragment.getRange() 
);
}
+   this.input.setRTL( dir === 'rtl' );
 };
 
 /**
diff --git a/modules/ve/ce/ve.ce.Document.js b/modules/ve/ce/ve.ce.Document.js
index 5a374a6..d9b6ad1 100644
--- a/modules/ve/ce/ve.ce.Document.js
+++ b/modules/ve/ce/ve.ce.Document.js
@@ -268,3 +268,33 @@
return new ve.Range( contentOrSlugOffset );
}
 };
+
+
+/**
+ * Get the directionality of some range.
+ *
+ * @method
+ * @param {ve.Range} range Selection range
+ * @returns {String} 'rtl' or 'ltr' as response
+ */
+ve.ce.Document.prototype.getDirectionFromRange = function ( range ) {
+   var node, effectiveNodes, selectedNodes;
+
+   selectedNodes = this.selectNodes( range, 'covered' );
+   if ( selectedNodes.length  1 ) {
+   // selection of multiple nodes
+   effectiveNodes = this.selectNodes( range, 'siblings' );
+
+   // Get the common parent's outer range
+   range = effectiveNodes[0].parentOuterRange;
+   } else {
+   // selection of a single node
+
+   // Get the node's outer range
+   range = selectedNodes[0].node.getOuterRange();
+   }
+
+   node = this.getNodeFromOffset( range.start );
+
+   return node.$element.css( 'direction' );
+};
diff --git a/modules/ve/ui/ve.ui.Toolbar.js b/modules/ve/ui/ve.ui.Toolbar.js
index b61d524..13bc0d0 100644
--- a/modules/ve/ui/ve.ui.Toolbar.js
+++ b/modules/ve/ui/ve.ui.Toolbar.js
@@ -172,27 +172,17 @@
nodes.push( leafNodes[i].node );
}
}
-   // Update context direction for button icons UI:
+   // Update context direction for button icons UI
 
-   // block direction (direction of the current node)
-   currentNodes.fragNodes = fragment.getCoveredNodes();
-   if ( currentNodes.fragNodes.length  1 ) {
-   // selection of multiple nodes
-   currentNodes.dm.block = 
fragment.getSiblingNodes()[0].node.parent;
-   } else {
-   // selection of a single node
-   currentNodes.dm.block = currentNodes.fragNodes[0].node;
-   }
-   // get the direction of the block:
-   currentNodes.ce.block = doc.getNodeFromOffset( 
currentNodes.dm.block.getRange().start );
-   dirBlock = currentNodes.ce.block.$element.css( 'direction' );
-   

[MediaWiki-commits] [Gerrit] [WIP] Add direction classes to Toolbar based on context - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Add direction classes to Toolbar based on context
..

[WIP] Add direction classes to Toolbar based on context

Add rtl/ltr-related classes to the toolbar based on cursor context, so
certain icons can change based on inline and block directions.

Change-Id: I1b6e450226bf8da820fb622f28c1c3062c534bb0
---
M modules/ve/ui/ve.ui.Toolbar.js
1 file changed, 47 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Toolbar.js b/modules/ve/ui/ve.ui.Toolbar.js
index b97ed85..3a7296f 100644
--- a/modules/ve/ui/ve.ui.Toolbar.js
+++ b/modules/ve/ui/ve.ui.Toolbar.js
@@ -49,7 +49,11 @@
return toolbar.onSurfaceViewKeyUp.apply( toolbar, 
arguments );
}
};
-
+   // default directions:
+   this.contextDirection = { 'inline': 'ltr', 'block': 'ltr' };
+   this.$element
+   .addClass( 've-ui-dir-inline-' + this.contextDirection.inline )
+   .addClass( 've-ui-dir-block-' + this.contextDirection.block );
// Events
this.surface.getModel().connect( this, { 'contextChange': 
'onContextChange' } );
this.surface.connect( this, { 'addCommand': 'onSurfaceAddCommand' } );
@@ -152,8 +156,15 @@
  * @fires updateState
  */
 ve.ui.Toolbar.prototype.onContextChange = function () {
-   var i, len, leafNodes,
+   var i, len, leafNodes, dirInline, dirBlock, fragmentAnnotation,
+   currentNodes = {
+   fragNodes: null,
+   fragAnnotations: null,
+   'dm': {},
+   'ce': {}
+   },
fragment = this.surface.getModel().getFragment( null, false ),
+   doc = this.surface.getView().getDocument(),
nodes = [];
 
leafNodes = fragment.getLeafNodes();
@@ -162,6 +173,40 @@
nodes.push( leafNodes[i].node );
}
}
+   // Update context direction for button icons UI:
+
+   // block direction (direction of the current node)
+   currentNodes.fragNodes = fragment.getCoveredNodes();
+   if ( currentNodes.fragNodes.length  1 ) {
+   // selection of multiple nodes
+   currentNodes.dm.block = 
fragment.getSiblingNodes()[0].node.parent;
+   } else {
+   // selection of a single node
+   currentNodes.dm.block = currentNodes.fragNodes[0].node;
+   }
+   // get the direction of the block:
+   currentNodes.ce.block = doc.getNodeFromOffset( 
currentNodes.dm.block.getOffset() );
+   dirBlock = currentNodes.ce.block.$element.css( 'direction' );
+
+   // 'inline' direction is set by language annotation:
+   fragmentAnnotation = fragment.getAnnotations();
+   if ( fragmentAnnotation.hasAnnotationWithName( 'meta/language' ) ) {
+   dirInline = fragmentAnnotation.getAnnotationsByName( 
'meta/language' ).get()[0].getAttribute( 'dir' );
+   } else {
+   dirInline = dirBlock;
+   }
+
+   if ( dirInline !== this.contextDirection.inline ) {
+   // remove previous class:
+   this.$element.removeClass( 've-ui-dir-inline-rtl 
ve-ui-dir-inline-ltr' );
+   this.$element.addClass( 've-ui-dir-inline-' + dirInline );
+   this.contextDirection.inline = dirInline;
+   }
+   if ( dirBlock !== this.contextDirection.block ) {
+   this.$element.removeClass( 've-ui-dir-block-rtl 
ve-ui-dir-block-ltr' );
+   this.$element.addClass( 've-ui-dir-block-' + dirBlock );
+   this.contextDirection.block = dirBlock;
+   }
this.emit( 'updateState', nodes, fragment.getAnnotations(), 
fragment.getAnnotations( true ) );
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1b6e450226bf8da820fb622f28c1c3062c534bb0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add OO.ui.GroupButtonWidget - change (oojs/ui)

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

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


Change subject: Add OO.ui.GroupButtonWidget
..

Add OO.ui.GroupButtonWidget

Adding a group button widget that displays multiple buttons and sends
a click event with the stored value of whatever one of the buttons
that is pressed.

Change-Id: I480acb5a9d7ee751e2ee10941cddc11f829aeb57
---
A src/widgets/OO.ui.GroupButtonWidget.js
1 file changed, 75 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/95/97995/1

diff --git a/src/widgets/OO.ui.GroupButtonWidget.js 
b/src/widgets/OO.ui.GroupButtonWidget.js
new file mode 100644
index 000..8157fd9
--- /dev/null
+++ b/src/widgets/OO.ui.GroupButtonWidget.js
@@ -0,0 +1,75 @@
+/**
+ * Creates an OO.ui.GroupButtonWidget object.
+ *
+ * @class
+ * @extends OO.ui.Widget
+ *
+ * @param {Object} [config] Configuration options
+ * @cfg {Object} [group] Button group parameters organized by { 'label': 
returnValue }
+ * where 'returnValue' is the value returned upon click
+ */
+OO.ui.GroupButtonWidget = function OoUiGroupButtonWidget( config ) {
+   var item,
+   counter = 0;
+
+   // Configuration initialization
+   config = $.extend( { 'target': '_blank' }, config );
+
+   // Parent constructor
+   OO.ui.Widget.call( this, config );
+
+   // Initialization
+   this.$element.addClass( 've-ui-groupButtonWidget' );
+
+   this.value = null;
+   this.group = config.group;
+   this.buttons = {};
+   // Set up the buttons
+   for ( item in this.group ) {
+   this.buttons[item] = new OO.ui.PushButtonWidget( {
+   'label': item,
+   } );
+   // bind to master click event
+   this.buttons[item].on( 'click', OO.ui.bind( this.onClick, this, 
{ 'returnValue': this.group[item] } ) );
+   // add button DOM
+   this.$element.append( this.buttons[item].$element );
+   // separate lines if needed
+   // TODO: separate into lines through CSS instead
+   if ( ++counter = 8 ) {
+   this.$element.append( $( 'br /' ) );
+   counter = 0;
+   }
+   }
+
+};
+
+/* Inheritance */
+
+OO.inheritClass( OO.ui.GroupButtonWidget, OO.ui.Widget );
+
+/* Events */
+
+/**
+ * @event click
+ */
+
+/**
+ * Handle onClick event to any of the buttons in the group
+ *
+ * @method
+ * @param {jQuery.Event} e Mouse click event
+ * @fires click
+ */
+OO.ui.GroupButtonWidget.prototype.onClick = function ( config ) {
+   this.value = config.returnValue;
+   this.emit( 'click' );
+};
+
+/**
+ * Get the value of the pushed button from the group
+ *
+ * @returns {string} value of the selected button from the group
+ */
+OO.ui.GroupButtonWidget.prototype.getValue = function () {
+   return this.value;
+};

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I480acb5a9d7ee751e2ee10941cddc11f829aeb57
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Refactoring CE NWBlockImageNode - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Refactoring CE NWBlockImageNode
..

[WIP] Refactoring CE NWBlockImageNode

This is meant to change image so it uses figure and a standard CSS structure,
so we can visualize the changes of attributes like 'type' and 'alignment'
without constantly destroying and rebuilding nested div structures for images.

Change-Id: I40065acd9fd59d30f94b5336736d4986e8de15aa
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ce/nodes/ve.ce.MWImageNode.js
M modules/ve-mw/ce/styles/ve.ce.Node.css
3 files changed, 146 insertions(+), 75 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 1859003..32d9e4d 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -17,73 +17,70 @@
  * @param {Object} [config] Configuration options
  */
 ve.ce.MWBlockImageNode = function VeCeMWBlockImageNode( model, config ) {
-   var captionModel, captionView, type;
+   var captionModel, captionView;
 
// Parent constructor
ve.ce.BranchNode.call( this, model, config );
 
-   type = this.model.getAttribute( 'type' );
+   // Properties
+   this.type = this.model.getAttribute( 'type' );
+   this.alignment = this.model.getAttribute( 'align' );
+   this.size = {
+   'width': this.model.getAttribute( 'width' ),
+   'height': this.model.getAttribute( 'height' )
+   };
 
-   if ( this.model.getAttribute( 'align' ) === 'center' ) {
-   this.$.addClass( 'center' );
-   this.$thumb = this.$$( 'div' ).appendTo( this.$ );
-   } else {
-   this.$thumb = this.$;
-   }
-
-   this.$thumbInner = this.$$( 'div' )
-   .addClass( 'thumbinner' )
-   .css( 'width', parseInt( this.model.getAttribute( 'width' ), 10 
) + 2 );
-
+   // Build DOM:
this.$a = this.$$( 'a' )
.addClass( 'image' )
.attr( 'href', this.getResolvedAttribute( 'href' ) );
 
this.$image = this.$$( 'img' )
.attr( 'src', this.getResolvedAttribute( 'src' ) )
-   .attr( 'width', this.model.getAttribute( 'width' ) )
-   .attr( 'height', this.model.getAttribute( 'height' ) )
+   .attr( 'width', this.size.width )
+   .attr( 'height', this.size.height )
.appendTo( this.$a );
 
-   this.$inner = this.$$( 'div' ).addClass( 
've-ce-mwBlockImageNode-inner' );
+   this.$wrapper = this.$$( 'div' )
+   .addClass( 've-ce-mwBlockImageNode-inner' )
+   .append( this.$a );
 
-   if ( type === 'none' || type === 'frameless' ) {
-   this.$thumb.addClass(
+   this.$figure = this.$$( 'figure' )
+   .appendTo( this.$ )
+   .append( this.$wrapper );
+
+   this.$.addClass( 've-ce-mwBlockImageNode-type-' + this.type );
+   this.$.addClass( 've-ce-mwBlockImageNode-align-' + this.alignment );
+
+   // Update size:
+   this.updateSize( this.size.height, this.size.width );
+
+   // Mixin constructors
+   ve.ce.MWImageNode.call( this, this.$wrapper, this.$image );
+
+   if ( this.type === 'none' || this.type === 'frameless' ) {
+   this.$.addClass(
this.getCssClass( 'none', this.model.getAttribute( 
'align' ) )
);
-   this.$a.appendTo( this.$thumb );
-
-   // For centered images, this.$thumb is full width, so wrap
-   // this.$image in another div and use that for selection
-   this.$inner
-   .append( this.$image )
-   .appendTo( this.$a );
} else {
// Type frame, thumb and the default
this.$image.addClass( 'thumbimage' );
-   this.$thumb
-   .addClass( 'thumb' );
-   this.$a.appendTo( this.$thumbInner );
-   this.$thumbInner.appendTo( this.$thumb );
-
-   // For centered images, this.$thumb is full width, so wrap
-   // this.$thumbInner in another div and use that for selection
-   this.$inner
-   .append( this.$thumbInner )
-   .appendTo( this.$thumb );
+   this.$figure.addClass( 'borderwrap' );
+   this.$.addClass( 'thumb' );
}
 
-   // Mixin constructors
-   ve.ce.MWImageNode.call( this, this.$inner, this.$image );
-
// I smell a caption!
-   if ( type !== 'none'  type !== 'frameless'  
this.model.children.length === 1 ) {
+   

[MediaWiki-commits] [Gerrit] Fix image resize handles update on surface change - change (mediawiki...VisualEditor)

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

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


Change subject: Fix image resize handles update on surface change
..

Fix image resize handles update on surface change

The resizing handles under ResizableNode are created in the location of the 
image
but if the page is edited and the image moves relative to the document, the 
handles
remained where the image was previously and not where its updated location is 
at.

This code fixes that bug by changing the CE event listening to the model's 
'transact'
instead of 'history'.

Change-Id: Id0e4296dd89b24839ba68a534ca77d73c23b7434
---
M modules/ve/ce/ve.ce.ResizableNode.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index 3009cbc..1fdf431 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -184,9 +184,9 @@
var surfaceModel = this.getRoot().getSurface().getModel();
 
if ( this.live ) {
-   surfaceModel.connect( this, { 'history': 
'setResizableHandlesSizeAndPosition' } );
+   surfaceModel.connect( this, { 'transact': 
'setResizableHandlesSizeAndPosition' } );
} else {
-   surfaceModel.disconnect( this, { 'history': 
'setResizableHandlesSizeAndPosition' } );
+   surfaceModel.disconnect( this, { 'transact': 
'setResizableHandlesSizeAndPosition' } );
this.onResizableBlur();
}
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id0e4296dd89b24839ba68a534ca77d73c23b7434
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] MWExtensionInspector input direction based on content - change (mediawiki...VisualEditor)

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

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


Change subject: MWExtensionInspector input direction based on content
..

MWExtensionInspector input direction based on content

** Needs proper testing **

In general, the textarea direction of the MWExtensionInspector textarea
should be dependent on the directionality of the node it is editing.

The only feasible exception is source or code which are edited
in a separate inspector.

Bug: 56779
Change-Id: Iac5c1c3bf2c61b9fa36c9588c1734c91ca4305c4
---
M modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
1 file changed, 5 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
index 3d3cc57..7039cf0 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWExtensionInspector.js
@@ -71,6 +71,11 @@
extsrc = this.node.getModel().getAttribute( 'mw' ).body.extsrc;
}
 
+   // direction of the input textarea should correspond to the
+   // direction of the surrounding content of the node itself
+   // rather than the GUI direction:
+   this.input.$input.attr( 'dir', this.node.$element.css( 'dir' ) );
+
// Wait for animation to complete
setTimeout( ve.bind( function () {
// Setup input text

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac5c1c3bf2c61b9fa36c9588c1734c91ca4305c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Force LTR direction in MWSyntaxHighlightDialog - change (mediawiki...VisualEditor)

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

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


Change subject: Force LTR direction in MWSyntaxHighlightDialog
..

Force LTR direction in MWSyntaxHighlightDialog

Syntax highlight editor shouldn't rely on GUI language directionality
but always allow for LTR text editing.

Bug: 56780
Change-Id: Iae7f9eee20ffb9a003830503865458918f5e1df3
---
M modules/syntaxhighlight/styles/ve.ui.MWSyntaxHighlight.css
M modules/syntaxhighlight/ve.ui.MWSyntaxHighlightSimpleSurface.js
2 files changed, 8 insertions(+), 0 deletions(-)


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

diff --git a/modules/syntaxhighlight/styles/ve.ui.MWSyntaxHighlight.css 
b/modules/syntaxhighlight/styles/ve.ui.MWSyntaxHighlight.css
index f1685ff..11e41f0 100644
--- a/modules/syntaxhighlight/styles/ve.ui.MWSyntaxHighlight.css
+++ b/modules/syntaxhighlight/styles/ve.ui.MWSyntaxHighlight.css
@@ -90,7 +90,9 @@
bottom: 0;
 }
 
+/* @noflip */
 .ve-ui-simplesurface-container-editbox {
+   direction: ltr;
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
@@ -107,6 +109,7 @@
cursor: text;
 }
 
+/* @noflip */
 .ve-ui-simplesurface-textarea {
display:inline-block;
overflow: hidden;
@@ -116,6 +119,8 @@
left: -10px;
top: 0;
 }
+
+/* @noflip */
 .ve-ui-simplesurface-container-editbox pre {
border: none;
background-color: transparent;
@@ -132,12 +137,14 @@
font-size: 1.25em;
 }
 
+/* @noflip */
 .ve-ui-simplesurface-container-editbox-lineNumber {
display: inline-block;
float: left;
height: 100%;
 }
 
+/* @noflip */
 .ve-ui-simplesurface-container-editbox-text {
display: inline-block;
position: absolute;
diff --git a/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightSimpleSurface.js 
b/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightSimpleSurface.js
index c4277b3..a40cafa 100644
--- a/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightSimpleSurface.js
+++ b/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightSimpleSurface.js
@@ -126,6 +126,7 @@
);
this.$editboxLayer
.addClass( 've-ui-simplesurface-container-editbox' )
+   .addClass( 'oo-ui-ltr' )
.append( this.$lineNumberLayer
.addClass( 
've-ui-simplesurface-container-editbox-lineNumber' )
.append( this.$lineNumber

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iae7f9eee20ffb9a003830503865458918f5e1df3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] List-related buttons depend on content for direction - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] List-related buttons depend on content for direction
..

[WIP] List-related buttons depend on content for direction

All icons are currently dependent on the GUI language direction to display
correctly for LTR/RTL. However, content-related directional icons like
list (bulleted/numbered) and indent (increase/decrease) should be shown
according to the direction of the actual text.

Change-Id: Ic916b527ead973c7dfc3107cafa3fec5ed7b3f92
---
M modules/oojs-ui/OO.ui.Tool.js
M modules/syntaxhighlight/ve.ui.MWSyntaxHighlightTool.js
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve/ui/styles/ve.ui.Icons-raster.css
M modules/ve/ui/styles/ve.ui.Icons-vector.css
M modules/ve/ui/tools/ve.ui.IndentationTool.js
M modules/ve/ui/tools/ve.ui.ListTool.js
7 files changed, 123 insertions(+), 3 deletions(-)


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

diff --git a/modules/oojs-ui/OO.ui.Tool.js b/modules/oojs-ui/OO.ui.Tool.js
index 3c07f54..74d73dd 100644
--- a/modules/oojs-ui/OO.ui.Tool.js
+++ b/modules/oojs-ui/OO.ui.Tool.js
@@ -48,6 +48,10 @@
.append( this.$link );
this.setIcon( this.constructor.static.icon );
this.updateLabel();
+   // Corrections for list-related icons:
+   if ( this.constructor.static.iconContentDir === true ) {
+   this.$element.addClass( 'oo-ui-' + 
this.toolbar.surface.getView().getDir() );
+   }
 };
 
 /* Inheritance */
@@ -68,6 +72,12 @@
 OO.ui.Tool.static.tagName = 'span';
 
 /**
+ * Whether to force the icon to follow the content direction
+ * rather than GUI direction
+ * @type {Boolean}
+ */
+OO.ui.Tool.static.iconContentDir = false;
+/**
  * Symbolic name of tool.
  *
  * @abstract
diff --git a/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightTool.js 
b/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightTool.js
index d404040..5c039fe 100644
--- a/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightTool.js
+++ b/modules/syntaxhighlight/ve.ui.MWSyntaxHighlightTool.js
@@ -95,6 +95,7 @@
 ve.ui.MWSynHiIndentTool.static.group = 'synhiEditorTool';
 ve.ui.MWSynHiIndentTool.static.method = 'indent';
 ve.ui.MWSynHiIndentTool.static.icon = 'indent-list';
+ve.ui.MWSynHiIndentTool.static.iconContentDir = true;
 ve.ui.MWSynHiIndentTool.static.titleMessage = '';
 ve.ui.MWSynHiIndentTool.static.autoAdd = false;
 ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiIndentTool );
@@ -109,4 +110,4 @@
 ve.ui.MWSynHiBeautifyTool.static.icon = 'reformat';
 ve.ui.MWSynHiBeautifyTool.static.titleMessage = '';
 ve.ui.MWSynHiBeautifyTool.static.autoAdd = false;
-ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiBeautifyTool );
\ No newline at end of file
+ve.ui.syntaxHighlightEditorToolFactory.register( ve.ui.MWSynHiBeautifyTool );
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 5f9f50a..ff1a715 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -965,7 +965,6 @@
'history': 
'updateToolbarSaveButtonState'
} );
target.$element.append( 
target.surface.$element );
-   target.setUpToolbar();
target.transformPageTitle();
target.changeDocumentTitle();
 
@@ -977,12 +976,12 @@
'lang': mw.config.get( 
'wgVisualEditor' ).pageLanguageCode,
'dir': mw.config.get( 
'wgVisualEditor' ).pageLanguageDir
} );
-
// Add appropriately mw-content-ltr or 
mw-content-rtl class
target.surface.view.$element.addClass(
'mw-content-' + mw.config.get( 
'wgVisualEditor' ).pageLanguageDir
);
 
+   target.setUpToolbar();
// Now that the surface is attached to 
the document and ready,
// let it initialize itself
target.surface.initialize();
diff --git a/modules/ve/ui/styles/ve.ui.Icons-raster.css 
b/modules/ve/ui/styles/ve.ui.Icons-raster.css
index 2194f7c..5442ed4 100644
--- a/modules/ve/ui/styles/ve.ui.Icons-raster.css
+++ b/modules/ve/ui/styles/ve.ui.Icons-raster.css
@@ -70,6 +70,30 @@
background-image: url(images/icons/indent-list-ltr.png);
 }
 
+/* @noflip */

[MediaWiki-commits] [Gerrit] Use image sources from API's fileRepo - change (mediawiki...VisualEditor)

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

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


Change subject: Use image sources from API's fileRepo
..

Use image sources from API's fileRepo

Instead of hard-coding the image resources to search from in the media insert
dialog, this commit queries the local API to get the list of file repos
through meta=filerepoinfo API request. The API request is only done once
per session.

Bug: 50673
Change-Id: Ia5ad9a8c00cca6cbbbc890359dc529e29e1a6be7
---
M modules/ve-mw/init/ve.init.mw.Platform.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
3 files changed, 105 insertions(+), 14 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.Platform.js 
b/modules/ve-mw/init/ve.init.mw.Platform.js
index b78271e..a841988 100644
--- a/modules/ve-mw/init/ve.init.mw.Platform.js
+++ b/modules/ve-mw/init/ve.init.mw.Platform.js
@@ -25,8 +25,8 @@
this.parsedMessages = {};
this.mediaSources = [
//TODO: Bug 50673
-   { 'url': mw.util.wikiScript( 'api' ) },
-   { 'url': '//commons.wikimedia.org/w/api.php' }
+   { 'url': mw.util.wikiScript( 'api' ), 'local': true },
+   { 'apiurl': '//commons.wikimedia.org/w/api.php' }
];
 };
 
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
index 4cd9855..35a0a54 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
@@ -5,6 +5,8 @@
  * @license The MIT License (MIT); see LICENSE.txt
  */
 
+/*global mw */
+
 /**
  * Dialog for inserting MediaWiki media objects.
  *
@@ -24,6 +26,7 @@
 
// Properties
this.item = null;
+   this.sources = {};
 };
 
 /* Inheritance */
@@ -59,14 +62,19 @@
// Parent method
ve.ui.MWDialog.prototype.initialize.call( this );
 
-   // Properties
-   this.search = new ve.ui.MWMediaSearchWidget( { '$': this.$ } );
+   // Widget
+   this.search = new ve.ui.MWMediaSearchWidget( {
+   '$': this.$
+   } );
+
+   // Initialization
+   this.search.$element.addClass( 've-ui-mwMediaInsertDialog-select' );
 
// Events
this.search.connect( this, { 'select': 'onSearchSelect' } );
 
-   // Initialization
-   this.search.$element.addClass( 've-ui-mwMediaInsertDialog-select' );
+   this.$spinner = this.$( 'div' ).addClass( 've-specialchar-spinner' );
+   this.$body.append( this.$spinner );
this.$body.append( this.search.$element );
 };
 
@@ -77,10 +85,81 @@
// Parent method
ve.ui.MWDialog.prototype.setup.call( this, data );
 
-   // Initialization
-   this.search.getQuery().$input.focus().select();
-   this.search.getResults().selectItem();
-   this.search.getResults().highlightItem();
+   this.$spinner.show();
+   this.search.$element.hide();
+   // Get the repos from the API first
+   // The ajax request will only be done once per session
+   this.getFileRepos().done( ve.bind( function () {
+   // Done, hide the spinner
+   this.$spinner.hide();
+
+   // Show the search and query the media sources
+   this.search.$element.show();
+   this.search.queryMediaSources();
+
+   // Initialization
+   this.search.getQuery().$input.focus().select();
+   this.search.getResults().selectItem();
+   this.search.getResults().highlightItem();
+   }, this ) );
+};
+
+/**
+ * Get the list of file repos to use for the media search
+ * @return {jQuery.Promise}
+ */
+ve.ui.MWMediaInsertDialog.prototype.getFileRepos = function () {
+   var xhr, deferred = $.Deferred();
+
+   // Only take this.sources if they aren't already loaded
+   if ( $.isEmptyObject( this.sources ) ) {
+   // Take sources from 
api.php?action=querymeta=filerepoinfoformat=jsonfm
+   xhr = $.ajax( {
+   'url': mw.util.wikiScript( 'api' ),
+   'data': {
+   'action': 'query',
+   'meta': 'filerepoinfo',
+   'format': 'json'
+   },
+   'dataType': 'json',
+   'type': 'POST',
+   // Wait up to 100 seconds before giving up
+   'timeout': 10,
+   'cache': 'false'
+   } )
+   .done( ve.bind( this.onResponseSuccess, this, deferred ) )
+   .fail( ve.bind( this.onResponseFailure, this, deferred ) );
+   } else {
+   

[MediaWiki-commits] [Gerrit] [wip] figure css fixes - change (mediawiki...VisualEditor)

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

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


Change subject: [wip] figure css fixes
..

[wip] figure css fixes

Some corrections were done to frameless images and right/left-aligned images
to try and force firefox to not use its own styles on these.

Change-Id: I52e0e10b465bb9761c2e4be28c98bec37b0dd2ca
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ce/styles/ve.ce.Node.css
2 files changed, 30 insertions(+), 8 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 70dd782..a9fddfd 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -62,12 +62,6 @@
this.$element
.addClass( 've-ce-mwBlockImageNode-align-' + this.alignment );
 
-   // Update size:
-   this.updateSize( this.size.height, this.size.width );
-
-   // Mixin constructors
-   ve.ce.MWImageNode.call( this, this.$figure, this.$image );
-
// I smell a caption!
this.$figcaption = this.$( 'figcaption ');
 
@@ -80,6 +74,12 @@
} else {
this.setCaptionVisible( false );
}
+
+   // Update size:
+   this.updateSize( this.size.height, this.size.width );
+
+   // Mixin constructors
+   ve.ce.MWImageNode.call( this, this.$figure, this.$image );
 
// Events
this.model.connect( this, { 'attributeChange': 'onAttributeChange' } );
@@ -232,9 +232,20 @@
 
this.$figure
.css( {
-   'width': width + 5
+   'width': width
} );
 
+   if ( !this.caption.visible ) {
+   this.$figure
+   .css( {
+   'height': height
+   } );
+   } else {
+   this.$figure
+   .css( {
+   'height': 'auto'
+   } );
+   }
// update:
this.size = {
height: height,
diff --git a/modules/ve-mw/ce/styles/ve.ce.Node.css 
b/modules/ve-mw/ce/styles/ve.ce.Node.css
index e39471f..8a6d42d 100644
--- a/modules/ve-mw/ce/styles/ve.ce.Node.css
+++ b/modules/ve-mw/ce/styles/ve.ce.Node.css
@@ -48,6 +48,12 @@
 
 /* ve.ce.MWBlockImageNode */
 .ve-ce-mwBlockImageNode {
+   margin: 0;
+   padding: 0;
+   border: none;
+}
+
+figure[typeof*='mw:Image'] {
margin: 5px;
 }
 
@@ -55,6 +61,7 @@
 figure[typeof*='mw:Image'].mw-halign-right {
clear: right;
float: right;
+   margin-right: 0;
 }
 
 figure[typeof*='mw:Image'].mw-halign-center {
@@ -66,6 +73,7 @@
 figure[typeof*='mw:Image'].mw-halign-left {
clear: left;
float: left;
+   margin-left: 0;
 }
 
 figure[typeof='mw:Image/Thumb'], figure[typeof='mw:Image/Frame'] {
@@ -76,6 +84,9 @@
 font-size: 94%;
 text-align: center;
 }
+figure[typeof='mw:Image/Frameless'] {
+   border: 0;
+}
 
 figure[typeof*='mw:Image'] figcaption {
border: medium none;
@@ -84,7 +95,7 @@
padding: 3px !important;
 }
 
-figure[typeof*='mw:Image'] img {
+figure[typeof*='mw:Image']:not( [typeof='mw:Image/Frameless'] ) img {
border: 1px solid #cc;
vertical-align: middle;
 }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I52e0e10b465bb9761c2e4be28c98bec37b0dd2ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Changing image size in MWMediaEditDialog - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Changing image size in MWMediaEditDialog
..

[WIP] Changing image size in MWMediaEditDialog

Adding the ability to edit image size in the media edit dialog. Size is kept
in aspect ratio at all times. If value is invalid the user will see visual
cue through error class, and the size will not be updated.

Some remaining issues:
* Initial size: Figure out how to preserve the initial size of the image
  from the beginning of the session, so the user can cancel their edit
  if needed.
* Original size: Figure out if it is possible to get the original size
  of the image so we can test that the manual size isn't bigger than
  the original image size.

Change-Id: I2946fb21c46ce05583b219f665ef68928188899e
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
M modules/ve-mw/ui/styles/ve.ui.MWDialog.css
5 files changed, 201 insertions(+), 5 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 8e89840..2e0137f 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -135,6 +135,10 @@
   'visualeditor-dialog-beta-welcome-content' = 'This is our new, easier way 
to edit. It\'s still in beta, which means you might find parts of the page you 
can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the {{int:visualeditor-help-tool}} 
button to submit feedback). You can keep using the wikitext editor by clicking 
the $1 tab instead – unsaved changes will be lost.',
   'visualeditor-dialog-beta-welcome-title' = '{{GENDER:$1|Welcome}} to 
VisualEditor',
   'visualeditor-dialog-media-content-section' = 'Caption',
+  'visualeditor-dialog-media-size-section' = 'Image size',
+  'visualeditor-dialog-media-size-width' = 'Width',
+  'visualeditor-dialog-media-size-height' = 'Height',
+  'visualeditor-dialog-media-button-size-default' = 'Set to original size',
   'visualeditor-dialog-media-insert-button' = 'Insert media',
   'visualeditor-dialog-media-insert-title' = 'Insert media',
   'visualeditor-dialog-media-title' = 'Media settings',
@@ -456,6 +460,10 @@
 * $1 - username or empty string, for GENDER support',
   'visualeditor-dialog-media-content-section' = 'Label for the image content 
sub-section.
 {{Identical|Caption}}',
+  'visualeditor-dialog-media-size-section' = 'Label for the image size 
sub-section.',
+  'visualeditor-dialog-media-size-width' = 'Label for the image width.',
+  'visualeditor-dialog-media-size-height' = 'Label for the image height.',
+  'visualeditor-dialog-media-button-size-default' = 'Label for the button to 
reset image size to original values.',
   'visualeditor-dialog-media-insert-button' = 'Used as label for the button.
 {{Identical|Insert media}}',
   'visualeditor-dialog-media-insert-title' = 'Media insert dialog title text.
diff --git a/VisualEditor.php b/VisualEditor.php
index ca2a946..9b1a0b1 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -616,6 +616,10 @@
'visualeditor-dialog-beta-welcome-content',
'visualeditor-dialog-beta-welcome-title',
'visualeditor-dialog-media-content-section',
+   'visualeditor-dialog-media-size-section',
+   'visualeditor-dialog-media-size-width',
+   'visualeditor-dialog-media-size-height',
+   'visualeditor-dialog-media-button-size-default',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
'visualeditor-dialog-media-title',
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 78d424e..81ca27a 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -253,8 +253,16 @@
this.$image.attr( 'src', 
this.getResolvedAttribute( 'src' ) );
break;
case 'width':
+   this.updateSize( {
+   'width': to,
+   'height': this.model.getAttribute( 
'height' )
+   } );
+   break;
case 'height':
-   this.updateSize();
+   this.updateSize( {
+   'width': this.model.getAttribute( 
'width' ),
+  

[MediaWiki-commits] [Gerrit] [WIP] Insert special character tool - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Insert special character tool
..

[WIP] Insert special character tool

A tool to add special characters and diacritics to text.

Change-Id: I26d1f437feef1c8b61ed3be5f74ef524b33baf49
---
M VisualEditor.i18n.php
M VisualEditor.php
A modules/ve/ui/inspectors/ve.ui.SpecialCharacterInspector.js
M modules/ve/ui/styles/ve.ui.Widget.css
M modules/ve/ui/tools/ve.ui.ExperimentalTool.js
A modules/ve/ui/widgets/ve.ui.SpecialCharacterWidget.js
6 files changed, 212 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index f384c36..07de457 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -148,6 +148,8 @@
'visualeditor-linkinspector-title' = 'Hyperlink',
'visualeditor-listbutton-bullet-tooltip' = 'Bullet list',
'visualeditor-listbutton-number-tooltip' = 'Numbered list',
+   'visualeditor-specialcharacter-button-tooltip' = 'Special characters',
+   'visualeditor-specialcharacterinspector-title' = 'Special characters',
'visualeditor-loadwarning' = 'Error loading data from server: $1. 
Would you like to retry?',
'visualeditor-loadwarning-token' = 'Error loading edit token from 
server: $1. Would you like to retry?',
'visualeditor-mainnamespacepagelink' = 'Project:Main namespace',
@@ -511,6 +513,8 @@
 {{Identical|Hyperlink}}',
'visualeditor-listbutton-bullet-tooltip' = 'Tooltip text for the 
bullet list button',
'visualeditor-listbutton-number-tooltip' = 'Tooltip text for the 
numbered list button',
+   'visualeditor-specialcharacter-button-tooltip' = 'Tooltip text for the 
insert character button',
+   'visualeditor-specialcharacterinspector-title' = 'Used as title for 
special character inspector',
'visualeditor-loadwarning' = 'Text (JavaScript confirm()) shown when 
the editor fails to load properly.
 
 Parameters:
diff --git a/VisualEditor.php b/VisualEditor.php
index 82a55d9..44aa611 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -730,6 +730,8 @@
've/ui/widgets/ve.ui.LanguageInputWidget.js',
've/ui/tools/ve.ui.ExperimentalTool.js',
've-mw/ui/tools/ve.ui.MWExperimentalTool.js',
+   've/ui/widgets/ve.ui.SpecialCharacterWidget.js',
+   've/ui/inspectors/ve.ui.SpecialCharacterInspector.js',
),
'dependencies' = array(
'ext.visualEditor.core',
@@ -750,6 +752,8 @@
'visualeditor-mwalienextensioninspector-title',
'visualeditor-mwhieroinspector-title',
'visualeditor-mwmathinspector-title',
+   'visualeditor-specialcharacter-button-tooltip',
+   'visualeditor-specialcharacterinspector-title',
),
),
 
diff --git a/modules/ve/ui/inspectors/ve.ui.SpecialCharacterInspector.js 
b/modules/ve/ui/inspectors/ve.ui.SpecialCharacterInspector.js
new file mode 100644
index 000..1493d8f
--- /dev/null
+++ b/modules/ve/ui/inspectors/ve.ui.SpecialCharacterInspector.js
@@ -0,0 +1,145 @@
+/*!
+ * VisualEditor UserInterface LanguageInspector class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Special character inspector.
+ *
+ * @class
+ * @extends ve.ui.SurfaceInspector
+ *
+ * @constructor
+ * @param {ve.ui.SurfaceWindowSet} windowSet Window set this inspector is part 
of
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.SpecialCharacterInspector = function VeUiSpecialCharacterInspector( 
windowSet, config ) {
+   // Parent constructor
+   ve.ui.SurfaceInspector.call( this, windowSet, config );
+
+   this.characters = null;
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.SpecialCharacterInspector, ve.ui.SurfaceInspector );
+
+/* Static properties */
+
+ve.ui.SpecialCharacterInspector.static.name = 'specialcharacter';
+
+ve.ui.SpecialCharacterInspector.static.icon = 'specialcharacter';
+
+ve.ui.SpecialCharacterInspector.static.titleMessage = 
'visualeditor-specialcharacterinspector-title';
+
+/* Methods */
+
+/**
+ * Handle frame ready events.
+ *
+ * @method
+ */
+ve.ui.SpecialCharacterInspector.prototype.initialize = function () {
+   // Parent method
+   ve.ui.SurfaceInspector.prototype.initialize.call( this );
+
+   // Get the special character list
+   // This is temporarily hard-coded
+   this.characters = {
+   'symbols': {
+   '¡': '¡',
+   '¿': '¿',
+   '†': '†',
+   '‡': '‡',

[MediaWiki-commits] [Gerrit] [NOT2Merge!] Example for Selective Chrome bug in Inspectors - change (mediawiki...VisualEditor)

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

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


Change subject: [NOT2Merge!] Example for Selective Chrome bug in Inspectors
..

[NOT2Merge!] Example for Selective Chrome bug in Inspectors

I've created this as a testing ground for a bug in the way inspectors
load in Chrome.

The code given is an empty new inspector, completely inherited without
any special behavior at all from SurfaceInspector.

In theory, this should open an empty inspector popup with only the
title, icon and 'back' button. In reality, this works as expected
in Firefox but in Chrome the inspector fails to appear.

It only appears if you first open another surface inspector
(like Link or Language) and then open the test inspector.

Change-Id: Ib9cd1022ef395b96168fc349d28d3f436a1654de
---
M VisualEditor.i18n.php
M VisualEditor.php
A modules/ve/ui/inspectors/ve.ui.TestInspector.js
M modules/ve/ui/tools/ve.ui.InspectorTool.js
4 files changed, 74 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index b2cc671..f72fa09 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -193,6 +193,8 @@
'visualeditor-savedialog-warning-dirty' = 'Your edit may have been 
corrupted – please review before saving.',
'visualeditor-saveerror' = 'Error saving data to server: $1.',
'visualeditor-serializeerror' = 'Error loading data from server: $1.',
+   'visualeditor-testinspector-button-tooltip' = 'Test inspector',
+   'visualeditor-testinspector-title' = 'Test inspector',
'visualeditor-toolbar-cancel' = 'Cancel',
'visualeditor-toolbar-more' = 'More',
'visualeditor-toolbar-savedialog' = 'Save page',
@@ -619,6 +621,8 @@
 
 Parameters:
 * $1 is an error message, in English.',
+   'visualeditor-testinspector-button-tooltip' = 'Tool tip for the test 
inspector',
+   'visualeditor-testinspector-title' = 'Title for the test inspector',
'visualeditor-toolbar-cancel' = 'Label text for button to exit from 
VisualEditor.
 {{Identical|Cancel}}',
'visualeditor-toolbar-more' = 'Label for the toolbar group that 
contains a list of all other available tools.
diff --git a/VisualEditor.php b/VisualEditor.php
index faf826c..37ea549 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -536,6 +536,7 @@
've/ui/inspectors/ve.ui.LinkInspector.js',
've-mw/ui/inspectors/ve.ui.MWLinkInspector.js',
've-mw/ui/inspectors/ve.ui.MWExtensionInspector.js',
+   've/ui/inspectors/ve.ui.TestInspector.js',
),
'styles' = array(
// ce
@@ -698,6 +699,8 @@
'visualeditor-savedialog-warning-dirty',
'visualeditor-saveerror',
'visualeditor-serializeerror',
+   'visualeditor-testinspector-button-tooltip',
+   'visualeditor-testinspector-title',
'visualeditor-toolbar-cancel',
'visualeditor-toolbar-more',
'visualeditor-toolbar-savedialog',
diff --git a/modules/ve/ui/inspectors/ve.ui.TestInspector.js 
b/modules/ve/ui/inspectors/ve.ui.TestInspector.js
new file mode 100644
index 000..748a81a
--- /dev/null
+++ b/modules/ve/ui/inspectors/ve.ui.TestInspector.js
@@ -0,0 +1,47 @@
+/*!
+ * VisualEditor UserInterface TestInspector class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Test inspector.
+ *
+ * @class
+ * @extends ve.ui.SurfaceInspector
+ *
+ * @constructor
+ * @param {ve.ui.SurfaceWindowSet} windowSet Window set this inspector is part 
of
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.TestInspector = function VeUiTestInspector( windowSet, config ) {
+   // Parent constructor
+   ve.ui.SurfaceInspector.call( this, windowSet, config );
+
+   // Properties
+   this.initialAnnotation = null;
+   this.initialAnnotationHash = null;
+   this.initialText = null;
+   this.isNewAnnotation = false;
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.TestInspector, ve.ui.SurfaceInspector );
+
+/* Static properties */
+
+ve.ui.TestInspector.static.name = 'testinspector';
+
+ve.ui.TestInspector.static.icon = 'link'; // Just so we can see something here
+
+ve.ui.TestInspector.static.titleMessage = 'visualeditor-testinspector-title';
+
+ve.ui.TestInspector.static.removeable = false;
+
+/* Methods */
+
+/* Registration */
+
+ve.ui.inspectorFactory.register( ve.ui.TestInspector );
diff --git a/modules/ve/ui/tools/ve.ui.InspectorTool.js 
b/modules/ve/ui/tools/ve.ui.InspectorTool.js
index 17c15a4..cb4ee8c 100644
--- 

[MediaWiki-commits] [Gerrit] [WIP] Adding image attributes to media dialog - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Adding image attributes to media dialog
..

[WIP] Adding image attributes to media dialog

Adding image attributes to the media dialog. Also, this commit transforms the
media dialog into a OO.ui.PagedOutlineLayout() for organization.

Change-Id: I49a30bf16f51d07d72343a0b5dd2263a94c6831b
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
5 files changed, 118 insertions(+), 14 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 14dc896..fbdac67 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -63,9 +63,13 @@
'visualeditor-dialog-beta-welcome-action-continue' = 'Continue',
'visualeditor-dialog-beta-welcome-content' = 'This is our new, easier 
way to edit. It\'s still in beta, which means you might find parts of the page 
you can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the \'{{int:visualeditor-beta-label}}\' 
button to submit feedback). You can keep using the wikitext editor by clicking 
the $1 tab instead – unsaved changes will be lost.',
'visualeditor-dialog-beta-welcome-title' = '{{GENDER:$1|Welcome}} to 
VisualEditor',
-   'visualeditor-dialog-media-content-section' = 'Caption',
+   'visualeditor-dialog-media-alttext-label' = 'Alternate text',
+   'visualeditor-dialog-media-attributes-section' = 'Attributes',
+   'visualeditor-dialog-media-caption-section' = 'Caption',
+   'visualeditor-dialog-media-caption-label' = 'Caption',
'visualeditor-dialog-media-insert-button' = 'Insert media',
'visualeditor-dialog-media-insert-title' = 'Insert media',
+   'visualeditor-dialog-media-position-label' = 'Position',
'visualeditor-dialog-media-title' = 'Media settings',
'visualeditor-dialog-meta-categories-category' = 'Category',
'visualeditor-dialog-meta-categories-data-label' = 'Categories',
@@ -368,12 +372,16 @@
 See also:
 * {{msg-mw|Visualeditor-beta-label}}',
'visualeditor-dialog-beta-welcome-title' = 'Title of the beta welcome 
dialog',
-   'visualeditor-dialog-media-content-section' = 'Label for the image 
content sub-section.
+   'visualeditor-dialog-media-alttext-label' = 'Label of the alternate 
text field in the media dialog',
+   'visualeditor-dialog-media-attributes-section' = 'Label for the image 
attributes sub-section.',
+   'visualeditor-dialog-media-caption-section' = 'Label for the image 
caption sub-section.
 {{Identical|Caption}}',
+   'visualeditor-dialog-media-caption-label' = 'Label of the caption 
field in the media dialog {{Identical:Caption}}',
'visualeditor-dialog-media-insert-button' = 'Used as label for the 
button.
 {{Identical|Insert media}}',
'visualeditor-dialog-media-insert-title' = 'Media insert dialog title 
text.
 {{Identical|Insert media}}',
+   'visualeditor-dialog-media-position-label' = 'Label of the position 
field in the media dialog',
'visualeditor-dialog-media-title' = 'Title for the editing dialog to 
set how a media item is displayed on the page',
'visualeditor-dialog-meta-categories-category' = 'Title of popup for 
editing category options.
 {{Identical|Category}}',
diff --git a/VisualEditor.php b/VisualEditor.php
index ee53c70..f13fdc3 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -628,9 +628,13 @@
'visualeditor-dialog-beta-welcome-action-continue',
'visualeditor-dialog-beta-welcome-content',
'visualeditor-dialog-beta-welcome-title',
-   'visualeditor-dialog-media-content-section',
+   'visualeditor-dialog-media-alttext-label',
+   'visualeditor-dialog-media-attributes-section',
+   'visualeditor-dialog-media-caption-section',
+   'visualeditor-dialog-media-caption-label',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
+   'visualeditor-dialog-media-position-label',
'visualeditor-dialog-media-title',
'visualeditor-dialog-meta-categories-category',
'visualeditor-dialog-meta-categories-data-label',
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 1859003..8e588bb 100644
--- 

[MediaWiki-commits] [Gerrit] [WIP] Adding alternate text to media edit dialog - change (mediawiki...VisualEditor)

2014-01-02 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: [WIP] Adding alternate text to media edit dialog
..

[WIP] Adding alternate text to media edit dialog

Adding an option to add or edit alt text to images in the media edit dialog.

** This is blocked by a Parsoid bug,
   see https://bugzilla.wikimedia.org/show_bug.cgi?id=56400 ***

Change-Id: I6d339781822175c40c66a4689ec6e1a873cb081d
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
6 files changed, 46 insertions(+), 6 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 0875c2e..2258172 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -135,6 +135,7 @@
   'visualeditor-dialog-beta-welcome-content' = 'This is our new, easier way 
to edit. It\'s still in beta, which means you might find parts of the page you 
can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the {{int:visualeditor-help-tool}} 
button to submit feedback). You can keep using the wikitext editor by clicking 
the $1 tab instead – unsaved changes will be lost.',
   'visualeditor-dialog-beta-welcome-title' = '{{GENDER:$1|Welcome}} to 
VisualEditor',
   'visualeditor-dialog-media-content-section' = 'Caption',
+  'visualeditor-dialog-media-alttext-section' = 'Alternative Text',
   'visualeditor-dialog-media-insert-button' = 'Insert media',
   'visualeditor-dialog-media-insert-title' = 'Insert media',
   'visualeditor-dialog-media-title' = 'Media settings',
@@ -462,6 +463,8 @@
 * $1 - username or empty string, for GENDER support',
   'visualeditor-dialog-media-content-section' = 'Label for the image content 
sub-section.
 {{Identical|Caption}}',
+  'visualeditor-dialog-media-alttext-section' = 'Label for the image 
alternative text sub-section.
+{{Identical|Caption}}',
   'visualeditor-dialog-media-size-section' = 'Label for the image size 
sub-section.',
   'visualeditor-dialog-media-size-width' = 'Label for the image width.',
   'visualeditor-dialog-media-size-height' = 'Label for the image height.',
diff --git a/VisualEditor.php b/VisualEditor.php
index 8c06d41..d08ffe3 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -616,6 +616,7 @@
'visualeditor-dialog-beta-welcome-content',
'visualeditor-dialog-beta-welcome-title',
'visualeditor-dialog-media-content-section',
+   'visualeditor-dialog-media-alttext-section',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
'visualeditor-dialog-media-title',
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
index 5f03062..4b140dd 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
@@ -77,7 +77,12 @@
originalClasses: classes
},
width = $img.attr( 'width' ),
-   height = $img.attr( 'height' );
+   height = $img.attr( 'height' ),
+   alttext = $img.attr( 'alt' );
+
+   if ( alttext !== undefined ) {
+   attributes.alt = alttext;
+   }
 
attributes.width = width !== undefined  width !== '' ? Number( width 
) : null;
attributes.height = height !== undefined  height !== '' ? Number( 
height ) : null;
@@ -193,6 +198,9 @@
img.setAttribute( 'width', dataElement.attributes.width );
img.setAttribute( 'height', dataElement.attributes.height );
img.setAttribute( 'resource', dataElement.attributes.resource );
+   if ( dataElement.attributes.alt !== undefined ) {
+   img.setAttribute( 'alt', dataElement.attributes.alt );
+   }
figure.appendChild( imgWrapper );
imgWrapper.appendChild( img );
 
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 5e76be1..0c2f445 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -38,6 +38,7 @@
 visualeditor-dialog-beta-welcome-content: This is our new, easier way 
to edit. It's still in beta, which means you might find parts of the page you 
can't edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the \{{int:visualeditor-help-tool}}\ 
button to submit feedback). You can keep using the 

[MediaWiki-commits] [Gerrit] [WIP] Adding position setting to media edit dialog - change (mediawiki...VisualEditor)

2014-01-03 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: [WIP] Adding position setting to media edit dialog
..

[WIP] Adding position setting to media edit dialog

This adds an image position/alignment to the media edit dialog.

Change-Id: I15fbd1ed0998a9093fa039b76624395d661af05b
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
5 files changed, 57 insertions(+), 1 deletion(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 0875c2e..62ee178 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -135,6 +135,11 @@
   'visualeditor-dialog-beta-welcome-content' = 'This is our new, easier way 
to edit. It\'s still in beta, which means you might find parts of the page you 
can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the {{int:visualeditor-help-tool}} 
button to submit feedback). You can keep using the wikitext editor by clicking 
the $1 tab instead – unsaved changes will be lost.',
   'visualeditor-dialog-beta-welcome-title' = '{{GENDER:$1|Welcome}} to 
VisualEditor',
   'visualeditor-dialog-media-content-section' = 'Caption',
+  'visualeditor-dialog-media-position-section' = 'Position',
+  'visualeditor-dialog-media-position-left' = 'Left',
+  'visualeditor-dialog-media-position-right' = 'Right',
+  'visualeditor-dialog-media-position-center' = 'Center',
+  'visualeditor-dialog-media-position-none' = 'None',
   'visualeditor-dialog-media-insert-button' = 'Insert media',
   'visualeditor-dialog-media-insert-title' = 'Insert media',
   'visualeditor-dialog-media-title' = 'Media settings',
@@ -462,6 +467,11 @@
 * $1 - username or empty string, for GENDER support',
   'visualeditor-dialog-media-content-section' = 'Label for the image content 
sub-section.
 {{Identical|Caption}}',
+  'visualeditor-dialog-media-position-section' = 'Label for the image 
position sub-section.',
+  'visualeditor-dialog-media-position-left' = 'Label for the image position 
option for aligning to left.',
+  'visualeditor-dialog-media-position-right' = 'Label for the image position 
option for aligning to right.',
+  'visualeditor-dialog-media-position-center' = 'Label for the image position 
option for aligning to center.',
+  'visualeditor-dialog-media-position-none' = 'Label for the image position 
option for no alignment.',
   'visualeditor-dialog-media-size-section' = 'Label for the image size 
sub-section.',
   'visualeditor-dialog-media-size-width' = 'Label for the image width.',
   'visualeditor-dialog-media-size-height' = 'Label for the image height.',
diff --git a/VisualEditor.php b/VisualEditor.php
index 8c06d41..11cb874 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -616,6 +616,11 @@
'visualeditor-dialog-beta-welcome-content',
'visualeditor-dialog-beta-welcome-title',
'visualeditor-dialog-media-content-section',
+   'visualeditor-dialog-media-position-section',
+   'visualeditor-dialog-media-position-left',
+   'visualeditor-dialog-media-position-right',
+   'visualeditor-dialog-media-position-center',
+   'visualeditor-dialog-media-position-none',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
'visualeditor-dialog-media-title',
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 5e76be1..2f54425 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -38,6 +38,11 @@
 visualeditor-dialog-beta-welcome-content: This is our new, easier way 
to edit. It's still in beta, which means you might find parts of the page you 
can't edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the \{{int:visualeditor-help-tool}}\ 
button to submit feedback). You can keep using the wikitext editor by clicking 
the \$1\ tab instead – unsaved changes will be lost.,
 visualeditor-dialog-beta-welcome-title: {{GENDER:$1|Welcome}} to 
VisualEditor,
 visualeditor-dialog-media-content-section: Caption,
+visualeditor-dialog-media-position-section: Position,
+visualeditor-dialog-media-position-left: Left,
+visualeditor-dialog-media-position-right: Right,
+visualeditor-dialog-media-position-center: Center,
+visualeditor-dialog-media-position-none: None,
 

[MediaWiki-commits] [Gerrit] [WIP] Add image type change to media edit dialog - change (mediawiki...VisualEditor)

2014-01-03 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: [WIP] Add image type change to media edit dialog
..

[WIP] Add image type change to media edit dialog

Adding a type change to the media edit dialog.

Change-Id: I9c855e6381d970b5f08460822366f6333af24f82
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
6 files changed, 74 insertions(+), 2 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index 0875c2e..cb04907 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -135,6 +135,11 @@
   'visualeditor-dialog-beta-welcome-content' = 'This is our new, easier way 
to edit. It\'s still in beta, which means you might find parts of the page you 
can\'t edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we welcome reports about any issues you might 
encounter in using VisualEditor (click the {{int:visualeditor-help-tool}} 
button to submit feedback). You can keep using the wikitext editor by clicking 
the $1 tab instead – unsaved changes will be lost.',
   'visualeditor-dialog-beta-welcome-title' = '{{GENDER:$1|Welcome}} to 
VisualEditor',
   'visualeditor-dialog-media-content-section' = 'Caption',
+  'visualeditor-dialog-media-type-section' = 'Image type',
+  'visualeditor-dialog-media-type-thumb' = 'Thumbnail',
+  'visualeditor-dialog-media-type-frameless' = 'Frameless',
+  'visualeditor-dialog-media-type-frame' = 'Frame',
+  'visualeditor-dialog-media-type-border' = 'Border',
   'visualeditor-dialog-media-insert-button' = 'Insert media',
   'visualeditor-dialog-media-insert-title' = 'Insert media',
   'visualeditor-dialog-media-title' = 'Media settings',
@@ -462,6 +467,11 @@
 * $1 - username or empty string, for GENDER support',
   'visualeditor-dialog-media-content-section' = 'Label for the image content 
sub-section.
 {{Identical|Caption}}',
+  'visualeditor-dialog-media-type-section' = 'Label for the image type 
sub-section.',
+  'visualeditor-dialog-media-type-thumb' = 'Label for the image type option 
for thumbnail.',
+  'visualeditor-dialog-media-type-frameless' = 'Label for the image type 
option for frameless.',
+  'visualeditor-dialog-media-type-frame' = 'Label for the image type option 
for framed image.',
+  'visualeditor-dialog-media-type-border' = 'Label for the image type option 
for bordered image.',
   'visualeditor-dialog-media-size-section' = 'Label for the image size 
sub-section.',
   'visualeditor-dialog-media-size-width' = 'Label for the image width.',
   'visualeditor-dialog-media-size-height' = 'Label for the image height.',
diff --git a/VisualEditor.php b/VisualEditor.php
index 8c06d41..e816e3a 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -616,6 +616,11 @@
'visualeditor-dialog-beta-welcome-content',
'visualeditor-dialog-beta-welcome-title',
'visualeditor-dialog-media-content-section',
+   'visualeditor-dialog-media-type-section',
+   'visualeditor-dialog-media-type-thumb',
+   'visualeditor-dialog-media-type-frameless',
+   'visualeditor-dialog-media-type-frame',
+   'visualeditor-dialog-media-type-border',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
'visualeditor-dialog-media-title',
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 81ca27a..f86f677 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -121,7 +121,10 @@
var model, view,
type = this.model.getAttribute( 'type' );
 
-   this.captionVisible = type !== 'none'  type !== 'frameless'  
this.model.children.length === 1;
+   this.captionVisible = type !== 'none' 
+   type !== 'frameless' 
+   type !== 'border' 
+   this.model.children.length === 1;
 
if ( this.captionVisible ) {
// Only create a caption if we need it
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 5e76be1..3e7705f 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -38,6 +38,11 @@
 visualeditor-dialog-beta-welcome-content: This is our new, easier way 
to edit. It's still in beta, which means you might find parts of the page you 
can't edit, or encounter issues that need to be fixed. We encourage you to 
review your changes, and we 

[MediaWiki-commits] [Gerrit] Force CSSJanus to not flip image alignment classes - change (mediawiki...VisualEditor)

2014-01-05 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: Force CSSJanus to not flip image alignment classes
..

Force CSSJanus to not flip image alignment classes

For some reason, the class-wide /*@noflip*/ on mw-halign-left and
mw-halign-right didn't 'catch' and cssjanus ended up flipping the
float directions in RTL. This fix forces noflip condition on each
of the lines separately, which seems to work.

Bug: 50910
Change-Id: I4cddce80397d821dc3cbf40ee4b4c471890d8d35
---
M modules/ve-mw/ce/styles/ve.ce.Node.css
1 file changed, 12 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ce/styles/ve.ce.Node.css 
b/modules/ve-mw/ce/styles/ve.ce.Node.css
index 442cb2b..6aeff41 100644
--- a/modules/ve-mw/ce/styles/ve.ce.Node.css
+++ b/modules/ve-mw/ce/styles/ve.ce.Node.css
@@ -57,10 +57,15 @@
 }
 
 /* TODO: Merge with div.tright styles */
-/* @noflip */
+/* Due to a weird cssjanus bug, noflip rules
+   are set as single-rules rather than for the
+   whole class */
 figure[typeof*='mw:Image'].mw-halign-right {
+   /* @noflip */
clear: right;
+   /* @noflip */
float: right;
+   /* @noflip */
margin: .5em 0 1.3em 1.4em;
 }
 
@@ -70,10 +75,15 @@
 }
 
 /* TODO: Merge with div.tleft styles */
-/* @noflip */
+/* Due to a weird cssjanus bug, noflip rules
+   are set as single-rules rather than for the
+   whole class */
 figure[typeof*='mw:Image'].mw-halign-left {
+   /* @noflip */
clear: left;
+   /* @noflip */
float: left;
+   /* @noflip */
margin: .5em 1.4em 1.3em 0;
 }
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4cddce80397d821dc3cbf40ee4b4c471890d8d35
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Prevent the dialog from applying changes on bad input - change (mediawiki...TemplateData)

2014-02-02 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Prevent the dialog from applying changes on bad input
..

Prevent the dialog from applying changes on bad input

Make sure the dialog does not change the json string if the
editor form contains any errors.

Change-Id: Ib4d36f70e1f9d5b34605b4e54fd12b6e2405c37a
---
M modules/ext.templateDataGenerator.core.js
1 file changed, 15 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/07/110907/1

diff --git a/modules/ext.templateDataGenerator.core.js 
b/modules/ext.templateDataGenerator.core.js
index d2e8fe6..895d68d 100644
--- a/modules/ext.templateDataGenerator.core.js
+++ b/modules/ext.templateDataGenerator.core.js
@@ -483,7 +483,7 @@
if ( !doNotCheckForm ) {
if ( !isFormValid() ) {
showErrorModal( mw.msg( 
'templatedata-modal-errormsg' ) );
-   return;
+   return false;
}
}
 
@@ -602,18 +602,24 @@
var modalButtons = {};
 
modalButtons[btnApply] = function() {
-   var newJson = applyChangeToJSON(),
+   var finalOutput,
+   newJson = applyChangeToJSON();
+
+   // Check if returned json is valid
+   if ( newJson ) {
+   // Apply changes
finalOutput = amendWikitext( newJson );
 
+   // Close the modal
+   domObjects.$modalBox.dialog( 'close' );
 
-   // Close the modal
-   domObjects.$modalBox.dialog( 'close' );
+   // Trigger the closing event so the new 
output can be put
+   // back to the textbox
+   domObjects.$modalBox.trigger( 
'TemplateDataGeneratorDone', [ finalOutput ] );
 
-   // Trigger the closing event so the new output 
can be put
-   // back to the textbox
-   domObjects.$modalBox.trigger( 
'TemplateDataGeneratorDone', [ finalOutput ] );
-
-   return finalOutput;
+   return finalOutput;
+   }
+   return false;
};
 
modalButtons[btnCancel] = function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib4d36f70e1f9d5b34605b4e54fd12b6e2405c37a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Make {{ a parameter in the error message in the editor dialog - change (mediawiki...TemplateData)

2014-02-02 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Make {{ a parameter in the error message in the editor dialog
..

Make {{ a parameter in the error message in the editor dialog

Translatewiki warns of an unbalanced parenthesis problem in the
translation string. Turning the {{ into a parameter solves this issue.

Change-Id: I2fd69b3e901175dad22d285aa2373916acd4f208
---
M TemplateData.i18n.php
M modules/ext.templateDataGenerator.core.js
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/13/110913/1

diff --git a/TemplateData.i18n.php b/TemplateData.i18n.php
index c057ce5..e4614da 100644
--- a/TemplateData.i18n.php
+++ b/TemplateData.i18n.php
@@ -41,7 +41,7 @@
'templatedata-modal-button-cancel' = 'Cancel',
'templatedata-modal-button-delparam' = 'Delete parameter',
'templatedata-modal-button-importParams' = 'Import parameters',
-   'templatedata-modal-errormsg' = 'Errors found. Please make sure there 
are no empty or duplicate parameter names, and that the parameter name does not 
include |, = or }}.',
+   'templatedata-modal-errormsg' = 'Errors found. Please make sure there 
are no empty or duplicate parameter names, and that the parameter name does not 
include |, = or $1.',
'templatedata-modal-errormsg-import-noparams' = 'No new parameters 
found during import.',
'templatedata-modal-notice-import-numparams' = '$1 new 
{{PLURAL:$1|parameter was|parameters were}} imported.',
'templatedata-modal-table-param-actions' = 'Actions',
diff --git a/modules/ext.templateDataGenerator.core.js 
b/modules/ext.templateDataGenerator.core.js
index d2e8fe6..58581f7 100644
--- a/modules/ext.templateDataGenerator.core.js
+++ b/modules/ext.templateDataGenerator.core.js
@@ -482,7 +482,7 @@
// Validate
if ( !doNotCheckForm ) {
if ( !isFormValid() ) {
-   showErrorModal( mw.msg( 
'templatedata-modal-errormsg' ) );
+   showErrorModal( mw.msg( 
'templatedata-modal-errormsg', '}}' ) );
return;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fd69b3e901175dad22d285aa2373916acd4f208
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Adjusting error message for invalid inputs - change (mediawiki...TemplateData)

2014-02-03 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Adjusting error message for invalid inputs
..

Adjusting error message for invalid inputs

The invalid characters ('|', '=', and '}}') will be displayed through
individual parameters, for consistency, and to avoid parsing problems
in translatewiki.

Change-Id: Ic87541419aab5664f3530209e1ad8689deec33a5
---
M TemplateData.i18n.php
M modules/ext.templateDataGenerator.core.js
2 files changed, 8 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/76/110976/1

diff --git a/TemplateData.i18n.php b/TemplateData.i18n.php
index 68da8bf..75f2dfc 100644
--- a/TemplateData.i18n.php
+++ b/TemplateData.i18n.php
@@ -41,7 +41,7 @@
'templatedata-modal-button-cancel' = 'Cancel',
'templatedata-modal-button-delparam' = 'Delete parameter',
'templatedata-modal-button-importParams' = 'Import parameters',
-   'templatedata-modal-errormsg' = 'Errors found. Please make sure there 
are no empty or duplicate parameter names, and that the parameter name does not 
include |, = or $1.',
+   'templatedata-modal-errormsg' = 'Errors found. Please make sure there 
are no empty or duplicate parameter names, and that the parameter name does not 
include $1, $2 or $3.',
'templatedata-modal-errormsg-import-noparams' = 'No new parameters 
found during import.',
'templatedata-modal-notice-import-numparams' = '$1 new 
{{PLURAL:$1|parameter was|parameters were}} imported.',
'templatedata-modal-table-param-actions' = 'Actions',
@@ -130,8 +130,12 @@
 {{Identical|Cancel}}',
'templatedata-modal-button-delparam' = 'Button to delete a parameter',
'templatedata-modal-button-importParams' = 'Label of the import 
button',
-   'templatedata-modal-errormsg' = 'Error message that appears in the 
TemplateData generator GUI in case there are empty, duplicate or invalid 
parameter names
-* $1 - double curly brackets, supplied as a parameter to avoid parsing errors 
in translation strings.',
+   'templatedata-modal-errormsg' = 'Error message that appears in the 
TemplateData generator GUI in case there are empty, duplicate or invalid 
parameter names.
+Invalid characters are supplied as parameters to avoid parsing errors in 
translation strings.
+
+* $1 - pipe
+* $2 - equal sign
+* $3 - double curly brackets',
'templatedata-modal-errormsg-import-noparams' = 'message that appears 
in the TemplateData generator GUI in case no template parameters were found 
during the import attempt.',
'templatedata-modal-notice-import-numparams' = 'message that appears 
in the TemplateData generator GUI showing how many new parameters were imported 
into the GUI from an existing template.',
'templatedata-modal-table-param-actions' = 'Label for a table heading: 
Parameter actions in the table',
diff --git a/modules/ext.templateDataGenerator.core.js 
b/modules/ext.templateDataGenerator.core.js
index 58581f7..4eb8c07 100644
--- a/modules/ext.templateDataGenerator.core.js
+++ b/modules/ext.templateDataGenerator.core.js
@@ -482,7 +482,7 @@
// Validate
if ( !doNotCheckForm ) {
if ( !isFormValid() ) {
-   showErrorModal( mw.msg( 
'templatedata-modal-errormsg', '}}' ) );
+   showErrorModal( mw.msg( 
'templatedata-modal-errormsg', '|', '=', '}}' ) );
return;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic87541419aab5664f3530209e1ad8689deec33a5
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TemplateData
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Revamp media edit dialog's position widget - change (mediawiki...VisualEditor)

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

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

Change subject: Revamp media edit dialog's position widget
..

Revamp media edit dialog's position widget

Added checkbox to set position (left/center/right) or none if unchecked.

Change-Id: Iddd78c98929759a13d2dc5a774e72b59cbe28c36
---
M VisualEditor.php
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
4 files changed, 46 insertions(+), 17 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index 97cc95a..eb16645 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -651,11 +651,7 @@
'visualeditor-dialog-media-page-advanced',
'visualeditor-dialog-media-page-general',
'visualeditor-dialog-media-position-center',
-   'visualeditor-dialog-media-type-border',
-   'visualeditor-dialog-media-type-frame',
-   'visualeditor-dialog-media-type-frameless',
-   'visualeditor-dialog-media-type-section',
-   'visualeditor-dialog-media-type-thumb',
+   'visualeditor-dialog-media-position-checkbox',
'visualeditor-dialog-media-position-left',
'visualeditor-dialog-media-position-none',
'visualeditor-dialog-media-position-right',
@@ -663,6 +659,11 @@
'visualeditor-dialog-media-size-originalsize-error',
'visualeditor-dialog-media-size-section',
'visualeditor-dialog-media-title',
+   'visualeditor-dialog-media-type-border',
+   'visualeditor-dialog-media-type-frame',
+   'visualeditor-dialog-media-type-frameless',
+   'visualeditor-dialog-media-type-section',
+   'visualeditor-dialog-media-type-thumb',
'visualeditor-dialog-meta-categories-category',
'visualeditor-dialog-meta-categories-data-label',
'visualeditor-dialog-meta-categories-defaultsort-label',
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index be2bc7b..8bccc89 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -44,11 +44,7 @@
 visualeditor-dialog-media-page-advanced: Advanced settings,
 visualeditor-dialog-media-page-general: General settings,
 visualeditor-dialog-media-position-center: Center,
-visualeditor-dialog-media-type-border: Border,
-visualeditor-dialog-media-type-frame: Frame,
-visualeditor-dialog-media-type-frameless: Frameless,
-visualeditor-dialog-media-type-section: Image type,
-visualeditor-dialog-media-type-thumb: Thumbnail,
+visualeditor-dialog-media-position-checkbox: Use set floating 
direction,
 visualeditor-dialog-media-position-left: Left,
 visualeditor-dialog-media-position-none: None,
 visualeditor-dialog-media-position-right: Right,
@@ -56,6 +52,11 @@
 visualeditor-dialog-media-size-originalsize-error: Could not retrieve 
original file size.,
 visualeditor-dialog-media-size-section: Image size,
 visualeditor-dialog-media-title: Media settings,
+visualeditor-dialog-media-type-border: Border,
+visualeditor-dialog-media-type-frame: Frame,
+visualeditor-dialog-media-type-frameless: Frameless,
+visualeditor-dialog-media-type-section: Image type,
+visualeditor-dialog-media-type-thumb: Thumbnail,
 visualeditor-dialog-meta-categories-category: Category,
 visualeditor-dialog-meta-categories-data-label: Categories,
 visualeditor-dialog-meta-categories-defaultsort-label: Sort this page 
by default as,
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index 7e2f85c..dfee329 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -49,18 +49,19 @@
 visualeditor-dialog-media-page-advanced: Label for the advanced 
settings page in the media edit dialog,
 visualeditor-dialog-media-page-general: Label for the general settings 
page in the media edit dialog.\n{{Identical|General settings}},
 visualeditor-dialog-media-position-center: Label for the image position 
option for aligning to the center.,
+visualeditor-dialog-media-position-checkbox: Label for the position 
checkbox, denoting whether to use a set float position.,
 visualeditor-dialog-media-position-left: Label for the image position 
option for aligning to the left.,
 visualeditor-dialog-media-position-none: Label for the image position 
option for no alignment.,
 visualeditor-dialog-media-position-right: Label for the image position 
option for aligning to 

[MediaWiki-commits] [Gerrit] Make MWMediaSearchDialog not ignore empty scriptDirUrl - change (mediawiki...VisualEditor)

2014-02-10 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Make MWMediaSearchDialog not ignore empty scriptDirUrl
..

Make MWMediaSearchDialog not ignore empty scriptDirUrl

For wikis that are installed in root directory, the API parameter
'scriptDirUrl' is an empty string. This change makes sure it is not
ignored.

Change-Id: Ib58adf76c184c32c0cdbb9dba31db1e4028fa383
---
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index f0d5c03..5590ff6 100755
--- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
@@ -107,7 +107,7 @@
source = this.sources[i];
// If we don't have either 'apiurl' or 'scriptDirUrl'
// the source is invalid, and we will skip it
-   if ( source.apiurl || source.scriptDirUrl ) {
+   if ( source.apiurl || source.scriptDirUrl !== undefined ) {
if ( source.request ) {
source.request.abort();
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib58adf76c184c32c0cdbb9dba31db1e4028fa383
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fixing ButtonWidget call in MediaSizeWidget - change (VisualEditor/VisualEditor)

2014-01-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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


Change subject: Fixing ButtonWidget call in MediaSizeWidget
..

Fixing ButtonWidget call in MediaSizeWidget

OO.ui.PushButtonWidget is no longer used, instead the call is made to
OO.ui.ButtonWidget

Change-Id: I8dab934e9830ba176435f898d267d90763ebfaf4
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/82/109282/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 942c814..8c01c49 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -70,7 +70,7 @@
} );
 
// Define buttons
-   this.originalDimensionsButton = new OO.ui.PushButtonWidget( {
+   this.originalDimensionsButton = new OO.ui.ButtonWidget( {
'$': this.$,
'label': ve.msg( 
'visualeditor-mediasizewidget-button-originaldimensions' )
} );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8dab934e9830ba176435f898d267d90763ebfaf4
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Image type inline to block and vise versa - change (mediawiki...VisualEditor)

2014-01-29 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [WIP] Image type inline to block and vise versa
..

[WIP] Image type inline to block and vise versa

Adding an option to change to or from inline images in the edit media
dialog.

Change-Id: Idaafcb56b4c4edf1473446e7aaff6221a3c68254
---
M VisualEditor.php
M modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
5 files changed, 140 insertions(+), 55 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index f12395c..cf1da03 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -651,11 +651,6 @@
'visualeditor-dialog-media-page-advanced',
'visualeditor-dialog-media-page-general',
'visualeditor-dialog-media-position-center',
-   'visualeditor-dialog-media-type-border',
-   'visualeditor-dialog-media-type-frame',
-   'visualeditor-dialog-media-type-frameless',
-   'visualeditor-dialog-media-type-section',
-   'visualeditor-dialog-media-type-thumb',
'visualeditor-dialog-media-position-left',
'visualeditor-dialog-media-position-none',
'visualeditor-dialog-media-position-right',
@@ -663,6 +658,12 @@
'visualeditor-dialog-media-size-originalsize-error',
'visualeditor-dialog-media-size-section',
'visualeditor-dialog-media-title',
+   'visualeditor-dialog-media-type-border',
+   'visualeditor-dialog-media-type-frame',
+   'visualeditor-dialog-media-type-frameless',
+   'visualeditor-dialog-media-type-inline',
+   'visualeditor-dialog-media-type-section',
+   'visualeditor-dialog-media-type-thumb',
'visualeditor-dialog-meta-categories-category',
'visualeditor-dialog-meta-categories-data-label',
'visualeditor-dialog-meta-categories-defaultsort-label',
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
index 5d39f6f..2c80423 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWInlineImageNode.js
@@ -17,8 +17,6 @@
  * @param {Object} [config] Configuration options
  */
 ve.ce.MWInlineImageNode = function VeCeMWInlineImageNode( model, config ) {
-   var valign;
-
// Parent constructor
ve.ce.LeafNode.call( this, model, config );
 
@@ -33,6 +31,7 @@
this.$image = this.$( 'img' ).appendTo( this.$element );
}
 
+
// Mixin constructors
ve.ce.MWImageNode.call( this, this.$element, this.$image );
 
@@ -41,20 +40,13 @@
.attr( 'width', this.model.getAttribute( 'width' ) )
.attr( 'height', this.model.getAttribute( 'height' ) );
 
-   if ( this.model.getAttribute( 'border' ) ) {
-   this.$image.addClass( 'thumbborder' );
-   }
+// if ( this.model.getAttribute( 'border' ) ) {
+// this.$image.addClass( 'thumbborder' );
+// }
+   this.$image.toggleClass( 'thumbborder', !!this.model.getAttribute( 
'border' ) );
 
-   valign = this.model.getAttribute( 'valign' );
-   if ( valign !== 'default' ) {
-   this.$image.css( 'vertical-align', valign );
-   }
-
-   if ( this.$element.css( 'direction' ) === 'rtl' ) {
-   this.showHandles( ['sw'] );
-   } else {
-   this.showHandles( ['se'] );
-   }
+// valign = this.model.getAttribute( 'valign' );
+   this.changeAlignment( this.model.getAttribute( 'valign' ) );
 
// DOM changes
this.$element.addClass( 've-ce-mwInlineImageNode' );
@@ -79,6 +71,25 @@
 /* Methods */
 
 /**
+ * Update the valign property and css classes
+ *
+ * @param {String} valign Vertical alignment value
+ */
+ve.ce.MWInlineImageNode.prototype.changeAlignment = function ( valign ) {
+   this.valign = valign;
+
+   if ( valign !== 'default' ) {
+   this.$image.css( 'vertical-align', valign );
+   }
+
+   if ( this.$element.css( 'direction' ) === 'rtl' ) {
+   this.showHandles( ['sw'] );
+   } else {
+   this.showHandles( ['se'] );
+   }
+};
+
+/**
  * Update the rendering of the 'src', 'width' and 'height' attributes when 
they change in the model.
  *
  * @method
@@ -94,12 +105,29 @@
if ( from !== to ) {
switch ( key ) {

[MediaWiki-commits] [Gerrit] Adding bidi-isolation to reference numbers - change (mediawiki...Cite)

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

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


Change subject: Adding bidi-isolation to reference numbers
..

Adding bidi-isolation to reference numbers

This is a quick-fix to support proper rendering of sup[1]/sup elements when 
the sentence contains a right-to-left word.
Bug: 36032

Change-Id: If85efe5ff1e0a3c57ee2523656702db89df07145
---
M Cite.php
A modules/ext.rtlcite/ext.rtlcite.js
2 files changed, 16 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Cite 
refs/changes/34/61634/1

diff --git a/Cite.php b/Cite.php
index e4d7e92..3b3f18a 100644
--- a/Cite.php
+++ b/Cite.php
@@ -85,6 +85,13 @@
'position' = 'bottom',
 );
 
+/** Add RTL fix for the cite sup elements **/
+$wgResourceModules['ext.rtlcite'] = $citeResourceTemplate + array(
+   'styles' = array(),
+   'scripts' = 'ext.rtlcite/ext.rtlcite.js',
+   'position' = 'bottom',
+);
+
 /**
  * @param $out OutputPage
  * @param $sk Skin
@@ -97,6 +104,8 @@
$out-addModules( 'ext.cite' );
}
 
+   /** RTL support quick-fix module **/
+   $out-addModules( 'ext.rtlcite' );
return true;
 }
 
diff --git a/modules/ext.rtlcite/ext.rtlcite.js 
b/modules/ext.rtlcite/ext.rtlcite.js
new file mode 100644
index 000..f8b9e27
--- /dev/null
+++ b/modules/ext.rtlcite/ext.rtlcite.js
@@ -0,0 +1,7 @@
+( function($) {
+   $( function() {
+   /** RTL Support Quick-Fix **/
+   $('sup.reference').wrap('bdi /');
+   } );
+   
+} )( jQuery );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If85efe5ff1e0a3c57ee2523656702db89df07145
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Quickfix for the keyboard icon position in RTL languages - change (mediawiki...UniversalLanguageSelector)

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

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


Change subject: Quickfix for the keyboard icon position in RTL languages
..

Quickfix for the keyboard icon position in RTL languages

This is a rather quick fix for the problem described in the bug
attached. The keyboard icon appeared on the right side even in RTL
languages which blocked the beginning of the typed words.

Bug: 45585
Change-Id: If3ee213daae8cd8e5cefb6daecd19eb3a6da76c9
---
M lib/jquery.ime/jquery.ime.js
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UniversalLanguageSelector 
refs/changes/49/61749/1

diff --git a/lib/jquery.ime/jquery.ime.js b/lib/jquery.ime/jquery.ime.js
index 4323068..33404d0 100644
--- a/lib/jquery.ime/jquery.ime.js
+++ b/lib/jquery.ime/jquery.ime.js
@@ -684,6 +684,10 @@
top = position.top + this.$element.outerHeight();
left = position.left + this.$element.outerWidth()
- this.$imeSetting.outerWidth();
+   // RTL element position fix:
+   if ( $( 'html' ).attr( 'dir' ) == 'rtl' || 
this.$element.attr( 'dir' ) == 'rtl' ) {
+   left = position.left;
+   }
room = $( window ).height() - top;
 
if ( room  this.$imeSetting.outerHeight() ) {
@@ -709,9 +713,15 @@
} );
 
if ( parseInt( this.$menu.css( 'min-width' ) )  left ) 
{
-   this.$menu
-   .css( { left: position.left } )
-   .addClass( 'right' );
+   // RTL element position fix
+   if ( $( 'html' ).attr( 'dir' ) == 'rtl' || 
this.$element.attr( 'dir' ) == 'rtl' ) {
+   this.$menu
+   .css( { left: 0 } )
+   } else {
+   this.$menu
+   .css( { left: position.left } )
+   .addClass( 'right' );
+   }
}
},
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If3ee213daae8cd8e5cefb6daecd19eb3a6da76c9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UniversalLanguageSelector
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] RTL fix for VE's link widget - change (mediawiki...VisualEditor)

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

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


Change subject: RTL fix for VE's link widget
..

RTL fix for VE's link widget

The purpose is to flip the direction of the input inside
the link widget for RTL wikis, but flip it again to LTR
if the user inserts an external URL. This is my first VE
fix, I tried to follow conventions and avoid touching the
parent objects that are unrelated to URLs.

Bug: 47717
Change-Id: Ic13b9c3b155ce2979298cac9518c7419b9d45bac
---
M modules/ve/ui/styles/ve.ui.Widget.css
M modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js
2 files changed, 39 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index f066780..f31d7fe 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -481,3 +481,12 @@
 .ve-ui-mwCategorySortkeyForm .ve-ui-inputLabelWidget {
padding: 0 0.125em 0.5em 0.125em;
 }
+
+/* RTL Definitions */
+
+.ve-ui-rtl {
+   direction: rtl;
+}
+.ve-ui-ltr {
+   direction: ltr;
+}
\ No newline at end of file
diff --git a/modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js 
b/modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js
index 2545ba6..615e4d1 100644
--- a/modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.LinkTargetInputWidget.js
@@ -23,6 +23,11 @@
 
// Initialization
this.$.addClass( 've-ui-linkTargetInputWidget' );
+
+   // Default RTL/LTR check 
+   if ( $( 'body' ).hasClass( 'rtl' ) ) {
+   this.$input.addClass( 've-ui-rtl' );
+   }
 };
 
 /* Inheritance */
@@ -30,7 +35,32 @@
 ve.inheritClass( ve.ui.LinkTargetInputWidget, ve.ui.TextInputWidget );
 
 /* Methods */
+ve.ui.LinkTargetInputWidget.prototype.onEdit = function () {
+   if ( !this.disabled ) {
 
+   // RTL/LTR check:
+   if ( $( 'body' ).hasClass( 'rtl' ) ) {
+   if ( 
ve.init.platform.getExternalLinkUrlProtocolsRegExp().test( this.$input.val() ) 
) {
+   // External link
+   if ( this.$input.hasClass( 've-ui-rtl' ) ) {
+this.$input.removeClass( 've-ui-rtl' );
+this.$input.addClass( 've-ui-ltr' );
+   }
+   } else {
+   // Internal link
+   if ( this.$input.hasClass( 've-ui-ltr' ) ) {
+this.$input.removeClass( 've-ui-ltr');
+this.$input.addClass( 've-ui-rtl' );
+   }
+   }
+   }   
+   // Allow the stack to clear so the value will be updated
+   setTimeout( ve.bind( function () {
+   this.setValue( this.$input.val() );
+   }, this ) );
+   }
+   
+};
 /**
  * Set the value of the input.
  *
@@ -70,7 +100,6 @@
this.annotation = annotation;
 
// Call parent method
-
ve.ui.TextInputWidget.prototype.setValue.call(
this, this.getTargetFromAnnotation( annotation )
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic13b9c3b155ce2979298cac9518c7419b9d45bac
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] A quickfix for arrow movements in RTL wikis. - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] A quickfix for arrow movements in RTL wikis.
..

[WIP] A quickfix for arrow movements in RTL wikis.

This will make sure the marker moves correctly (backwards/forward)
in RTL languages as well as LTR languages, judging from the wiki pageLanguage.
This can be a quickfix until the movement can be decided per the direction
of the specific element (span/paragraph/div) the marker is in.

Bug: 38546
Change-Id: Ic01e110a5e6094cd275327a2e8cea90c900f1bd1
---
M modules/ve/ce/ve.ce.Surface.js
1 file changed, 6 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve/ce/ve.ce.Surface.js b/modules/ve/ce/ve.ce.Surface.js
index b761ae5..d7e1e38 100644
--- a/modules/ve/ce/ve.ce.Surface.js
+++ b/modules/ve/ce/ve.ce.Surface.js
@@ -916,7 +916,12 @@
// Stop with final poll cycle so we have correct information in model
this.surfaceObserver.stop( true );
selection = this.model.getSelection();
-   offsetDelta = e.keyCode === ve.Keys.LEFT ? -1 : 1;
+   if ( mw.config.get( 'wgVisualEditor' ).pageLanguageDir == 'rtl' ) {
+   // If the language direction is RTL, switch left/right 
directions:
+   offsetDelta = e.keyCode === ve.Keys.LEFT ? 1 : -1;
+   } else {
+   offsetDelta = e.keyCode === ve.Keys.LEFT ? -1 : 1;
+   }
 
// Check for selecting/deselecting inline images and aliens
if ( selection.isCollapsed() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic01e110a5e6094cd275327a2e8cea90c900f1bd1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix for edit links, RTL wikis with LTR interface - change (mediawiki...VisualEditor)

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

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


Change subject: Fix for edit links, RTL wikis with LTR interface
..

Fix for edit links, RTL wikis with LTR interface

Added both bidi-isolation and directionality. Since the directionality
has to come from the user interface (and not the wiki dir itself) I had
to read the $('body') direction. The other option could be adding a
mw.config.get().userLanguageDir that picks up the interface directionality
on top of the wiki directionality.

Bug: 50543
Change-Id: I9a00e9545a46f13750ab0d118b23d05573ee1a2e
---
M modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css
M modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
2 files changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css 
b/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css
index 450b15d..f08524e 100644
--- a/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css
+++ b/modules/ve/init/mw/styles/ve.init.mw.ViewPageTarget.css
@@ -327,6 +327,10 @@
 .mw-editsection {
white-space: nowrap;
padding-right: 0.25em;
+   /* bidi isolation: */
+   unicode-bidi: -moz-isolate;
+   unicode-bidi: -webkit-isolate;
+   unicode-bidi: isolate;
 }
 
 .mw-editsection-divider {
diff --git a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
index deb05fc..f2ce4b0 100644
--- a/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve/init/mw/targets/ve.init.mw.ViewPageTarget.js
@@ -1242,6 +1242,8 @@
$editsections = $( '#mw-content-text .mw-editsection' ),
handler = ve.bind( this.onEditSectionLinkClick, this );
 
+   // match direction to the user interface
+   $editsections.css( 'direction', $( 'body' ).css( 'direction' ) );
// The visibility css construct ensures we always occupy the same 
space in the layout.
// This prevents the heading from changing its wrap when the user 
toggles editSourceLink.
$editsections.each( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9a00e9545a46f13750ab0d118b23d05573ee1a2e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Layout fix for Link Surface in RTL - change (mediawiki...VisualEditor)

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

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


Change subject: Layout fix for Link Surface in RTL
..

Layout fix for Link Surface in RTL

This is a fix at least until CSSJanus is active inside iframes.
It flips the positions of the window icons (close/back/remove)
and should work for all inspector surfaces.

Bug: 50490
Change-Id: Ic363b43cd1a2b7340a9275126eeab3cf07fd7f6f
---
M modules/ve/ui/styles/ve.ui.Inspector.css
1 file changed, 24 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve/ui/styles/ve.ui.Inspector.css 
b/modules/ve/ui/styles/ve.ui.Inspector.css
index 514f869..32f1793 100644
--- a/modules/ve/ui/styles/ve.ui.Inspector.css
+++ b/modules/ve/ui/styles/ve.ui.Inspector.css
@@ -29,14 +29,38 @@
border-left: solid 1px #eee;
 }
 
+/*@noflip*/
+.ve-rtl div .ve-ui-window-icon {
+   padding: 0px;
+   margin: 0px;
+   border: 0px;
+   padding-right: 0.5em;
+   margin-right: 0.25em;
+   border-right: solid 1px #eee;
+}
+
 .ve-ui-inspector-closeButton {
float: left;
 }
 
+/*@noflip*/
+.ve-rtl div .ve-ui-inspector-closeButton {
+   float: right;
+   /** This background image is, for some reason, reversed LTR and RTL.
+   I'm adding a fix here temporarily until CSSJanus is active inside frames
+   which will sort this out anyways*/
+   background-image: url(images/icons/move-ltr.svg)
+}
+
 .ve-ui-inspector-removeButton {
float: right;
 }
 
+/*@noflip*/
+.ve-rtl div .ve-ui-inspector-removeButton {
+   float: left;
+}
+
 .ve-ui-window-body form {
margin: 0.25em 0 0 0;
padding: 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic363b43cd1a2b7340a9275126eeab3cf07fd7f6f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Page settings fix-fix - change (mediawiki...VisualEditor)

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

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


Change subject: Page settings fix-fix
..

Page settings fix-fix

This re-fixes the fix to the frame fix. fix fix.
Two things changed: Background position flipped to the right properly
(was somewhat off before) and text-alignment flipped as well.

Bug: 49613
Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
---
M modules/ve-mw/ui/styles/ve.ui.MWDialog.css
M modules/ve/ui/styles/ve.ui.Widget.css
2 files changed, 6 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css 
b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
index 9190ca9..7493160 100644
--- a/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
+++ b/modules/ve-mw/ui/styles/ve.ui.MWDialog.css
@@ -75,6 +75,11 @@
text-align: left;
 }
 
+/*@noflip*/
+.ve-rtl fieldset .ve-ui-mwMetaDialog-languages-table th {
+   text-align: right;
+}
+
 .ve-ui-mwMetaDialog-languages-table th,
 .ve-ui-mwMetaDialog-languages-table td {
padding: 0.75em 1em;
diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index 7b84d79..96a9849 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -199,8 +199,7 @@
 /* @noflip */
 .ve-rtl ul li.ve-ui-outlineItemWidget {
padding: 1.25em 3.5em 1.25em 3.5em;
-   background-position: 1em right center;
-   margin-right: 1.25em;
+   background-position: right 1em center;
 }
 
 .ve-ui-outlineItemWidget-level-1 {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0aa317ef674537d20d7ed64e74eaa3cfe8030c8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] RTL Fix for Category Popup - change (mediawiki...VisualEditor)

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

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


Change subject: RTL Fix for Category Popup
..

RTL Fix for Category Popup

Flipped the generated positions of the MWCategoryPopupWidget in case
the GUI is RTL.

Bug: 51490
Change-Id: I83436d50a4a0596fdae9526c3fc2804cf880a530
---
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
1 file changed, 9 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
index 911ad37..1ad1944 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryPopupWidget.js
@@ -173,6 +173,14 @@
width = this.$menu.outerWidth( true ),
height = this.$menu.outerHeight( true );
 
-   this.$.css( { 'left': left, 'top': top } );
+   if ( this.$container.attr('dir') === 'rtl' ) {
+   //flip me, I'm a mirror:
+   this.$.css( {
+   'right': this.$container.outerWidth( true ) - left,
+   'top': top
+   } );
+   } else {
+   this.$.css( { 'left': left, 'top': top } );
+   }
this.display( left, top, width, height );
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I83436d50a4a0596fdae9526c3fc2804cf880a530
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Quickfix for Transclusion icon in RTL wikis - change (mediawiki...VisualEditor)

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

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


Change subject: Quickfix for Transclusion icon in RTL wikis
..

Quickfix for Transclusion icon in RTL wikis

This fixes the icon position in RTL wikis from right to left.

Bug: 51819
Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
---
M modules/ve/ui/ve.ui.Context.js
1 file changed, 7 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 7df3676..521ca2f 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -267,7 +267,7 @@
$container = this.$menu;
position = { 'y': focusableOffset.top };
// HACK: Proper RTL detection plz!
-   if ( $( 'body' ).is( '.rtl,.ve-rtl' ) ) {
+   if ( $( 'body' ).is( '.sitedir-rtl' ) ) {
position.x = focusableOffset.left;
this.popup.align = 'left';
} else {
@@ -278,7 +278,12 @@
$container = inspector ? this.inspectors.$ : this.$menu;
this.popup.align = 'center';
}
-   this.$.css( { 'left': position.x, 'top': position.y } );
+   // Flip left with right if *wiki* is RTL
+   if ( $( 'body' ).is( '.sitedir-rtl' ) ) {
+   this.$.css( { 'right': position.x, 'top': position.y } 
);
+   } else {
+   this.$.css( { 'left': position.x, 'top': position.y } );
+   }
this.popup.display(
position.x,
position.y,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I36cef115017542c461e6d757f1c8bfda92074607
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

___
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 mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Regress RTL fix transclusion icon - change (mediawiki...VisualEditor)

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

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


Change subject: Regress RTL fix transclusion icon
..

Regress RTL fix transclusion icon

The fix to the transclusion icon messed up the way inspectors appear in RTL
wikis. The rtl check/correction (inside 'this.embedded') seems to be the only
rtl fix necessary. Something completely different will have to be done to the
transclusion icon.

Change-Id: I2417e125c99de9b0c5fd922a47de43ed9952d6fd
---
M modules/ve/ui/ve.ui.Context.js
1 file changed, 2 insertions(+), 6 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 694af14..007fea8 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -278,12 +278,8 @@
$container = inspector ? this.inspectors.$ : this.$menu;
this.popup.align = 'center';
}
-   // Flip left with right if CE is RTL
-   if ( this.surface.view.getDir() === 'rtl' ) {
-   this.$.css( { 'right': position.x, 'top': position.y } 
);
-   } else {
-   this.$.css( { 'left': position.x, 'top': position.y } );
-   }
+   this.$.css( { 'left': position.x, 'top': position.y } );
+
this.popup.display(
position.x,
position.y,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2417e125c99de9b0c5fd922a47de43ed9952d6fd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Link surface fix for RTL - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Link surface fix for RTL
..

[WIP] Link surface fix for RTL

This is NOT ready for merge, I fixed most of the problem and the link
surface appears in RTL, however, I got stuck with the position for the
TextInputMenuWidget, and I need a second (third/fourth/tenth) pair of
eyes. Help is appreciated, and thanks in advance!

Bug: 49416
Change-Id: I312610ca630a8f75f1a0778e97f227f35a003b41
---
M modules/ve/ui/styles/ve.ui.Surface.css
M modules/ve/ui/ve.ui.Context.js
M modules/ve/ui/ve.ui.Surface.js
M modules/ve/ui/widgets/ve.ui.TextInputMenuWidget.js
4 files changed, 40 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve/ui/styles/ve.ui.Surface.css 
b/modules/ve/ui/styles/ve.ui.Surface.css
index 5e45bc0..6a7fcbf 100644
--- a/modules/ve/ui/styles/ve.ui.Surface.css
+++ b/modules/ve/ui/styles/ve.ui.Surface.css
@@ -23,3 +23,14 @@
left: 0;
z-index: 1000;
 }
+
+   /* @noflip */
+.ve-ui-surface-overlay-rtl {
+   font-family: sans-serif;
+   line-height: 1.5em;
+   font-size: 1em;
+   position: absolute;
+   top: 0;
+   right: 0;
+   z-index: 1000;
+}
\ No newline at end of file
diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 99ceb77..325a3f8 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -276,7 +276,14 @@
$container = inspector ? this.inspectors.$ : this.$menu;
this.popup.align = 'center';
}
-   this.$.css( { 'left': position.x, 'top': position.y } );
+
+   if ( $('html').css( 'direction' ) === 'rtl' ) {
+   position.x = (window.innerWidth - position.x);
+   this.$.css( { 'right': position.x, 'top': position.y } 
);
+   } else {
+   this.$.css( { 'left': position.x, 'top': position.y } );
+   }
+
this.popup.display(
position.x,
position.y,
diff --git a/modules/ve/ui/ve.ui.Surface.js b/modules/ve/ui/ve.ui.Surface.js
index d21adfd..494099b 100644
--- a/modules/ve/ui/ve.ui.Surface.js
+++ b/modules/ve/ui/ve.ui.Surface.js
@@ -33,9 +33,16 @@
this.$
.addClass( 've-ui-surface' )
.append( this.view.$ );
-   this.$localOverlay
+   if ( $( 'body' ).hasClass( 'rtl' ) ) {
+   // If the language direction is RTL, switch left/right 
directions:
+   this.$localOverlay
+   .addClass( 've-ui-surface-overlay-rtl 
ve-ui-surface-overlay-local' )
+   .append( this.context.$ );
+   } else {
+   this.$localOverlay
.addClass( 've-ui-surface-overlay ve-ui-surface-overlay-local' )
.append( this.context.$ );
+   }
this.$globalOverlay
.addClass( 've-ui-surface-overlay ve-ui-surface-overlay-global' 
)
.append( this.dialogs.$ );
diff --git a/modules/ve/ui/widgets/ve.ui.TextInputMenuWidget.js 
b/modules/ve/ui/widgets/ve.ui.TextInputMenuWidget.js
index 8639d1f..a16c517 100644
--- a/modules/ve/ui/widgets/ve.ui.TextInputMenuWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.TextInputMenuWidget.js
@@ -96,6 +96,19 @@
dimensions.top += frameOffset.top;
}
 
+   if ( $('html').css( 'direction' ) === 'rtl' ) {
+   frameOffset = this.input.$$.frame.$.offset();
+   // The dimension should change from 'left' to 'right' to 
accommodate the changes
+   // in the link surface definition. *However* the current 
position of this container
+   // is all screwed up.
+
+   // The math here is driving me crazy. I've tried multiple 
calculations over the left/right
+   // and widths so I can have the right position, but I keep 
getting it wrong.
+   //Is there a way to get the 'right' property of the link of the 
ve.ui.Surface 
+   //that is defined for the link popup?
+   dimensions.right = window.innerWidth - frameOffset.left;
+   }
+
this.$.css( dimensions );
return this;
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I312610ca630a8f75f1a0778e97f227f35a003b41
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Directionality fix for iframes - change (mediawiki...VisualEditor)

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

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


Change subject: Directionality fix for iframes
..

Directionality fix for iframes

This will set the stage for directionality inheritance inside iframes,
and fix some of the problem with the Page Settings window in RTL wikis.

Bug: 49613
Change-Id: I418e669b0999552167683352acb365a4249ab9cc
---
M modules/ve/ui/ve.ui.Frame.js
1 file changed, 12 insertions(+), 7 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Frame.js b/modules/ve/ui/ve.ui.Frame.js
index dda0be5..0fad7e5 100644
--- a/modules/ve/ui/ve.ui.Frame.js
+++ b/modules/ve/ui/ve.ui.Frame.js
@@ -34,6 +34,10 @@
this.$
.addClass( 've-ui-frame' )
.attr( { 'frameborder': 0, 'scrolling': 'no' } );
+
+   // Set this up so the directionality is inherited inside the frame:
+   this.$.css('direction', $('body').css('direction'));
+
 };
 
 /* Inheritance */
@@ -89,17 +93,18 @@
// Initialize contents
doc.open();
doc.write(
-   '!doctype html' +
-   'html' +
-   'body style=padding:0;margin:0;' +
-   'div class=ve-ui-frame-content/div' +
-   '/body' +
-   '/html'
-   );
+   '!doctype html' +
+   'html' +
+   'body style=padding:0;margin:0;direction: ' + 
this.$.css( 'direction' ) + ';' +
+   'div 
class=ve-ui-frame-content/div' +
+   '/body' +
+   '/html'
+   );
doc.close();
 
// Import all stylesheets
style.textContent = '@import ' + this.config.stylesheets.join( 
';\n@import ' ) + ';';
+
doc.body.appendChild( style );
 
// Poll for access to stylesheet content

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I418e669b0999552167683352acb365a4249ab9cc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Language Inspector Prototype - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Language Inspector Prototype
..

[WIP] Language Inspector Prototype

Please ignore this for the moment; this will be the language inspector
but for the moment I'm trying to set up the files and go over the code
as per the example of the link inspector. It's far from being ready for
any sort of meaningful review just yet (though suggestions are comments
are always welcome!)

Change-Id: I239eef5124e29369ea9c5d8c0f49b2f6a61bc053
---
A modules/ve/ce/annotations/ve.ce.LanguageAnnotation.js
A modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
A modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
A modules/ve/ui/widgets/ve.ui.LanguageWidget.js
4 files changed, 101 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve/ce/annotations/ve.ce.LanguageAnnotation.js 
b/modules/ve/ce/annotations/ve.ce.LanguageAnnotation.js
new file mode 100644
index 000..9d1e5f7
--- /dev/null
+++ b/modules/ve/ce/annotations/ve.ce.LanguageAnnotation.js
@@ -0,0 +1,38 @@
+/*!
+ * VisualEditor ContentEditable LanguageAnnotation class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * ContentEditable language annotation.
+ *
+ * @class
+ * @extends ve.ce.Annotation
+ * @constructor
+ * @param {ve.dm.LinkAnnotation} model Model to observe
+ * @param {Object} [config] Config options
+ */
+ve.ce.LanguageAnnotation = function VeCeLanguageAnnotation( model, config ) {
+   // Parent constructor
+   ve.ce.Annotation.call( this, model, config );
+
+   // DOM changes
+   this.$.addClass( 've-ce-LanguageAnnotation' );
+   this.$.attr( 'lang', model.getAttribute( 'lang' ) );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ce.LanguageAnnotation, ve.ce.Annotation );
+
+/* Static Properties */
+
+ve.ce.LanguageAnnotation.static.name = 'language';
+
+ve.ce.LanguageAnnotation.static.tagName = 'span';
+
+/* Registration */
+
+ve.ce.annotationFactory.register( ve.ce.LanguageAnnotation );
diff --git a/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js 
b/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
new file mode 100644
index 000..d333dd2
--- /dev/null
+++ b/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
@@ -0,0 +1,61 @@
+/*!
+ * VisualEditor DataModel LanguageAnnotation class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * DataModel language annotation.
+ *
+ * Represents `span` tags with 'lang' property.
+ *
+ * @class
+ * @extends ve.dm.Annotation
+ * @constructor
+ * @param {Object} element
+ */
+ve.dm.LanguageAnnotation = function VeDmLanguageAnnotation( element ) {
+   // Parent constructor
+   ve.dm.Annotation.call( this, element );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.dm.LanguageAnnotation, ve.dm.Annotation );
+
+/* Static Properties */
+
+ve.dm.LanguageAnnotation.static.name = 'language';
+
+ve.dm.LanguageAnnotation.static.matchTagNames = ['span'];
+
+ve.dm.LanguageAnnotation.static.applyToAppendedContent = false;
+
+ve.dm.LanguageAnnotation.static.toDataElement = function ( domElements ) {
+   return {
+   'type': 'span',
+   'attributes': {
+   'lang': domElements[0].getAttribute( 'lang' )
+   }
+   };
+};
+
+ve.dm.LanguageAnnotation.static.toDomElements = function ( dataElement, doc ) {
+   var domElement = doc.createElement( 'span' );
+   domElement.setAttribute( 'lang', dataElement.attributes.href );
+   return [ domElement ];
+};
+
+/* Methods */
+
+ve.dm.LanguageAnnotation.prototype.getComparableObject = function () {
+   return {
+   'type': this.getType(),
+   'lang': this.getAttribute( 'lang' )
+   };
+};
+
+/* Registration */
+
+ve.dm.modelRegistry.register( ve.dm.LanguageAnnotation );
diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
new file mode 100644
index 000..e22a6d6
--- /dev/null
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -0,0 +1 @@
+/** placeholder file for the moment **/
\ No newline at end of file
diff --git a/modules/ve/ui/widgets/ve.ui.LanguageWidget.js 
b/modules/ve/ui/widgets/ve.ui.LanguageWidget.js
new file mode 100644
index 000..e22a6d6
--- /dev/null
+++ b/modules/ve/ui/widgets/ve.ui.LanguageWidget.js
@@ -0,0 +1 @@
+/** placeholder file for the moment **/
\ No newline at end of file

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I239eef5124e29369ea9c5d8c0f49b2f6a61bc053

[MediaWiki-commits] [Gerrit] Fixing inspector popup position - change (mediawiki...VisualEditor)

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

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


Change subject: Fixing inspector popup position
..

Fixing inspector popup position

The inspector popup should appear relative to the position of the related
calling method - either relative to the cursor (like in links and language)
or relative to the focusableNode (like in templates/transclusion).

Bug: 50905
Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
---
M modules/ve/ui/ve.ui.Context.js
1 file changed, 14 insertions(+), 5 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 7a3577b..7334645 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -253,11 +253,20 @@
position = surface.getSelectionRect(),
surfaceOffset = surface.$.offset();
 
-   // translate from ce surface
-   position = {
-   y: position.end.y - surfaceOffset.top,
-   x: position.end.x - surfaceOffset.left
-   };
+   // If there's a focused node, fit the position to its corner:
+   if ( focusedNode !== null ) {
+   position = {
+   x: focusedNode.$.position().left,
+   y: focusedNode.$.position().top
+   };
+   } else {
+   // Otherwise, use the cursor position.
+   // translate from ce surface
+   position = {
+   y: position.end.y - surfaceOffset.top,
+   x: position.end.x - surfaceOffset.left
+   };
+   }
 
if ( position ) {
$container = inspector ? this.inspectors.$ : this.$menu;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I07f58d0c6561adecbec560fc24bcb6e590f2cd9f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Invalid Link Fix - change (mediawiki...VisualEditor)

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

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


Change subject: Invalid Link Fix
..

Invalid Link Fix

As per DavidChan regex fix, this will allow unicode code units
above U+00FF.

Change-Id: I122a4437eb55b1d6f16440f2279323f505273db8
---
M modules/ve-mw/ui/inspectors/ve.ui.MWLinkInspector.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkInspector.js
index 05019cf..36a57d5 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkInspector.js
@@ -89,7 +89,7 @@
  *
  * @type {RegExp}
  */
-ve.ui.MWLinkInspector.static.legalTitle = /^[ 
%!$'()*,\-.\/0-9:;=?@A-Z\\^_`a-z~\u0080-\u00FF+]+$/;
+ve.ui.MWLinkInspector.static.legalTitle = /^[ 
%!$'()*,\-.\/0-9:;=?@A-Z\\^_`a-z~\u0080-\u+]+$/;
 
 /* Registration */
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I122a4437eb55b1d6f16440f2279323f505273db8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Language Inspector Default Fix - change (mediawiki...VisualEditor)

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

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


Change subject: Language Inspector Default Fix
..

Language Inspector Default Fix

Fixes the situation where there's a language set but not a direction.

Change-Id: If353b36ff0700717f1b8fd917b39c230de5ec272
---
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
1 file changed, 26 insertions(+), 22 deletions(-)


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

diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
index 41ee0c4..0d4774e 100644
--- a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -96,8 +96,8 @@
// This will be called only if the annotation doesn't already exist, 
setting
// the default value as the current language/dir of the selected text.
if ( fragDOM ) {
-   this.initLang = fragDOM.$.closest('[lang]').attr('lang') || 
'en';
-   this.initDir = fragDOM.$.closest('[dir]').css('direction') || 
'ltr';
+   this.initLang = fragDOM.$.closest('[lang]').attr('lang');
+   this.initDir = fragDOM.$.closest('[dir]').css('direction');
}
 
// Parent method
@@ -146,43 +146,47 @@
  * @chainable
  */
 ve.ui.LanguageInspector.prototype.setAnnotation = function ( annotation ) {
-   var langCode = '',
-   langDir = '';
+   var langCode, langDir, annData;
 
// Validate the given annotation:
 
// Give precedence to dir value if it already exists
// in the annotation:
-   if ( annotation.getAttribute( 'dir' ) ) {
-   langDir = annotation.getAttribute( 'dir' );
-   }
+   langDir = annotation.getAttribute( 'dir' );
 
// Set language according to the one in the given annotation
// or leave blank if element has no language set
-   if ( annotation.getAttribute( 'lang' ) ) {
-   langCode = annotation.getAttribute( 'lang' );
-   }
+   langCode = annotation.getAttribute( 'lang' );
 
// If language exists, but dir is undefined/null,
// fix the dir in terms of language:
if ( langCode  !langDir ) {
-   langDir = $.uls.data.getDir( this.lang );
+   langDir = $.uls.data.getDir( langCode );
}
 
+   // Set the annotation data:
+   annData = {
+   'type': 'language',
+   'attributes': {}
+   };
+
+   if ( langCode ) {
+   annData.attributes.lang = langCode;
+   }
+
+   if ( langDir ) {
+   annData.attributes.dir = langDir;
+   }
+
+   // Update the widget:
+   this.targetInput.setAttributes( langCode, langDir );
+
+   // Update inspector properties:
this.lang = langCode;
this.dir = langDir;
 
-   // Update the widget:
-   this.targetInput.setAttributes( this.lang, this.dir );
-
-   // Set the annotation:
-   this.annotation = new ve.dm.LanguageAnnotation( {
-   'type': 'language',
-   'attributes': {
-   'lang': this.lang,
-   'dir': this.dir
-   }
-   } );
+   // Set up the annotation:
+   this.annotation = new ve.dm.LanguageAnnotation( annData );
 
return this;
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If353b36ff0700717f1b8fd917b39c230de5ec272
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Language Block Node Inspector Prototype - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Language Block Node Inspector Prototype
..

[WIP] Language Block Node Inspector Prototype

This is work in progress, mostly just setting up the basics and testing
node wrapping and combining an inspector with a node wrapper functionality.

- Added new LanguageBlock node as div element with lang/dir attributes
- Added button (no icon for the moment)
- Added ce/dm functionality
- Added a basic inspector
- TODO: Improve LanguageInputWidget so it could work as an interface to
  both Language Inspector (inline span) and Language Block Inspector
  (wrapper div)

Change-Id: I4852ec462d63a25a9dc7215df439d96df81be527
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve/ce/styles/ve.ce.Node.css
M modules/ve/init/ve.init.Target.js
5 files changed, 18 insertions(+), 2 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index fde772b..65f9969 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -33,6 +33,7 @@
'visualeditor-annotationbutton-italic-tooltip' = 'Italic',
'visualeditor-annotationbutton-link-tooltip' = 'Link',
'visualeditor-annotationbutton-language-tooltip' = 'Language',
+   'visualeditor-annotationbutton-languageblock-tooltip' = 'Language 
Block',
'visualeditor-annotationbutton-strikethrough-tooltip' = 
'Strikethrough',
'visualeditor-beta-label' = 'beta',
'visualeditor-beta-warning' = 'VisualEditor is in \'beta\'. You may 
encounter software issues, and you may not be able to edit parts of the page. 
Click {{int:visualeditor-ca-editsource}} to switch to wikitext mode – unsaved 
changes will be lost.',
@@ -134,6 +135,7 @@
'visualeditor-linkinspector-title' = 'Hyperlink',
'visualeditor-mwhieroinspector-title' = 'Hieroglyphics',
'visualeditor-mwmathinspector-title' = 'LaTeX',
+   'visualeditor-languageblock-inspector-title' = 'Language Block',
'visualeditor-languageinspector-title' = 'Language',
'visualeditor-languageinspector-block-tooltip' = 'Language block: $1',
'visualeditor-languageinspector-block-tooltip-rtldirection' = ': Right 
to Left',
@@ -247,6 +249,7 @@
 {{Identical|Link}}',
'visualeditor-annotationbutton-language-tooltip' = 'Tooltip text for 
language button.
 {{Identical|Language}}',
+   'visualeditor-annotationbutton-languageblock-tooltip' = 'Tooltip text 
for language block button',
'visualeditor-annotationbutton-strikethrough-tooltip' = 'Tooltip text 
for strikethrough button',
'visualeditor-beta-label' = 'Text of tool in the toolbar that 
highlights that VisualEditor is still in beta.
 {{Identical|Beta}}',
@@ -432,6 +435,7 @@
'visualeditor-mwmathinspector-title' = 'Used as title for 
MathInspector.
 
 See [[w:LaTeX]].',
+   'visualeditor-languageblock-inspector-title' = 'Title of the language 
block inspector dialog',
'visualeditor-languageinspector-title' = 'Title of the language 
inspector dialog.
 {{Identical|Language}}',
'visualeditor-languageinspector-block-tooltip' = 'Tooltip identifying 
language block properties inside VisualEditor. Parameters: $1 - the language 
code (for example en)',
diff --git a/VisualEditor.php b/VisualEditor.php
index 9a00f6b..7a0e2a3 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -728,6 +728,10 @@
've/ui/widgets/ve.ui.LanguageInputWidget.js',
've/ui/tools/buttons/ve.ui.CodeButtonTool.js',
've/ui/tools/buttons/ve.ui.StrikethroughButtonTool.js',
+   've/dm/nodes/ve.dm.LanguageBlockNode.js',
+   've/ce/nodes/ve.ce.LanguageBlockNode.js',
+   've/ui/inspectors/ve.ui.LanguageBlockInspector.js',
+   've/ui/tools/buttons/ve.ui.LanguageBlockButtonTool.js',
),
'dependencies' = array(
'ext.visualEditor.core',
@@ -738,7 +742,9 @@
'visualeditor-mwhieroinspector-title',
'visualeditor-mwmathinspector-title',
'visualeditor-annotationbutton-language-tooltip',
+   'visualeditor-annotationbutton-languageblock-tooltip',
'visualeditor-annotationbutton-strikethrough-tooltip',
+   'visualeditor-languageblock-inspector-title',
),
),
 
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 16b7d41..8ffeb73 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ 

[MediaWiki-commits] [Gerrit] LanguageInputWidget Generalization - change (mediawiki...VisualEditor)

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

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


Change subject: LanguageInputWidget Generalization
..

LanguageInputWidget Generalization

This commit prepares the LanguageInputWidget to handle both annotation
and node, so it can be used as the GUI for both the LanguageInspector
and the LanguageBlockInspector that's coming up.

The LanguageInspector was adjusted mildly to accomodate the change
in the widget.

Change-Id: I17954707c00ffc4c32fbb44a6807a61760ad573c
---
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
M modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
2 files changed, 96 insertions(+), 44 deletions(-)


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

diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
index 9f9fc1a..67a90a9 100644
--- a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -19,6 +19,7 @@
// Parent constructor
ve.ui.AnnotationInspector.call( this, surface, config );
 
+   // Placeholder for the dm properties:
this.initLang = '';
this.initDir = '';
 };
@@ -54,8 +55,12 @@
 
// Properties
this.targetInput = new ve.ui.LanguageInputWidget( {
-   '$$': this.frame.$$, '$overlay': this.surface.$localOverlay
+   '$$': this.frame.$$,
+   '$overlay': this.surface.$localOverlay
} );
+
+   // Define the LanguageInputWidget as an annotation:
+   this.targetInput.dataType = annotation;
 
// Initialization
this.$form.append( this.targetInput.$ );
@@ -75,10 +80,10 @@
}, this ), 200 );
 };
 /**
- * Handle the inspector being setup.
- * Make sure the initial language and direction are set by the parent of the 
DOM
- * element of the selected fragment before the rest of the onSetup method is
- * processed by the parent ve.ui.AnnotationInspector
+ * Handle the inspector being set up.
+ * Make sure the initial language and direction are set by the parent
+ * of the DOM element of the selected fragment before the rest of the
+ * onSetup method is processed by the parent ve.ui.AnnotationInspector
  */
 ve.ui.LanguageInspector.prototype.onSetup = function () {
var fragDOM,
diff --git a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js 
b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
index c76e0bc..30bc1ce 100644
--- a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
@@ -20,13 +20,16 @@
// Parent constructor
ve.ui.Widget.call( this, config );
 
-   // Properties
+   // Visual Properties
this.$langCodeDisp = this.getDisplayElement( config ); // language code
this.$langNameDisp = this.getDisplayElement( config ); // 
human-readable language name
this.$dirDisp = this.getDisplayElement( config );
 
-   // Placeholders for annotation value
+   // Placeholders for datamodels:
this.annotation = null;
+   this.node = null;
+
+   // Placeholders for attribute values
this.lang = '';
this.dir = '';
 
@@ -65,7 +68,17 @@
 
ulsParams = {
onSelect: function( language ) {
-   langInpObj.setValue( language );
+   var newAnnotation = new ve.dm.LanguageAnnotation( {
+   'type': 'language',
+   'attributes': {
+   'lang': language,
+   'dir': $.uls.data.getDir( 
this.lang )
+   }
+   } );
+   // Set the new value, annotation or node:
+   if ( langInpObj.dataType === 'annotation' ) {
+   langInpObj.setAnnotation( newAnnotation );
+   }
},
compact: true,
// Temporary Quicklist for the Prototype:
@@ -89,7 +102,13 @@
 
 ve.inheritClass( ve.ui.LanguageInputWidget, ve.ui.Widget );
 
+/* Static properties */
+
+// This will define whether we are in annotation or node mode:
+ve.ui.LanguageInputWidget.static.dataType = '';
+
 /* Methods */
+
 /**
  * Get display element. This replaces the 'getInputElement'
  * of the InputWidget
@@ -103,76 +122,104 @@
 };
 
 /**
- * Set the value of the language display
+ * Return the current language attributes
  *
- * Overrides setValue to keep annotations in sync.
- *
- * @method
- * @param {string} value New value
  */
-ve.ui.LanguageInputWidget.prototype.setValue = function ( value ) {
-   // Keep annotation in sync with value
-   if ( value === '' ) {
-   this.annotation = null;
- 

[MediaWiki-commits] [Gerrit] LanguageBlock Node - change (mediawiki...VisualEditor)

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

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


Change subject: LanguageBlock Node
..

LanguageBlock Node

This is the ce/dm definition for the LanguageBlockNode as part of the
new LanguageBlockInspector. The inspector UI will come up next.

This commit sets up the dm/ce to recognize language div blocks with
some langu='xx' dir='yy' definition and visually marks them for the user.
The LanguageBlock Node definition is set up as BranchNode so it can
wrap a block of content that has other nodes in it.

Change-Id: I0e7d3156085970ce3b0cca1f853d2ad7417bd712
---
M VisualEditor.php
A modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
M modules/ve/ce/styles/ve.ce.Node.css
A modules/ve/dm/nodes/ve.dm.LanguageBlockNode.js
4 files changed, 119 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index b067472..e5007a7 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -732,6 +732,8 @@
've/ui/widgets/ve.ui.LanguageInputWidget.js',
've/ui/tools/buttons/ve.ui.CodeButtonTool.js',
've/ui/tools/buttons/ve.ui.StrikethroughButtonTool.js',
+   've/ce/nodes/ve.ce.LanguageBlockNode.js',
+   've/dm/nodes/ve.dm.LanguageBlockNode.js',
),
'dependencies' = array(
'ext.visualEditor.core',
diff --git a/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js 
b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
new file mode 100644
index 000..58bea53
--- /dev/null
+++ b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
@@ -0,0 +1,55 @@
+/*!
+ * VisualEditor ContentEditable ListNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * ContentEditable language block node.
+ *
+ * @class
+ * @extends ve.ce.BranchNode
+ * @constructor
+ * @param {ve.dm.ListNode} model Model to observe
+ * @param {Object} [config] Config options
+ */
+ve.ce.LanguageBlockNode = function VeCeLanguageBlockNode( model, config ) {
+   // Parent constructor
+   ve.ce.BranchNode.call( this, model, config );
+
+   // Events
+   this.model.connect( this, { 'update': 'onUpdate' } );
+
+   // DOM Changes
+   this.$.addClass( 've-ce-languageBlockNode' );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ce.LanguageBlockNode, ve.ce.BranchNode );
+
+/* Static Properties */
+
+ve.ce.LanguageBlockNode.static.name = 'languageblock';
+
+ve.ce.LanguageBlockNode.static.tagName = 'div';
+
+ve.ce.LanguageBlockNode.static.canBeSplit = true;
+
+/* Methods */
+
+/**
+ * Handle model update events.
+ *
+ * If the style changed since last update the DOM wrapper will be replaced 
with an appropriate one.
+ *
+ * @method
+ */
+ve.ce.LanguageBlockNode.prototype.onUpdate = function () {
+// this.updateTagName();
+};
+
+/* Registration */
+
+ve.ce.nodeFactory.register( ve.ce.LanguageBlockNode );
diff --git a/modules/ve/ce/styles/ve.ce.Node.css 
b/modules/ve/ce/styles/ve.ce.Node.css
index 6458fb6..b20e57a 100644
--- a/modules/ve/ce/styles/ve.ce.Node.css
+++ b/modules/ve/ce/styles/ve.ce.Node.css
@@ -192,3 +192,10 @@
border-bottom: dashed #ccc 1px;
background-color: #ebf3f5;
 }
+
+/* Language Block Div Node */
+.ve-ce-languageBlockNode {
+   border: dashed #ccc 1px;
+   background-color: #ebf3f5;
+}
+
diff --git a/modules/ve/dm/nodes/ve.dm.LanguageBlockNode.js 
b/modules/ve/dm/nodes/ve.dm.LanguageBlockNode.js
new file mode 100644
index 000..316220b
--- /dev/null
+++ b/modules/ve/dm/nodes/ve.dm.LanguageBlockNode.js
@@ -0,0 +1,55 @@
+/*!
+ * VisualEditor DataModel LanguageBlockNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * DataModel language block node.
+ *
+ * @class
+ * @extends ve.dm.BranchNode
+ * @constructor
+ * @param {ve.dm.BranchNode[]} [children] Child nodes to attach
+ * @param {Object} [element] Reference to element in linear model
+ */
+ve.dm.LanguageBlockNode = function VeDmLanguageBlockNode( children, element ) {
+   // Parent constructor
+   ve.dm.BranchNode.call( this, children, element );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.dm.LanguageBlockNode, ve.dm.BranchNode );
+
+/* Static Properties */
+
+ve.dm.LanguageBlockNode.static.name = 'languageblock';
+
+ve.dm.LanguageBlockNode.static.matchTagNames = [ 'div' ];
+
+// TODO:
+// change the default from 'en'/'ltr' to the page langauge/dir
+// from the surface.getDir()
+ve.dm.LanguageBlockNode.static.toDataElement = function ( domElements ) {
+   var $node = $( domElements[0] );
+   return {
+   'type': 'languageblock',
+   'attributes': 

[MediaWiki-commits] [Gerrit] [WIP] LanguageBlock Inspector - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] LanguageBlock Inspector
..

[WIP] LanguageBlock Inspector

Adding a div element with lang/dir attributes around blocks of content.
This is still work in progress.

Current problem: ve.dm.LanguageBlockNode doesn't have 'attributes' accessible
despite the fact I'm setting them up in the definition. I'm not sure why.
This stops the addition of the node to the widget (which will be added after
I solve this issue).

Change-Id: Ic40f4265792a227a70460d865e251d4a80c0064c
---
M VisualEditor.i18n.php
M VisualEditor.php
M modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
M modules/ve/init/ve.init.Target.js
A modules/ve/ui/actions/ve.ui.LanguageBlockAction.js
A modules/ve/ui/inspectors/ve.ui.LanguageBlockInspector.js
A modules/ve/ui/tools/buttons/ve.ui.LanguageBlockButtonTool.js
7 files changed, 304 insertions(+), 2 deletions(-)


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

diff --git a/VisualEditor.i18n.php b/VisualEditor.i18n.php
index b992b1e..e488c33 100644
--- a/VisualEditor.i18n.php
+++ b/VisualEditor.i18n.php
@@ -135,6 +135,8 @@
'visualeditor-mwalienextensioninspector-title' = 'MediaWiki extension',
'visualeditor-mwhieroinspector-title' = 'Hieroglyphics',
'visualeditor-mwmathinspector-title' = 'LaTeX',
+   'visualeditor-languageblock-tooltip' = 'Language Block',
+   'visualeditor-languageblock-inspector-title' = 'Language Block',
'visualeditor-languageinspector-title' = 'Language',
'visualeditor-languageinspector-block-tooltip' = 'Language block: $1',
'visualeditor-languageinspector-block-tooltip-rtldirection' = ': Right 
to Left',
@@ -438,6 +440,8 @@
'visualeditor-mwmathinspector-title' = 'Used as title for 
MathInspector.
 
 See [[w:LaTeX]].',
+   'visualeditor-languageblock-tooltip' = 'Tooltip text for language 
block button',
+   'visualeditor-languageblock-inspector-title' = 'Title of the language 
block inspector dialog',
'visualeditor-languageinspector-title' = 'Title of the language 
inspector dialog.
 {{Identical|Language}}',
'visualeditor-languageinspector-block-tooltip' = 'Tooltip identifying 
language block properties inside VisualEditor. Parameters: $1 - the language 
code (for example en)',
diff --git a/VisualEditor.php b/VisualEditor.php
index e5007a7..438997d 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -734,6 +734,9 @@
've/ui/tools/buttons/ve.ui.StrikethroughButtonTool.js',
've/ce/nodes/ve.ce.LanguageBlockNode.js',
've/dm/nodes/ve.dm.LanguageBlockNode.js',
+   've/ui/tools/buttons/ve.ui.LanguageBlockButtonTool.js',
+   've/ui/inspectors/ve.ui.LanguageBlockInspector.js',
+   've/ui/actions/ve.ui.LanguageBlockAction.js',
),
'dependencies' = array(
'ext.visualEditor.core',
@@ -746,6 +749,8 @@
'visualeditor-mwmathinspector-title',
'visualeditor-annotationbutton-language-tooltip',
'visualeditor-annotationbutton-strikethrough-tooltip',
+   'visualeditor-languageblock-tooltip',
+   'visualeditor-languageblock-inspector-title',
),
),
 
diff --git a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
index 16b7d41..8ffeb73 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.ViewPageTarget.js
@@ -171,7 +171,7 @@
{ 'items': [ 'undo', 'redo' ] },
{ 'items': [ 'mwFormat' ] },
{ 'items': [ 'bold', 'italic', 'mwLink', 'language', 'code', 
'strikethrough', 'clear' ] },
-   { 'items': [ 'number', 'bullet', 'outdent', 'indent' ] },
+   { 'items': [ 'number', 'bullet', 'outdent', 'indent', 'languageblock' ] 
},
{ 'items': [ 'mwMediaInsert', 'mwReference', 'mwReferenceList', 
'mwTransclusion', 'mwMath', 'mwHiero' ] }
 ];
 
diff --git a/modules/ve/init/ve.init.Target.js 
b/modules/ve/init/ve.init.Target.js
index 28c246d..74d0a6c 100644
--- a/modules/ve/init/ve.init.Target.js
+++ b/modules/ve/init/ve.init.Target.js
@@ -33,7 +33,7 @@
{ 'items': ['undo', 'redo'] },
{ 'items': ['format'] },
{ 'items': ['bold', 'italic', 'link', 'code', 'language', 
'strikethrough', 'clear'] },
-   { 'items': ['number', 'bullet', 'outdent', 'indent'] }
+   { 'items': ['number', 'bullet', 'outdent', 'indent', 'languageblock'] }
 ];
 
 ve.init.Target.static.surfaceCommands = [
diff --git a/modules/ve/ui/actions/ve.ui.LanguageBlockAction.js 

[MediaWiki-commits] [Gerrit] [WIP] StickeredNode mixin and StickerWidget - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] StickeredNode mixin and StickerWidget
..

[WIP] StickeredNode mixin and StickerWidget

This is the UI piece of the StickerNode, a node mixin that allows for
static menus on block nodes for edit purposes. The widget will be
populated by inspectors for the node they are associated with.

The main use of this functionality is the Language Block node, but
the functionality will be useful for other block nodes like tables.

Change-Id: Iaef3afdf6ae8e18457146fbc03b6877494bcf650
---
M VisualEditor.php
A modules/ve/ce/ve.ce.StickeredNode.js
M modules/ve/ui/styles/ve.ui.Widget.css
A modules/ve/ui/ve.ui.Sticker.js
A modules/ve/ui/widgets/ve.ui.StickerWidget.js
5 files changed, 441 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index 4920ed4..878ce47 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -705,6 +705,9 @@
've/ui/tools/ve.ui.BlockInspectorTool.js',
've/ui/actions/ve.ui.BlockInspectorAction.js',
've/ui/ve.ui.StickerToolbar.js',
+   've/ce/ve.ce.StickeredNode.js',
+   've/ui/ve.ui.Sticker.js',
+   've/ui/widgets/ve.ui.StickerWidget.js',
've/ui/tools/ve.ui.ExperimentalTool.js',
've-mw/ui/tools/ve.ui.MWExperimentalTool.js',
),
diff --git a/modules/ve/ce/ve.ce.StickeredNode.js 
b/modules/ve/ce/ve.ce.StickeredNode.js
new file mode 100644
index 000..ecd7b9d
--- /dev/null
+++ b/modules/ve/ce/ve.ce.StickeredNode.js
@@ -0,0 +1,80 @@
+/*!
+ * VisualEditor ContentEditable FocusableNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * ContentEditable sticker node.
+ *
+ * Node that pops a sticky menu at the top.
+ *
+ * @param {jQuery} [$stickered=this.$] node jquery object
+ */
+ve.ce.StickeredNode = function VeCeStickeredNode( $stickered ) {
+   this.$stickered = $stickered || this.$;
+
+   this.$stickered.addClass( 've-ce-stickeredNode' );
+
+   this.$stickered.on( 'mouseenter', ve.bind( this.onMouseEnter, this ) );
+   this.$stickered.on( 'mouseleave', ve.bind( this.onMouseLeave, this ) );
+
+   this.dmNode = this.model; // -- how do I get Dm of the current node??
+
+   this.surface = null;
+   this.sticker = null;
+
+   this.focused = false;
+   // Events
+   this.connect( this, {
+   'setup': 'onStickeredSetup',
+   'resize': 'onStickeredResize',
+   'rerender': 'onStickeredRerendered',
+   } );
+}
+
+ve.ce.StickeredNode.prototype.onStickeredSetup = function () {
+   this.surface = this.root.getSurface();
+   // Create Sticker:
+   this.sticker = new ve.ui.Sticker( this.surface.getSurface(), {
+   '$$': this.$$,
+   '$stickeredNode': this.$,
+   'nodeView': this,
+   'nodeModel': this.dmNode
+   } );
+   this.sticker.show( true );
+
+   // Repositioning Events:
+   this.surface.getModel()
+   .connect( this, { 'change': 'onStickeredModelChange' } );
+   this.surface.getSurface()
+   .connect( this, { 'position': 'onStickeredResize' } );
+
+}
+
+ve.ce.StickeredNode.prototype.onStickeredRerendered = function () {
+   this.updatePosition();
+}
+
+ve.ce.StickeredNode.prototype.onStickeredResize = function () {
+   this.updatePosition();
+
+}
+
+ve.ce.StickeredNode.prototype.onStickeredModelChange = function () {
+   this.updatePosition();
+   this.sticker.updateMenu();
+}
+
+ve.ce.StickeredNode.prototype.updatePosition = function() {
+   var $stickeredNode = this.$;
+   this.sticker.updateDimensions( true, $stickeredNode.position() );
+};
+
+ve.ce.StickeredNode.prototype.onMouseEnter = function () {
+   this.focused = true;
+};
+ve.ce.StickeredNode.prototype.onMouseLeave = function () {
+   this.focused = false;
+};
diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index 2bf8ef3..aa002f9 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -575,3 +575,15 @@
border-bottom-left-radius: 0;
border-bottom-width: 0;
 }
+
+/* ve.ui.StickerWidget.js */
+
+.ve-ui-stickerWidget {
+   position: absolute;
+   -webkit-box-sizing: border-box;
+   -moz-box-sizing: border-box;
+   box-sizing: border-box;
+   border: 1px solid #F2DCA0;
+   background: #FFFAC7;
+   padding: 2px;
+}
diff --git a/modules/ve/ui/ve.ui.Sticker.js b/modules/ve/ui/ve.ui.Sticker.js
new file mode 100644
index 

[MediaWiki-commits] [Gerrit] [WIP] LanguageBlock Inspector Implementation - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] LanguageBlock Inspector Implementation
..

[WIP] LanguageBlock Inspector Implementation

This is the implementation of the LanguageBlock node, tool and inspector,
based on the StickeredNode and BlockInspector that are in the dependent
commits.

In this change:
* ve.dm.LanguageBlockNode  ve.ce.LanguageBlockNode - The definition of
  the languageblock node as div with 'lang' and 'dir' properties.
* ve.ui.LanguageBlockInspector - The behavior of the languageblock inspector
  tool is split to two: as an 'add' functionality when called from the main
  toolbar, and as an 'edit' functionality when called from the specific node
  the button is attached to (through StickerToolbar).
* ve.ui.LanguageBlockAction - The actual 'wrap' and 'unwrap' functionality
  for the languageblock nodes. The functionality may end up being elaborate
  with several exceptions-to-the-rule (somewhat different behaviro for cases
  like list items, table cells, etc) and hence the code is separated from the
  inspector itself.
* ve.ce.Node.css - Added visual indication of the languageblock node. This
  should probably change to something that looks nicer.

Change-Id: I46b66aaf9f4bd1f8acd1c5aea0883d3146cf42d4
---
M modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
1 file changed, 0 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js 
b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
index d28c303..a510868 100644
--- a/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
+++ b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
@@ -29,7 +29,6 @@
 
// DOM Changes
this.$.addClass( 've-ce-languageBlockNode' );
-
 };
 
 /* Inheritance */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I46b66aaf9f4bd1f8acd1c5aea0883d3146cf42d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] TemplateData Generator GUI - change (mediawiki...TemplateData)

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

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


Change subject: TemplateData Generator GUI
..

TemplateData Generator GUI

This change adds a TemplateData Generator to the Template edit form. If a 
templatedata
tag already exists, the tool will parse it and display it in a visual GUI the 
user can
then manipulate in their own language. If there is no templatedata tag, the 
tool will
appear empty and allow users to add and tweak their desired template parameter 
data.
The tool also allows for rudamentary parameter import, which picks up the 
parameters from
a current template into the GUI to make the user's life easier when producing 
templatedata.

Bug: 50436
Change-Id: I863a8199c0b08cc52b320ed00dcba912dd2aeefc
---
M TemplateData.hooks.php
M TemplateData.i18n.php
M TemplateData.php
A modules/TemplateDataGenerator.core.js
A modules/TemplateDataGenerator.css
A modules/TemplateDataGenerator.editPage.js
6 files changed, 962 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/00/85400/1

diff --git a/TemplateData.hooks.php b/TemplateData.hooks.php
index 621f8a3..367fd62 100644
--- a/TemplateData.hooks.php
+++ b/TemplateData.hooks.php
@@ -64,6 +64,18 @@
}
 
/**
+* Parser hook registering the GUI module only in edit pages.
+*
+* @param EditPage $editPage
+* @param OutputPage $output
+*/
+   public static function onTemplateEditPage( $editPage, $output ) {
+   global $wgOut;
+   $wgOut-addModules( 'ext.templateDataGenerator' );
+   return true;
+   }
+
+   /**
 * Parser hook for templatedata.
 * If there is any JSON provided, render the template documentation on 
the page.
 *
diff --git a/TemplateData.i18n.php b/TemplateData.i18n.php
index e599928..ca73f99 100644
--- a/TemplateData.i18n.php
+++ b/TemplateData.i18n.php
@@ -24,6 +24,34 @@
'templatedata-invalid-unknown' = 'Unexpected property $1.',
'templatedata-invalid-value' = 'Invalid value for property $1.',
'templatedata-invalid-length' = 'Data too large to save 
({{formatnum:$1}} {{PLURAL:$1|byte|bytes}}, {{PLURAL:$2|limit is}} 
{{formatnum:$2}})',
+
+   // TemplateData Generator GUI:
+   'templatedatagenerator-editbutton' = 'Generate TemplateData',
+   'templatedatagenerator-errormsg-jsonbadformat' = 'Bad JSON format. 
Either correct it, or delete the current templatedata tags and try again.',
+   'templatedatagenerator-modal-errormsg' = 'Errors found. Please make 
sure there are no empty or duplicate parameter names, and that the parameter 
name does not include | = or }}',
+   'templatedatagenerator-modal-errormsg-import-noparams' = 'No new 
parameters found during import',
+   'templatedatagenerator-modal-notice-import-numparams' = '$1 new 
parameters were imported',
+   'templatedatagenerator-modal-title' = 'TemplateData Generator',
+   'templatedatagenerator-modal-title-templatedesc' = 'Template 
description',
+   'templatedatagenerator-modal-title-templateparams' = 'Template 
parameters',
+   'templatedatagenerator-modal-table-param-name' = 'Name',
+   'templatedatagenerator-modal-table-param-aliases' = 'Aliasesbr 
/(comma separated)',
+   'templatedatagenerator-modal-table-param-label' = 'Label',
+   'templatedatagenerator-modal-table-param-desc' = 'Description',
+   'templatedatagenerator-modal-table-param-type' = 'Type',
+   'templatedatagenerator-modal-table-param-type-undefined' = 'Undefined',
+   'templatedatagenerator-modal-table-param-type-number' = 'Number',
+   'templatedatagenerator-modal-table-param-type-string' = 'String',
+   'templatedatagenerator-modal-table-param-type-user' = 'User',
+   'templatedatagenerator-modal-table-param-type-page' = 'Page',
+   'templatedatagenerator-modal-table-param-default' = 'Default',
+   'templatedatagenerator-modal-table-param-required' = 'Required',
+   'templatedatagenerator-modal-table-param-actions' = 'Actions',
+   'templatedatagenerator-modal-button-addparam' = 'Add parameter',
+   'templatedatagenerator-modal-button-delparam' = 'Delete parameter',
+   'templatedatagenerator-modal-button-importParams' = 'Import 
Parameters',
+   'templatedatagenerator-modal-buttons-apply' = 'Apply',
+   'templatedatagenerator-modal-buttons-cancel' = 'Cancel',
 );
 
 /** Message documentation (Message documentation)
@@ -65,6 +93,32 @@
'templatedata-invalid-length' = Error message when generated JSON's 
length exceed database limits.
 * $1 - length of generated JSON
 * $2 - maximal allowed length,
+   'templatedatagenerator-editbutton' = 'The label of the button, 
appearing above the editor field.',
+   'templatedatagenerator-errormsg-jsonbadformat' = 'Error message 

[MediaWiki-commits] [Gerrit] LanguageAnnotation Touchup - change (mediawiki...VisualEditor)

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

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


Change subject: LanguageAnnotation Touchup
..

LanguageAnnotation Touchup

Fixing a couple of mishaps in the language annotation, including adding a
getComparableObject in the ve.dm.LanguageAnnotation class.

Change-Id: Ia28900df55969f60576cfd716c70ffc1ba5f4c27
---
M modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
2 files changed, 19 insertions(+), 13 deletions(-)


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

diff --git a/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js 
b/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
index f8477e3..70eb7e3 100644
--- a/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
+++ b/modules/ve/dm/annotations/ve.dm.LanguageAnnotation.js
@@ -60,9 +60,15 @@
 
 /* Methods */
 
-// TODO:
-// Set up a proper comparable method for lang and dir attributes
-// ve.dm.LanguageAnnotation.prototype.getComparableObject
+/**
+ * @returns {Object}
+ */
+ve.dm.LanguageAnnotation.prototype.getComparableObject = function () {
+   return {
+   'type': 'meta/language',
+   'lang': this.getAttribute( 'lang' )
+   };
+};
 
 /* Registration */
 
diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
index 55e1823..f6d299f 100644
--- a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -20,8 +20,8 @@
ve.ui.AnnotationInspector.call( this, surface, config );
 
// Placeholder for the dm properties:
-   this.initLang = '';
-   this.initDir = '';
+   this.lang = '';
+   this.dir = '';
 
// Placeholder for the annotation:
this.annotation = null;
@@ -98,8 +98,8 @@
// This will be called only if the annotation doesn't already exist, 
setting
// the default value as the current language/dir of the selected text.
if ( fragDOM ) {
-   this.initLang = fragDOM.$.closest( '[lang]' ).attr( 'lang' );
-   this.initDir = fragDOM.$.closest( '[dir]' ).css( 'direction' );
+   this.lang = fragDOM.$.closest( '[lang]' ).attr( 'lang' );
+   this.dir = fragDOM.$.closest( '[dir]' ).css( 'direction' );
}
 
// Parent method
@@ -161,19 +161,19 @@
langCode = annotation.getAttribute( 'lang' );
} else {
// No annotation (empty text or collapsed fragment on empty 
line)
-   langCode = this.initLang;
-   langDir = this.initDir;
+   langCode = this.lang;
+   langDir = this.dir;
}
 
// If language exists, but dir is undefined/null,
// fix the dir in terms of language:
-   if ( langCode  !langDir ) {
+   if ( langCode  !langDir  $.uls ) {
langDir = $.uls.data.getDir( langCode );
}
 
// Set the annotation data:
annData = {
-   'type': 'language',
+   'type': 'meta/language',
'attributes': {}
};
 
@@ -205,8 +205,8 @@
return new ve.dm.LanguageAnnotation( {
'type': 'meta/language',
'attributes': {
-   'lang': this.initLang,
-   'dir': this.initDir
+   'lang': this.lang,
+   'dir': this.dir
}
} );
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia28900df55969f60576cfd716c70ffc1ba5f4c27
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Language widget ULS call fix - change (mediawiki...VisualEditor)

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

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


Change subject: Language widget ULS call fix
..

Language widget ULS call fix

Because of the change to ButtonWidget, the button returned false after
onClick and as a result, ULS dialog didn't open.

This fix adds a fake 'href' value to the PushButtonWidget instance
in ve.ui.LanguageInputWidget so clicking the 'change language' button
continues to evoke ULS.

(Notice, this widget will soon be split into ve-MW with a smaller fallback
widget in core, but for now, this fixes the fact ULS doesn't appear when it
should)

Change-Id: I32eabdc5ee1b3681c20c756f45a3257c7a0b5681
---
M modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js 
b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
index b84ee63..26c266b 100644
--- a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
@@ -76,6 +76,8 @@
// Create a 'change language' Button:
this.$button = new ve.ui.PushButtonWidget({
'label': ve.msg( 
'visualeditor-languageinspector-widget-changelang' ),
+   // Add 'href' so the button returns true on click and triggers 
ULS
+   'href': '#',
'flags': ['primary']
});
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I32eabdc5ee1b3681c20c756f45a3257c7a0b5681
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Adding a slug into an empty transclusion - change (mediawiki...VisualEditor)

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

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


Change subject: Adding a slug into an empty transclusion
..

Adding a slug into an empty transclusion

If a template was setup without a default output and returns an empty result
to the transclusion, the user could not access the template dialog because
there was nowhere to hover over to get it visible. This commit checks the
output from the template after it was rendered with the given parameters
and if it returns empty, it adds a slug to the output so to give the users
a placeholder to access that template and edit or remove it.

Bug:55810
Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
1 file changed, 7 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index d6763d4..6cbfd75 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -104,6 +104,13 @@
if ( contentNodes.length === 1  
contentNodes[0].nodeName.toLowerCase() === 'p' ) {
contentNodes = Array.prototype.slice.apply( 
contentNodes[0].childNodes );
}
+
+   // Check if the final result of the imported template is empty.
+   // If it is empty, put an inline slug inside it so that it can
+   // be accessible to users (either to remove or edit)
+   if ( contentNodes.length === 0 ) {
+   contentNodes.push( ve.ce.BranchNode.$inlineSlugTemplate[0] );
+   }
deferred.resolve( contentNodes );
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib842b401e74d79b6382cada6bb7c6048b713977c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] AnnotationInspector insertion over blank selection - change (mediawiki...VisualEditor)

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

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


Change subject: AnnotationInspector insertion over blank selection
..

AnnotationInspector insertion over blank selection

This commit fixes two issues with insertion of annotations in blank space:
* LanguageInspector issue with inserting an language annotation inside any
  whitespace (selection of space between words or collapsed selection in
  blank line)
* AnnotationInspector issue with collapsed selection on the first line. If
  the marker was on the first blank line with collapsed selection, activating
  AnnotationInspector would expand the range to the closest word (on the next
  paragraph), probably because of the slug. This commit fixes that, and
  instead inserts a new annotation like in any other blank line.

Change-Id: I144eccefba16131a3d2ec6a3181adf47a15d6cc0
---
M modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
M modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
3 files changed, 14 insertions(+), 9 deletions(-)


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

diff --git a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js 
b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
index 6d5c59e..7448b7b 100644
--- a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
@@ -63,7 +63,7 @@
 
// Initialize range
if ( !annotation ) {
-   if ( fragment.getRange().isCollapsed() ) {
+   if ( fragment.getRange().isCollapsed()  
fragment.getRange().start  0 ) {
// Expand to nearest word
expandedFragment = fragment.expandRange( 'word' );
fragment = expandedFragment;
diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
index 0d4774e..3f2503d 100644
--- a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -149,14 +149,19 @@
var langCode, langDir, annData;
 
// Validate the given annotation:
+   if ( annotation ) {
+   // Give precedence to dir value if it already exists
+   // in the annotation:
+   langDir = annotation.getAttribute( 'dir' );
 
-   // Give precedence to dir value if it already exists
-   // in the annotation:
-   langDir = annotation.getAttribute( 'dir' );
-
-   // Set language according to the one in the given annotation
-   // or leave blank if element has no language set
-   langCode = annotation.getAttribute( 'lang' );
+   // Set language according to the one in the given annotation
+   // or leave blank if element has no language set
+   langCode = annotation.getAttribute( 'lang' );
+   } else {
+   // No annotation (empty text or collapsed fragment on empty 
line)
+   langCode = this.initLang;
+   langDir = this.initDir;
+   }
 
// If language exists, but dir is undefined/null,
// fix the dir in terms of language:
diff --git a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js 
b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
index 5605c77..21f08c9 100644
--- a/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
@@ -133,7 +133,7 @@
  */
 ve.ui.LanguageInputWidget.prototype.getValue = function () {
// Specifically to be displayed
-   return this.lang;
+   return this.$langNameDisp.text();
 };
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I144eccefba16131a3d2ec6a3181adf47a15d6cc0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Cursor fix after link insertion - change (mediawiki...VisualEditor)

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

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


Change subject: Cursor fix after link insertion
..

Cursor fix after link insertion

When a link was inserted, the cursor position was backwards (at the beginning
of the word rather than its end) - this commit fixes that problem.
Also, thanks for the help Ed!

Bug:53560
Change-Id: I04fe1ca4c9126898e7bf85cdf519794d66b4f38b
---
M modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js 
b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
index 1afb2b9..3d2de42 100644
--- a/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.AnnotationInspector.js
@@ -166,7 +166,7 @@
// Apply new annotation
fragment.annotateContent( 'set', annotation );
}
-   if ( action === 'back' ) {
+   if ( action === 'back' || insert ) {
// Restore selection to what it was before we expanded it
selection = this.previousSelection;
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I04fe1ca4c9126898e7bf85cdf519794d66b4f38b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP] Creating StickeredNode - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Creating StickeredNode
..

[WIP] Creating StickeredNode

StickerNode and StickerWidget will be used as menus over the top of a block
to give access to menu functionality and inspectors.

This is mainly for LanguageBlockNode functionality but can later be used
for tables as well.

Change-Id: Id97c3840d26a39cb5f6b4cea7a89e89b05b45325
---
M VisualEditor.php
M modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
A modules/ve/ce/ve.ce.StickeredNode.js
M modules/ve/ui/styles/ve.ui.Widget.css
A modules/ve/ui/ve.ui.Sticker.js
A modules/ve/ui/widgets/ve.ui.StickerWidget.js
6 files changed, 377 insertions(+), 1 deletion(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index e39b4de..8fd65c2 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -727,6 +727,9 @@
've/ui/tools/buttons/ve.ui.SubscriptButtonTool.js',
've/ui/tools/buttons/ve.ui.SuperscriptButtonTool.js',
've/ui/tools/buttons/ve.ui.UnderlineButtonTool.js',
+   've/ce/ve.ce.StickeredNode.js',
+   've/ui/ve.ui.Sticker.js',
+   've/ui/widgets/ve.ui.StickerWidget.js',
've/ce/nodes/ve.ce.LanguageBlockNode.js',
've/dm/nodes/ve.dm.LanguageBlockNode.js',
),
diff --git a/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js 
b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
index e081f35..f0c5c90 100644
--- a/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
+++ b/modules/ve/ce/nodes/ve.ce.LanguageBlockNode.js
@@ -21,6 +21,9 @@
// Events
this.model.connect( this, { 'update': 'onUpdate' } );
 
+   // Mixin constructors
+   ve.ce.StickeredNode.call( this );
+
this.$.attr( 'lang', model.getAttribute( 'lang' ) );
this.$.attr( 'dir', model.getAttribute( 'dir' ) );
 
@@ -32,6 +35,8 @@
 /* Inheritance */
 
 ve.inheritClass( ve.ce.LanguageBlockNode, ve.ce.BranchNode );
+
+ve.mixinClass( ve.ce.LanguageBlockNode, ve.ce.StickeredNode );
 
 /* Static Properties */
 
@@ -55,7 +60,6 @@
this.$.attr( 'dir', this.model.getAttribute( 'dir' ) );
 // this.updateTagName();
 };
-
 /* Registration */
 
 ve.ce.nodeFactory.register( ve.ce.LanguageBlockNode );
diff --git a/modules/ve/ce/ve.ce.StickeredNode.js 
b/modules/ve/ce/ve.ce.StickeredNode.js
new file mode 100644
index 000..ff1fe7c
--- /dev/null
+++ b/modules/ve/ce/ve.ce.StickeredNode.js
@@ -0,0 +1,48 @@
+/*!
+ * VisualEditor ContentEditable FocusableNode class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * ContentEditable stamped node.
+ *
+ * Node that pops a sticky menu at the top.
+ *
+ * @param {jQuery} [$stickered=this.$] description here
+ */
+ve.ce.StickeredNode = function VeCeStickeredNode( $stickered ) {
+   this.$stickered = $stickered || this.$;
+
+   this.$stickered.addClass( 've-ce-stickeredNode' );
+
+   this.$stickered.on( 'mouseenter', ve.bind( this.onMouseEnter, this ) );
+   this.$stickered.on( 'mouseleave', ve.bind( this.onMouseLeave, this ) );
+
+   this.surface = null;
+   this.sticker = null;
+   
+   this.focused = false;
+   // Events
+   this.connect( this, {
+   'setup': 'onStickeredSetup',
+///'resize': 'onFocusableResize',
+// 'rerender': 'onFocusableRerender',
+// 'live': 'onFocusableLive'
+   } );
+}
+
+ve.ce.StickeredNode.prototype.onStickeredSetup = function () {
+   this.surface = this.root.getSurface();
+   // Create Sticker:
+   this.sticker = new ve.ui.Sticker( this.surface.getSurface(), { '$$': 
this.$$, '$stickeredNode': this.$ } );
+   this.sticker.show( true );
+}
+
+ve.ce.StickeredNode.prototype.onMouseEnter = function () {
+   this.focused = true;
+};
+ve.ce.StickeredNode.prototype.onMouseLeave = function () {
+   this.focused = false;
+};
diff --git a/modules/ve/ui/styles/ve.ui.Widget.css 
b/modules/ve/ui/styles/ve.ui.Widget.css
index 2bf8ef3..3c78f35 100644
--- a/modules/ve/ui/styles/ve.ui.Widget.css
+++ b/modules/ve/ui/styles/ve.ui.Widget.css
@@ -575,3 +575,15 @@
border-bottom-left-radius: 0;
border-bottom-width: 0;
 }
+
+/* ve.ui.StickerWidget.js */
+.ve-ui-sticker,
+.ve-ui-sticker-inspectors,
+.ve-ui-sticker-menu {
+   position: absolute;
+}
+
+.ve-ui-stickerWidget {
+   width: 17.25em;
+   height: 3em;
+}
diff --git a/modules/ve/ui/ve.ui.Sticker.js b/modules/ve/ui/ve.ui.Sticker.js
new file mode 100644
index 000..a8593bf
--- /dev/null
+++ b/modules/ve/ui/ve.ui.Sticker.js
@@ -0,0 +1,205 @@
+/*!
+ * VisualEditor UserInterface Context 

[MediaWiki-commits] [Gerrit] Quickfix Language Tool - change (mediawiki...VisualEditor)

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

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


Change subject: Quickfix Language Tool
..

Quickfix Language Tool

Correcting the language span tool so the ve.ui.LanguageInspector has
static name changed from 'language' to 'meta/language'

Change-Id: I66fd3d2558663c9f1304365a11fd1276e204a7e7
---
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js 
b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
index 55e1823..b8d0570 100644
--- a/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
+++ b/modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
@@ -33,7 +33,7 @@
 
 /* Static properties */
 
-ve.ui.LanguageInspector.static.name = 'language';
+ve.ui.LanguageInspector.static.name = 'meta/language';
 
 ve.ui.LanguageInspector.static.icon = 'language';
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I66fd3d2558663c9f1304365a11fd1276e204a7e7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Allowing for config data when instantiating dialogs - change (mediawiki...VisualEditor)

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

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


Change subject: Allowing for config data when instantiating dialogs
..

Allowing for config data when instantiating dialogs

Currently, WindowSet open method uses the Window factory to call up
the instantiation of a new dialog or inspector class. This commit will
also allow sending further config options to these classes if needed.

Specifically, this will also allow the use of ve.ui.Context.js for
block inspectors that are not dependent on current selection or current
location of the cursor.

It will also let us generalize the dialog/inspector window instantiations
by adding in any needed config settings on call.

Change-Id: If14384d74ab91ef01b1c7641ff84f327f2a12112
---
M modules/ve/ui/ve.ui.Context.js
M modules/ve/ui/ve.ui.WindowSet.js
2 files changed, 6 insertions(+), 4 deletions(-)


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

diff --git a/modules/ve/ui/ve.ui.Context.js b/modules/ve/ui/ve.ui.Context.js
index 0a0825b..cfcb475 100644
--- a/modules/ve/ui/ve.ui.Context.js
+++ b/modules/ve/ui/ve.ui.Context.js
@@ -386,11 +386,12 @@
  *
  * @method
  * @param {string} name Symbolic name of inspector
+ * @param {Object} [config] Config options to be sent to the inspector class 
constructor
  * @chainable
  */
-ve.ui.Context.prototype.openInspector = function ( name ) {
+ve.ui.Context.prototype.openInspector = function ( name, config ) {
if ( !this.inspectors.currentWindow ) {
-   this.inspectors.open( name );
+   this.inspectors.open( name, config );
}
return this;
 };
diff --git a/modules/ve/ui/ve.ui.WindowSet.js b/modules/ve/ui/ve.ui.WindowSet.js
index 1c23fc7..769dd29 100644
--- a/modules/ve/ui/ve.ui.WindowSet.js
+++ b/modules/ve/ui/ve.ui.WindowSet.js
@@ -113,9 +113,10 @@
  *
  * @method
  * @param {string} name Symbolic name of window
+ * @param {Object} [config] Config options to be sent to the window class 
constructor
  * @chainable
  */
-ve.ui.WindowSet.prototype.open = function ( name ) {
+ve.ui.WindowSet.prototype.open = function ( name, config ) {
var win;
 
if ( !this.factory.lookup( name ) ) {
@@ -125,7 +126,7 @@
throw new Error( 'Cannot open another window while another one 
is active' );
}
if ( !( name in this.windows ) ) {
-   win = this.windows[name] = this.factory.create( name, 
this.surface );
+   win = this.windows[name] = this.factory.create( name, 
this.surface, config );
win.connect( this, {
'setup': ['onWindowSetup', win],
'open': ['onWindowOpen', win],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If14384d74ab91ef01b1c7641ff84f327f2a12112
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] BlockInspectorTool and StickerToolbar - change (mediawiki...VisualEditor)

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

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


Change subject: BlockInspectorTool and StickerToolbar
..

BlockInspectorTool and StickerToolbar

This change adds a 'BlockInspectorTool' whose purpose is to be used for
block nodes. The tool will have two functions; add a block node or edit
and existing block node. The add functionality is used when the tool is
called from the general toolbar, but the edit functionality is called when
this tool is called from the specific StickerToolbar that is associated
with the existing block node.

For the moment, this functionality is designed to be used mainly with the
languageblock div functionality, but it is designed to be generalized so
it can be used with other block nodes, like tables, etc.

In this change:
* BlockInspectorTool - defines a new sublcass for the inspector tool that
  is meant to work with block nodes for either edit or add functions.
* BlockInspectorAction - calls the designated inspector and sends over
  the edit details if needed. If the tool was called from the sticker
  toolbar, there is an associated ve.dm.Node that will be sent to the
  inspector.
* StickerToolbar - defines a new subclass for the toolbar that is
  specifically attached to a blocknode (through the upcoming 'stickernode'
  mixin. The new subclass allows to attach a specific node to the toolbar
  so the buttons and inspectors within it are associated with that node
  for editing.

Change-Id: I5efff0741eec68c820b29a7b8e68729ad2889f3d
---
M VisualEditor.php
A modules/ve/ui/actions/ve.ui.BlockInspectorAction.js
A modules/ve/ui/tools/ve.ui.BlockInspectorTool.js
A modules/ve/ui/ve.ui.StickerToolbar.js
4 files changed, 160 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index 6327d7e..4920ed4 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -702,6 +702,9 @@
've/ce/annotations/ve.ce.LanguageAnnotation.js',
've/ui/inspectors/ve.ui.LanguageInspector.js',
've/ui/widgets/ve.ui.LanguageInputWidget.js',
+   've/ui/tools/ve.ui.BlockInspectorTool.js',
+   've/ui/actions/ve.ui.BlockInspectorAction.js',
+   've/ui/ve.ui.StickerToolbar.js',
've/ui/tools/ve.ui.ExperimentalTool.js',
've-mw/ui/tools/ve.ui.MWExperimentalTool.js',
),
diff --git a/modules/ve/ui/actions/ve.ui.BlockInspectorAction.js 
b/modules/ve/ui/actions/ve.ui.BlockInspectorAction.js
new file mode 100644
index 000..ca16783
--- /dev/null
+++ b/modules/ve/ui/actions/ve.ui.BlockInspectorAction.js
@@ -0,0 +1,57 @@
+/*!
+ * VisualEditor UserInterface BlockInspectorAction class.
+ * Handling actions coming from an inspector of blocks or stickeredNodes
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * BlockInspector action.
+ *
+ * @class
+ * @extends ve.ui.Action
+ * @constructor
+ * @param {ve.ui.Surface} surface Surface to act on
+ */
+ve.ui.BlockInspectorAction = function VeUiBlockInspectorAction( surface ) {
+   // Parent constructor
+   ve.ui.Action.call( this, surface );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ui.BlockInspectorAction, ve.ui.Action );
+
+/* Static Properties */
+
+/**
+ * List of allowed methods for the action.
+ *
+ * @static
+ * @property
+ */
+ve.ui.BlockInspectorAction.static.methods = ['open', 'close'];
+
+/* Methods */
+
+/**
+ * Open an inspector.
+ *
+ * @method
+ * @param {string} name Symbolic name of inspector to open
+ * @param {boolean} isEditBlockAction dictates whether this is an 'edit' 
action for the block
+ * @param {ve.dm.Node} nodeModel if we are in 'edit' mode, this is the 
nodeModel that is to be edited
+ */
+ve.ui.BlockInspectorAction.prototype.open = function ( name, 
isEditBlockAction, nodeModel ) {
+   var props = {
+   'isBlock': true,
+   'isEditBlockAction': isEditBlockAction,
+   'nodeModel': nodeModel
+   };
+   this.surface.getContext().openInspector( name, props );
+};
+
+/* Registration */
+
+ve.ui.actionFactory.register( 'blockinspector', ve.ui.BlockInspectorAction );
diff --git a/modules/ve/ui/tools/ve.ui.BlockInspectorTool.js 
b/modules/ve/ui/tools/ve.ui.BlockInspectorTool.js
new file mode 100644
index 000..0ed759d
--- /dev/null
+++ b/modules/ve/ui/tools/ve.ui.BlockInspectorTool.js
@@ -0,0 +1,61 @@
+/*!
+ * VisualEditor UserInterface InspectorTool classes.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * UserInterface block inspector tool for block nodes 

[MediaWiki-commits] [Gerrit] [WIP] Migrating LanguageInspector to ve-MW - change (mediawiki...VisualEditor)

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

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


Change subject: [WIP] Migrating LanguageInspector to ve-MW
..

[WIP] Migrating LanguageInspector to ve-MW

Moving the ULS-dependent language inspector to ve-MW with a simple widget
fallback in ve core.

Change-Id: I48eaa63a65ed643969bf0975dfe7505edd22
---
M VisualEditor.php
A modules/ve-mw/ui/inspectors/ve.ui.MWLanguageInspector.js
A modules/ve-mw/ui/widgets/ve.ui.MWLanguageInputWidget.js
M modules/ve/ui/inspectors/ve.ui.LanguageInspector.js
M modules/ve/ui/widgets/ve.ui.LanguageInputWidget.js
5 files changed, 250 insertions(+), 78 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index 25c1d28..da34999 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -715,6 +715,8 @@
've/ui/widgets/ve.ui.LanguageInputWidget.js',
've/ui/tools/ve.ui.ExperimentalTool.js',
've-mw/ui/tools/ve.ui.MWExperimentalTool.js',
+   've-mw/ui/inspectors/ve.ui.MWLanguageInspector.js',
+   've-mw/ui/widgets/ve.ui.MWLanguageInputWidget.js'
),
'dependencies' = array(
'ext.visualEditor.core',
diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLanguageInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWLanguageInspector.js
new file mode 100644
index 000..2701b2c
--- /dev/null
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLanguageInspector.js
@@ -0,0 +1,64 @@
+/*!
+ * VisualEditor UserInterface LanguageInspector class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * MWLanguage inspector.
+ *
+ * @class
+ * @extends ve.ui.LanguageInspector
+ *
+ * @constructor
+ * @param {ve.ui.Surface} surface
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.MWLanguageInspector = function VeUiMWLanguageInspector( surface, config 
) {
+   // Parent constructor
+   ve.ui.LanguageInspector.call( this, surface, config );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ui.MWLanguageInspector, ve.ui.LanguageInspector );
+
+/* Static properties */
+
+ve.ui.MWLanguageInspector.static.languageInputWidget = 
ve.ui.MWLanguageInputWidget;
+
+/* Methods */
+
+/**
+ * Validates and sets the annotation value
+ * Then updates the attributes and the widget table display
+ *
+ * @method
+ * @param {ve.dm.LanguageAnnotation} annotation Language annotation
+ * @chainable
+ */
+ve.ui.MWLanguageInspector.prototype.setAnnotation = function ( annotation ) {
+   var langAttrs;
+
+   // Parent method
+   ve.ui.LanguageInspector.prototype.setAnnotation.call( this, annotation 
);
+
+   langAttrs = this.annotation.getAttributes();
+
+   if ( langAttrs.lang  !langAttrs.dir ) {
+   langAttrs.dir = $.uls.data.getDir( langAttrs.lang );
+   // Set the new annotation:
+   this.annotation = new ve.dm.LanguageAnnotation( {
+   'type': 'meta/language',
+   'attributes': langAttrs
+   } );
+   }
+
+   return this;
+};
+
+
+/* Registration */
+
+ve.ui.inspectorFactory.register( ve.ui.MWLanguageInspector );
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWLanguageInputWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWLanguageInputWidget.js
new file mode 100644
index 000..7289075
--- /dev/null
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWLanguageInputWidget.js
@@ -0,0 +1,125 @@
+/*!
+ * VisualEditor UserInterface LanguageInputWidget class.
+ *
+ * @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Creates an ve.ui.MWLanguageInputWidget object.
+ *
+ * @class
+ * @extends ve.ui.LanguageInputWidget
+ *
+ * @constructor
+ * @param {Object} [config] Configuration options
+ */
+ve.ui.MWLanguageInputWidget = function VeUiMWLanguageInputWidget( config ) {
+   // Parent constructor
+   ve.ui.LanguageInputWidget.call( this, config );
+};
+
+/* Inheritance */
+
+ve.inheritClass( ve.ui.MWLanguageInputWidget, ve.ui.LanguageInputWidget );
+
+/* Static properties */
+
+/* Methods */
+
+/**
+ * Build the visual widget html content
+ *
+ * use:
+ * - this.$langNameDisp for language display name (example: English)
+ * - this.$langCodeDisp for language code (example: en)
+ * - this.$dirDisp for language direction (example: ltr)
+ */
+ve.ui.MWLanguageInputWidget.prototype.buildWidget = function() {
+   var table, ulsParams, langInpObj;
+
+   // Create the informational table:
+   table = $( 'table' ).css( { 'width': '100%' } )
+   .addClass( 've-LanguageInspector-information' )
+   .append( $( 'tr' )
+   

[MediaWiki-commits] [Gerrit] Allow dynamic limit to maxDimensions - change (VisualEditor/VisualEditor)

2014-02-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Allow dynamic limit to maxDimensions
..

Allow dynamic limit to maxDimensions

Make sure that the ability to limit to maximum dimensions is dyamic
and can change. This is beneficial for when the image type changes
to thumbnail (which requires a limit) or to anything else (that can
allow for any size without limit.)

Also, allow for a forced revalidation of the current size widget
dimensions in case limits were applied or removed.

Change-Id: I362c7c378c5ccd7a83495b03e4429c9b93c1e9ee
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
M modules/ve/ve.Scalable.js
2 files changed, 35 insertions(+), 8 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/06/115306/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index c36ea65..0820e0a 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -137,12 +137,29 @@
this.widthInput.setValue( this.getCurrentDimensions().width );
this.heightInput.setValue( this.getCurrentDimensions().height );
 
-   this.errorLabel.$element.toggle( !this.isCurrentDimensionsValid() );
-   this.$element.toggleClass( 've-ui-mediaSizeWidget-input-hasError', 
!this.isCurrentDimensionsValid() );
+   this.validateDimensions( false );
 
this.preventChangeRecursion = false;
 };
 
+/**
+ * Explicitly call for validating the current dimensions. This is especially
+ * useful if we've changed conditions for the widget, like limiting image
+ * dimensions for thumbnails when the image type changes. Triggers the error
+ * class if needed.
+ *
+ * @param {boolean} isForced Force a re-evaluation even if this.valid is
+ * already set.
+ * @returns {boolean} Current dimensions are valid
+ */
+ve.ui.MediaSizeWidget.prototype.validateDimensions = function ( isForced ) {
+   var isValid = this.isCurrentDimensionsValid( isForced );
+   this.errorLabel.$element.toggle( !isValid );
+   this.$element.toggleClass( 've-ui-mediaSizeWidget-input-hasError', 
!isValid );
+
+   return isValid;
+};
+
 /** */
 ve.ui.MediaSizeWidget.prototype.setOriginalDimensions = function ( dimensions 
) {
// Parent method
diff --git a/modules/ve/ve.Scalable.js b/modules/ve/ve.Scalable.js
index 01df533..775106a 100644
--- a/modules/ve/ve.Scalable.js
+++ b/modules/ve/ve.Scalable.js
@@ -193,6 +193,14 @@
 ve.Scalable.prototype.isEnforcedMax = function () {
return this.enforceMax;
 };
+/**
+ * Set enforcement of maximum dimensions
+ *
+ * @param {boolean} Enforces the maximum dimensions
+ */
+ve.Scalable.prototype.setEnforcedMax = function ( isEnforcedMax ) {
+   this.enforceMax = isEnforcedMax;
+};
 
 /**
  * Get the fixed aspect ratio (width/height)
@@ -310,10 +318,12 @@
 /**
  * Checks whether the current dimensions are numeric and within range
  *
+ * @param {boolean} isForced Force a re-evaluation even if this.valid is
+ * already set.
  * @returns {boolean} Current dimensions are valid
  */
-ve.Scalable.prototype.isCurrentDimensionsValid = function () {
-   if ( this.valid === null ) {
+ve.Scalable.prototype.isCurrentDimensionsValid = function ( isForced ) {
+   if ( this.valid === null || isForced ) {
var dimensions = this.getCurrentDimensions(),
minDimensions = this.isEnforcedMin()  
this.getMinDimensions(),
maxDimensions = this.isEnforcedMax()  
this.getMaxDimensions();
@@ -323,14 +333,14 @@
$.isNumeric( dimensions.height ) 
(
!minDimensions || (
-   dimensions.width = minDimensions.width 

-   dimensions.height = 
minDimensions.height
+   dimensions.width = 
this.getMinDimensions().width 
+   dimensions.height = 
this.getMinDimensions().height
)
) 
(
!maxDimensions || (
-   dimensions.width = maxDimensions.width 

-   dimensions.height = 
maxDimensions.height
+   dimensions.width = 
this.getMaxDimensions().width 
+   dimensions.height = 
this.getMaxDimensions().height
)
)
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I362c7c378c5ccd7a83495b03e4429c9b93c1e9ee
Gerrit-PatchSet: 1

[MediaWiki-commits] [Gerrit] [wip] Limit thumbnail dimensions in media edit dialog - change (mediawiki...VisualEditor)

2014-02-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [wip] Limit thumbnail dimensions in media edit dialog
..

[wip] Limit thumbnail dimensions in media edit dialog

Add a dynamic limit to image dimensions; image is limited to its max
size if it is 'thumb' and unlimited in size otherwise.

This change depends on ve-core Scalable/MediaSizeWidget adjustment
https://gerrit.wikimedia.org/r/115306

Bug: 61282
Change-Id: I1247b1360ae50af039673fa3f2b3521e457ef578
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 29 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 6bb50fe..008ae11 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -263,6 +263,7 @@
// Events
this.applyButton.connect( this, { 'click': [ 'close', { 'action': 
'apply' } ] } );
this.positionCheckbox.connect( this, { 'change': 
'onPositionCheckboxChange' } );
+   this.typeInput.connect( this, { 'select': 'onTypeChange' } );
 
// Initialization
this.generalSettingsPage.$element.append( [
@@ -278,6 +279,22 @@
 
this.$body.append( this.bookletLayout.$element );
this.$foot.append( this.applyButton.$element );
+};
+
+/**
+ * Handle type change, particularly to and from 'thumb' to make
+ * sure size is limited.
+ */
+ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () {
+   if ( this.typeInput.getSelectedItem().getData() === 'thumb' ) {
+   // Tell the size widget to limit maxDimensions
+   this.sizeWidget.setEnforcedMax( true );
+   } else {
+   // Don't limit the widget for other types (Wikitext doesn't)
+   this.sizeWidget.setEnforcedMax( false );
+   }
+   // Re-validate the existing dimensions
+   this.sizeWidget.validateDimensions( true );
 };
 
 /**
@@ -374,6 +391,16 @@
dialog.sizeErrorLabel.$element.show();
} );
}
+
+   if (
+   this.mediaNode.getAttribute( 'type' ) === 'thumb' 
+   !this.sizeWidget.getMaxDimensions()
+   ) {
+   // Tell the size widget to limit maxDimensions to image's 
original dimensions
+   this.sizeWidget.setEnforcedMax( true );
+   } else {
+   this.sizeWidget.setEnforcedMax( false );
+   }
// Set initial alt text
this.altTextInput.setValue( this.mediaNode.getAttribute( 'alt' ) || '' 
);
 
@@ -452,6 +479,8 @@
// Change attributes only if the values are valid
if ( this.sizeWidget.isCurrentDimensionsValid() ) {
attrs = this.sizeWidget.getCurrentDimensions();
+
+   // Deal with default size
if (
this.mediaNode.getAttribute( 'defaultSize' ) 
(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1247b1360ae50af039673fa3f2b3521e457ef578
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add 'change' event to MediaSizeWidget - change (VisualEditor/VisualEditor)

2014-02-24 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Add 'change' event to MediaSizeWidget
..

Add 'change' event to MediaSizeWidget

Make sure other elements can respond to MediaSizeWidget's change
event, fired on changing the current dimensions.

Especially important for this commit:
https://gerrit.wikimedia.org/r/#/c/114420/

Change-Id: Ie96fd7f64655a1ba89781e3a8106e580a4febebe
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/38/115338/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 521da79..fe07778 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -110,6 +110,12 @@
 
 OO.mixinClass( ve.ui.MediaSizeWidget, ve.Scalable );
 
+/* Events */
+
+/**
+ * @event event
+ */
+
 /* Methods */
 
 /**
@@ -152,6 +158,8 @@
 /**
  * Overridden from ve.Scalable to allow one dimension to be set
  * at a time, write values back to inputs and show any errors.
+ *
+ * @fires change
  */
 ve.ui.MediaSizeWidget.prototype.setCurrentDimensions = function ( dimensions ) 
{
// Recursion protection
@@ -188,6 +196,8 @@
this.errorLabel.$element.toggle( !this.isCurrentDimensionsValid() );
this.$element.toggleClass( 've-ui-mediaSizeWidget-input-hasError', 
!this.isCurrentDimensionsValid() );
 
+   // Emit change event
+   this.emit( 'change' );
this.preventChangeRecursion = false;
 };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie96fd7f64655a1ba89781e3a8106e580a4febebe
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Use CSS to style figure and figcaption - change (mediawiki...VisualEditor)

2014-02-25 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Use CSS to style figure and figcaption
..

Use CSS to style figure and figcaption

In order to make the output if figure and figcaption as close to the
generalized parsoid output, this fix removes the explicit size dimensions
from figure and uses CSS styles instead to format the figure and caption.

Change-Id: I348e55ddea94f3b67f647c66ba53f7384d683584
---
M modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
M modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css
2 files changed, 10 insertions(+), 6 deletions(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
index 0828184..026705a 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWBlockImageNode.js
@@ -206,12 +206,6 @@
}
 
this.$image.css( dimensions );
-
-   this.$figure.css( {
-   // If we have a border then the width is increased by 2
-   'width': dimensions.width + ( this.captionVisible ? 2 : 0 ),
-   'height': this.captionVisible ? 'auto' : dimensions.height
-   } );
 };
 
 /**
diff --git a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css 
b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css
index 0290e39..6125611 100644
--- a/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css
+++ b/modules/ve-mw/init/styles/ve.init.mw.ViewPageTarget-shared.css
@@ -39,8 +39,18 @@
 figure[typeof='mw:Image/Thumb'], figure[typeof='mw:Image/Frame'] {
background-color: #f9f9f9;
border: 1px solid #cc;
+   border-bottom: none !important;
padding: 3px !important;
font-size: 94%;
+   display: table;
+}
+
+figcaption {
+   display: table-caption;
+   caption-side: bottom;
+   background-color: #f9f9f9;
+   border: 1px #cc solid !important;
+   border-top: none !important;
 }
 
 /* TODO: Merge with .thumbimage styles */

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I348e55ddea94f3b67f647c66ba53f7384d683584
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Default/custom switch size quickfix - change (mediawiki...VisualEditor)

2014-02-26 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Default/custom switch size quickfix
..

Default/custom switch size quickfix

Handling a bug where the placeholders weren't set to images that weren't
set to default size. The switch to 'default' failed because there were
no placeholders and data for default to go on. This is now fixed in this
commit; if the image is non-default, the values are given to the media
size widget from the config settings.

Change-Id: I402b8d4de606c0939daa316408fcf5de2f0b2181
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 17 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 98c4944..5d16c4b 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -372,8 +372,8 @@
if ( this.sizeSelectWidget.getSelectedItem().getData() === 'default' ) {
// Reset so placeholders appear
this.sizeWidget.setCurrentDimensions( {
-   'width': 0,
-   'height': 0
+   'width': '',
+   'height': ''
} );
} else {
// Fill the values as actual values into the size widget
@@ -387,7 +387,7 @@
  * @inheritdoc
  */
 ve.ui.MWMediaEditDialog.prototype.setup = function ( data ) {
-   var newDoc,
+   var newDoc, defaultBoundingBox,
dialog = this,
doc = this.surface.getModel().getDocument(),
mediaNodeView = this.surface.getView().getFocusedNode();
@@ -523,6 +523,20 @@
'height': 0
} );
} else {
+   // Set placeholders for the default bounding box
+   defaultBoundingBox = mw.config.get( 'wgVisualEditorConfig' )
+   .defaultUserOptions.defaultthumbsize;
+
+   if ( this.mediaNode.getAttribute( 'width' )  
this.mediaNode.getAttribute( 'height' ) ) {
+   this.sizeWidget.setPlaceholderDimensions( {
+   'width': defaultBoundingBox,
+   } );
+   } else {
+   this.sizeWidget.setPlaceholderDimensions( {
+   'height': defaultBoundingBox
+   } );
+   }
+
this.sizeSelectWidget.intializeSelection(
this.sizeSelectWidget.getItemFromData( 'custom' )
);

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I402b8d4de606c0939daa316408fcf5de2f0b2181
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add type 'none' to the media edit dialog - change (mediawiki...VisualEditor)

2014-02-27 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Add type 'none' to the media edit dialog
..

Add type 'none' to the media edit dialog

Deal with wikitext images that have no specifying type and allow users
to explicitly choose to set images for 'basic' (no type) in the media
edit dialog. Also make sure frameless images are bound by thumbnail
size rules.

Change-Id: I6778705306f0dd6bb96afeb91383089a4ddab7ed
---
M VisualEditor.php
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
4 files changed, 22 insertions(+), 2 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index 323434f..3a5fcda 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -701,6 +701,7 @@
'visualeditor-dialog-media-type-border',
'visualeditor-dialog-media-type-frame',
'visualeditor-dialog-media-type-frameless',
+   'visualeditor-dialog-media-type-none',
'visualeditor-dialog-media-type-section',
'visualeditor-dialog-media-type-thumb',
'visualeditor-dialogbutton-media-tooltip',
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 847631f..581ef2c 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -58,6 +58,7 @@
 visualeditor-dialog-media-type-border: Border,
 visualeditor-dialog-media-type-frame: Frame,
 visualeditor-dialog-media-type-frameless: Frameless,
+visualeditor-dialog-media-type-none: Basic,
 visualeditor-dialog-media-type-section: Image type,
 visualeditor-dialog-media-type-thumb: Thumbnail,
 visualeditor-dialog-meta-advancedsettings-label: Advanced settings,
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index c319c34..9aa3a4e 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -63,6 +63,7 @@
 visualeditor-dialog-media-type-border: Label for the image type option 
for bordered image.,
 visualeditor-dialog-media-type-frame: Label for the image type option 
for framed image.,
 visualeditor-dialog-media-type-frameless: Label for the image type 
option for frameless.,
+visualeditor-dialog-media-type-none: Label for the image type option 
for basic image.,
 visualeditor-dialog-media-type-section: Label for the image type 
sub-section.\n\nFollowed by the following buttons:\n* 
{{msg-mw|Visualeditor-dialog-media-type-thumb}}\n* 
{{msg-mw|Visualeditor-dialog-media-type-frame}}\n* 
{{msg-mw|Visualeditor-dialog-media-type-frameless}}\n* 
{{msg-mw|Visualeditor-dialog-media-type-border}},
 visualeditor-dialog-media-type-thumb: Label for the image type option 
for thumbnail.,
 visualeditor-dialog-meta-advancedsettings-label: Title for the advanced 
settings dialog section.\n{{Identical|Advanced settings}},
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 36eb437..16fd0bf 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -226,6 +226,10 @@
new OO.ui.ButtonOptionWidget( 'border', {
'$': this.$,
'label': ve.msg( 
'visualeditor-dialog-media-type-border' )
+   } ),
+   new OO.ui.ButtonOptionWidget( 'none', {
+   '$': this.$,
+   'label': ve.msg( 'visualeditor-dialog-media-type-none' )
} )
] );
 
@@ -326,7 +330,13 @@
  * sure size is limited.
  */
 ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () {
-   if ( this.typeInput.getSelectedItem().getData() === 'thumb' ) {
+   if (
+   this.typeInput.getSelectedItem().getData() === 'thumb' ||
+   // As per wikitext docs, both 'thumb' and 'frameless' have
+   // explicitly limited size, as opposed to the similar case
+   // of having no type specified
+   this.typeInput.getSelectedItem().getData() === 'frameless'
+   ) {
// Tell the size widget to limit maxDimensions
this.sizeWidget.setEnforcedMax( true );
} else {
@@ -505,6 +515,11 @@
this.typeInput.selectItem(
this.typeInput.getItemFromData( 
this.mediaNode.getAttribute( 'type' ) )
);
+   } else {
+   // Explicitly show 'none' if no type was specified
+   this.typeInput.selectItem(
+   this.typeInput.getItemFromData( 'none' )
+   );
}
 
// Initialize size
@@ -640,8 +655,10 @@

[MediaWiki-commits] [Gerrit] Make the 'full size' button optional - change (VisualEditor/VisualEditor)

2014-03-03 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Make the 'full size' button optional
..

Make the 'full size' button optional

Transform MediaSizeWidget's 'full size' button to appear only as an
optional configuration option. This is mainly used in the new correction
related to MediaEditoDialog type and default size change at
https://gerrit.wikimedia.org/r/#/c/115939/

Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 23 insertions(+), 12 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/47/116647/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 3a00044..661350a 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -27,6 +27,7 @@
// Configuration
config = config || {};
 
+   this.showOriginalDimensionsButton = 
!!config.showOriginalDimensionsButton;
// Parent constructor
OO.ui.Widget.call( this, config );
 
@@ -77,19 +78,26 @@
.append( [
heightLabel.$element,
this.heightInput.$element
-   ] ),
-   this.$( 'div' )
-   .addClass( 've-ui-mediaSizeWidget-button-originalSize' )
-   .append( this.originalDimensionsButton.$element ),
+   ] )
+   ] );
+   // Optionally append the original size button
+   if ( this.showOriginalDimensionsButton ) {
+   this.$element.append(
+   this.$( 'div' )
+   .addClass( 
've-ui-mediaSizeWidget-button-originalSize' )
+   .append( this.originalDimensionsButton.$element 
)
+   );
+   this.originalDimensionsButton.setDisabled( true );
+   // Events
+   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   }
+
+   // Append error message
+   this.$element.append(
this.$( 'div' )
.addClass( 've-ui-mediaSizeWidget-label-error' )
-   .append( this.errorLabel.$element ),
-   ] );
-
-   this.originalDimensionsButton.setDisabled( true );
-
-   // Events
-   this.originalDimensionsButton.connect( this, { 'click': 
'onButtonOriginalDimensionsClick' } );
+   .append( this.errorLabel.$element )
+   );
 
this.widthInput.connect( this, { 'change': 'onWidthChange' } );
this.heightInput.connect( this, { 'change': 'onHeightChange' } );
@@ -221,8 +229,11 @@
 ve.ui.MediaSizeWidget.prototype.setOriginalDimensions = function ( dimensions 
) {
// Parent method
ve.Scalable.prototype.setOriginalDimensions.call( this, dimensions );
+   this.emit( 'originaldimensions-available' );
// Enable the 'original dimensions' button
-   this.originalDimensionsButton.setDisabled( false );
+   if ( this.showOriginalDimensionsButton ) {
+   this.originalDimensionsButton.setDisabled( false );
+   }
 };
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie18e2e371f18f5e8ab37ad27810ff11e5ee92d32
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Inline CR fixes for Media Edit Dialog - change (mediawiki...VisualEditor)

2014-03-05 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Inline CR fixes for Media Edit Dialog
..

Inline CR fixes for Media Edit Dialog

Fixing several inline comments from the previous commit, and
reorganizing the usability of size select clicks to prevent loop
click bug.

Change-Id: I259d86e9bbe90270d8883b7a3de96979b1d5a156
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 61 insertions(+), 75 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 811d425..8cee8b0 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -324,48 +324,38 @@
  * the widget.
  */
 ve.ui.MWMediaEditDialog.prototype.onSizeWidgetChange = function () {
-   var selectedType = ( this.typeInput.getSelectedItem() ) ? 
this.typeInput.getSelectedItem().getData() : '';
+   var selectedType = this.typeInput.getSelectedItem() ? 
this.typeInput.getSelectedItem().getData() : '',
+   thumbOrFrameless = selectedType === 'thumb' || selectedType === 
'frameless';
+
// Switch to 'default' or 'custom' size
if ( this.sizeWidget.isEmpty() ) {
-   if (
-   selectedType === 'thumb' ||
-   selectedType === 'frameless'
-   ) {
-   this.sizeSelectWidget.selectItem(
-   this.sizeSelectWidget.getItemFromData( 
'default' )
-   );
-   } else {
-   this.sizeSelectWidget.selectItem(
-   this.sizeSelectWidget.getItemFromData( 'full' )
-   );
-   }
-   } else {
-   // If the value is full size for either thumb or frameless
-   // images, make sure the size select is on 'full' despite the
-   // fact that there are actual custom numbers in the
-   // size widget
-   if (
-   (
-   selectedType === 'thumb' ||
-   selectedType === 'frameless'
-   ) 
-   OO.compare(
-   this.sizeWidget.getCurrentDimensions(),
-   this.sizeWidget.getOriginalDimensions()
+   this.sizeSelectWidget.selectItem(
+   this.sizeSelectWidget.getItemFromData(
+   thumbOrFrameless ?
+   'default' :
+   'full'
)
-   ) {
-   this.sizeSelectWidget.selectItem(
-   this.sizeSelectWidget.getItemFromData( 'full' )
-   );
-   } else {
-   // Otherwise, when the widget has actual typed values, 
it
-   // is considerind 'custom' so clicking the 'full' button
-   // will result in removing size attributes altogether 
from
-   // the wikitext (faux-default)
-   this.sizeSelectWidget.selectItem(
-   this.sizeSelectWidget.getItemFromData( 'custom' 
)
-   );
-   }
+   );
+   } else {
+   this.sizeSelectWidget.selectItem(
+   this.sizeSelectWidget.getItemFromData(
+   thumbOrFrameless 
+   OO.compare(
+   this.sizeWidget.getCurrentDimensions(),
+   this.sizeWidget.getOriginalDimensions()
+   ) ?
+   // If the value is full size for either thumb 
or frameless
+   // images, make sure the size select is on 
'full' despite the
+   // fact that there are actual custom numbers 
in the
+   // size widget
+   'full' :
+   // Otherwise, when the widget has actual typed 
values, it
+   // is considerind 'custom' so clicking the 
'full' button
+   // will result in removing size attributes 
altogether from
+   // the wikitext (faux-default)
+   'custom'
+   )
+   );
}
 };
 
@@ -374,14 +364,14 @@
  * sure size is limited.
  */
 ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () {
-   var currentChoice = 

[MediaWiki-commits] [Gerrit] Enforce width-only default size only on larger images - change (mediawiki...VisualEditor)

2014-03-05 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Enforce width-only default size only on larger images
..

Enforce width-only default size only on larger images

While the documentation is unclear, it seems that the 'thumbsize' in
$wgDefaultUserOptions is setting up width limit rather than a general
bounding box.

Two things are adapted in this fix:

* Only resize the image if the image is bigger than default and marked
  as default size.
* Only limit width, even if the image is tall.
* Make sure new images follow these rules as well on insertion.

Bug: 62293
Change-Id: I37525bf3480bb1da8b0538f9b38576616aabbfa6
---
M modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
2 files changed, 7 insertions(+), 13 deletions(-)


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

diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
index 62d0292..8f28a5f 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWBlockImageNode.js
@@ -135,18 +135,15 @@
// rather than default MediaWiki configuration 
dimensions.
// We must force local wiki default in edit mode for 
default
// size images.
-   // FIXME if the image's original size is less than the 
default size,
-   // this is wrong.
-   if ( attributes.width  attributes.height ) {
+   // Only change the image size to default if the image 
isn't
+   // smaller than that defaut size
+   if (
+   attributes.width  defaultSizeBoundingBox
+   ) {
if ( attributes.height !== null ) {
-   attributes.height = ( attributes.height 
/ attributes.width ) * defaultSizeBoundingBox;
+   attributes.height = Math.round( ( 
attributes.height / attributes.width ) * defaultSizeBoundingBox );
}
attributes.width = defaultSizeBoundingBox;
-   } else {
-   if ( attributes.width !== null ) {
-   attributes.width = ( attributes.width / 
attributes.height ) * defaultSizeBoundingBox;
-   }
-   attributes.height = defaultSizeBoundingBox;
}
}
}
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
index de7828e..376c946 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaInsertDialog.js
@@ -170,12 +170,9 @@
if ( data.action === 'insert' ) {
info = this.item.imageinfo[0];
// Calculate proper size according to default thumb size limit
-   if ( info.width  info.height ) {
+   if ( info.width  this.defaultThumbSize ) {
thumbwidth = this.defaultThumbSize;
thumbheight = Math.round( ( info.height / info.width ) 
* thumbwidth );
-   } else {
-   thumbheight = this.defaultThumbSize;
-   thumbwidth = Math.round( ( info.width / info.height ) * 
thumbheight );
}

this.surface.getModel().getFragment().collapseRangeToEnd().insertContent( [
{

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I37525bf3480bb1da8b0538f9b38576616aabbfa6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Get item data from change event in select widget items - change (mediawiki...VisualEditor)

2014-03-06 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Get item data from change event in select widget items
..

Get item data from change event in select widget items

Fix a bug in MediaEditDialog that resulted from sync issues when the
'select' event is fired for OO.ui.ButtonSelectWidget widgets.

Use the details of the selected item given from the event rather than
checking the state of the widget with getSelectedItem().

Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 8 insertions(+), 11 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index f92d4ed..a9a77ed 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -375,9 +375,10 @@
 /**
  * Handle type change, particularly to and from 'thumb' to make
  * sure size is limited.
+ * @param {OO.ui.ButtonOptionWidget} item Selected item
  */
-ve.ui.MWMediaEditDialog.prototype.onTypeChange = function () {
-   var selectedType = this.typeInput.getSelectedItem() ? 
this.typeInput.getSelectedItem().getData() : '',
+ve.ui.MWMediaEditDialog.prototype.onTypeChange = function ( item ) {
+   var selectedType = item ? item.getData() : '',
thumbOrFrameless = selectedType === 'thumb' || selectedType === 
'frameless';
 
// As per wikitext docs, both 'thumb' and 'frameless' have
@@ -494,21 +495,17 @@
 
 /**
  * Respond to sizeSelectWidget change
+ * @param {OO.ui.ButtonOptionWidget} item Selected item
  */
-ve.ui.MWMediaEditDialog.prototype.onSizeSelectWidgetSelect = function () {
-   if (
-   this.sizeSelectWidget.getSelectedItem() 
-   this.sizeSelectWidget.getSelectedItem().getData() === 'default'
-   ) {
+ve.ui.MWMediaEditDialog.prototype.onSizeSelectWidgetSelect = function ( item ) 
{
+   var currentItem = item ? item.getData() : '';
+   if ( currentItem === 'default' ) {
// Reset so placeholders appear
this.sizeWidget.setCurrentDimensions( {
'width': 0,
'height': 0
} );
-   } else if (
-   this.sizeSelectWidget.getSelectedItem() 
-   this.sizeSelectWidget.getSelectedItem().getData() === 'full'
-   ) {
+   } else if ( currentItem === 'full' ) {
if (
this.typeInput.getSelectedItem() 
(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbbf722ff374e10b680a6b55ab99f5fc86480c40
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] If no media is found display a message in media insert dialog - change (mediawiki...VisualEditor)

2014-05-13 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: If no media is found display a message in media insert dialog
..

If no media is found display a message in media insert dialog

Add a message indicating to the user that no image results were
found in the media insert dialog in case no results are found.

Bug: 52463
Change-Id: I93aea897d864298bf891a90c2fb147f7d34df06d
---
M VisualEditor.php
M modules/ve-mw/i18n/en.json
M modules/ve-mw/i18n/qqq.json
M modules/ve-mw/ui/styles/widgets/ve.ui.MWMediaResultWidget.css
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
5 files changed, 28 insertions(+), 0 deletions(-)


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

diff --git a/VisualEditor.php b/VisualEditor.php
index a990bef..786b9bf 100644
--- a/VisualEditor.php
+++ b/VisualEditor.php
@@ -782,6 +782,7 @@
'visualeditor-dialog-media-content-section',
'visualeditor-dialog-media-insert-button',
'visualeditor-dialog-media-insert-title',
+   'visualeditor-dialog-media-noresults',
'visualeditor-dialog-media-page-advanced',
'visualeditor-dialog-media-page-general',
'visualeditor-dialog-media-position-center',
diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 3d562a0..9afe782 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -49,6 +49,7 @@
 visualeditor-dialog-media-content-section: Caption,
 visualeditor-dialog-media-insert-button: Insert media,
 visualeditor-dialog-media-insert-title: Insert media,
+visualeditor-dialog-media-noresults: No results found.,
 visualeditor-dialog-media-page-advanced: Advanced settings,
 visualeditor-dialog-media-page-general: General settings,
 visualeditor-dialog-media-position-center: Center,
diff --git a/modules/ve-mw/i18n/qqq.json b/modules/ve-mw/i18n/qqq.json
index b8671af..1c629e0 100644
--- a/modules/ve-mw/i18n/qqq.json
+++ b/modules/ve-mw/i18n/qqq.json
@@ -54,6 +54,7 @@
visualeditor-dialog-media-content-section: Label for the image 
content sub-section.\n{{Identical|Caption}},
visualeditor-dialog-media-insert-button: Used as label for the 
button.\n{{Identical|Insert media}},
visualeditor-dialog-media-insert-title: Media insert dialog title 
text.\n{{Identical|Insert media}},
+   visualeditor-dialog-media-noresults: Label notifying the user no 
results were found for the media search.,
visualeditor-dialog-media-page-advanced: Label for the advanced 
settings page in the media edit dialog.\n{{Identical|Advanced settings}},
visualeditor-dialog-media-page-general: Label for the general 
settings page in the media edit dialog.\n{{Identical|General settings}},
visualeditor-dialog-media-position-center: Label for the image 
position option for aligning to the 
center.\n{{Related|Visualeditor-dialog-media-position}}\n{{Identical|Center}},
diff --git a/modules/ve-mw/ui/styles/widgets/ve.ui.MWMediaResultWidget.css 
b/modules/ve-mw/ui/styles/widgets/ve.ui.MWMediaResultWidget.css
index 037d236..fcdcbf1 100644
--- a/modules/ve-mw/ui/styles/widgets/ve.ui.MWMediaResultWidget.css
+++ b/modules/ve-mw/ui/styles/widgets/ve.ui.MWMediaResultWidget.css
@@ -87,3 +87,7 @@
 .ve-ui-mwMediaResultWidget.oo-ui-optionWidget-selected 
.oo-ui-labeledElement-label {
background-color: #000;
 }
+
+.ve-ui-mwMediaSearchWidget-noresults {
+   padding-top: 1em;
+}
diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index de53f7b..3efc28d 100755
--- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
@@ -34,6 +34,13 @@
this.titles = {};
this.queryMediaSourcesCallback = ve.bind( this.queryMediaSources, this 
);
 
+   this.sourceCounter = 0;
+
+   this.$noItemsMessage = $( 'div' )
+   .addClass( 've-ui-mwMediaSearchWidget-noresults' )
+   .appendTo( this.$query )
+   .text( ve.msg( 'visualeditor-dialog-media-noresults' ) );
+
// Events
this.$results.on( 'scroll', ve.bind( this.onResultsScroll, this ) );
 
@@ -103,6 +110,10 @@
return;
}
 
+   // Reset counter
+   this.sourceCounter = 0;
+   this.$noItemsMessage.hide();
+
for ( i = 0, len = this.sources.length; i  len; i++ ) {
source = this.sources[i];
// If we don't have either 'apiurl' or 'scriptDirUrl'
@@ -159,6 +170,16 @@
 ve.ui.MWMediaSearchWidget.prototype.onMediaQueryAlways = function ( source ) {
source.request = null;
this.query.popPending();
+
+   // Count this source as done

[MediaWiki-commits] [Gerrit] Make sure originalDimensions are available before use - change (mediawiki...VisualEditor)

2014-05-13 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Make sure originalDimensions are available before use
..

Make sure originalDimensions are available before use

Before applying default size based on originalDimensions, make sure
these are available through the scalable call. The image will be
marked as default size, but the presentation will depend on whether
or not we have the defaultDimensions from the API.

Bug: 65239
Change-Id: I41b30498713e969bd24ef0ad3e9a074c6ffcdc3b
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 8 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 769deb8..bdedb88 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -621,10 +621,15 @@
// Figure out the default size
if ( imageType === 'thumb' || imageType === 'frame' ) {
// Default is thumb-default unless the image is 
originally smaller
-   if ( originalDimensions.width  this.defaultThumbSize ) 
{
-   attr = this.scalable.getDimensionsFromValue( { 
'width': this.defaultThumbSize } );
-   } else {
+   if (
+   originalDimensions 
+   originalDimensions.width  this.defaultThumbSize
+   ) {
attr = originalDimensions;
+   } else {
+   attr = this.scalable.getDimensionsFromValue( {
+   'width': this.defaultThumbSize
+   } );
}
} else {
// Default is full size

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I41b30498713e969bd24ef0ad3e9a074c6ffcdc3b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Hide 'no results found' once there's at least one result - change (mediawiki...VisualEditor)

2014-05-16 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Hide 'no results found' once there's at least one result
..

Hide 'no results found' once there's at least one result

Naturally, the 'no results found' should only appear as long as there
are actually no results found.

Bug: 52463
Change-Id: I0116b769b9e4995678975d43a74c54c4d426f672
---
M modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
1 file changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
index 24b6ed9..7d2147d 100755
--- a/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWMediaSearchWidget.js
@@ -181,6 +181,12 @@
this.$noItemsMessage.show();
}
}
+
+   // Even if the whole list of sources didn't finish yet
+   // if there are results, make the message go away
+   if ( this.results.getItems().length  0 ) {
+   this.$noItemsMessage.hide();
+   }
 };
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0116b769b9e4995678975d43a74c54c4d426f672
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Block object descriptions from edit - change (mediawiki...TemplateData)

2014-05-17 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Block object descriptions from edit
..

Block object descriptions from edit

Some descriptions allow for language objects. For the moment, these
should be blocked for editing so the original json string won't be
corrupted.

Change-Id: I9b13e2f3cfd805d382564e270484557567932a0f
---
M TemplateData.php
M i18n/en.json
M i18n/qqq.json
M modules/ext.templateDataGenerator.core.js
4 files changed, 31 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TemplateData 
refs/changes/44/133944/1

diff --git a/TemplateData.php b/TemplateData.php
index acc34e5..3d076c9 100644
--- a/TemplateData.php
+++ b/TemplateData.php
@@ -105,6 +105,7 @@
'templatedata-modal-table-param-type-string',
'templatedata-modal-table-param-type-undefined',
'templatedata-modal-table-param-type-user',
+   'templatedata-modal-table-param-uneditablefield',
'templatedata-modal-title',
'templatedata-modal-title-templatedesc',
'templatedata-modal-title-templateparams',
diff --git a/i18n/en.json b/i18n/en.json
index c928f5f..bede97c 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -52,6 +52,7 @@
templatedata-modal-table-param-type-string: String,
templatedata-modal-table-param-type-undefined: Undefined,
templatedata-modal-table-param-type-user: User,
+   templatedata-modal-table-param-uneditablefield: Uneditable,
templatedata-modal-title: Template documentation editor,
templatedata-modal-title-templatedesc: Template description,
templatedata-modal-title-templateparams: Template parameters
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 3d73e31..3cb1211 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -53,6 +53,7 @@
templatedata-modal-table-param-type-string: A possible parameter 
type: String,
templatedata-modal-table-param-type-undefined: A possible parameter 
type: Undefined,
templatedata-modal-table-param-type-user: A possible parameter type: 
User,
+   templatedata-modal-table-param-uneditablefield: Placeholder text 
notifying the user the field is uneditable,
templatedata-modal-title: Title of the modal popup.,
templatedata-modal-title-templatedesc: The title for the template 
description textbox,
templatedata-modal-title-templateparams: The title for the template 
parameters table
diff --git a/modules/ext.templateDataGenerator.core.js 
b/modules/ext.templateDataGenerator.core.js
index 0bc84f8..8be668e 100644
--- a/modules/ext.templateDataGenerator.core.js
+++ b/modules/ext.templateDataGenerator.core.js
@@ -278,11 +278,22 @@
paramsJson.params[paramid] 
paramsJson.params[paramid][paramAttr]
) {
-   // make sure we set the value correctly 
based on the DOM element
-   if ( paramAttrObj[paramAttr].prop( 
'type' ) === 'checkbox' ) {
-   paramAttrObj[paramAttr].prop( 
'checked', paramsJson.params[paramid][paramAttr] );
+   // Deal with 'description' being an 
object
+   if ( paramAttr === 'description' ) {
+   if ( $.isPlainObject( 
paramsJson.params[paramid][paramAttr] ) ) {
+   
paramAttrObj[paramAttr].prop( 'disabled', true );
+   
paramAttrObj[paramAttr].data( 'isObject', true );
+   
paramAttrObj[paramAttr].val( '[ ' + mw.msg( 
'templatedata-modal-table-param-uneditablefield' ) + ' ]' );
+   } else {
+   
paramAttrObj[paramAttr].val( paramsJson.params[paramid][paramAttr] );
+   }
} else {
-   paramAttrObj[paramAttr].val( 
paramsJson.params[paramid][paramAttr] );
+   // make sure we set the value 
correctly based on the DOM element
+   if ( 
paramAttrObj[paramAttr].prop( 'type' ) === 'checkbox' ) {
+   
paramAttrObj[paramAttr].prop( 'checked', paramsJson.params[paramid][paramAttr] 
);
+   } else {
+   
paramAttrObj[paramAttr].val( paramsJson.params[paramid][paramAttr] );
+ 

[MediaWiki-commits] [Gerrit] Fix MWImageModel's getImageNodeType() - change (mediawiki...VisualEditor)

2014-05-20 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix MWImageModel's getImageNodeType()
..

Fix MWImageModel's getImageNodeType()

* Fixing a typo in the getImageNodeType() method ('frame' was supposed
  to be 'frameless').
* Adding a check for type 'mwBlockImage' before editing/adding captions
* Using the node's getType() method instead of the model's where possible.
* Adjusting default alignment, so that when we check if it is set, it gives
  us the actual answer, which is always useful.

Bug: 65568
Change-Id: I1687d8c7430c723b52448a9e24641e2c30d85d6a
---
M modules/ve-mw/dm/models/ve.dm.MWImageModel.js
1 file changed, 39 insertions(+), 37 deletions(-)


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

diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js 
b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
index 28a8834..d2e102c 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
@@ -127,7 +127,7 @@
);
 
// If this is a block image, get the caption
-   if ( imgModel.getImageNodeType() === 'mwBlockImage' ) {
+   if ( node.getType() === 'mwBlockImage' ) {
captionNode = node.getCaptionNode();
if ( captionNode  captionNode.getLength()  0 ) {
imgModel.setCaptionDocument( doc.cloneFromRange( 
captionNode.getRange() ) );
@@ -145,7 +145,7 @@
  */
 ve.dm.MWImageModel.prototype.getImageNodeType = function () {
if (
-   ( this.getType() === 'frame' || this.getType() === 'none' ) 
+   ( this.getType() === 'frameless' || this.getType() === 'none' ) 

( !this.isAligned() || this.isDefaultAligned() )
) {
return 'mwInlineImage';
@@ -160,46 +160,49 @@
  * @param {ve.dm.Surface} surfaceModel Surface model of main document
  */
 ve.dm.MWImageModel.prototype.updateImageNode = function ( surfaceModel ) {
-   var captionRange,
+   var captionRange, captionNode,
doc = surfaceModel.getDocument(),
-   captionNode = this.getMediaNode().getCaptionNode();
+   node = this.getMediaNode();
 
// Update the caption
-   if ( !captionNode ) {
-   // There was no caption before, so insert one now
-   surfaceModel.getFragment()
-   .adjustRange( 1 )
-   .collapseRangeToStart()
-   .insertContent( [ { 'type': 'mwImageCaption' }, { 
'type': '/mwImageCaption' } ] );
-   // Update the caption node
-   captionNode = this.getMediaNode().getCaptionNode();
+   if ( node.getType() === 'mwBlockImage' ) {
+   captionNode = node.getCaptionNode();
+   if ( !captionNode ) {
+   // There was no caption before, so insert one now
+   surfaceModel.getFragment()
+   .adjustRange( 1 )
+   .collapseRangeToStart()
+   .insertContent( [ { 'type': 'mwImageCaption' }, 
{ 'type': '/mwImageCaption' } ] );
+   // Update the caption node
+   captionNode = this.getMediaNode().getCaptionNode();
+   }
+
+   captionRange = captionNode.getRange();
+
+   // Remove contents of old caption
+   surfaceModel.change(
+   ve.dm.Transaction.newFromRemoval(
+   doc,
+   captionRange,
+   true
+   )
+   );
+
+   // Add contents of new caption
+   surfaceModel.change(
+   ve.dm.Transaction.newFromDocumentInsertion(
+   doc,
+   captionRange.start,
+   this.getCaptionDocument()
+   )
+   );
}
-
-   captionRange = captionNode.getRange();
-
-   // Remove contents of old caption
-   surfaceModel.change(
-   ve.dm.Transaction.newFromRemoval(
-   doc,
-   captionRange,
-   true
-   )
-   );
-
-   // Add contents of new caption
-   surfaceModel.change(
-   ve.dm.Transaction.newFromDocumentInsertion(
-   doc,
-   captionRange.start,
-   this.getCaptionDocument()
-   )
-   );
 
// Update attributes
surfaceModel.change(
ve.dm.Transaction.newFromAttributeChanges(
doc,
-   this.mediaNode.getOffset(),
+   node.getOffset(),
  

[MediaWiki-commits] [Gerrit] Adjust newNode range and fallback in MWImageModel - change (mediawiki...VisualEditor)

2014-05-20 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Adjust newNode range and fallback in MWImageModel
..

Adjust newNode range and fallback in MWImageModel

When inserting a new node, get the proper fragment range and ask
for the node from within the search loop. Also added a fallback
for the case that the node wasn't found, and a caption cannot
be added.

Depends on I8c75c875caad48f28c3da3fe7cee395365c8814a

Change-Id: Ic19d9b1cd2739435137f633de09a13b25a11a0cb
---
M modules/ve-mw/dm/models/ve.dm.MWImageModel.js
1 file changed, 2 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js 
b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
index d2e102c..ea6d553 100644
--- a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
+++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
@@ -243,7 +243,6 @@
 
// Insert the new image
coveredNodes = fragment
-   .collapseRangeToEnd()
.insertContent( contentToInsert )
.getCoveredNodes();
 
@@ -254,6 +253,7 @@
coveredNodes[i].node.type === 'mwInlineImage'
) {
newNodeRange = coveredNodes[i].nodeOuterRange;
+   newNode = coveredNodes[i].node;
break;
}
}
@@ -261,10 +261,9 @@
// Select the new node (without extras)
newFragment = surfaceModel.getFragment( newNodeRange );
newFragment.select();
-   newNode = newFragment.getSelectedNode();
 
// Check if there should be a caption
-   if ( newNode.getType() === 'mwBlockImage' ) {
+   if ( newNode  newNode.getType() === 'mwBlockImage' ) {
 
if ( this.getCaptionDocument().data.getLength()  4 ) {
// Add contents of new caption

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic19d9b1cd2739435137f633de09a13b25a11a0cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Don't update image model twice - change (mediawiki...VisualEditor)

2014-05-21 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Don't update image model twice
..

Don't update image model twice

The image model is updated through events from the edit dialog.
There is no need to update the states of the select/checkboxes
at the end in 'apply'. The only inputs that are not updated
on change are caption and alternate text.

Bug: 65564
Change-Id: I18c009546120e270467418cff677ec491fd109ca
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 1 insertion(+), 12 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 1a10110..9c93638 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -526,21 +526,10 @@
this.imageModel.setAltText(
this.altTextInput.getValue()
);
+
this.imageModel.setCaptionDocument(
this.captionSurface.getSurface().getModel().getDocument()
);
-
-   if ( this.typeInput.getSelectedItem() ) {
-   this.imageModel.setType(
-   this.typeInput.getSelectedItem().getData()
-   );
-   }
-   if ( this.positionCheckbox.getValue()  
this.positionInput.getSelectedItem() ) {
-   this.imageModel.setAlignment(
-   this.positionInput.getSelectedItem().getData()
-   );
-   }
-   this.imageModel.toggleBorder( this.borderCheckbox.getValue() );
 
// Check if the image node changed from inline to block or
// vise versa

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18c009546120e270467418cff677ec491fd109ca
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Updating scalable default in MediaSizeWidget - change (VisualEditor/VisualEditor)

2014-05-05 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Updating scalable default in MediaSizeWidget
..

Updating scalable default in MediaSizeWidget

Updating defaults when scalable is attached to media size widget.
This makes sure the defaults are loaded initially; they will change
later by the scalable default change event.

h/t Roan for figuring this out.

Change-Id: Ie45419a9f88694484d072dbc28d451fdc0ba06c1
---
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/17/131617/1

diff --git a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js 
b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
index 1075bc8..1fa98b2 100644
--- a/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
+++ b/modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
@@ -279,6 +279,7 @@
this.scalable.connect( this, { 'defaultSizeChange': 
'onScalableDefaultSizeChange' } );
// Reset current dimensions to new scalable object
this.setCurrentDimensions( this.scalable.getCurrentDimensions() );
+   this.updateDefaultDimensions();
 
// If we don't have original dimensions, disable the full size button
if ( !this.scalable.getOriginalDimensions() ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie45419a9f88694484d072dbc28d451fdc0ba06c1
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Add MobileSurface to .docs/eg-iframe.html - change (mediawiki...VisualEditor)

2014-05-08 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Add MobileSurface to .docs/eg-iframe.html
..

Add MobileSurface to .docs/eg-iframe.html

Change-Id: Id3b84ac20f81be470e541d5e45f6dd93cfcb9c8c
---
M .docs/eg-iframe.html
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/.docs/eg-iframe.html b/.docs/eg-iframe.html
index c921340..950d8cb 100644
--- a/.docs/eg-iframe.html
+++ b/.docs/eg-iframe.html
@@ -42,6 +42,7 @@
link rel=stylesheet 
href=lib/ve/modules/ve/ui/themes/apex/ve.ui.Inspector.css
 
!-- visualEditor.mobile --
+   link rel=stylesheet 
href=lib/ve/modules/ve/ui/styles/ve.ui.MobileSurface.css
link rel=stylesheet 
href=lib/ve/modules/ve/ui/styles/ve.ui.MobileContext.css
 
!-- example styles --

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3b84ac20f81be470e541d5e45f6dd93cfcb9c8c
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Cache image scalable promises by filename - change (mediawiki...VisualEditor)

2014-05-08 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Cache image scalable promises by filename
..

Cache image scalable promises by filename

Make sure that each api request per file is delivered once. If the
file appears more than once on the page, the api request for
scalable details will be sent once and cached so there aren't
multiple api requests per image.

Change-Id: I68507a8ceb31b77dbf33d1074939ce6219cf076e
---
M modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
1 file changed, 39 insertions(+), 21 deletions(-)


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

diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
index 6a0c1b9..1729720 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWImageNode.js
@@ -46,6 +46,16 @@
 
 OO.mixinClass( ve.dm.MWImageNode, ve.dm.ResizableNode );
 
+/* Static Properties */
+
+/**
+ * Cache the scalable promises to make sure that the same image
+ * doesn't release multiple api requests.
+ *
+ * @property {Object}
+ */
+ve.dm.MWImageNode.static.promiseCache = {}
+
 /* Methods */
 
 /**
@@ -167,28 +177,36 @@
// On the first call set off an async call to update the scalable's
// original dimensions from the API.
if ( !this.scalablePromise ) {
-   this.scalablePromise = ve.init.mw.Target.static.apiRequest(
-   {
-   'action': 'query',
-   'prop': 'imageinfo',
-   'indexpageids': '1',
-   'iiprop': 'size|mediatype',
-   'titles': this.getFilename()
-   },
-   { 'type': 'POST' }
-   ).then( ve.bind( function ( response ) {
-   var page = response.query  
response.query.pages[response.query.pageids[0]],
-   info = page  page.imageinfo  
page.imageinfo[0];
+   // Check if the promise is already cached
+   if ( !ve.dm.MWImageNode.static.promiseCache[this.getFilename()] 
) {
+   this.scalablePromise = 
ve.init.mw.Target.static.apiRequest(
+   {
+   'action': 'query',
+   'prop': 'imageinfo',
+   'indexpageids': '1',
+   'iiprop': 'size|mediatype',
+   'titles': this.getFilename()
+   },
+   { 'type': 'POST' }
+   ).then( ve.bind( function ( response ) {
+   var page = response.query  
response.query.pages[response.query.pageids[0]],
+   info = page  page.imageinfo  
page.imageinfo[0];
 
-   if ( info ) {
-   this.getScalable().setOriginalDimensions( {
-   'width': info.width,
-   'height': info.height
-   } );
-   // Update media type
-   this.mediaType = info.mediatype;
-   }
-   }, this ) ).promise();
+   if ( info ) {
+   
this.getScalable().setOriginalDimensions( {
+   'width': info.width,
+   'height': info.height
+   } );
+   // Update media type
+   this.mediaType = info.mediatype;
+   }
+   }, this ) ).promise();
+   // Cache the promise
+   
ve.dm.MWImageNode.static.promiseCache[this.getFilename()] = 
this.scalablePromise;
+   } else {
+   // If there is a promise for this image in cache, 
retrieve it
+   this.scalablePromise = 
ve.dm.MWImageNode.static.promiseCache[this.getFilename()];
+   }
}
return this.scalablePromise;
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I68507a8ceb31b77dbf33d1074939ce6219cf076e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org

[MediaWiki-commits] [Gerrit] Show/hide the magnify button on type change - change (mediawiki...VisualEditor)

2014-03-10 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Show/hide the magnify button on type change
..

Show/hide the magnify button on type change

Make sure the magnify button in the caption is properly shown or
hidden when image type changes. The magnify icon will always be
built, but will be shown and hidden using CSS rules.

Bug: 62139
Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4
---
M .docs/eg-iframe.html
M modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js
M modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css
3 files changed, 16 insertions(+), 13 deletions(-)


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

diff --git a/.docs/eg-iframe.html b/.docs/eg-iframe.html
index e1d4211..f6ea85b 100644
--- a/.docs/eg-iframe.html
+++ b/.docs/eg-iframe.html
@@ -6,6 +6,7 @@
 
!-- oojs-ui --
link rel=stylesheet href=lib/ve/lib/oojs-ui/oojs-ui.svg.css
+   link rel=stylesheet href=lib/ve/lib/oojs-ui/oojs-ui-apex.css
 
!-- visualEditor.standalone --
link rel=stylesheet 
href=lib/ve/modules/ve/init/sa/styles/ve.init.sa.css
diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js
index 1eb99cb..c612964 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWImageCaptionNode.js
@@ -37,26 +37,24 @@
 /* Methods */
 
 /**
- * TODO: Magnify should appear/disappear based on the changes/updates to the 
parent (switching to
- * and from thumb or frame).
+ * Reset the magnify button if the structure of the caption changed,
+ * so it is always rendered in the right place.
+ *
+ * The magnify icon will always be attached to the caption; we
+ * handle hiding and showing it per block image type in the CSS rules.
  */
 ve.ce.MWImageCaptionNode.prototype.onSplice = function () {
-   var parentType = this.model.getParent().getAttribute( 'type' );
-
-   if ( parentType === 'thumb' ) {
-   if ( this.$magnify ) {
-   this.$magnify.detach();
-   } else {
-   this.buildMagnify();
-   }
+   if ( this.$magnify ) {
+   this.$magnify.detach();
+   } else {
+   this.buildMagnify();
}
 
// Parent method
ve.ce.BranchNode.prototype.onSplice.apply( this, arguments );
 
-   if ( parentType === 'thumb' ) {
-   this.$magnify.prependTo( this.$element );
-   }
+   // Reset the magnify icon, prepend it to the caption
+   this.$magnify.prependTo( this.$element );
 };
 
 /** */
diff --git a/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css 
b/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css
index b139054..52cce17 100644
--- a/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css
+++ b/modules/ve-mw/ce/styles/ve.ce.MWBlockImageNode.css
@@ -41,6 +41,10 @@
float: left;
 }
 
+figure:not([typeof='mw:Image/Thumb']) figcaption .magnify {
+   display:none;
+}
+
 /* TODO: Merge with div.thumbinner styles */
 figure[typeof='mw:Image/Thumb'], figure[typeof='mw:Image/Frame'] {
overflow: hidden;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9a4569239ed70d16a153fb0823e283203fba1d4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Deal with images whose size is smalled than default - change (mediawiki...VisualEditor)

2014-03-11 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Deal with images whose size is smalled than default
..

Deal with images whose size is smalled than default

When an image smaller than the default size, the placeholder 'default'
value will be the image's actual size. This means that if a user selects
default thumb size for the image, it won't be change unless the original
size is bigger than the default. Also adjusted so that default size limits
width only, and not acts as a bounding box on size change.

Bug: 62293
Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index a9a77ed..0711073 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -386,15 +386,16 @@
// of having no type specified
if ( thumbOrFrameless ) {
 
-   // Set the placeholders to be wiki default
-   if ( this.mediaNode.getAttribute( 'width' )  
this.mediaNode.getAttribute( 'height' ) ) {
+   // Set the placeholders to be wiki default, but only if the 
image
+   // is not smaller. Limit on width only (according to wikitext 
default)
+   if ( this.mediaNode.getAttribute( 'width' )  
this.defaultThumbSize ) {
this.sizeWidget.setPlaceholderDimensions( {
'width': this.defaultThumbSize,
} );
} else {
-   this.sizeWidget.setPlaceholderDimensions( {
-   'height': this.defaultThumbSize
-   } );
+   // The image is smaller than wiki default. Make the 
default dimensions
+   // the image max size
+   this.sizeWidget.setPlaceholderDimensions( 
this.sizeWidget.getOriginalDimensions() );
}
 
// Enable the size select widget 'default' option

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8341776794843ff63a93bedeadf5921851c57a26
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix regression bug 'default size' change on alignment - change (mediawiki...VisualEditor)

2014-03-12 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix regression bug 'default size' change on alignment
..

Fix regression bug 'default size' change on alignment

* Corrected the condition that set default size only if the image
  wasn't smaller than the default.
* Added a couple of sanity check conditions for the OO.Compare
  condition

Bug: 62586
Bug: 62581
Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 13 insertions(+), 7 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 0711073..1d20a0d 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -353,6 +353,10 @@
this.sizeSelectWidget.selectItem(
this.sizeSelectWidget.getItemFromData(
thumbOrFrameless 
+   // Sanity check just in case before the 
comparison
+   this.sizeWidget.getCurrentDimensions() 
+   // Make sure there are original dimensions set 
up
+   this.sizeWidget.getOriginalDimensions() 
OO.compare(
this.sizeWidget.getCurrentDimensions(),
this.sizeWidget.getOriginalDimensions()
@@ -378,24 +382,24 @@
  * @param {OO.ui.ButtonOptionWidget} item Selected item
  */
 ve.ui.MWMediaEditDialog.prototype.onTypeChange = function ( item ) {
-   var selectedType = item ? item.getData() : '',
+   var originalDimensions = this.sizeWidget.getOriginalDimensions(),
+   selectedType = item ? item.getData() : '',
thumbOrFrameless = selectedType === 'thumb' || selectedType === 
'frameless';
 
// As per wikitext docs, both 'thumb' and 'frameless' have
// explicitly limited size, as opposed to the similar case
// of having no type specified
if ( thumbOrFrameless ) {
-
// Set the placeholders to be wiki default, but only if the 
image
// is not smaller. Limit on width only (according to wikitext 
default)
-   if ( this.mediaNode.getAttribute( 'width' )  
this.defaultThumbSize ) {
+   if ( originalDimensions.width  this.defaultThumbSize ) {
this.sizeWidget.setPlaceholderDimensions( {
'width': this.defaultThumbSize,
} );
} else {
// The image is smaller than wiki default. Make the 
default dimensions
// the image max size
-   this.sizeWidget.setPlaceholderDimensions( 
this.sizeWidget.getOriginalDimensions() );
+   this.sizeWidget.setPlaceholderDimensions( 
originalDimensions );
}
 
// Enable the size select widget 'default' option
@@ -408,9 +412,7 @@
// Technically, this is the 'default' of non thumb/frameless
// images, as that is the size that they render in when
// no size is specified.
-   this.sizeWidget.setPlaceholderDimensions(
-   this.sizeWidget.getOriginalDimensions()
-   );
+   this.sizeWidget.setPlaceholderDimensions( originalDimensions );
 
// Don't allow for 'default' choice
this.sizeSelectWidget.getItemFromData( 'default' ).setDisabled( 
true );
@@ -443,6 +445,10 @@
// thumbnail or frameless
if (
thumbOrFrameless 
+   // Sanity check just in case before the comparison
+   this.sizeWidget.getCurrentDimensions() 
+   // Make sure there are original dimensions set up
+   this.sizeWidget.getOriginalDimensions() 
OO.compare(
this.sizeWidget.getCurrentDimensions(),
this.sizeWidget.getOriginalDimensions()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4db996cec33ac9d53ef485b53568100e3912c4ae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] [WIP^2] Refactor Scalable and MediaSizeWidget - change (VisualEditor/VisualEditor)

2014-03-19 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: [WIP^2] Refactor Scalable and MediaSizeWidget
..

[WIP^2] Refactor Scalable and MediaSizeWidget

Scalable is now a dm calculation engine, responsible for all the
size and constraint calculations of a scalable object. MediaSizeWidget
takes a scalable object to interact with the user and process the values
supplied.

**
This commit is up on gerrit for backup purposes since my VM is
unpredictable. The commit requests you not look at it. It's hedious.
Seriously. Move along. Nothing to see here just yet.
***

Change-Id: Ie7ca3bbbe5d0287c7ce17d296c1827b8213ea950
---
M modules/ve/ce/ve.ce.ResizableNode.js
A modules/ve/dm/ve.dm.ResizableNode.js
R modules/ve/dm/ve.dm.Scalable.js
A modules/ve/ui/widgets/ve.ui.DimensionsWidget.js
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
5 files changed, 505 insertions(+), 154 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/35/119435/1

diff --git a/modules/ve/ce/ve.ce.ResizableNode.js 
b/modules/ve/ce/ve.ce.ResizableNode.js
index 89372e5..6c31ab1 100644
--- a/modules/ve/ce/ve.ce.ResizableNode.js
+++ b/modules/ve/ce/ve.ce.ResizableNode.js
@@ -23,9 +23,6 @@
 ve.ce.ResizableNode = function VeCeResizableNode( $resizable, config ) {
config = config || {};
 
-   // Mixin constructors
-   ve.Scalable.call( this, config );
-
// Properties
this.$resizable = $resizable || this.$element;
this.resizing = false;
@@ -68,15 +65,15 @@
.addClass( 've-ce-resizableNode-swHandle 
ve-ui-icon-resize-ne-sw' )
.data( 'handle', 'sw' ) );
 
-   this.setCurrentDimensions( {
-   'width': this.model.getAttribute( 'width' ),
-   'height': this.model.getAttribute( 'height' )
-   } );
+   // Scalable object ftw
+   this.scalable = this.model.getScalable();
+// this.setCurrentDimensions( {
+// 'width': this.model.getAttribute( 'width' ),
+// 'height': this.model.getAttribute( 'height' )
+// } );
 };
 
 /* Inheritance */
-
-OO.mixinClass( ve.ce.ResizableNode, ve.Scalable );
 
 /* Events */
 
@@ -115,12 +112,12 @@
 
 /** */
 ve.ce.ResizableNode.prototype.setOriginalDimensions = function ( dimensions ) {
-   // Parent method
-   ve.Scalable.prototype.setOriginalDimensions.call( this, dimensions );
+   this.scalable.setOriginalDimensions( dimensions );
+// ve.Scalable.prototype.setOriginalDimensions.call( this, dimensions );
// If dimensions are valid and the scale label is desired, enable it
this.canShowScaleLabel = this.showScaleLabel 
-   this.getOriginalDimensions().width 
-   this.getOriginalDimensions().height;
+   this.scalable.getOriginalDimensions().width 
+   this.scalable.getOriginalDimensions().height;
 };
 
 /**
diff --git a/modules/ve/dm/ve.dm.ResizableNode.js 
b/modules/ve/dm/ve.dm.ResizableNode.js
new file mode 100644
index 000..198ca53
--- /dev/null
+++ b/modules/ve/dm/ve.dm.ResizableNode.js
@@ -0,0 +1,36 @@
+/*!
+ * VisualEditor DataModel Resizable node.
+ *
+ * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * A mixin class for resizable nodes.
+ *
+ * @class
+ * @abstract
+ * @constructor
+ */
+ve.dm.ResizableNode = function VeDmResizableNode( config ) {
+   config = config || {};
+};
+
+/**
+ * Produce a scalable object based on the current object's
+ * properties. This should be overriden in the specific instances
+ * of resizable nodes; the basic operation assumes at least current
+ * width and height.
+ * @returns {ve.dm.Scalable} Scalable object
+ */
+ve.dm.ResizableNode.prototype.getScalable = function() {
+   var width = this.getAttribute( 'width' ),
+   height = this.getAttribute( 'height' );
+
+   return new ve.dm.Scalable( {
+   'currentDimensions': {
+   'width': width,
+   'height': height,
+   }
+   } );
+};
diff --git a/modules/ve/ve.Scalable.js b/modules/ve/dm/ve.dm.Scalable.js
similarity index 76%
rename from modules/ve/ve.Scalable.js
rename to modules/ve/dm/ve.dm.Scalable.js
index bc1bf23..e3fe77e 100644
--- a/modules/ve/ve.Scalable.js
+++ b/modules/ve/dm/ve.dm.Scalable.js
@@ -1,5 +1,5 @@
 /*!
- * VisualEditor Scalable class.
+ * VisualEditor DataModel Scalable class.
  *
  * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
  * @license The MIT License (MIT); see LICENSE.txt
@@ -21,15 +21,21 @@
  * @cfg {boolean} [enforceMin=true] Enforce the minimum dimensions
  * @cfg {boolean} [enforceMax=true] Enforce the maximum dimensions
  */
-ve.Scalable = function VeScalable( config ) {
+ve.dm.Scalable = function VeDmScalable( config ) {
   

[MediaWiki-commits] [Gerrit] Fix 'original dimensions' async call in MediaEdit dialog - change (mediawiki...VisualEditor)

2014-03-21 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix 'original dimensions' async call in MediaEdit dialog
..

Fix 'original dimensions' async call in MediaEdit dialog

The request for originalDimensions is taken from the API, which can be
rather slow. There is a future (soon) fix that refactors the entire way
we read the originalDimensions asynchronously and load it into the dialog
but until that is available, this fix introduces a couple of basic
fallbacks in case originalDimensions are not yet available in the size
widget.

Bug: 62024
Change-Id: I8d00cea6f1d667359a44a6c185c16340bc6e81c9
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 16 insertions(+), 9 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index 09f6825..926c9d7 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -385,9 +385,11 @@
  * @param {OO.ui.ButtonOptionWidget} item Selected item
  */
 ve.ui.MWMediaEditDialog.prototype.onTypeChange = function ( item ) {
-   var originalDimensions = this.sizeWidget.getOriginalDimensions(),
+   var originalDimensions,
selectedType = item ? item.getData() : '',
thumbOrFrameless = selectedType === 'thumb' || selectedType === 
'frameless';
+
+   originalDimensions = this.sizeWidget.getOriginalDimensions() || {};
 
// As per wikitext docs, both 'thumb' and 'frameless' have
// explicitly limited size, as opposed to the similar case
@@ -395,14 +397,14 @@
if ( thumbOrFrameless ) {
// Set the placeholders to be wiki default, but only if the 
image
// is not smaller. Limit on width only (according to wikitext 
default)
-   if ( originalDimensions.width  this.defaultThumbSize ) {
-   this.sizeWidget.setPlaceholderDimensions( {
-   'width': this.defaultThumbSize,
-   } );
-   } else {
+   if ( originalDimensions  originalDimensions.width  
this.defaultThumbSize ) {
// The image is smaller than wiki default. Make the 
default dimensions
// the image max size
this.sizeWidget.setPlaceholderDimensions( 
originalDimensions );
+   } else {
+   this.sizeWidget.setPlaceholderDimensions( {
+   'width': this.defaultThumbSize,
+   } );
}
 
// Enable the size select widget 'default' option
@@ -414,8 +416,10 @@
// Set placeholders to be image original dimensions
// Technically, this is the 'default' of non thumb/frameless
// images, as that is the size that they render in when
-   // no size is specified.
-   this.sizeWidget.setPlaceholderDimensions( originalDimensions );
+   // no size is specified. Only do that if original dimensions 
exist
+   if ( originalDimensions.width  originalDimensions.height ) {
+   this.sizeWidget.setPlaceholderDimensions( 
originalDimensions );
+   }
 
// Don't allow for 'default' choice
this.sizeSelectWidget.getItemFromData( 'default' ).setDisabled( 
true );
@@ -518,6 +522,7 @@
} else if ( currentItem === 'full' ) {
if (
this.typeInput.getSelectedItem() 
+   this.sizeWidget.getPlaceholderDimensions() 
(
this.typeInput.getSelectedItem().getData() === 
'frame' ||
this.typeInput.getSelectedItem().getData() === 
'none'
@@ -607,7 +612,7 @@
dialog.sizeWidget.setOriginalDimensions( 
mediaNodeView.getOriginalDimensions() );
dialog.sizeWidget.setEnforcedMax( false );
// Original dimensions available, enable the 
button
-   this.sizeSelectWidget.getItemFromData( 'full' 
).setDisabled( false );
+   dialog.sizeSelectWidget.getItemFromData( 'full' 
).setDisabled( false );
if ( mediaNodeView.getMaxDimensions() ) {
dialog.sizeWidget.setMaxDimensions( 
mediaNodeView.getMaxDimensions() );
if ( dialog.mediaNode.getAttribute( 
'type' ) === 'thumb' ) {
@@ -633,6 +638,8 @@
// If there are original dimensions, enable that choice

[MediaWiki-commits] [Gerrit] Image model - change (mediawiki...VisualEditor)

2014-03-25 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Image model
..

Image model

Splitting the huge commit. Commit message to follow.

Change-Id: Ibe71bc8bd74e4ba5a024ac722432ccf0b8f65e71
---
A modules/ve-mw/dm/models/ve.dm.MWImageModel.js
1 file changed, 192 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/dm/models/ve.dm.MWImageModel.js 
b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
new file mode 100644
index 000..540b12e
--- /dev/null
+++ b/modules/ve-mw/dm/models/ve.dm.MWImageModel.js
@@ -0,0 +1,192 @@
+/*!
+ * VisualEditor DataModel MWImageModel class.
+ *
+ * @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * MediaWiki image model.
+ *
+ * @class
+ * @mixins OO.EventEmitter
+ * @mixins ve.Scalable
+ *
+ * @constructor
+ */
+ve.dm.MWImageModel = function VeDmMWImageModel() {
+   // Mixin constructors
+   OO.EventEmitter.call( this );
+// ve.Scalable.call( this );
+
+   // Properties
+   this.viewNode = null;
+   this.modelNode = null;
+   this.mediaType = null;
+
+   // Image properties
+   this.caption = null;
+   this.altText = null;
+   this.type = null;
+   this.alignment = null;
+   this.currentDimensions = {
+   'width': null,
+   'height': null
+   };
+   this.originalDimensions = {
+   'width': null,
+   'height': null
+   };
+};
+
+/* Inheritance */
+
+OO.mixinClass( ve.dm.MWImageModel, OO.EventEmitter );
+
+/* Events */
+
+/**
+ * @event change
+ */
+
+/* Static Properties */
+
+ve.dm.MWImageModel.static.infoCache = {};
+
+/* Static Methods */
+
+/**
+ * Get the original size of the image object from the API, if it exists
+ *
+ * @static
+ * @param {string} filename Image file name
+ * @returns {jQuery.Promise} Promise which resolves with an info object
+ *  containing width, height and mediatype properties
+ *
+ve.dm.MWImageModel.static.getInfo = function ( filename ) {
+   var deferred = $.Deferred(),
+   cache = this.infoCache;
+
+   if ( cache[filename] ) {
+   deferred.resolve( cache[filename] );
+   } else {
+   // Get image info from server
+   ve.init.mw.Target.static.apiRequest(
+   {
+   'action': 'query',
+   'prop': 'imageinfo',
+   'indexpageids': '1',
+   'iiprop': 'size|mediatype',
+   'titles': filename
+   },
+   { 'type': 'POST' }
+   )
+   .done( function ( response ) {
+   var svgMaxSize,
+   page = response.query  
response.query.pages[response.query.pageids[0]],
+   info = page  page.imageinfo  
page.imageinfo[0],
+   originalDimensions = {
+   'width': info.width,
+   'height': info.height
+   },
+   maxDimensions = originalDimensions,
+   ratio = originalDimensions.width / 
originalDimensions.height;
+
+   // Calculate max dimensions for drawings
+   if ( info.mediatype === 'DRAWING' ) {
+   svgMaxSize = mw.config.get( 
'wgVisualEditor' ).svgMaxSize;
+   maxDimensions = ratio  1 ?
+   { 'width': Math.round( 
svgMaxSize * ratio ), 'height': svgMaxSize } :
+   { 'width': svgMaxSize, 
'height': Math.round( svgMaxSize / ratio ) };
+   }
+
+   if ( info ) {
+   info = {
+   'originalDimensions': 
originalDimensions,
+   'maxDimensions': maxDimensions,
+   'mediaType': info.mediatype
+   };
+   // Store result and resolve
+   cache[filename] = info;
+   deferred.resolve( info );
+   } else {
+   deferred.reject();
+   }
+   } )
+ 

[MediaWiki-commits] [Gerrit] Small validation fixes to scalable - change (VisualEditor/VisualEditor)

2014-04-11 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Small validation fixes to scalable
..

Small validation fixes to scalable

There was an issue where scalable dimensions may have been set as
{ width: undefined } which made the tests in most 'set' methods
pass probperly, because this wasn't an empty object. However,
practically speaking this is an empty dimensions object, and it
should be considered as if it isn't valid.

This wrecked havoc on the calculations done with the aspect ratio,
and affected 'default dimensions' most of all.

Changes made:
* Added a 'isDimensionsObjectValid' method to ve.dm.Scalable that
  tests dimension objects specifically to see if they are valid
  before update is done to any of the stored dimension values.
* Added originalSizeChange event to ve.dm.Scalable and a listener
  in ve.ui.MediaSizeWidget to make sure that the 'full size'
  button is only enabled when original dimensions are acquired,
  even if the API response is slow or was completed after the
  widget is already loaded.
* Fixed small typos in setDefaultDimensions in ve.dm.Scalable

Change-Id: I1242e8dadca4f2cf2737c366034a77edc5ce308e
---
M modules/ve/dm/ve.dm.Scalable.js
M modules/ve/ui/widgets/ve.ui.MediaSizeWidget.js
2 files changed, 81 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/28/125428/1

diff --git a/modules/ve/dm/ve.dm.Scalable.js b/modules/ve/dm/ve.dm.Scalable.js
index ca4b145..51035ac 100644
--- a/modules/ve/dm/ve.dm.Scalable.js
+++ b/modules/ve/dm/ve.dm.Scalable.js
@@ -76,6 +76,13 @@
  */
 
 /**
+ * Original size changed
+ *
+ * @event originalSizeChange
+ * @param {Object} Original dimensions width and height
+ */
+
+/**
  * Min size changed
  *
  * @event minSizeChange
@@ -111,7 +118,7 @@
  * @param {Object} dimensions Dimensions object with width  height
  */
 ve.dm.Scalable.prototype.setCurrentDimensions = function ( dimensions ) {
-   if ( dimensions ) {
+   if ( this.isDimensionsObjectValid( dimensions ) ) {
this.currentDimensions = ve.copy( dimensions );
// Only use current dimensions for ratio if it isn't set
if ( this.fixedRatio  !this.ratio ) {
@@ -127,14 +134,24 @@
  * Also resets the aspect ratio if in fixed ratio mode.
  *
  * @param {Object} dimensions Dimensions object with width  height
+ * @fires originalSizeChange
  */
 ve.dm.Scalable.prototype.setOriginalDimensions = function ( dimensions ) {
-   this.originalDimensions = ve.copy( dimensions );
-   // Always overwrite ratio
-   if ( this.fixedRatio ) {
-   this.setRatioFromDimensions( this.getOriginalDimensions() );
+   if (
+   !this.originalDimensions ||
+   (
+   this.isDimensionsObjectValid( dimensions ) 
+   !ve.compare( this.originalDimensions, dimensions )
+   )
+   ) {
+   this.originalDimensions = ve.copy( dimensions );
+   // Always overwrite ratio
+   if ( this.fixedRatio ) {
+   this.setRatioFromDimensions( 
this.getOriginalDimensions() );
+   }
+   this.valid = null;
+   this.emit( 'originalSizeChange', this.getOriginalDimensions() );
}
-   this.valid = null;
 };
 
 /**
@@ -144,7 +161,13 @@
  * @fires defaultSizeChange
  */
 ve.dm.Scalable.prototype.setDefaultDimensions = function ( dimensions ) {
-   if ( !this.dimensions || !ve.compare( this.dimensions, dimensions ) ) {
+   if (
+   !this.defaultDimensions ||
+   (
+   this.isDimensionsObjectValid( dimensions ) 
+   !ve.compare( this.defaultDimensions, dimensions )
+   )
+   ) {
this.defaultDimensions = ve.copy( dimensions );
this.valid = null;
this.emit( 'defaultSizeChange', this.isDefault() );
@@ -179,7 +202,13 @@
  * @fires minSizeChange
  */
 ve.dm.Scalable.prototype.setMinDimensions = function ( dimensions ) {
-   if ( !this.minDimensions || !ve.compare( this.minDimensions, dimensions 
) ) {
+   if (
+   !this.minDimensions ||
+   (
+   this.isDimensionsObjectValid( dimensions ) 
+   !ve.compare( this.minDimensions, dimensions )
+   )
+   ) {
this.minDimensions = ve.copy( dimensions );
this.valid = null;
this.emit( 'minSizeChange', dimensions );
@@ -193,7 +222,13 @@
  * @fires maxSizeChange
  */
 ve.dm.Scalable.prototype.setMaxDimensions = function ( dimensions ) {
-   if ( !this.maxDimensions || !ve.compare( this.maxDimensions, dimensions 
) ) {
+   if (
+   !this.maxDimensions ||
+   (
+   

[MediaWiki-commits] [Gerrit] Fix typo in ve.dm.Scalable - change (VisualEditor/VisualEditor)

2014-04-11 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix typo in ve.dm.Scalable
..

Fix typo in ve.dm.Scalable

this.dimensions should actually be this.defaultDimensions.

Change-Id: I4c4e71c936c989c5f8d78940316112ad8188ba1b
---
M modules/ve/dm/ve.dm.Scalable.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/22/125522/1

diff --git a/modules/ve/dm/ve.dm.Scalable.js b/modules/ve/dm/ve.dm.Scalable.js
index ca4b145..6274b4a 100644
--- a/modules/ve/dm/ve.dm.Scalable.js
+++ b/modules/ve/dm/ve.dm.Scalable.js
@@ -144,7 +144,7 @@
  * @fires defaultSizeChange
  */
 ve.dm.Scalable.prototype.setDefaultDimensions = function ( dimensions ) {
-   if ( !this.dimensions || !ve.compare( this.dimensions, dimensions ) ) {
+   if ( !this.defaultDimensions || !ve.compare( this.defaultDimensions, 
dimensions ) ) {
this.defaultDimensions = ve.copy( dimensions );
this.valid = null;
this.emit( 'defaultSizeChange', this.isDefault() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4c4e71c936c989c5f8d78940316112ad8188ba1b
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Fix border checkbox - change (mediawiki...VisualEditor)

2014-04-15 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Fix border checkbox
..

Fix border checkbox

Make sure border is enabled for unframed types and disabled for
framed images.

Change-Id: I716e9bc4140fbc09aac52930d1dd8213f31617a3
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 9 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index bde1dd1..fadbe71 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -363,12 +363,19 @@
// enforce any max size
this.scalable.setEnforcedMax( false );
}
+   } else {
+   // Don't limit maximum dimensions on basic and frameless images
+   this.scalable.setEnforcedMax( false );
+   }
+
+   // Disable border checkbox for framed images
+   // According to documentation:
+   // https://en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax#Border
+   if ( selectedType === 'frame' ) {
// Disable border option
this.borderCheckbox.setDisabled( true );
this.borderCheckbox.setValue( false );
} else {
-   // Don't limit maximum dimensions on basic and frameless images
-   this.scalable.setEnforcedMax( false );
// Enable border option
this.borderCheckbox.setDisabled( false );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I716e9bc4140fbc09aac52930d1dd8213f31617a3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


[MediaWiki-commits] [Gerrit] Border checkbox disabling/enabling fix - change (mediawiki...VisualEditor)

2014-04-16 Thread Mooeypoo (Code Review)
Mooeypoo has uploaded a new change for review.

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

Change subject: Border checkbox disabling/enabling fix
..

Border checkbox disabling/enabling fix

Due to a lack of clarity in the wikitext documentation the border
checkbox wasn't set up right. This is the proper behavior: border is
allowed for all unframed images (frameless and basic) while the
framed images (frame and thumb) have it anyways. Wikitext
documentation was also clarified for prosperity.

Change-Id: I4dd4775da473d669781553796be99646240c13fe
---
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
index fadbe71..5616cd5 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaEditDialog.js
@@ -368,10 +368,10 @@
this.scalable.setEnforcedMax( false );
}
 
-   // Disable border checkbox for framed images
+   // Disable border checkbox for thumb and framed images
// According to documentation:
// https://en.wikipedia.org/wiki/Wikipedia:Extended_image_syntax#Border
-   if ( selectedType === 'frame' ) {
+   if ( selectedType === 'thumb' || selectedType === 'frame' ) {
// Disable border option
this.borderCheckbox.setDisabled( true );
this.borderCheckbox.setValue( false );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4dd4775da473d669781553796be99646240c13fe
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo mor...@gmail.com

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


  1   2   3   4   5   6   7   8   9   10   >