[MediaWiki-commits] [Gerrit] mediawiki...MobileFrontend[master]: VE MobileFrontend: fix call to _fixIosHeader

2018-01-23 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405991 )

Change subject: VE MobileFrontend: fix call to _fixIosHeader
..

VE MobileFrontend: fix call to _fixIosHeader

Needs to be a jQuery object, not a selector. a952a5fcb9 changed the parameter
for this and missed this call.

Change-Id: I257575a7a90b484fe615b1314842c313d2225891
---
M resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git 
a/resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js 
b/resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js
index 938ef74..763cb88 100644
--- a/resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js
+++ b/resources/mobile.editor.ve/ve.init.mw.MobileFrontendArticleTarget.js
@@ -159,7 +159,7 @@
// we have to do it here because contenteditable elements still do not
// exist when postRender is executed
// FIXME: Don't call a private method that is outside the class.
-   this.overlay._fixIosHeader( '[contenteditable]' );
+   this.overlay._fixIosHeader( $( '[contenteditable]' ) );
 
this.maybeShowWelcomeDialog();
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I257575a7a90b484fe615b1314842c313d2225891
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWWikitextStringTransferHandler: Perform Parsoid cleanup on ...

2018-01-22 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405759 )

Change subject: MWWikitextStringTransferHandler: Perform Parsoid cleanup on 
result
..

MWWikitextStringTransferHandler: Perform Parsoid cleanup on result

Parsoid markup delivered as a result of a paste was being handled differently.

Bug: T183173
Change-Id: Ic563d2c5cd1f663f35860892b369fb7ba34b9c55
---
M 
modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
M modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js
2 files changed, 20 insertions(+), 0 deletions(-)


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

diff --git 
a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
 
b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
index d913356..e9b9c8c 100644
--- 
a/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
+++ 
b/modules/ve-mw/tests/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.test.js
@@ -176,6 +176,21 @@
]
},
{
+   msg: 'Headings, parsoid fallback ids don\'t 
interfere with whitespace stripping',
+   pasteString: '== Tudnivalók ==',
+   pasteType: 'text/plain',
+   parsoidResponse: ' Tudnivalók ',
+   annotations: [],
+   assertDom: true,
+   expectedData: [
+   { type: 'mwHeading', attributes: { 
level: 2 }, originalDomElements: $( ' Tudnivalók ' 
).toArray() },
+   'T', 'u', 'd', 'n', 'i', 'v', 'a', 'l', 
'ó', 'k',
+   { type: '/mwHeading' },
+   { type: 'internalList' },
+   { type: '/internalList' }
+   ]
+   },
+   {
msg: 'Magic link (RFC)',
pasteString: 'RFC 1234',
pasteType: 'text/plain',
diff --git 
a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js
 
b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js
index 10aedba..2929f4d 100644
--- 
a/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js
+++ 
b/modules/ve-mw/ui/datatransferhandlers/ve.ui.MWWikitextStringTransferHandler.js
@@ -128,6 +128,11 @@
}
}
 
+   // Strip Parsoid sections
+   ve.unwrapParsoidSections( htmlDoc.body );
+   // Strip legacy IDs, for example in section headings
+   ve.stripParsoidFallbackIds( htmlDoc.body );
+
// Pass an empty object for the second argument (importRules) 
so that clipboard mode is used
// TODO: Fix that API
doc = handler.surface.getModel().getDocument().newFromHtml( 
htmlDoc, {} );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update TitleInput's getTitle to getMWTitle

2018-01-18 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/405023 )

Change subject: Update TitleInput's getTitle to getMWTitle
..

Update TitleInput's getTitle to getMWTitle

cb92c72c63274b332dc81edf473b1b3979ab4bdf in MW core changed this.

Bug: T185231
Change-Id: I9084a11bd40e46bddbcd1922ff549703bc90f60f
---
M modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js 
b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
index 2e53985..140d351 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
@@ -109,7 +109,7 @@
if ( menu.isVisible() ) {
menu.chooseItem( menu.findSelectedItem() );
}
-   name = this.addTemplateInput.getTitle();
+   name = this.addTemplateInput.getMWTitle();
if ( !name ) {
// Invalid titles return null, so abort here.
return;
@@ -124,7 +124,7 @@
 };
 
 ve.ui.MWTemplatePlaceholderPage.prototype.onTemplateInputChange = function () {
-   this.addTemplateButton.setDisabled( this.addTemplateInput.getTitle() 
=== null );
+   this.addTemplateButton.setDisabled( this.addTemplateInput.getMWTitle() 
=== null );
 };
 
 ve.ui.MWTemplatePlaceholderPage.prototype.onRemoveButtonClick = function () {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Use mw.storage instead of localStorage

2018-01-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403434 )

Change subject: Use mw.storage instead of localStorage
..

Use mw.storage instead of localStorage

mw.storage catches errors, so we won't crash horribly when the user has
localStorage disabled / full.

Bug: T181822
Change-Id: I212994eb535b9a8fb5f6c09deaa10b16c3d7f10e
---
M build/screenshots.js
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
M modules/ve-mw/ui/tools/ve.ui.MWEducationPopupTool.js
5 files changed, 12 insertions(+), 34 deletions(-)


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

diff --git a/build/screenshots.js b/build/screenshots.js
index 3513599..d163a43 100644
--- a/build/screenshots.js
+++ b/build/screenshots.js
@@ -111,9 +111,9 @@
};
 
// Suppress welcome dialog
-   localStorage.setItem( 
've-beta-welcome-dialog', 1 );
+   mw.storage.set( 
've-beta-welcome-dialog', 1 );
// Suppress user education 
indicators
-   localStorage.setItem( 
've-hideusered', 1 );
+   mw.storage.set( 
've-hideusered', 1 );
mw.hook( 
've.activationComplete' ).add( function () {
var target = 
ve.init.target,
surfaceView = 
target.getSurface().getView();
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 285498d..36ad052 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -926,8 +926,7 @@
section = uri.query.section !== undefined ? 
parseSection( uri.query.section ) : null,
isLoggedIn = !mw.user.isAnon(),
prefSaysShowWelcome = isLoggedIn && 
!mw.user.options.get( 'visualeditor-hidebetawelcome' ),
-   urlSaysHideWelcome = 'hidewelcomedialog' in new mw.Uri( 
location.href ).query,
-   welcomeDialogLocalStorageValue = null;
+   urlSaysHideWelcome = 'hidewelcomedialog' in new mw.Uri( 
location.href ).query;
 
requiredSkinElements =
$( '#content' ).length &&
@@ -1077,9 +1076,6 @@
init.setupEditLinks();
}
 
-   try {
-   welcomeDialogLocalStorageValue = localStorage.getItem( 
've-beta-welcome-dialog' );
-   } catch ( e ) {}
if (
pageCanLoadEditor &&
showWikitextWelcome &&
@@ -1090,7 +1086,7 @@
prefSaysShowWelcome ||
(
!isLoggedIn &&
-   welcomeDialogLocalStorageValue === null 
&&
+   mw.storage.get( 
've-beta-welcome-dialog' ) === null &&
$.cookie( 've-beta-welcome-dialog' ) 
=== null
)
) &&
@@ -1123,9 +1119,7 @@
new mw.Api().saveOption( 
'visualeditor-hidebetawelcome', '1' );
mw.user.options.set( 
'visualeditor-hidebetawelcome', '1' );
} else if ( !isLoggedIn && !urlSaysHideWelcome 
) {
-   try {
-   localStorage.setItem( 
've-beta-welcome-dialog', 1 );
-   } catch ( e ) {
+   if ( !mw.storage.set( 
've-beta-welcome-dialog', 1 ) ) {
$.cookie( 
've-beta-welcome-dialog', 1, { path: '/', expires: 30 } );
}
}
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index b8dd7cd..94fe5bd 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -343,9 +343,7 @@
 
// Pretend the user saw the welcome dialog before suppressing 
it.
if ( mw.user

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Catch errors when accessing localStorage

2018-01-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/403433 )

Change subject: Catch errors when accessing localStorage
..

Catch errors when accessing localStorage

Bug: T181822
Change-Id: If015a9cb08c7d05efe5bddc96ac62570198dbb2f
---
M src/init/sa/ve.init.sa.Platform.js
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/33/403433/1

diff --git a/src/init/sa/ve.init.sa.Platform.js 
b/src/init/sa/ve.init.sa.Platform.js
index ee4f3ef..6701050 100644
--- a/src/init/sa/ve.init.sa.Platform.js
+++ b/src/init/sa/ve.init.sa.Platform.js
@@ -87,10 +87,12 @@
for ( i = 0, l = keys.length; i < l; i++ ) {
values[ keys[ i ] ] = this.getUserConfig( keys[ i ] );
}
+   return values;
} else {
-   return JSON.parse( localStorage.getItem( 've-' + keys ) );
+   try {
+   return JSON.parse( localStorage.getItem( 've-' + keys ) 
);
+   } catch ( e ) {}
}
-   return values;
 };
 
 /**
@@ -105,7 +107,9 @@
}
}
} else {
-   localStorage.setItem( 've-' + keyOrValueMap, JSON.stringify( 
value ) );
+   try {
+   localStorage.setItem( 've-' + keyOrValueMap, 
JSON.stringify( value ) );
+   } catch ( e ) {}
}
return true;
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If015a9cb08c7d05efe5bddc96ac62570198dbb2f
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Change save dialog accesskey to be entirely off the trigger

2018-01-08 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402874 )

Change subject: Change save dialog accesskey to be entirely off the trigger
..

Change save dialog accesskey to be entirely off the trigger

Accesskeys in this situation are unreliable cross-browser. Firefox won't
trigger the accesskey inside the dialog. We can manually simulate it, via the
existing trigger.

Bug: T121183
Change-Id: Ib919d8b9fcd9324a517037bcc6ef93a26d1488b9
---
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
2 files changed, 13 insertions(+), 13 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index 5eb252f..cd9b666 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -1926,13 +1926,23 @@
  * @fires saveWorkflowBegin
  */
 ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, 
checkboxName ) {
-   var checkbox,
+   var checkbox, currentWindow,
target = this;
 
if ( !( this.edited || this.restoring ) ) {
return;
}
 
+   currentWindow = this.getSurface().getDialogs().getCurrentWindow();
+   if ( currentWindow && currentWindow.constructor.static.name === 
'mwSave' && ( action === 'save' || action === null ) ) {
+   // The current window is the save dialog, and we've gotten here 
via
+   // the save action. Trigger a save. We're doing this here 
instead of
+   // relying on an accesskey on the save button, because that has 
some
+   // cross-browser issues that makes it not work in Firefox.
+   currentWindow.executeAction( 'save' );
+   return;
+   }
+
this.emit( 'saveWorkflowBegin' );
 
// Preload the serialization
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 1ef5c8c..f2649c4 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -58,8 +58,7 @@
// May be overridden by config.saveButtonLabel
label: OO.ui.deferMsg( 'visualeditor-savedialog-label-review' ),
flags: [ 'primary', 'progressive' ],
-   modes: [ 'save', 'review', 'preview' ],
-   accessKey: 's'
+   modes: [ 'save', 'review', 'preview' ]
},
{
label: OO.ui.deferMsg( 
'visualeditor-savedialog-label-resume-editing' ),
@@ -498,8 +497,7 @@
  * @inheritdoc
  */
 ve.ui.MWSaveDialog.prototype.initialize = function () {
-   var saveAccessKey,
-   dialog = this;
+   var dialog = this;
 
// Parent method
ve.ui.MWSaveDialog.super.prototype.initialize.call( this );
@@ -642,14 +640,6 @@
this.previewPanel,
this.conflictPanel
] );
-
-   // Save button for "save" panel
-   saveAccessKey = ve.msg( 'accesskey-save' );
-   if ( saveAccessKey !== '-' && saveAccessKey !== '' ) {
-   this.actions.forEach( { actions: 'save' }, function ( action ) {
-   action.setAccessKey( saveAccessKey );
-   } );
-   }
 
// Initialization
this.$body.append( this.panels.$element );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Use section fragment after-save even if the query is empty

2018-01-05 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/402399 )

Change subject: Use section fragment after-save even if the query is empty
..

Use section fragment after-save even if the query is empty

Bug: T181075
Change-Id: If2d1107982d3f947330c750c635ee221ab71610f
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index b8dd7cd..f1fb146 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1333,6 +1333,7 @@
 
if ( $section.length && $section.attr( 'id' ) ) {
uri.fragment = $section.attr( 'id' );
+   this.viewUri.fragment = uri.fragment;
}
delete uri.query.section;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ArticleTargetEvents: Track editor mode on save events

2017-12-14 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398333 )

Change subject: ArticleTargetEvents: Track editor mode on save events
..

ArticleTargetEvents: Track editor mode on save events

Bug: T182610
Change-Id: I8b58bea8e478cde4c1340d13ddf97aab8f01
---
M modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
1 file changed, 10 insertions(+), 4 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
index f3e9fd2..fcc2fd7 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetEvents.js
@@ -69,7 +69,9 @@
this.track( 'behavior.lastTransactionTillSaveDialogOpen', {
duration: this.timings.saveWorkflowBegin - 
this.timings.lastTransaction
} );
-   ve.track( 'mwedit.saveIntent' );
+   ve.track( 'mwedit.saveIntent', {
+   mode: this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode()
+   } );
 };
 
 /**
@@ -89,7 +91,9 @@
this.track( 'behavior.saveDialogOpenTillSave', {
duration: this.timings.saveInitiated - 
this.timings.saveWorkflowBegin
} );
-   ve.track( 'mwedit.saveAttempt' );
+   ve.track( 'mwedit.saveAttempt', {
+   mode: this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode()
+   } );
 };
 
 /**
@@ -104,7 +108,8 @@
this.timings.saveRetries = 0;
ve.track( 'mwedit.saveSuccess', {
timing: ve.now() - this.timings.saveInitiated + ( 
this.timings.serializeForCache || 0 ),
-   'page.revid': newRevId
+   'page.revid': newRevId,
+   mode: this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode()
} );
 };
 
@@ -150,7 +155,8 @@
 
data = {
type: typeMap[ type ] || 'responseUnknown',
-   timing: ve.now() - this.timings.saveInitiated + ( 
this.timings.serializeForCache || 0 )
+   timing: ve.now() - this.timings.saveInitiated + ( 
this.timings.serializeForCache || 0 ),
+   mode: this.target.surface ? this.target.surface.getMode() : 
this.target.getDefaultMode()
};
if ( type === 'unknown' && failureArguments[ 0 ] ) {
data.message = failureArguments[ 0 ];

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Add section id to URI fragment on save

2017-12-14 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398285 )

Change subject: Add section id to URI fragment on save
..

Add section id to URI fragment on save

Bug: T181075

Change-Id: Iea63112301bfa0860c3d68efc35648a5af7e4ae6
---
M lib/ve
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
2 files changed, 15 insertions(+), 2 deletions(-)


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

diff --git a/lib/ve b/lib/ve
index cd6bce1..bafb26b 16
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit cd6bce192f313cc4670bee1b66197f4ff1b8b2ce
+Subproject commit bafb26b25c42914452b46d787331f6f4edaa263c
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index 108127e..8a09b74 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1292,7 +1292,7 @@
  * Page modifications for switching back to view mode.
  */
 ve.init.mw.DesktopArticleTarget.prototype.restorePage = function () {
-   var uri, keys;
+   var uri, keys, section, $section;
 
// Skins like monobook don't have a tab for view mode and instead just 
have the namespace tab
// selected. We didn't deselect the namespace tab, so we're ready after 
deselecting #ca-ve-edit.
@@ -1316,6 +1316,19 @@
delete uri.query.veaction;
}
if ( 'section' in uri.query ) {
+   // Translate into a fragment for the new URI:
+   // This should be after replacePageContent if this is 
post-save, so we can just look
+   // at the headers on the page.
+   section = uri.query.section.toString().indexOf( 'T-' ) 
=== 0 ? +uri.query.section.slice( 2 ) : uri.query.section;
+   $section = this.$editableContent.find( 'h1, h2, h3, h4, 
h5, h6' )
+   // Ignore headings inside TOC
+   .filter( function () {
+   return $( this ).closest( '#toc' 
).length === 0;
+   } )
+   .eq( section - 1 ).find( '.mw-headline' );
+   if ( $section.length && $section.attr( 'id' ) ) {
+   uri.fragment = $section.attr( 'id' );
+   }
delete uri.query.section;
}
if ( 'action' in uri.query && $( '#wpTextbox1' ).length === 0 ) 
{

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: trackSubscriber: data isn't required

2017-12-13 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/398084 )

Change subject: trackSubscriber: data isn't required
..

trackSubscriber: data isn't required

Editor-fixing caused errors on some events which don't pass data in.

Introduced in 8f612fbe64.

Change-Id: I5c9471e6ffe4cdda0bf5455c80ef70251690e20f
---
M modules/ve-mw/init/ve.init.mw.trackSubscriber.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js 
b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js
index 29b75cb..2caa31d 100644
--- a/modules/ve-mw/init/ve.init.mw.trackSubscriber.js
+++ b/modules/ve-mw/init/ve.init.mw.trackSubscriber.js
@@ -95,7 +95,7 @@
}
 
// Convert mode=source/visual to editor name
-   if ( data.mode ) {
+   if ( data && data.mode ) {
data.editor = data.mode === 'source' ? 'wikitext-2017' 
: 'visualeditor';
delete data.mode;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...WikiEditor[master]: Track time-to-ready/loaded via window.performance

2017-12-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397580 )

Change subject: Track time-to-ready/loaded via window.performance
..

Track time-to-ready/loaded via window.performance

Change-Id: Iadb9c131ca6730c20d4b166e686942f9b404e198
---
M modules/ext.wikiEditor.js
1 file changed, 13 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikiEditor 
refs/changes/80/397580/1

diff --git a/modules/ext.wikiEditor.js b/modules/ext.wikiEditor.js
index a9368f1..f1300c2 100644
--- a/modules/ext.wikiEditor.js
+++ b/modules/ext.wikiEditor.js
@@ -5,6 +5,14 @@
 ( function ( $, mw ) {
var editingSessionId;
 
+   var startTime;
+   if ( window.performance && window.performance.timing ) {
+   // Time we started to navigate to this page
+   startTime = window.performance.timing.navigationStart;
+   } else {
+   startTime = Date.now();
+   }
+
function logEditEvent( action, data ) {
if ( mw.loader.getState( 'schema.Edit' ) === null ) {
return;
@@ -54,16 +62,18 @@
var $textarea = $( '#wpTextbox1' ),
$editingSessionIdInput = $( '#editingStatsId' ),
origText = $textarea.val(),
-   submitting, onUnloadFallback;
+   submitting, onUnloadFallback, startTime;
 
if ( $editingSessionIdInput.length ) {
editingSessionId = $editingSessionIdInput.val();
logEditEvent( 'ready', {
-   editingSessionId: editingSessionId
+   editingSessionId: editingSessionId,
+   timing: startTime - Date.now()
} );
$textarea.on( 'wikiEditor-toolbar-doneInitialSections', 
function () {
logEditEvent( 'loaded', {
-   editingSessionId: editingSessionId
+   editingSessionId: editingSessionId,
+   timing: startTime - Date.now()
} );
} );
$textarea.closest( 'form' ).submit( function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iadb9c131ca6730c20d4b166e686942f9b404e198
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikiEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...WikimediaEvents[master]: Bump Edit schema version

2017-12-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/397573 )

Change subject: Bump Edit schema version
..

Bump Edit schema version

Change-Id: I873bd197806c6f7e8d7a72436610044ec8e8b011
---
M extension.json
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/73/397573/1

diff --git a/extension.json b/extension.json
index 9f6d515..746e5de 100644
--- a/extension.json
+++ b/extension.json
@@ -85,7 +85,7 @@
"schema.Edit": {
"class": "ResourceLoaderSchemaModule",
"schema": "Edit",
-   "revision": 13457736
+   "revision": 17520312
},
"schema.CompletionSuggestions": {
"class": "ResourceLoaderSchemaModule",

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I873bd197806c6f7e8d7a72436610044ec8e8b011
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Track action=loaded for consistency with WikiEditor

2017-12-06 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/395783 )

Change subject: Track action=loaded for consistency with WikiEditor
..

Track action=loaded for consistency with WikiEditor

Change-Id: I1b92996e63dd85416755377dc14a5a997aac6657
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 6cb96c0..28c078d 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -311,6 +311,7 @@
} )
.then( function () {
ve.track( 'mwedit.ready' );
+   ve.track( 'mwedit.loaded' );
} )
.always( clearLoading );
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Use rel="noopener" on links targeted at new windows

2017-11-30 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394374 )

Change subject: Use rel="noopener" on links targeted at new windows
..

Use rel="noopener" on links targeted at new windows

Bug: T180932
Change-Id: I93bda6aaebf97727a187774cccbeba4f27fcddd5
---
M modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
M modules/ve-mw/ui/pages/ve.ui.MWTemplatePage.js
M modules/ve-mw/ui/pages/ve.ui.MWTemplatesUsedPage.js
M modules/ve-mw/ui/tools/ve.ui.MWPopupTool.js
7 files changed, 15 insertions(+), 10 deletions(-)


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

diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js 
b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
index 0c269da..d777fc4 100644
--- a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
+++ b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
@@ -57,7 +57,8 @@
.text( description )
.attr( {
href: ve.resolveUrl( href, htmlDoc ),
-   target: '_blank'
+   target: '_blank',
+   rel: 'noopener'
} );
 
// Style based on link cache information
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
index 865ebd1..c627dad 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
@@ -601,6 +601,7 @@
.addClass( 
'visualeditor-dialog-media-content-description-link' )
.attr( 'href', title.getUrl() )
.attr( 'target', '_blank' )
+   .attr( 'rel', 'noopener' )
.text( ve.msg( 
'visualeditor-dialog-media-content-description-link' ) )
)
);
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
index b1c33d9..4465cb7 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWMediaDialog.js
@@ -648,7 +648,7 @@
);
 
// Make sure all links open in a new window
-   $info.find( 'a' ).prop( 'target', '_blank' );
+   $info.find( 'a' ).prop( 'target', '_blank' ).attr( 'rel', 'noopener' );
 
// Initialize thumb container
$thumbContainer
@@ -903,6 +903,7 @@
.addClass( 
'visualeditor-dialog-media-content-description-link' )
.attr( 'href', mw.util.getUrl( 
title ) )
.attr( 'target', '_blank' )
+   .attr( 'rel', 'noopener' )
.text( ve.msg( 
'visualeditor-dialog-media-content-description-link' ) )
)
);
@@ -1210,6 +1211,7 @@
.addClass( 
'visualeditor-dialog-media-content-description-link' )
.attr( 'href', mw.util.getUrl( 
this.imageModel.getResourceName() ) )
.attr( 'target', '_blank' )
+   .attr( 'rel', 'noopener' )
.text( ve.msg( 
'visualeditor-dialog-media-content-description-link' ) )
)
);
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 0a2fecd..0e621f9 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -523,7 +523,7 @@
// Save panel
this.$editSummaryLabel = $( '' ).addClass( 
've-ui-mwSaveDialog-summaryLabel' )
.html( ve.init.platform.getParsedMessage( 'summary' ) )
-   .find( 'a' ).attr( 'target', '_blank' ).end();
+   .find( 'a' ).attr( 'target', '_blank' ).attr( 'rel', 'noopener' 
).end();
this.editSummaryInput = new OO.ui.MultilineTextInputWidget( {
placeholder: ve.msg( 'visualeditor-editsummary' ),
classes: [ 've-ui-mwSaveDialog-summary' ],
@@ -568,7 +568,7 @@
this.$saveFoot = $( '' ).addClass( 've-ui-mwSaveDialog-foot' 
).append(
$( '' ).addClass( 've-ui-mwSaveDialog-license' )
.html( ve.init.platform.getParsedMessage( 
'copyrightwarning' ) )
-   .find( 'a' ).attr( 'target', '_blank' ).end()
+   

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Use rel="noopener" on links targeted at new windows

2017-11-30 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394373 )

Change subject: Use rel="noopener" on links targeted at new windows
..

Use rel="noopener" on links targeted at new windows

Bug: T180932
Change-Id: I9b7e32bf110e9a1b96b057242121b59b4c9c9513
---
M src/ui/contextitems/ve.ui.LinkContextItem.js
M src/ve.utils.js
M tests/ui/ve.ui.DiffElement.test.js
3 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/73/394373/1

diff --git a/src/ui/contextitems/ve.ui.LinkContextItem.js 
b/src/ui/contextitems/ve.ui.LinkContextItem.js
index ffc3c06..3fb1c51 100644
--- a/src/ui/contextitems/ve.ui.LinkContextItem.js
+++ b/src/ui/contextitems/ve.ui.LinkContextItem.js
@@ -61,7 +61,8 @@
.text( this.getDescription() )
.attr( {
href: ve.resolveUrl( this.model.getHref(), 
htmlDoc ),
-   target: '_blank'
+   target: '_blank',
+   rel: 'noopener'
} )
);
 };
diff --git a/src/ve.utils.js b/src/ve.utils.js
index 72eb3dc..c0d874c 100644
--- a/src/ve.utils.js
+++ b/src/ve.utils.js
@@ -1043,6 +1043,7 @@
 ve.targetLinksToNewWindow = function ( container ) {
// Make all links open in a new window
Array.prototype.forEach.call( container.querySelectorAll( 'a[href]' ), 
function ( el ) {
+   el.setAttribute( 'rel', 'noopener' );
el.setAttribute( 'target', '_blank' );
} );
 };
diff --git a/tests/ui/ve.ui.DiffElement.test.js 
b/tests/ui/ve.ui.DiffElement.test.js
index d8983a3..624888f 100644
--- a/tests/ui/ve.ui.DiffElement.test.js
+++ b/tests/ui/ve.ui.DiffElement.test.js
@@ -375,7 +375,7 @@
newDoc: 'foo http://example.org/whee";>bar baz',
expected:
'' +
-   'foo http://example.org/quuz"; 
target="_blank">barhttp://example.org/whee"; 
target="_blank">bar baz' +
+   'foo http://example.org/quuz"; 
rel="noopener" target="_blank">barhttp://example.org/whee"; rel="noopener" target="_blank">bar 
baz' +
''
},
{
@@ -384,7 +384,7 @@
newDoc: 'http://example.org/";>foo 
bar baz',
expected:
'' +
-   'http://example.org/"; target="_blank">foo barbar baz' +
+   'http://example.org/"; rel="noopener" target="_blank">foo barbar baz' +
''
},
{

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9b7e32bf110e9a1b96b057242121b59b4c9c9513
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ui.MWSaveDialog: consistent handling of preview category links

2017-11-29 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394088 )

Change subject: ui.MWSaveDialog: consistent handling of preview category links
..

ui.MWSaveDialog: consistent handling of preview category links

Category links weren't being checked for redlink status, and weren't opening
in a new window.

Bug: T179913
Change-Id: Ic665583128bf51710178c5674cd35c273f5f207e
---
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
1 file changed, 5 insertions(+), 4 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index a31a8be..0a2fecd 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -203,9 +203,6 @@
 
// TODO: This code is very similar to 
ve.ui.PreviewElement+ve.ui.MWPreviewElement
ve.resolveAttributes( body, docOrMsg, 
ve.dm.Converter.static.computedAttributes );
-   ve.targetLinksToNewWindow( body );
-   // Add styles so links render with their appropriate classes
-   ve.init.platform.linkCache.styleParsoidElements( $( body ), 
baseDoc );
 
// Remove metadata
contents = ve.filterMetaElements( Array.prototype.slice.call( 
body.childNodes ) );
@@ -223,12 +220,16 @@
document.createTextNode( ve.msg( 
'pagecategories', categories.length ) + ve.msg( 'colon-separator' ) ),
$( '' ).append( categories.map( 
function ( category ) {
var title = 
mw.Title.newFromText( category );
-   return $( '' ).append( $( 
'' ).attr( 'href', title.getUrl() ).text( title.getMainText() ) );
+   return $( '' ).append( $( 
'' ).attr( 'rel', 'mw:WikiLink' ).attr( 'href', title.getUrl() ).text( 
title.getMainText() ) );
} ) )
)
);
}
 
+   ve.targetLinksToNewWindow( this.$previewViewer[ 0 ] );
+   // Add styles so links render with their appropriate classes
+   ve.init.platform.linkCache.styleParsoidElements( 
this.$previewViewer, baseDoc );
+
// Run hooks so other things can alter the document
mw.hook( 'wikipage.content' ).fire( this.$previewViewer );
} else {

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.Surface: more tests for Google Docs pasting

2017-11-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393932 )

Change subject: ce.Surface: more tests for Google Docs pasting
..

ce.Surface: more tests for Google Docs pasting

Bug: T145252
Change-Id: Ia51cc6f8eb5d90e8f8a1a496a0a166254c694cf5
---
M src/ce/ve.ce.Surface.js
M tests/ce/ve.ce.Surface.test.js
2 files changed, 13 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/32/393932/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 0f35d77..ae35351 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2048,11 +2048,11 @@
if ( node.style.fontStyle === 'italic' ) {
$node.wrap( '' );
}
-   if ( node.style.textDecoration === 'underline' ) {
+   if ( node.style.textDecorationLine === 'underline' ) {
$node.wrap( '' );
}
-   if ( node.style.textDecoration === 'strikethrough' ) {
-   $node.wrap( '' );
+   if ( node.style.textDecorationLine === 'line-through' ) 
{
+   $node.wrap( '' );
}
if ( node.style.verticalAlign === 'super' ) {
$node.wrap( '' );
diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js
index 6cdc1fb..7d5e95b 100644
--- a/tests/ce/ve.ce.Surface.test.js
+++ b/tests/ce/ve.ce.Surface.test.js
@@ -2049,7 +2049,7 @@
},
{
rangeOrSelection: new ve.Range( 1 ),
-   pasteHtml: 'A',
+   pasteHtml: 'ABCDEFGH',
fromVe: true,
expectedOps: [
[
@@ -2057,14 +2057,21 @@
{
type: 'replace',
insert: [
-   [ 'A', [ { 
type: 'textStyle/bold', attributes: { nodeName: 'b' } }, { type: 
'textStyle/italic', attributes: { nodeName: 'i' } } ] ]
+   [ 'A', [ { 
type: 'textStyle/bold', attributes: { nodeName: 'b' } } ] ],
+   [ 'B', [ { 
type: 'textStyle/italic', attributes: { nodeName: 'i' } } ] ],
+   [ 'C', [ { 
type: 'textStyle/underline', attributes: { nodeName: 'u' } } ] ],
+   [ 'D', [ { 
type: 'textStyle/strikethrough', attributes: { nodeName: 's' } } ] ],
+   [ 'E', [ { 
type: 'textStyle/superscript', attributes: { nodeName: 'sup' } } ] ],
+   [ 'F', [ { 
type: 'textStyle/subscript', attributes: { nodeName: 'sub' } } ] ],
+   [ 'G', [ { 
type: 'textStyle/bold', attributes: { nodeName: 'b' } }, { type: 
'textStyle/italic', attributes: { nodeName: 'i' } } ] ],
+   'H'
],
remove: []
},
{ type: 'retain', length: 29 }
]
],
-   expectedRangeOrSelection: new ve.Range( 2 ),
+   expectedRangeOrSelection: new ve.Range( 9 ),
msg: 'Span cleanups: style converted into 
markup'
},
{

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia51cc6f8eb5d90e8f8a1a496a0a166254c694cf5
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.Surface: support formatted google docs paste content again

2017-11-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/393813 )

Change subject: ce.Surface: support formatted google docs paste content again
..

ce.Surface: support formatted google docs paste content again

Very narrow-focus on the markup Google Docs produces.

Bug: T145252
Change-Id: I5164d3d7781cdabd79af15133a79672e9a439753
---
M src/ce/ve.ce.Surface.js
M tests/ce/ve.ce.Surface.test.js
2 files changed, 57 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/13/393813/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 14f6927..0f35d77 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2025,6 +2025,43 @@
 
// All $pasteTarget sanitization can be skipped for internal paste
if ( !slice ) {
+   // Do some simple transforms to catch content that is using
+   // spans+styles instead of regular tags. This is very much 
targeted at
+   // the output of Google Docs, but should work with anything 
fairly-
+   // similar. This is *fragile*, but more in the sense that small
+   // deviations will stop it from working, rather than it being 
terribly
+   // likely to incorrectly over-format things.
+   // TODO: This might be cleaner if we could move the 
sanitization into
+   // dm.converter entirely.
+   this.$pasteTarget.find( 'span' ).each( function ( i, node ) {
+   var $node;
+   // Later sanitization will replace completely-empty 
spans with
+   // their contents, so we can lazily-wrap here without 
cleaning
+   // up.
+   if ( !node.style ) {
+   return;
+   }
+   $node = $( node );
+   if ( node.style.fontWeight === '700' ) {
+   $node.wrap( '' );
+   }
+   if ( node.style.fontStyle === 'italic' ) {
+   $node.wrap( '' );
+   }
+   if ( node.style.textDecoration === 'underline' ) {
+   $node.wrap( '' );
+   }
+   if ( node.style.textDecoration === 'strikethrough' ) {
+   $node.wrap( '' );
+   }
+   if ( node.style.verticalAlign === 'super' ) {
+   $node.wrap( '' );
+   }
+   if ( node.style.verticalAlign === 'sub' ) {
+   $node.wrap( '' );
+   }
+   } );
+
// Remove style attributes. Any valid styles will be restored 
by data-ve-attributes.
this.$pasteTarget.find( '[style]' ).removeAttr( 'style' );
 
diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js
index 41b279e..6cdc1fb 100644
--- a/tests/ce/ve.ce.Surface.test.js
+++ b/tests/ce/ve.ce.Surface.test.js
@@ -2048,6 +2048,26 @@
msg: 'Span cleanups: clipboard key stripped'
},
{
+   rangeOrSelection: new ve.Range( 1 ),
+   pasteHtml: 'A',
+   fromVe: true,
+   expectedOps: [
+   [
+   { type: 'retain', length: 1 },
+   {
+   type: 'replace',
+   insert: [
+   [ 'A', [ { 
type: 'textStyle/bold', attributes: { nodeName: 'b' } }, { type: 
'textStyle/italic', attributes: { nodeName: 'i' } } ] ]
+   ],
+   remove: []
+   },
+   { type: 'retain', length: 29 }
+   ]
+   ],
+   expectedRangeOrSelection: new ve.Range( 2 ),
+   msg: 'Span cleanups: style converted into 
markup'
+   },
+   {
rangeOrSelection: new ve.Range( 0 ),
pasteHtml: 'foo\nBarbaz',
useClipboardData: true,

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

Gerrit-MessageType: ne

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget: enable spellcheck on sectionTitle

2017-11-15 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391587 )

Change subject: DesktopArticleTarget: enable spellcheck on sectionTitle
..

DesktopArticleTarget: enable spellcheck on sectionTitle

Tell browsers we explicitly want spellchecking on the section title. If
unspecified this is browser-dependent, so it was inconsistent.

This won't actually have an effect until the next OOjs-UI release (v0.24.3),
as this was a new feature added to TextInputWidget.

Bug: T179654
Change-Id: I588874efcff91c5be03da2fc03c268f883b718e2
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index 9868671..e0c0135 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -494,7 +494,8 @@
$element: $( '' ),
classes: [ 
've-ui-init-desktopArticleTarget-sectionTitle' ],
maxLength: 255,
-   placeholder: ve.msg( 
'visualeditor-section-title-placeholder' )
+   placeholder: ve.msg( 
'visualeditor-section-title-placeholder' ),
+   spellcheck: true
} );
this.sectionTitle.connect( this, { change: 
'updateToolbarSaveButtonState' } );
}

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

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

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: TextInputWidget: support spellcheck attribute

2017-11-14 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/391256 )

Change subject: TextInputWidget: support spellcheck attribute
..

TextInputWidget: support spellcheck attribute

`spellcheck` allows browser spellchecking to be enabled/disabled in an input.
When not provided, it's left up to the browser, as it currently is.

Bug: T179654
Change-Id: I1c9a25470765e6040ecbb599cbcebdd6c97cb74a
---
M php/widgets/TextInputWidget.php
M src/widgets/TextInputWidget.js
2 files changed, 10 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/56/391256/1

diff --git a/php/widgets/TextInputWidget.php b/php/widgets/TextInputWidget.php
index 72abc16..14e68f6 100644
--- a/php/widgets/TextInputWidget.php
+++ b/php/widgets/TextInputWidget.php
@@ -58,6 +58,8 @@
 *   Implies `indicator: 'required'`. (default: false)
 * @param bool $config['autocomplete'] If the field should support 
autocomplete
 *   or not (default: true)
+* @param bool $config['spellcheck'] If the field should support 
spellcheck
+*   or not (default: browser-dependent)
 */
public function __construct( array $config = [] ) {
// Config initialization
@@ -120,6 +122,9 @@
if ( !$config['autocomplete'] ) {
$this->input->setAttributes( [ 'autocomplete' => 'off' 
] );
}
+   if ( isset( $config['spellcheck'] ) ) {
+   $this->input->setAttributes( [ 'spellcheck' => 
$config['spellcheck'] ? 'true' : 'false' ] );
+   }
if ( $this->multiline && isset( $config['rows'] ) && 
$config['rows'] ) {
$this->input->setAttributes( [ 'rows' => 
$config['rows'] ] );
}
diff --git a/src/widgets/TextInputWidget.js b/src/widgets/TextInputWidget.js
index a432ba3..08b2bb3 100644
--- a/src/widgets/TextInputWidget.js
+++ b/src/widgets/TextInputWidget.js
@@ -37,6 +37,8 @@
  *  the value or placeholder text: `'before'` or `'after'`
  * @cfg {boolean} [required=false] Mark the field as required. Implies 
`indicator: 'required'`.
  * @cfg {boolean} [autocomplete=true] Should the browser support autocomplete 
for this field
+ * @cfg {boolean} [spellcheck] Should the browser support spellcheck for this 
field (`undefined` means
+ *  leaving it up to the browser).
  * @cfg {RegExp|Function|string} [validate] Validation pattern: when string, a 
symbolic name of a
  *  pattern defined by the class: 'non-empty' (the value cannot be an empty 
string) or 'integer'
  *  (the value must contain only numbers); when RegExp, a regular expression 
that must match the
@@ -116,6 +118,9 @@
}.bind( this )
} );
}
+   if ( config.spellcheck !== undefined ) {
+   this.$input.attr( 'spellcheck', config.spellcheck ? 'true' : 
'false' );
+   }
if ( this.label ) {
this.isWaitingToBeAttached = true;
this.installParentChangeDetector();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c9a25470765e6040ecbb599cbcebdd6c97cb74a
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.Surface: on paste, make sure clipboardKey spans don't sho...

2017-11-07 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/389750 )

Change subject: ce.Surface: on paste, make sure clipboardKey spans don't show up
..

ce.Surface: on paste, make sure clipboardKey spans don't show up

Cleanup is fairly likely to remove an `importantElement` from $pasteTarget,
making it refresh the HTML from the clipboard and deciding to trust it because
it's from *a* VisualEditor. If so, we still need to remove the clipboardKey
span.

Bug: T121588
Change-Id: I830a4dbc5eddd7e00218e87cbfdc9fdd86c86256
---
M src/ce/ve.ce.Surface.js
1 file changed, 2 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/50/389750/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 4fac48c..14f6927 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2137,6 +2137,8 @@
htmlDoc = ve.createDocumentFromHtml( 
beforePasteData.html );
// Remove the pasteProtect class. See #onCopy.
$( htmlDoc ).find( 'span' ).removeClass( 
've-pasteProtect' );
+   // Remove the clipboard key
+   $( htmlDoc ).find( 
'span[data-ve-clipboard-key]' ).remove();
beforePasteData.context = null;
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I830a4dbc5eddd7e00218e87cbfdc9fdd86c86256
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ArticleTarget: remember whether we preloaded, so it can affe...

2017-10-26 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386644 )

Change subject: ArticleTarget: remember whether we preloaded, so it can affect 
the save button
..

ArticleTarget: remember whether we preloaded, so it can affect the save button

Idea being: preload use case is often "load content, maybe with parameters,
immediately save it", so we can treat it as being already-modified for saving
purposes.

Bug: T179063
Change-Id: I35ff04bc9cb5172edf8174832624145973aa1fdb
---
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
M modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
2 files changed, 11 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index d60da72..66889b7 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -283,6 +283,7 @@
this.fromEditedState = data.fromEditedState;
this.switched = data.switched || 'wteswitched' in new mw.Uri( 
location.href ).query;
this.doc = this.constructor.static.parseDocument( 
this.originalHtml, this.getDefaultMode() );
+   this.preloaded = data.preloaded;
 
this.remoteNotices = ve.getObjectValues( data.notices );
this.protectedClasses = data.protectedClasses;
@@ -1882,7 +1883,7 @@
return;
}
 
-   this.edited = this.getSurface().getModel().hasBeenModified() || 
this.fromEditedState;
+   this.edited = this.getSurface().getModel().hasBeenModified() || 
this.fromEditedState || this.preloaded;
if ( this.sectionTitle ) {
this.edited = this.edited || this.sectionTitle.getValue() !== 
'';
}
diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
index a5e8986..58defee 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
@@ -168,6 +168,9 @@
cacheHit: /hit/i.test( 
jqxhr.getResponseHeader( 'X-Cache' ) ),
targetName: options.targetName
} );
+   if ( options.preload && 
data.visualeditor.content && data.visualeditor.oldid === 0 ) {
+   data.visualeditor.preloaded = 
options.preload;
+   }
return data;
} );
 
@@ -298,7 +301,12 @@
data.oldid = options.oldId;
}
 
-   return new mw.Api().get( data );
+   return new mw.Api().get( data ).then( function ( 
apiData ) {
+   if ( options.preload && 
apiData.visualeditor.content && ( options.section === 'new' || 
apiData.visualeditor.oldid === 0 ) ) {
+   apiData.visualeditor.preloaded = 
options.preload;
+   }
+   return apiData;
+   } );
}
};
 }() );

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.ContentBranchNode: onTeardown, check if we have a root

2017-10-25 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386419 )

Change subject: ce.ContentBranchNode: onTeardown, check if we have a root
..

ce.ContentBranchNode: onTeardown, check if we have a root

Some situations can make teardown happen while we're unrooted. If so, we don't
really care about the unicorning status any more.

Change-Id: I6ab27fe19fceddb7284e22b6f763cb272fdb8946
---
M src/ce/ve.ce.ContentBranchNode.js
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/src/ce/ve.ce.ContentBranchNode.js 
b/src/ce/ve.ce.ContentBranchNode.js
index cd3a292..fc53015 100644
--- a/src/ce/ve.ce.ContentBranchNode.js
+++ b/src/ce/ve.ce.ContentBranchNode.js
@@ -480,12 +480,14 @@
  * @method
  */
 ve.ce.ContentBranchNode.prototype.onTeardown = function () {
-   var ceSurface = this.getRoot().getSurface();
+   var ceSurface = this.getRoot() ? this.getRoot().getSurface() : false;
 
// Parent method
ve.ce.ContentBranchNode.super.prototype.onTeardown.call( this );
 
-   ceSurface.setNotUnicorning( this );
+   if ( ceSurface ) {
+   ceSurface.setNotUnicorning( this );
+   }
 };
 
 /**

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6ab27fe19fceddb7284e22b6f763cb272fdb8946
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: LinearEnterKeyDownHandler: Enter behavior in nested lists

2017-10-25 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386418 )

Change subject: LinearEnterKeyDownHandler: Enter behavior in nested lists
..

LinearEnterKeyDownHandler: Enter behavior in nested lists

Bug: T108595
Change-Id: Ie78addc64db977f84553705b18dcc98e58d5c352
---
M src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
M tests/ce/ve.ce.Surface.test.js
2 files changed, 54 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/18/386418/1

diff --git a/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js 
b/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
index 7d05f16..c22ce2a 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
@@ -35,12 +35,13 @@
  * @inheritdoc
  */
 ve.ce.LinearEnterKeyDownHandler.static.execute = function ( surface, e ) {
-   var txRemove, txInsert, outerParent, outerChildrenCount, list, 
prevContentOffset,
+   var txRemove, txInsert, outerParent, outerChildrenCount, list, 
listParent, prevContentOffset,
insertEmptyParagraph, node, focusedNode,
range = surface.model.getSelection().getRange(),
cursor = range.from,
documentModel = surface.model.getDocument(),
emptyParagraph = [ { type: 'paragraph' }, { type: '/paragraph' 
} ],
+   emptyListItem = [ { type: 'listItem' }, { type: 'paragraph' }, 
{ type: '/paragraph' }, { type: '/listItem' } ],
advanceCursor = true,
stack = [],
outermostNode = null,
@@ -179,6 +180,8 @@
) {
// Enter was pressed in an empty list item.
list = outermostNode.getModel().getParent();
+   listParent = list.getParent();
+   advanceCursor = false;
if ( list.getChildren().length === 1 ) {
// The list item we're about to remove is the 
only child of the list
// Remove the list
@@ -190,14 +193,32 @@
txInsert = 
ve.dm.TransactionBuilder.static.newFromRemoval(
documentModel, 
outermostNode.getModel().getOuterRange()
);
+   }
+
+   if (
+   // The removed item was in a nested list node
+   listParent.type === 'listItem' &&
+   // This was the last item in the nested list
+   listParent.getChildren()[ 
listParent.getChildren().length - 1 ] === list
+   ) {
surface.model.change( txInsert );
range = txInsert.translateRange( range );
-   // Insert a paragraph
+   // Add a new listItem to the parent list
+   txInsert = 
ve.dm.TransactionBuilder.static.newFromInsertion(
+   documentModel, 
listParent.getOuterRange().to, emptyListItem
+   );
+   // ...and push forward to be within it
+   advanceCursor = true;
+   } else if ( list.getChildren().length !== 1 ) {
+   // Otherwise, if we just removed a list item, 
insert a paragraph
+
+   surface.model.change( txInsert );
+   range = txInsert.translateRange( range );
+
txInsert = 
ve.dm.TransactionBuilder.static.newFromInsertion(
documentModel, list.getOuterRange().to, 
emptyParagraph
);
}
-   advanceCursor = false;
} else {
// We must process the transaction first because 
getRelativeContentOffset can't help us yet
txInsert = 
ve.dm.TransactionBuilder.static.newFromInsertion( documentModel, range.from, 
stack );
diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js
index c224f5f..c4fcc16 100644
--- a/tests/ce/ve.ce.Surface.test.js
+++ b/tests/ce/ve.ce.Surface.test.js
@@ -1014,17 +1014,32 @@
msg: 'List item not split by shift+enter'
},
{
+   rangeOrSelection: new ve.Range( 30 ),
+   keys: [ 'ENTER', 'ENTER' ],
+   expectedData: function ( data ) {
+   data.splice(
+  

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWInternalLinkContextItem: increase specificity to override ...

2017-10-24 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/386286 )

Change subject: MWInternalLinkContextItem: increase specificity to override 
OOUI changes
..

MWInternalLinkContextItem: increase specificity to override OOUI changes

OOUI 8e31b2f273 increased changed various icon CSS rules, and increased their
specificity. Increase ours to match. This restores the correct size/ratio of
the images in the link context item.

Bug: T178933
Change-Id: I4f1a6dde363cf99f7665dc83f4b0fa6b1dd3c29e
---
M modules/ve-mw/ui/styles/contextitems/ve.ui.MWInternalLinkContextItem.css
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git 
a/modules/ve-mw/ui/styles/contextitems/ve.ui.MWInternalLinkContextItem.css 
b/modules/ve-mw/ui/styles/contextitems/ve.ui.MWInternalLinkContextItem.css
index 60c38a1..4f4f569 100644
--- a/modules/ve-mw/ui/styles/contextitems/ve.ui.MWInternalLinkContextItem.css
+++ b/modules/ve-mw/ui/styles/contextitems/ve.ui.MWInternalLinkContextItem.css
@@ -10,7 +10,7 @@
white-space: normal;
 }
 
-.ve-ui-mwInternalLinkContextItem-withImage .oo-ui-iconElement-icon {
+.ve-ui-mwInternalLinkContextItem-withImage > 
.oo-ui-iconElement.oo-ui-iconElement-icon {
float: left;
width: 3.75em;
height: 3.75em;
@@ -25,7 +25,7 @@
background-size: cover;
 }
 
-.ve-ui-mwInternalLinkContextItem-withImage 
.ve-ui-mwInternalLinkContextItem-hasImage {
+.ve-ui-mwInternalLinkContextItem-withImage > 
.ve-ui-mwInternalLinkContextItem-hasImage.oo-ui-iconElement-icon {
border: 0;
background-size: cover;
opacity: 1;

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Cite[master]: MWReferencesList: drop autoGenerated attribute if changed

2017-10-17 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384757 )

Change subject: MWReferencesList: drop autoGenerated attribute if changed
..

MWReferencesList: drop autoGenerated attribute if changed

If the user has moved the reflist away from the end of the document, or
changed any properties on it, it shouldn't be treated as autoGenerated any
more.

Bug: T153754
Change-Id: I348601952dbfcf06bfb564e4db9cac820f3b2776
---
M modules/ve-cite/ve.dm.MWReferencesListNode.js
M modules/ve-cite/ve.ui.MWReferencesListDialog.js
2 files changed, 29 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-cite/ve.dm.MWReferencesListNode.js 
b/modules/ve-cite/ve.dm.MWReferencesListNode.js
index 415e153..c34b0c0 100644
--- a/modules/ve-cite/ve.dm.MWReferencesListNode.js
+++ b/modules/ve-cite/ve.dm.MWReferencesListNode.js
@@ -76,7 +76,7 @@
 };
 
 ve.dm.MWReferencesListNode.static.toDomElements = function ( data, doc, 
converter ) {
-   var el, els, mwData, originalMw, contentsHtml, originalHtml,
+   var el, els, mwData, originalMw, contentsHtml, originalHtml, nextIndex, 
nextElement,
isResponsiveDefault = mw.config.get( 
'wgCiteResponsiveReferences' ),
wrapper = doc.createElement( 'div' ),
originalHtmlWrapper = doc.createElement( 'div' ),
@@ -107,6 +107,24 @@
delete mwData.attrs.responsive;
}
 
+   if ( mwData.autoGenerated ) {
+   // This was an autogenerated reflist. We need to check whether 
changes
+   // have been made which make that no longer true. The reflist 
dialog
+   // handles unsetting this if changes to the properties have 
been made.
+   // Here we want to work out if it has been moved away from the 
end of
+   // the document.
+   nextIndex = converter.documentData.indexOf( data[ data.length - 
1 ] ) + 1;
+   while ( ( nextElement = converter.documentData[ nextIndex ] ) ) 
{
+   if ( nextElement.type[ 0 ] !== '/' ) {
+   break;
+   }
+   nextIndex++;
+   }
+   if ( nextElement && nextElement.type !== 'internalList' ) {
+   delete mwData.autoGenerated;
+   }
+   }
+
el = els[ 0 ];
el.setAttribute( 'typeof', 'mw:Extension/references' );
 
diff --git a/modules/ve-cite/ve.ui.MWReferencesListDialog.js 
b/modules/ve-cite/ve.ui.MWReferencesListDialog.js
index bfaf002..586bca1 100644
--- a/modules/ve-cite/ve.ui.MWReferencesListDialog.js
+++ b/modules/ve-cite/ve.ui.MWReferencesListDialog.js
@@ -101,7 +101,7 @@
 ve.ui.MWReferencesListDialog.prototype.getActionProcess = function ( action ) {
if ( action === 'apply' ) {
return new OO.ui.Process( function () {
-   var refGroup, listGroup, oldListGroup, isResponsive, 
oldResponsive, attrChanges, doc,
+   var refGroup, listGroup, oldListGroup, isResponsive, 
oldResponsive, mwData, attrChanges, doc,
surfaceModel = this.getFragment().getSurface();
 
// Save changes
@@ -116,10 +116,18 @@
oldResponsive = this.selectedNode.getAttribute( 
'isResponsive' );
 
if ( listGroup !== oldListGroup || isResponsive 
!== oldResponsive ) {
+   // newFromAttributeChanges doesn't do 
the smart-replacing
+   // for nested attributes, so make a 
copy of the mw
+   // attribute so we can disable 
autoGenerated now we're
+   // changed it.
+   mwData = ve.copy( 
this.selectedNode.getAttribute( 'mw' ) ) || {};
+   delete mwData.autoGenerated;
+
attrChanges = {
listGroup: listGroup,
refGroup: refGroup,
-   isResponsive: isResponsive
+   isResponsive: isResponsive,
+   mw: mwData
};
surfaceModel.change(

ve.dm.TransactionBuilder.static.newFromAttributeChanges(

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I348601952dbfcf06bfb564e4db9cac820f3b2776
Gerrit-PatchSet: 1
Gerrit-Project: med

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: init.mw.DesktopArticleTarget: properly set up section links

2017-10-16 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/384560 )

Change subject: init.mw.DesktopArticleTarget: properly set up section links
..

init.mw.DesktopArticleTarget: properly set up section links

We were reimplementing (poorly) setupMultiSectionLinks from the .init version.
Just call the original.

Bug: T151021
Change-Id: I65bd7c5ecf75c478d6babeb13e7fb2a76a9842c8
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 1 insertion(+), 12 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index 8064a3f..7adc0b3 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -1403,18 +1403,7 @@
}
 
// Re-set any edit section handlers now that the page content has been 
replaced
-   if (
-   // editsection but no editsection-visualeditor:
-   // whole editsection triggers VE
-   $content.find( '.mw-editsection' ).length &&
-   !$content.find( '.mw-editsection-visualeditor' ).length
-   ) {
-   $veSectionLinks = $content.find( '.mw-editsection a' );
-   } else {
-   // Otherwise, put it on the editsection-visualeditor links
-   $veSectionLinks = $content.find( 
'a.mw-editsection-visualeditor' );
-   }
-   $veSectionLinks.on( 'click', mw.libs.ve.onEditSectionLinkClick.bind( 
mw.libs.ve, 'visual' ) );
+   mw.libs.ve.setupMultiSectionLinks();
 
mw.hook( 'wikipage.content' ).fire( 
this.$editableContent.empty().append( $content ) );
if ( displayTitle ) {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: init.mw.Target: make getSurfaceConfig aware of modes

2017-10-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383410 )

Change subject: init.mw.Target: make getSurfaceConfig aware of modes
..

init.mw.Target: make getSurfaceConfig aware of modes

ve.init.Target sets up TriggerListeners based on getSurfaceConfig if there's
no Surface instantiated. As such, loading directly in source mode would have
those listeners present and assuming the document is in visual mode. So, if
there's not a Surface already, we'll assume we're going to get one created
with the defaultMode, and set things up expecting that.

Bug: T153959
Change-Id: Ia0afe32e6b63ea0d3418137ca5c8bc32c009ecfa
---
M modules/ve-mw/init/ve.init.mw.Target.js
1 file changed, 14 insertions(+), 3 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.Target.js 
b/modules/ve-mw/init/ve.init.mw.Target.js
index 2fc7b9c..08d17f2 100644
--- a/modules/ve-mw/init/ve.init.mw.Target.js
+++ b/modules/ve-mw/init/ve.init.mw.Target.js
@@ -310,9 +310,6 @@
// Preserve empty linebreaks on paste in source editor
importRules.all.keepEmptyContentBranches = true;
config = this.getSurfaceConfig( ve.extendObject( {}, config, {
-   commandRegistry: ve.ui.wikitextCommandRegistry,
-   sequenceRegistry: ve.ui.wikitextSequenceRegistry,
-   dataTransferHandlerFactory: 
ve.ui.wikitextDataTransferHandlerFactory,
importRules: importRules
} ) );
return new ve.ui.MWWikitextSurface( dmDoc, config );
@@ -342,6 +339,20 @@
 };
 
 /**
+ * @inheritdoc
+ */
+ve.init.mw.Target.prototype.getSurfaceConfig = function ( config ) {
+   // If we're not asking for a specific mode's config, use the default 
mode.
+   config = ve.extendObject( { mode: this.defaultMode }, config );
+   return ve.init.mw.Target.super.prototype.getSurfaceConfig.call( this, 
ve.extendObject( {
+   // Provide the wikitext versions of the registries, if we're 
using source mode
+   commandRegistry: config.mode === 'source' ? 
ve.ui.wikitextCommandRegistry : ve.ui.commandRegistry,
+   sequenceRegistry: config.mode === 'source' ? 
ve.ui.wikitextSequenceRegistry : ve.ui.sequenceRegistry,
+   dataTransferHandlerFactory: config.mode === 'source' ? 
ve.ui.wikitextDataTransferHandlerFactory : ve.ui.dataTransferHandlerFactory
+   }, config ) );
+};
+
+/**
  * Switch to editing mode.
  *
  * @method

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Make sure content is set

2017-10-04 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382359 )

Change subject: Make sure content is set
..

Make sure content is set

Change-Id: I59a5146a1186937a643818d02441563c5cc63319
---
M ApiVisualEditor.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 96bb561..12df277 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -581,7 +581,7 @@
];
if ( $params['paction'] === 'parse' ||
 $params['paction'] === 'wikitext' ||
-( !empty( $params['preload'] ) && 
$content )
+( !empty( $params['preload'] ) && 
isset( $content ) )
) {
$result['content'] = $content;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ApiVisualEditor: avoid some unset variable notices

2017-10-04 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/382166 )

Change subject: ApiVisualEditor: avoid some unset variable notices
..

ApiVisualEditor: avoid some unset variable notices

Bug: T176440
Change-Id: I571fbea79bd7f656cd367a5d8a773408fd80c7cf
---
M ApiVisualEditor.php
1 file changed, 3 insertions(+), 3 deletions(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 179d893..96bb561 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -282,7 +282,7 @@
 
if ( $section === 'new' ) {
$content = '';
-   if ( $params['preload'] 
) {
+   if ( !empty( 
$params['preload'] ) ) {
$content = 
$this->getPreloadContent(

$params['preload'], $params['preloadparams'], $title,

$params['paction'] !== 'wikitext'
@@ -322,7 +322,7 @@
if ( $content !== '' ) {
$content = 
$this->parseWikitextFragment( $title, $content );
}
-   if ( $content === '' && 
$params['preload'] ) {
+   if ( $content === '' && !empty( 
$params['preload'] ) ) {
$content = 
$this->getPreloadContent(
$params['preload'], 
$params['preloadparams'], $title,
$params['paction'] !== 
'wikitext'
@@ -581,7 +581,7 @@
];
if ( $params['paction'] === 'parse' ||
 $params['paction'] === 'wikitext' ||
-( $params['preload'] && $content )
+( !empty( $params['preload'] ) && 
$content )
) {
$result['content'] = $content;
}

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.Surface: handle table-adjacent observed selection changes...

2017-10-02 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381805 )

Change subject: ce.Surface: handle table-adjacent observed selection changes 
better
..

ce.Surface: handle table-adjacent observed selection changes better

Moving to the closest cursorable location produces better results, and means
clicking to the left of a table no longer vanishes the cursor.

There's a remaining bug when a table is the very first node in a document, and
you click to the left of it *twice*, which deselects the block slug and places
the cursor in an invalid position. This needs more changes to various
optimizations selection-changes try to make to avoid, however.

Bug: T148679
Bug: T176936
Change-Id: I8a3dde56d52342316c00a909ac9369b2a9f6b409
---
M src/ce/ve.ce.Surface.js
M src/dm/ve.dm.Document.js
2 files changed, 19 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/05/381805/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 63c056f..f340f80 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2762,7 +2762,7 @@
  * @param {ve.ce.RangeState} newState The changed range state
  */
 ve.ce.Surface.prototype.handleObservedChanges = function ( oldState, newState 
) {
-   var newSelection, transaction, removedUnicorns,
+   var newSelection, transaction, removedUnicorns, offset,
activeNode, coveringRange, nodeRange, containsStart, 
containsEnd,
surface = this,
dmDoc = this.getModel().getDocument(),
@@ -2812,9 +2812,16 @@
// cursorable location. Failure to do this can 
result in
// strange behavior when inserting content 
immediately after
// clicking on the surface.
-   newSelection = new ve.dm.LinearSelection( 
dmDoc, new ve.Range(
-   dmDoc.getNearestCursorOffset( 
newState.veRange.from, 1 )
-   ) );
+   offset = dmDoc.getNearestCursorOffset( 
newState.veRange.from, 0 );
+   if ( dmDoc.data.getNearestContentOffset( offset 
) === -1 ) {
+   // First, if we're in a document which 
outright doesn't
+   // have any cursorable locations, don't 
try to set one.
+   // These would be niche documents, 
since slugs normally
+   // catch those cases.
+   newSelection = new ve.dm.NullSelection( 
dmDoc );
+   } else {
+   newSelection = new 
ve.dm.LinearSelection( dmDoc, new ve.Range( offset ) );
+   }
} else {
newSelection = new ve.dm.LinearSelection( 
dmDoc, newState.veRange );
}
diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js
index 6087c9b..a75b1aa 100644
--- a/src/dm/ve.dm.Document.js
+++ b/src/dm/ve.dm.Document.js
@@ -920,11 +920,17 @@
  *
  * @method
  * @param {number} offset Offset to start looking at
- * @param {number} [direction=-1] Direction to look in, +1 or -1
+ * @param {number} [direction=-1] Direction to look in, +1 or -1; if 0, find 
the closest offset
  * @return {number} Nearest offset a cursor can be placed at
  */
 ve.dm.Document.prototype.getNearestCursorOffset = function ( offset, direction 
) {
-   var contentOffset, structuralOffset;
+   var contentOffset, structuralOffset, left, right;
+
+   if ( direction === 0 ) {
+   left = this.getNearestCursorOffset( offset, -1 );
+   right = this.getNearestCursorOffset( offset, 1 );
+   return offset - left < right - offset ? left : right;
+   }
 
direction = direction > 0 ? 1 : -1;
if (

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8a3dde56d52342316c00a909ac9369b2a9f6b409
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.Surface: in observed selection changes, only make cursora...

2017-09-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381235 )

Change subject: ce.Surface: in observed selection changes, only make cursorable 
selections
..

ce.Surface: in observed selection changes, only make cursorable selections

If we're placing a collapsed selection, it should be somewhere a cursor is
allowed to be. In practice, this mostly seems to mean nudging it into
paragraphs when a selection was attempted next to a block node.

Example this fixes:
1. Add a table followed by a blank line
2. Click in the table
3. Click to the right of the table
4. Press enter, get a "tried to close document node" error

Bug: T148679
Change-Id: I03348d34b3a2ffb5049acd4f62b4c568692e1649
---
M src/ce/ve.ce.Surface.js
M tests/ce/ve.ce.Surface.test.js
2 files changed, 21 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/35/381235/1

diff --git a/src/ce/ve.ce.Surface.js b/src/ce/ve.ce.Surface.js
index 46825e2..63c056f 100644
--- a/src/ce/ve.ce.Surface.js
+++ b/src/ce/ve.ce.Surface.js
@@ -2807,7 +2807,17 @@
oldState.veRange.equalsSelection( newState.veRange )
) ) {
if ( newState.veRange ) {
-   newSelection = new ve.dm.LinearSelection( dmDoc, 
newState.veRange );
+   if ( newState.veRange.isCollapsed() ) {
+   // If we're placing the cursor, make sure it 
winds up in a
+   // cursorable location. Failure to do this can 
result in
+   // strange behavior when inserting content 
immediately after
+   // clicking on the surface.
+   newSelection = new ve.dm.LinearSelection( 
dmDoc, new ve.Range(
+   dmDoc.getNearestCursorOffset( 
newState.veRange.from, 1 )
+   ) );
+   } else {
+   newSelection = new ve.dm.LinearSelection( 
dmDoc, newState.veRange );
+   }
} else {
newSelection = new ve.dm.NullSelection( dmDoc );
}
diff --git a/tests/ce/ve.ce.Surface.test.js b/tests/ce/ve.ce.Surface.test.js
index a4981a1..c224f5f 100644
--- a/tests/ce/ve.ce.Surface.test.js
+++ b/tests/ce/ve.ce.Surface.test.js
@@ -1233,6 +1233,16 @@
expectedOps: [],
expectsBreakpoint: false,
msg: 'Just moving the selection'
+   },
+   {
+   prevHtml: 'FooBar',
+   prevRange: new ve.Range( 4 ),
+   nextHtml: 'FooBar',
+   nextRange: new ve.Range( 5 ),
+   expectedOps: [],
+   expectsBreakpoint: false,
+   expectedRangeOrSelection: new ve.Range( 6 ),
+   msg: 'Moving the selection to a non-cursorable 
location'
}
];
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I03348d34b3a2ffb5049acd4f62b4c568692e1649
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: LinearEnterKeyDownHandler: make sure the range is in a curso...

2017-09-27 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/381033 )

Change subject: LinearEnterKeyDownHandler: make sure the range is in a 
cursorable location
..

LinearEnterKeyDownHandler: make sure the range is in a cursorable location

If the range is such that we try to act on the document node, everything will
break because it can't be closed. As such, make sure we're in the closest
possible cursorable position.

In my testing this seems to come up in interactions with block content which
has a paragraph following it, where the selection winds up focused between the
block and the paragraph instead of inside the paragraph. In practice this code
thus mostly works as `offset = offset + 1`.

Bug: T148679
Change-Id: I00b900646b3d335bfd3c74f8db1b32cf3cdf429d
---
M src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
1 file changed, 6 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/33/381033/1

diff --git a/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js 
b/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
index 7d05f16..7796374 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearEnterKeyDownHandler.js
@@ -76,6 +76,12 @@
surface.model.change( txRemove, new ve.dm.LinearSelection( 
documentModel, range ) );
}
 
+   // Adjust our range to be in cursor-appropriate places, now we know 
it's collapsed.
+   range = new ve.Range(
+   surface.model.documentModel.getNearestCursorOffset( range.from, 
1 ) ||
+   surface.model.documentModel.getNearestCursorOffset( range.from, 
-1 )
+   );
+
node = surface.documentView.getBranchNodeFromOffset( range.from );
if ( node !== null ) {
// assertion: node is certainly a contentBranchNode

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I00b900646b3d335bfd3c74f8db1b32cf3cdf429d
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Api: Missing preloadparams

2017-09-25 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380536 )

Change subject: Api: Missing preloadparams
..

Api: Missing preloadparams

Tiny fix to 33dc60838cbb8fc1c78678230c4516c1a36c23b3.

Change-Id: I844db115f2563cb9ee1629c30d5f49d1ce58f5bd
---
M ApiVisualEditor.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index d337cab..0216598 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -162,7 +162,7 @@
$content = $content->preloadTransform(
$preloadTitle,
$parserOptions,
-   $params['preloadparams']
+   $params
)->serialize();
 
if ( $parse ) {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Api: include preload content when section=new

2017-09-25 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380530 )

Change subject: Api: include preload content when section=new
..

Api: include preload content when section=new

Consistency with former editor behavior. Needed for some cases like
Template:Meetup/signup which use preload + section=new to make as close to a
one-click experience as they can.

Bug: T51622
Change-Id: I0940898b56dbaea536f57560135665df89569232
---
M ApiVisualEditor.php
1 file changed, 41 insertions(+), 26 deletions(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 2ebba05..d337cab 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -142,6 +142,37 @@
);
}
 
+   protected function getPreloadContent( $preload, $params, $contextTitle, 
$parse = false ) {
+   $content = '';
+   $preloadTitle = Title::newFromText( $preload );
+   // Check for existence to avoid getting MediaWiki:Noarticletext
+   if ( $preloadTitle instanceof Title &&
+$preloadTitle->exists() &&
+$preloadTitle->userCan( 'read' )
+   ) {
+   $preloadPage = WikiPage::factory( $preloadTitle );
+   if ( $preloadPage->isRedirect() ) {
+   $preloadTitle = 
$preloadPage->getRedirectTarget();
+   $preloadPage = WikiPage::factory( $preloadTitle 
);
+   }
+
+   $content = $preloadPage->getContent( Revision::RAW );
+   $parserOptions = ParserOptions::newFromUser( 
$this->getUser() );
+
+   $content = $content->preloadTransform(
+   $preloadTitle,
+   $parserOptions,
+   $params['preloadparams']
+   )->serialize();
+
+   if ( $parse ) {
+   // We need to turn this transformed wikitext 
into parsoid html
+   $content = $this->parseWikitextFragment( 
$contextTitle, $content );
+   }
+   }
+   return $content;
+   }
+
protected function getLangLinks( $title ) {
$apiParams = [
'action' => 'query',
@@ -251,6 +282,12 @@
 
if ( $section === 'new' ) {
$content = '';
+   if ( $params['preload'] 
) {
+   $content = 
$this->getPreloadContent(
+   
$params['preload'], $params['preloadparams'], $title,
+   
$params['paction'] !== 'wikitext'
+   );
+   }
} else {
$apiParams['rvsection'] 
= $section;
 
@@ -286,32 +323,10 @@
$content = 
$this->parseWikitextFragment( $title, $content );
}
if ( $content === '' && 
$params['preload'] ) {
-   $preloadTitle = 
Title::newFromText( $params['preload'] );
-   // Check for existence to avoid 
getting MediaWiki:Noarticletext
-   if ( $preloadTitle instanceof 
Title &&
-
$preloadTitle->exists() &&
-
$preloadTitle->userCan( 'read' )
-   ) {
-   $preloadPage = 
WikiPage::factory( $preloadTitle );
-   if ( 
$preloadPage->isRedirect() ) {
-   $preloadTitle = 
$preloadPage->getRedirectTarget();
-   $preloadPage = 
WikiPage::factory( $preloadTitle );
-   }
-
-   $content = 
$preloadPage->getContent( Revision::RAW );
-   $parserOptions = 
ParserOptions::newFromUser( $user );
-
-   $

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ApiVisualEditor: Stop an undefined variable error for preloa...

2017-09-21 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379666 )

Change subject: ApiVisualEditor: Stop an undefined variable error for preload 
on existing pages
..

ApiVisualEditor: Stop an undefined variable error for preload on existing pages

Bug: T176440
Change-Id: I39c8efe6d59948170b848730c4cc20c80cc2d326
---
M ApiVisualEditor.php
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index 285a953..2ebba05 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -566,7 +566,7 @@
];
if ( $params['paction'] === 'parse' ||
 $params['paction'] === 'wikitext' ||
-$params['preload']
+( $params['preload'] && $content )
) {
$result['content'] = $content;
}

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update VE core submodule to master (bd5da1725)

2017-09-21 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379557 )

Change subject: Update VE core submodule to master (bd5da1725)
..

Update VE core submodule to master (bd5da1725)

New changes:
3a64969b9 Setup slugs in TreeModifier
86c4df845 Update OOjs UI to v0.23.1
74c1020e1 Surface: reset selection when popping staging
754c5cf63 Localisation updates from https://translatewiki.net.

Bug: T166134
Bug: T175852
Bug: T175943
Change-Id: If101bd348a659d2954b28ca4b94dac66b8197ce3
---
M lib/ve
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/lib/ve b/lib/ve
index 75726b8..bd5da17 16
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit 75726b8504e95a5e73c877a1b4f1c42162b49047
+Subproject commit bd5da1725c967e47df36c31f18a49bfc6aea3172

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Graph[master]: ui.MWGraphDialog: update dialog fragment after popping staging

2017-09-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379437 )

Change subject: ui.MWGraphDialog: update dialog fragment after popping staging
..

ui.MWGraphDialog: update dialog fragment after popping staging

Depends-On: I905a4d5860a3bdf36477fc798a233e166febd63b
Bug: T166134
Change-Id: Ie8e949a21b305329eeb3633d80cd076de541a197
---
M modules/ve-graph/ve.ui.MWGraphDialog.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-graph/ve.ui.MWGraphDialog.js 
b/modules/ve-graph/ve.ui.MWGraphDialog.js
index ad00467..b3426cc 100644
--- a/modules/ve-graph/ve.ui.MWGraphDialog.js
+++ b/modules/ve-graph/ve.ui.MWGraphDialog.js
@@ -294,6 +294,7 @@
// Kill staging
if ( data === undefined ) {
this.getFragment().getSurface().popStaging();
+   this.getFragment().update( 
this.getFragment().getSurface().getSelection() );
}
}, this );
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie8e949a21b305329eeb3633d80cd076de541a197
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Graph
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Surface: reset selection when popping staging

2017-09-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379435 )

Change subject: Surface: reset selection when popping staging
..

Surface: reset selection when popping staging

Bug: T166134
Change-Id: I905a4d5860a3bdf36477fc798a233e166febd63b
---
M src/dm/ve.dm.Surface.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/35/379435/1

diff --git a/src/dm/ve.dm.Surface.js b/src/dm/ve.dm.Surface.js
index f04ce18..053c531 100644
--- a/src/dm/ve.dm.Surface.js
+++ b/src/dm/ve.dm.Surface.js
@@ -262,7 +262,7 @@
transaction = transactions[ i ].reversed();
reverseTransactions.push( transaction );
}
-   this.changeInternal( reverseTransactions, undefined, true );
+   this.changeInternal( reverseTransactions, staging.selectionBefore, true 
);
 
if ( !this.isStaging() ) {
this.startHistoryTracking();

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I905a4d5860a3bdf36477fc798a233e166febd63b
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Hooks: remove preloadtitle from unsupported list

2017-09-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/379246 )

Change subject: Hooks: remove preloadtitle from unsupported list
..

Hooks: remove preloadtitle from unsupported list

Bug: T51622
Change-Id: I480bbc5b9906f82b06667c69a559360f9083f06a
---
M VisualEditor.hooks.php
1 file changed, 2 insertions(+), 2 deletions(-)


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

diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index c3b1aa6..1c3820c 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -14,9 +14,9 @@
 
// Known parameters that VE does not handle
// TODO: Other params too?
-   // Known-good parameters: edit, veaction, section, oldid, lintid
+   // Known-good parameters: edit, veaction, section, oldid, lintid, 
preload, preloadparams, editintro
+   // Partially-good: preloadtitle (source-mode only)
private static $unsupportedEditParams = [
-   'preloadtitle',
'undo',
'undoafter',
'veswitched'

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget: Support preloadtitle in source mode

2017-09-18 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378726 )

Change subject: DesktopArticleTarget: Support preloadtitle in source mode
..

DesktopArticleTarget: Support preloadtitle in source mode

Can't support it in visual mode, since there's no new-section handling at all.

Bug: T51622
Change-Id: I763d5fff156e9ef3893bd882fab1dc2d47121728
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index bab1f98..8817de7 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -494,6 +494,7 @@
  * @param {ve.ui.Surface} surface Surface
  */
 ve.init.mw.DesktopArticleTarget.prototype.setupNewSection = function ( surface 
) {
+   var uri;
if ( surface.getMode() === 'source' && this.section === 'new' ) {
if ( !this.sectionTitle ) {
this.sectionTitle = new OO.ui.TextInputWidget( {
@@ -506,6 +507,11 @@
}
surface.setPlaceholder( ve.msg( 
'visualeditor-section-body-placeholder' ) );
this.$editableContent.before( this.sectionTitle.$element );
+
+   uri = new mw.Uri();
+   if ( uri.query.preloadtitle ) {
+   this.sectionTitle.setValue( uri.query.preloadtitle );
+   }
}
 };
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Enable preload in VisualEditor

2017-09-15 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378343 )

Change subject: Enable preload in VisualEditor
..

Enable preload in VisualEditor

This allows the use of the preload and preloadparams query parameters. They
should behave as they do in the old editor, loading substituted content in
visual and source modes.

Bug: T51622
Change-Id: I522fb5b480d17912f6d6116be6aa043ead855b52
---
M ApiVisualEditor.php
M VisualEditor.hooks.php
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
M modules/ve-mw/init/ve.init.mw.ArticleTargetLoader.js
4 files changed, 43 insertions(+), 7 deletions(-)


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

diff --git a/ApiVisualEditor.php b/ApiVisualEditor.php
index f479f15..6ab6425 100644
--- a/ApiVisualEditor.php
+++ b/ApiVisualEditor.php
@@ -285,6 +285,28 @@
if ( $content !== '' ) {
$content = 
$this->parseWikitextFragment( $title, $content );
}
+   if ( $content === '' && 
$params['preload'] ) {
+   $preloadTitle = 
Title::newFromText( $params['preload'] );
+   # Check for existence to avoid 
getting MediaWiki:Noarticletext
+   if ( $preloadTitle instanceof 
Title && $preloadTitle->exists() && $preloadTitle->userCan( 'read' ) ) {
+
+   $preloadPage = 
WikiPage::factory( $preloadTitle );
+   if ( 
$preloadPage->isRedirect() ) {
+   $preloadTitle = 
$preloadPage->getRedirectTarget();
+   $preloadPage = 
WikiPage::factory( $preloadTitle );
+   }
+
+   $content = 
$preloadPage->getContent( Revision::RAW );
+   $parserOptions = 
ParserOptions::newFromUser( $wgUser );
+
+   $content = 
$content->preloadTransform( $preloadTitle, $parserOptions, 
$params['preloadparams'] )->serialize();
+
+   if ( $params['paction'] 
!== 'wikitext' ) {
+   // We need to 
turn this transformed wikitext into parsoid html
+   $content = 
$this->parseWikitextFragment( $title, $content );
+   }
+   }
+   }
$baseTimestamp = wfTimestampNow();
$oldid = 0;
$restoring = false;
@@ -524,7 +546,7 @@
'oldid' => $oldid,
 
];
-   if ( $params['paction'] === 'parse' || 
$params['paction'] === 'wikitext' ) {
+   if ( $params['paction'] === 'parse' || 
$params['paction'] === 'wikitext' || $params['preload'] ) {
$result['content'] = $content;
}
break;
@@ -657,6 +679,8 @@
'oldid' => null,
'editintro' => null,
'pst' => false,
+   'preload' => null,
+   'preloadparams' => null,
];
}
 
diff --git a/VisualEditor.hooks.php b/VisualEditor.hooks.php
index af932c1..c3b1aa6 100644
--- a/VisualEditor.hooks.php
+++ b/VisualEditor.hooks.php
@@ -16,8 +16,6 @@
// TODO: Other params too?
// Known-good parameters: edit, veaction, section, oldid, lintid
private static $unsupportedEditParams = [
-   'preload',
-   'preloadparams',
'preloadtitle',
'undo',
'undoafter',
diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 0f79fb8..41dd4b7 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -251,6 +251,8 @@
oldId: oldId,
targetName: 'article', // 
ve.init.mw.DesktopArticleTarget.static.name

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ui.TableLineContext: fix z-index for menu

2017-09-14 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/378099 )

Change subject: ui.TableLineContext: fix z-index for menu
..

ui.TableLineContext: fix z-index for menu

Bug: T169389
Change-Id: Ic4c69b5469bd0bdfbe7420804df5276d075757c8
---
M src/ui/styles/ve.ui.TableLineContext.css
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/99/378099/1

diff --git a/src/ui/styles/ve.ui.TableLineContext.css 
b/src/ui/styles/ve.ui.TableLineContext.css
index d372ede..435da04 100644
--- a/src/ui/styles/ve.ui.TableLineContext.css
+++ b/src/ui/styles/ve.ui.TableLineContext.css
@@ -34,3 +34,7 @@
left: -1.2em;
border-right: 0;
 }
+
+.ve-ui-tableLineContext-menu {
+   z-index: 2;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic4c69b5469bd0bdfbe7420804df5276d075757c8
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ui.TableLineContext: adjust positioning

2017-09-12 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377482 )

Change subject: ui.TableLineContext: adjust positioning
..

ui.TableLineContext: adjust positioning

a4a0be2da1 restored this rule to stop overlap with the table context. However, 
it causes problems in RTL. Adjust it so it still stops overlap, without RTL 
issues.

Bug: T175417
Change-Id: I48aa0a542dbc42399e5ae6a5e341600dbb19427c
---
M src/ui/styles/ve.ui.TableLineContext.css
1 file changed, 1 insertion(+), 2 deletions(-)


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

diff --git a/src/ui/styles/ve.ui.TableLineContext.css 
b/src/ui/styles/ve.ui.TableLineContext.css
index 1c781b0..d372ede 100644
--- a/src/ui/styles/ve.ui.TableLineContext.css
+++ b/src/ui/styles/ve.ui.TableLineContext.css
@@ -5,9 +5,8 @@
  */
 
 .ve-ui-tableLineContext {
-   position: absolute;
/* Ensure it is placed above the table context */
-   z-index: 2;
+   z-index: 3;
 }
 
 .ve-ui-tableLineContext-indicator {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48aa0a542dbc42399e5ae6a5e341600dbb19427c
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget.init: handle new-section tab when in vi...

2017-09-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/377301 )

Change subject: DesktopArticleTarget.init: handle new-section tab when in 
visual mode
..

DesktopArticleTarget.init: handle new-section tab when in visual mode

Bug: T157755
Change-Id: Ida657edb57c4d3067f17104ff1b74965c8082131
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 4 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 11c4f78..47666af 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -609,9 +609,11 @@
if ( mode === 'visual' && 
target.getDefaultMode() === 'source' ) {
target.switchToVisualEditor();
} else if (
-   mode === 'source' && 
target.getDefaultMode() === 'source'
+   mode === 'source'
) {
-   // Requetsed section may have 
changed
+   // Requested section may have 
changed, or we may need
+   // to switch from visual mode 
to source mode with a
+   // section.
target.switchToWikitextSection( 
section );
}
} );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWExtensionWindow: clean up originalMwData on teardown

2017-09-07 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/376536 )

Change subject: MWExtensionWindow: clean up originalMwData on teardown
..

MWExtensionWindow: clean up originalMwData on teardown

Not doing this makes adding a new extension node with the exact same content
as a previously-viewed one have the Done button disabled.

Bug: T172586
Change-Id: I39105144e17135044ef644b5464b0fbfdfc019d5
---
M modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
1 file changed, 4 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js 
b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
index 104ee9e..c6451ba 100644
--- a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
+++ b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
@@ -114,7 +114,10 @@
  * @inheritdoc OO.ui.Window
  */
 ve.ui.MWExtensionWindow.prototype.getTeardownProcess = function ( data, 
process ) {
-   return process;
+   return process.next( function () {
+   // Don't hold on to the original data, it's only refreshed on 
setup for existing nodes
+   this.originalMwData = null;
+   }, this );
 };
 
 /**

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: mw.ArticleTarget: strip HTML tags entirely from source-mode ...

2017-08-29 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374573 )

Change subject: mw.ArticleTarget: strip HTML tags entirely from source-mode 
summary
..

mw.ArticleTarget: strip HTML tags entirely from source-mode summary

Bug: T173711
Change-Id: If8b354b2788285ea27472bf9a16544f8e5c091f8
---
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index 99abbba..2d0bde9 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -2027,6 +2027,8 @@
.replace( /\[\[:?([^[|]+)\|([^[]+)\]\]/, '$2' )
.replace( /\[\[:?([^[]+)\|?\]\]/, '$1' )
.replace( new RegExp( '\\[(?:' + 
ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + ')([^ 
]+?) ([^\\[]+)\\]', 'i' ), '$3' )
+   // Cheap HTML removal
+   .replace( /<[^>]+?>/g, '' )
;
}
if ( headingText ) {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWLinkAnnotationInspector: check input validity when switchi...

2017-08-29 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/374563 )

Change subject: MWLinkAnnotationInspector: check input validity when switching 
modes
..

MWLinkAnnotationInspector: check input validity when switching modes

Focusing a TextInputWidget normally unsets validity. However, because we're
kind of pretending this is the same input, just in a different mode, it
doesn't make sense to the user that the focus behavior occurs. So, make it
recheck validity after we switch.

Bug: T172159
Change-Id: I1d9d6670d72483c7510fd5ed3c539b43af8432bf
---
M modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js 
b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js
index 1870e96..b1ba81d 100644
--- a/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js
+++ b/modules/ve-mw/ui/inspectors/ve.ui.MWLinkAnnotationInspector.js
@@ -299,6 +299,10 @@
// 2. User clicks external link tab (unnecessary, because we'd 
auto-switch, but the user doesn't know that)
// 3. User pastes a link, intending to replace the existing prefilled 
link
this.annotationInput.getTextInputWidget().$input[ 0 
].setSelectionRange( 0, end );
+   // Focusing a TextInputWidget normally unsets validity. However, because
+   // we're kind of pretending this is the same input, just in a different
+   // mode, it doesn't make sense to the user that the focus behavior 
occurs.
+   this.annotationInput.getTextInputWidget().setValidityFlag();
 
this.updateActions();
 };

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...Cite[master]: ce.MWReferencesListNode: wait for content before destroying ...

2017-08-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369949 )

Change subject: ce.MWReferencesListNode: wait for content before destroying 
temporary view node
..

ce.MWReferencesListNode: wait for content before destroying temporary view node

Probably as fallout from the jQuery 3 update and associated promise-async
changes, `viewNode.destroy()` in the reflist preview caused problems when
adding a new reference with the generated content nodes which were actually
having to make an API call for their contents. New functions for waiting for
content generation to finish were added to core, and will defer the
destruction of the placeholder view until after it's done rendering.

Bug: T168932
Change-Id: I700bff9979a3356626aa311bfdf030da686f5878
Depends-On: Ic12973c0b46af50e0f1933137282a142f32e7de2
---
M modules/ve-cite/ve.ce.MWReferencesListNode.js
1 file changed, 24 insertions(+), 20 deletions(-)


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

diff --git a/modules/ve-cite/ve.ce.MWReferencesListNode.js 
b/modules/ve-cite/ve.ce.MWReferencesListNode.js
index 9dd59d9..20f4560 100644
--- a/modules/ve-cite/ve.ce.MWReferencesListNode.js
+++ b/modules/ve-cite/ve.ce.MWReferencesListNode.js
@@ -150,6 +150,27 @@
listGroup = this.model.getAttribute( 'listGroup' ),
nodes = internalList.getNodeGroup( listGroup );
 
+   function updateGeneratedContent( viewNode, $li ) {
+   // HACK: PHP parser doesn't wrap single lines in a paragraph
+   if (
+   viewNode.$element.children().length === 1 &&
+   viewNode.$element.children( 'p' ).length === 1
+   ) {
+   // unwrap inner
+   viewNode.$element.children().replaceWith(
+   viewNode.$element.children().contents()
+   );
+   }
+   $li.append(
+   $( '' )
+   .addClass( 'reference-text' )
+   .append( viewNode.$element )
+   );
+   // Since this is running after content generation has finished, 
it's
+   // safe to destroy the view.
+   viewNode.destroy();
+   }
+
this.$reflist.detach().empty();
this.$refmsg.detach();
 
@@ -220,26 +241,9 @@
modelNode = internalList.getItemNode( 
firstNode.getAttribute( 'listIndex' ) );
if ( modelNode && modelNode.length ) {
viewNode = new ve.ce.InternalItemNode( 
modelNode );
-   // HACK: PHP parser doesn't wrap single lines 
in a paragraph
-   if (
-   viewNode.$element.children().length === 
1 &&
-   viewNode.$element.children( 'p' 
).length === 1
-   ) {
-   // unwrap inner
-   
viewNode.$element.children().replaceWith(
-   
viewNode.$element.children().contents()
-   );
-   }
-   $li.append(
-   $( '' )
-   .addClass( 'reference-text' )
-   .append( viewNode.$element )
-   );
-   // HACK: See bug 62682 - We happen to know that 
destroy doesn't abort async
-   // rendering for generated content nodes, but 
we really can't guarantee that in the
-   // future - if you are here, debugging, because 
something isn't rendering properly,
-   // it's likely that something has changed and 
these assumptions are no longer valid
-   viewNode.destroy();
+
+   
ve.ce.GeneratedContentNode.static.awaitGeneratedContent( viewNode )
+   .then( updateGeneratedContent.bind( 
this, viewNode, $li ) );
} else {
$li.append(
$( '' )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I700bff9979a3356626aa311bfdf030da686f5878
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: DLynch 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mail

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ce.GeneratedContentNode: helper for waiting for generation

2017-08-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369948 )

Change subject: ce.GeneratedContentNode: helper for waiting for generation
..

ce.GeneratedContentNode: helper for waiting for generation

Waiting for all content generation to occur before doing something else isn't
an uncommon pattern. So, pull the one-off code out of PreviewElement and make
it available here for our use elsewhere.

Bug: T168932
Change-Id: Ic12973c0b46af50e0f1933137282a142f32e7de2
---
M src/ce/nodes/ve.ce.GeneratedContentNode.js
M src/ui/elements/ve.ui.PreviewElement.js
2 files changed, 37 insertions(+), 21 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/48/369948/1

diff --git a/src/ce/nodes/ve.ce.GeneratedContentNode.js 
b/src/ce/nodes/ve.ce.GeneratedContentNode.js
index b726f08..b5d76fe 100644
--- a/src/ce/nodes/ve.ce.GeneratedContentNode.js
+++ b/src/ce/nodes/ve.ce.GeneratedContentNode.js
@@ -48,6 +48,41 @@
 // We handle rendering ourselves, no need to render attributes from 
originalDomElements
 ve.ce.GeneratedContentNode.static.renderHtmlAttributes = false;
 
+/* Static methods */
+
+/**
+ * Wait for all content-generation within a given node to finish
+ *
+ * If no GeneratedContentNodes are within the node, a resolved promise will be
+ * returned.
+ *
+ * @param  {ve.ce.View} view Any view node
+ * @return {jQuery.Promise} Promise, resolved when content is generated
+ */
+ve.ce.GeneratedContentNode.static.awaitGeneratedContent = function ( view ) {
+   var promises = [];
+
+   function queueNode( node ) {
+   var promise;
+   if ( typeof node.generateContents === 'function' ) {
+   if ( node.isGenerating() ) {
+   promise = $.Deferred();
+   node.once( 'rerender', promise.resolve );
+   promises.push( promise );
+   }
+   }
+   }
+
+   // Traverse children to see when they are all rerendered
+   if ( view instanceof ve.ce.BranchNode ) {
+   view.traverse( queueNode );
+   } else {
+   queueNode( view );
+   }
+
+   return $.when.apply( $, promises );
+};
+
 /* Abstract methods */
 
 /**
diff --git a/src/ui/elements/ve.ui.PreviewElement.js 
b/src/ui/elements/ve.ui.PreviewElement.js
index 33f889e..b2baaec 100644
--- a/src/ui/elements/ve.ui.PreviewElement.js
+++ b/src/ui/elements/ve.ui.PreviewElement.js
@@ -98,32 +98,13 @@
  * Update the preview
  */
 ve.ui.PreviewElement.prototype.updatePreview = function () {
-   var promises = [],
-   element = this;
+   var element = this;
 
// Initial CE node
this.view = ve.ce.nodeFactory.create( this.model.getType(), this.model 
);
 
-   function queueNode( node ) {
-   var promise;
-   if ( typeof node.generateContents === 'function' ) {
-   if ( node.isGenerating() ) {
-   promise = $.Deferred();
-   node.once( 'rerender', promise.resolve );
-   promises.push( promise );
-   }
-   }
-   }
-
-   // Traverse children to see when they are all rerendered
-   if ( this.view instanceof ve.ce.BranchNode ) {
-   this.view.traverse( queueNode );
-   } else {
-   queueNode( this.view );
-   }
-
// When all children are rerendered, replace with dm DOM
-   $.when.apply( $, promises )
+   ve.ce.GeneratedContentNode.static.awaitGeneratedContent( this.view )
.then( function () {
// Verify that the element and/or the ce node weren't 
destroyed
if ( element.view ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic12973c0b46af50e0f1933137282a142f32e7de2
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: LinearTabKeyDownHandler: Abort if modifiers are used

2017-08-01 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/369407 )

Change subject: LinearTabKeyDownHandler: Abort if modifiers are used
..

LinearTabKeyDownHandler: Abort if modifiers are used

Firefox still does the tab-switch, so we shouldn't move the selection when
that's going to happen. This is the same check that's used in the
TableArrowKeyDownHander.

Bug: T172168
Change-Id: I05ff2a52813bf299bdd9121e42718941fc5f35dd
---
M src/ce/keydownhandlers/ve.ce.LinearTabKeyDownHandler.js
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/07/369407/1

diff --git a/src/ce/keydownhandlers/ve.ce.LinearTabKeyDownHandler.js 
b/src/ce/keydownhandlers/ve.ce.LinearTabKeyDownHandler.js
index c68816d..a60cbf8 100644
--- a/src/ce/keydownhandlers/ve.ce.LinearTabKeyDownHandler.js
+++ b/src/ce/keydownhandlers/ve.ce.LinearTabKeyDownHandler.js
@@ -39,6 +39,13 @@
 ve.ce.LinearTabKeyDownHandler.static.execute = function ( surface, e ) {
var activeTableNode = surface.getActiveNode() && 
surface.getActiveNode().findParent( ve.ce.TableNode );
if ( activeTableNode ) {
+   if ( e.ctrlKey || e.altKey || e.metaKey ) {
+   // Support: Firefox
+   // In Firefox, ctrl-tab to switch browser-tabs still 
triggers the
+   // keydown event.
+   return;
+   }
+
e.preventDefault();
e.stopPropagation();
activeTableNode.setEditing( false );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I05ff2a52813bf299bdd9121e42718941fc5f35dd
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ce.MWTransclusionNode: make sure model exists before getting...

2017-07-24 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/367429 )

Change subject: ce.MWTransclusionNode: make sure model exists before getting 
its document
..

ce.MWTransclusionNode: make sure model exists before getting its document

Bug: T168932
Change-Id: I8d45ed0b80205ce17b41f3506410c550630f
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 0515721..8542ecc 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -189,7 +189,7 @@
// Parent method
var elements = 
ve.ce.GeneratedContentNode.prototype.getRenderedDomElements.apply( this, 
arguments );
 
-   if ( this.getModelHtmlDocument() ) {
+   if ( this.model && this.getModelHtmlDocument() ) {
ve.init.platform.linkCache.styleParsoidElements(
$( elements ),
this.getModelHtmlDocument()

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ArticleTarget: set local config to hide welcome dialog

2017-07-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366279 )

Change subject: ArticleTarget: set local config to hide welcome dialog
..

ArticleTarget: set local config to hide welcome dialog

This stops the welcome dialog from being displayed repeatedly if the user
edits the article multiple times in the same pageload.

Bug: T170983
Change-Id: I8cc5990e9acb1ac09a2d6dd95eef8042c70088c7
---
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index ffa9d12..9672b02 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -2159,6 +2159,7 @@
 
if ( prefSaysShow ) {
new mw.Api().saveOption( 
'visualeditor-hidebetawelcome', '1' );
+   mw.user.options.set( 'visualeditor-hidebetawelcome', 
'1' );
 
// No need to set a cookie every time for logged-in 
users that have already
// set the hidebetawelcome=1 preference, but only if 
this isn't a one-off

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: LinkCache: parsoid element styling, detect selflink fragments

2017-07-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/366286 )

Change subject: LinkCache: parsoid element styling, detect selflink fragments
..

LinkCache: parsoid element styling, detect selflink fragments

Selflinks with fragments aren't actually selflinks, and so shouldn't be styled
as such.

Bug: T170943
Change-Id: Icb67c81327769d09af6bcfe593843d9dd2bcc33c
---
M modules/ve-mw/init/ve.init.mw.LinkCache.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/init/ve.init.mw.LinkCache.js 
b/modules/ve-mw/init/ve.init.mw.LinkCache.js
index cfdca0c..f4ec4df 100644
--- a/modules/ve-mw/init/ve.init.mw.LinkCache.js
+++ b/modules/ve-mw/init/ve.init.mw.LinkCache.js
@@ -128,7 +128,7 @@
title = 
ve.init.platform.linkCache.constructor.static.normalizeTitle(

ve.dm.MWInternalLinkAnnotation.static.getTargetDataFromHref( href, doc ).title
);
-   ve.init.platform.linkCache.styleElement( title, 
$( this ) );
+   ve.init.platform.linkCache.styleElement( title, 
$( this ), href.indexOf( '#' ) !== -1 );
} );
}
 };

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget.init: more explicit no-welcome-on-prote...

2017-07-17 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365867 )

Change subject: DesktopArticleTarget.init: more explicit 
no-welcome-on-protected-pages
..

DesktopArticleTarget.init: more explicit no-welcome-on-protected-pages

Bug: T138715
Change-Id: I1d1efe7fb3286bbf85ea2a17356dcad1d3346517
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 5 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 5d338b7..03323b8 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -1055,6 +1055,11 @@
welcomeDialogLocalStorageValue === null 
&&
$.cookie( 've-beta-welcome-dialog' ) 
=== null
)
+   ) &&
+   (
+   // Not on protected pages
+   mw.config.get( 'wgIsProbablyEditable' ) ||
+   mw.config.get( 
'wgRelevantPageIsProbablyEditable' )
)
) {
mw.loader.using( 'ext.visualEditor.welcome' ).done( 
function () {

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...SyntaxHighlight_GeSHi[master]: ce.MWSyntaxHighlightNode: Always generate node contents

2017-07-17 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365643 )

Change subject: ce.MWSyntaxHighlightNode: Always generate node contents
..

ce.MWSyntaxHighlightNode: Always generate node contents

Don't bother checking supported languages before generating the node contents.
We always want the preview, as that's what will display on the rendered page
even if the language is invalid.

Bug: T164120
Change-Id: I839bbf9c9cce131d745ea5f4e54b96fe57b1
---
M modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
1 file changed, 0 insertions(+), 3 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SyntaxHighlight_GeSHi 
refs/changes/43/365643/1

diff --git a/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js 
b/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
index 11a45fd..0d1cc57 100644
--- a/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
+++ b/modules/ve-syntaxhighlight/ve.ce.MWSyntaxHighlightNode.js
@@ -30,9 +30,6 @@
 ve.ce.MWSyntaxHighlightNode.prototype.generateContents = function () {
var node = this,
args = arguments;
-   if ( !this.getModel().isLanguageSupported() ) {
-   return $.Deferred().reject().promise();
-   }
// Parent method
return mw.loader.using( 'ext.pygments' ).then( function () {
return ve.ce.MWExtensionNode.prototype.generateContents.apply( 
node, args );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I839bbf9c9cce131d745ea5f4e54b96fe57b1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SyntaxHighlight_GeSHi
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ce.MWTransclusionNode: make sure model exists before getting...

2017-07-13 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/365057 )

Change subject: ce.MWTransclusionNode: make sure model exists before getting 
its document
..

ce.MWTransclusionNode: make sure model exists before getting its document

Bug: T168932
Change-Id: Idf18839b1f1fae6eb29621f1950d2b52c99e3433
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index 5a37a5f..518601c 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -155,7 +155,7 @@
}
 
// Work around https://github.com/jquery/jquery/issues/1997
-   contentNodes = $.parseHTML( response.visualeditor.content, 
this.getModelHtmlDocument() ) || [];
+   contentNodes = $.parseHTML( response.visualeditor.content, this.model 
&& this.getModelHtmlDocument() ) || [];
deferred.resolve( this.constructor.static.filterRendering( contentNodes 
) );
 };
 

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget.init: only show welcome dialog if page ...

2017-07-12 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364760 )

Change subject: DesktopArticleTarget.init: only show welcome dialog if page 
editable
..

DesktopArticleTarget.init: only show welcome dialog if page editable

"Welcome to wikipedia, anyone can edit, we welcome all improvements. Start
editing!" is a bit out of place when what you'll see after clicking "start
editing" is "you can't edit this page".

Bug: T138715
Change-Id: I9f655a5f12d4e45644bd01631c2d3131375d8e8f
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
index 2452098..5d338b7 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.init.js
@@ -1043,6 +1043,7 @@
welcomeDialogLocalStorageValue = localStorage.getItem( 
've-beta-welcome-dialog' );
} catch ( e ) {}
if (
+   pageCanLoadEditor &&
showWikitextWelcome &&
mw.config.get( 'wgVisualEditorConfig' ).showBetaWelcome 
&&
[ 'edit', 'submit' ].indexOf( mw.config.get( 'wgAction' 
) ) !== -1 &&

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

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

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: WindowManager: fix closing promise state check

2017-07-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364227 )

Change subject: WindowManager: fix closing promise state check
..

WindowManager: fix closing promise state check

Async promise resolution means that `deferreds.closing` and `closing` can have
their state out of sync if a window is closed multiple times in the same tick.
As such, check the state on `deferreds.closing` directly, since that's what
the preparingToClose promise directly manipulates.

Bug: T169844
Change-Id: I43b378e2e235f0425845844d3047ab506fd5f786
---
M src/WindowManager.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/27/364227/1

diff --git a/src/WindowManager.js b/src/WindowManager.js
index 1945318..2c58fe4 100644
--- a/src/WindowManager.js
+++ b/src/WindowManager.js
@@ -474,7 +474,7 @@
error = 'Cannot close window: window is not attached to 
manager';
} else if ( win !== this.currentWindow ) {
error = 'Cannot close window: window already closed with 
different data';
-   } else if ( this.preparingToClose || lifecycle.closing.state() === 
'resolved' ) {
+   } else if ( this.preparingToClose || 
lifecycle.deferreds.closing.state() === 'resolved' ) {
error = 'Cannot close window: window already closing with 
different data';
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I43b378e2e235f0425845844d3047ab506fd5f786
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: DiffElement: hide strikethrough on hover

2017-07-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/364202 )

Change subject: DiffElement: hide strikethrough on hover
..

DiffElement: hide strikethrough on hover

Bug: T170133
Change-Id: I7f89deb4252011ddd58c716ec785aacc078c0775
---
M src/ui/styles/elements/ve.ui.DiffElement.css
1 file changed, 3 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/02/364202/1

diff --git a/src/ui/styles/elements/ve.ui.DiffElement.css 
b/src/ui/styles/elements/ve.ui.DiffElement.css
index 65a89f8..274d6eb 100644
--- a/src/ui/styles/elements/ve.ui.DiffElement.css
+++ b/src/ui/styles/elements/ve.ui.DiffElement.css
@@ -99,6 +99,9 @@
 del[data-diff-action='remove'] {
text-decoration: line-through;
 }
+del[data-diff-action='remove']:hover {
+   text-decoration: none;
+}
 
 [data-diff-action='insert'] [rel='ve:Comment'],
 [data-diff-action='remove'] [rel='ve:Comment'],

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7f89deb4252011ddd58c716ec785aacc078c0775
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ve.ui.TableLineContext: restore the z-index hack

2017-07-06 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363619 )

Change subject: ve.ui.TableLineContext: restore the z-index hack
..

ve.ui.TableLineContext: restore the z-index hack

73ce638f11 removed this, thinking it was unnecessary. Unfortunately, it still
appears under the table context without the hack.

Bug: T169389
Change-Id: I02302a5f5b7443ef164a4c0db1be5960595f7daa
---
M src/ui/styles/ve.ui.TableLineContext.css
1 file changed, 6 insertions(+), 0 deletions(-)


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

diff --git a/src/ui/styles/ve.ui.TableLineContext.css 
b/src/ui/styles/ve.ui.TableLineContext.css
index eb3fa27..1c781b0 100644
--- a/src/ui/styles/ve.ui.TableLineContext.css
+++ b/src/ui/styles/ve.ui.TableLineContext.css
@@ -4,6 +4,12 @@
  * @copyright 2011-2017 VisualEditor Team and others; see 
http://ve.mit-license.org
  */
 
+.ve-ui-tableLineContext {
+   position: absolute;
+   /* Ensure it is placed above the table context */
+   z-index: 2;
+}
+
 .ve-ui-tableLineContext-indicator {
position: absolute;
display: block;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I02302a5f5b7443ef164a4c0db1be5960595f7daa
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: Minimal demo: update deprecated TextInputWidget

2017-07-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363096 )

Change subject: Minimal demo: update deprecated TextInputWidget
..

Minimal demo: update deprecated TextInputWidget

Change-Id: I985ebe9a7968b3bb9cfe704c9e49341dc6469a38
---
M demos/ve/demo.minimal.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/96/363096/1

diff --git a/demos/ve/demo.minimal.js b/demos/ve/demo.minimal.js
index 0be6f52..633c6e6 100644
--- a/demos/ve/demo.minimal.js
+++ b/demos/ve/demo.minimal.js
@@ -32,7 +32,7 @@
convertText.setValue( target.getSurface().getHtml() );
} );
 
-   convertText = new OO.ui.TextInputWidget( { multiline: true, 
autosize: true, classes: [ 've-demo-html' ] } );
+   convertText = new OO.ui.MultilineTextInputWidget( { autosize: 
true, classes: [ 've-demo-html' ] } );
 
$( '.ve-demo-output' ).append(
convertButton.$element,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I985ebe9a7968b3bb9cfe704c9e49341dc6469a38
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Custom TextInputWidgets: clean up unneeded multiline config

2017-07-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363095 )

Change subject: Custom TextInputWidgets: clean up unneeded multiline config
..

Custom TextInputWidgets: clean up unneeded multiline config

Bug: T169272
Change-Id: I45565f01de76a88d64d7b0691d1e7279354f375d
---
M modules/ve-mw/ce/ve.ce.MWWikitextSurface.js
M modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js
M modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
M modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js
M modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
6 files changed, 4 insertions(+), 9 deletions(-)


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

diff --git a/modules/ve-mw/ce/ve.ce.MWWikitextSurface.js 
b/modules/ve-mw/ce/ve.ce.MWWikitextSurface.js
index 1ccb3f9..898a457 100644
--- a/modules/ve-mw/ce/ve.ce.MWWikitextSurface.js
+++ b/modules/ve-mw/ce/ve.ce.MWWikitextSurface.js
@@ -19,7 +19,7 @@
// Parent constructors
ve.ce.MWWikitextSurface.super.apply( this, arguments );
 
-   this.pasteTargetInput = new OO.ui.TextInputWidget( { multiline: true } 
);
+   this.pasteTargetInput = new OO.ui.MultilineTextInputWidget( {} );
 };
 
 /* Inheritance */
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
index 2ca281b..8f0a82a 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWGalleryDialog.js
@@ -127,9 +127,8 @@
.addClass( 've-ui-mwGalleryDialog-highlighted-image' );
this.filenameFieldset.$element.append( this.$highlightedImage );
// TODO: make into a ve.ui.MWTargetWidget once Parsoid handles galleries
-   this.highlightedCaptionInput = new OO.ui.TextInputWidget( {
+   this.highlightedCaptionInput = new OO.ui.MultilineTextInputWidget( {
placeholder: ve.msg( 
'visualeditor-mwgallerydialog-image-caption-placeholder' ),
-   multiline: true,
autosize: true
} );
this.highlightedCaptionFieldset = new OO.ui.FieldsetLayout( {
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js
index 293d0e2..c900ac8 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWPreDialog.js
@@ -58,7 +58,6 @@
} );
// Note that this overrides this.input from ve.ui.MWExtensionWindow
this.input = new ve.ui.MWPreTextInputWidget( {
-   multiline: true,
// This number doesn't really matter, it just needs to be large.
// The real height is enforced by #getBodyHeight and max-height 
in CSS.
rows: 100,
diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
index 017095e..7312479 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js
@@ -513,8 +513,7 @@
this.$editSummaryLabel = $( '' ).addClass( 
've-ui-mwSaveDialog-summaryLabel' )
.html( ve.init.platform.getParsedMessage( 'summary' ) )
.find( 'a' ).attr( 'target', '_blank' ).end();
-   this.editSummaryInput = new OO.ui.TextInputWidget( {
-   multiline: true,
+   this.editSummaryInput = new OO.ui.MultilineTextInputWidget( {
placeholder: ve.msg( 'visualeditor-editsummary' ),
classes: [ 've-ui-mwSaveDialog-summary' ],
inputFilter: function ( value ) {
diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js 
b/modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js
index 15c5cab..595daf5 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWTransclusionContentPage.js
@@ -27,8 +27,7 @@
 
// Properties
this.content = content;
-   this.textInput = new OO.ui.TextInputWidget( {
-   multiline: true,
+   this.textInput = new OO.ui.MultilineTextInputWidget( {
autosize: true,
classes: [ 've-ui-mwTransclusionDialog-input' ]
} )
diff --git a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js 
b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
index e00b77e..57ea1ae 100644
--- a/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
+++ b/modules/ve-mw/ui/ve.ui.MWExtensionWindow.js
@@ -56,7 +56,6 @@
 ve.ui.MWExtensionWindow.prototype.initialize = function () {
this.input = new ve.ui.WhitespacePreservingTextInputWidget( {
limit: 1,
-   multiline: true,
classes: [ 've-ui-mwExtensionWindow-input' ]
} );
 };

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

Gerrit-MessageType: ne

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Update VE core submodule to master (65ea4cf36)

2017-07-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363036 )

Change subject: Update VE core submodule to master (65ea4cf36)
..

Update VE core submodule to master (65ea4cf36)

New changes:
7b9f264b6 Localisation updates from https://translatewiki.net.
52e9cc349 Update OOjs UI to v0.22.2
65ea4cf36 ui.WhitespacePreservingTextInputWidget: inherit from 
MultilineTextInputWidget

Change-Id: I37987fec09a340a14eedd3535fcb48bea265823c
---
M lib/ve
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/lib/ve b/lib/ve
index b528a53..65ea4cf 16
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit b528a532135f0806a310d1cb4832ac0cff20c00b
+Subproject commit 65ea4cf36d125ac95de1d658fe10f0664d3a4e69

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ui.WhitespacePreservingTextInputWidget: inherit from Multili...

2017-07-03 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/363034 )

Change subject: ui.WhitespacePreservingTextInputWidget: inherit from 
MultilineTextInputWidget
..

ui.WhitespacePreservingTextInputWidget: inherit from MultilineTextInputWidget

Commit 1eb25592c to OOui removed multiline support from TextInputWidget. All
uses of WhitespacePreservingTextInputWidget require multiline, and caused
errors instead of functioning.

Bug: T169272
Change-Id: I3e510aa9b44f2ad37f8ff026d680df446925e8ee
---
M src/ui/inspectors/ve.ui.CommentInspector.js
M src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js
2 files changed, 2 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/34/363034/1

diff --git a/src/ui/inspectors/ve.ui.CommentInspector.js 
b/src/ui/inspectors/ve.ui.CommentInspector.js
index 2d9c5ac..c6d27c1 100644
--- a/src/ui/inspectors/ve.ui.CommentInspector.js
+++ b/src/ui/inspectors/ve.ui.CommentInspector.js
@@ -52,7 +52,6 @@
ve.ui.CommentInspector.super.prototype.initialize.call( this );
 
this.textWidget = new ve.ui.WhitespacePreservingTextInputWidget( {
-   multiline: true,
autosize: true
} );
this.textWidget.connect( this, { resize: 'updateSize' } );
diff --git a/src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js 
b/src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js
index 2be7710..3cd654b 100644
--- a/src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js
+++ b/src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js
@@ -8,7 +8,7 @@
  * Text input widget which hides but preserves leading and trailing whitespace
  *
  * @class
- * @extends OO.ui.TextInputWidget
+ * @extends OO.ui.MultilineTextInputWidget
  *
  * @constructor
  * @param {Object} [config] Configuration options
@@ -32,7 +32,7 @@
 
 /* Inheritance */
 
-OO.inheritClass( ve.ui.WhitespacePreservingTextInputWidget, 
OO.ui.TextInputWidget );
+OO.inheritClass( ve.ui.WhitespacePreservingTextInputWidget, 
OO.ui.MultilineTextInputWidget );
 
 /* Methods */
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e510aa9b44f2ad37f8ff026d680df446925e8ee
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ui.FormatAction: fixup selection for empty conversions

2017-06-29 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/362229 )

Change subject: ui.FormatAction: fixup selection for empty conversions
..

ui.FormatAction: fixup selection for empty conversions

Converting an empty node needs a small selection fixup afterwards, otherwise
the selection will be displayed outside the new empty node. This causes issues
with the display of the current format in the toolbar, and with hitting enter
if no content is entered. Don't always reapply the selection, because the
automatic behavior is better if isolateAndUnwrap has actually acted.

Bug: T151594
Change-Id: Ibf143e7954919d0d9efacd53205d5451461a3115
---
M src/ui/actions/ve.ui.FormatAction.js
1 file changed, 11 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/29/362229/1

diff --git a/src/ui/actions/ve.ui.FormatAction.js 
b/src/ui/actions/ve.ui.FormatAction.js
index eb4fdce..d3ed91b 100644
--- a/src/ui/actions/ve.ui.FormatAction.js
+++ b/src/ui/actions/ve.ui.FormatAction.js
@@ -51,9 +51,10 @@
var selected, i, length, contentBranch,
surfaceModel = this.surface.getModel(),
fragment = surfaceModel.getFragment(),
+   fragmentSelection = fragment.getSelection(),
fragments = [];
 
-   if ( !( fragment.getSelection() instanceof ve.dm.LinearSelection ) ) {
+   if ( !( fragmentSelection instanceof ve.dm.LinearSelection ) ) {
return;
}
 
@@ -73,6 +74,15 @@
}
 
fragment.convertNodes( type, attributes );
+   if ( fragment.getData().length === 0 ) {
+   // Converting an empty node needs a small selection fixup 
afterwards,
+   // otherwise the selection will be displayed outside the new 
empty
+   // node. This causes issues with the display of the current 
format in
+   // the toolbar, and with hitting enter if no content is 
entered. Don't
+   // always reapply the selection, because the automatic behavior 
is
+   // better if isolateAndUnwrap has actually acted. (T151594)
+   surfaceModel.setSelection( fragmentSelection );
+   }
this.surface.getView().focus();
return true;
 };

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf143e7954919d0d9efacd53205d5451461a3115
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: dm.SurfaceFragment tests: exercise fixupInsertion for mwHead...

2017-06-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361890 )

Change subject: dm.SurfaceFragment tests: exercise fixupInsertion for mwHeadings
..

dm.SurfaceFragment tests: exercise fixupInsertion for mwHeadings

Core VE doesn't have any elements with suggestedParents, so make sure this is
properly tested.

Bug: T164017

Change-Id: I01489226d282abe71020e65358ead24fe07692f7
Depends-On: I6ef341e7b6d378aab6090bf060d512f7f3c97e8b
---
M modules/ve-mw/tests/dm/ve.dm.SurfaceFragment.test.js
1 file changed, 49 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/tests/dm/ve.dm.SurfaceFragment.test.js 
b/modules/ve-mw/tests/dm/ve.dm.SurfaceFragment.test.js
index ef4b34c..64b18f1 100644
--- a/modules/ve-mw/tests/dm/ve.dm.SurfaceFragment.test.js
+++ b/modules/ve-mw/tests/dm/ve.dm.SurfaceFragment.test.js
@@ -27,3 +27,52 @@
);
}, 'isolating paragraph in list item "Nested 2" for MWheading' );
 } );
+
+QUnit.test( 'insertContent (MWheading)', function ( assert ) {
+   var doc = new ve.dm.Document( [
+   { type: 'list', attributes: { style: 'bullet' } },
+   { type: 'listItem' },
+   { type: 'paragraph' },
+   'a',
+   'b',
+   { type: '/paragraph' },
+   { type: '/listItem' },
+   { type: '/list' }
+   ] ),
+   surface = new ve.dm.Surface( doc ),
+   fragment = surface.getLinearFragment( new ve.Range( 4, 4 ) ),
+   headingData = [ { type: 'mwHeading', attributes: { level: 3 } 
}, 'x', { type: '/mwHeading' } ];
+
+   fragment.insertContent( headingData );
+   assert.deepEqual(
+   doc.getData( new ve.Range( 3, 14 ) ),
+   [
+   'a',
+   { type: '/paragraph' },
+   { type: '/listItem' },
+   { type: '/list' },
+   { type: 'mwHeading', attributes: { level: 3 } },
+   'x',
+   { type: '/mwHeading' },
+   { type: 'list', attributes: { style: 'bullet' } },
+   { type: 'listItem' },
+   { type: 'paragraph' },
+   'b'
+   ],
+   'inserting a mwheading into a listitem should isolate it from 
the list'
+   );
+
+   surface.undo();
+   fragment = surface.getLinearFragment( new ve.Range( 8, 8 ) );
+   fragment.insertContent( headingData );
+   assert.deepEqual(
+   doc.getData( new ve.Range( 7, 11 ) ),
+   [
+   { type: '/list' },
+   { type: 'mwHeading', attributes: { level: 3 } },
+   'x',
+   { type: '/mwHeading' }
+   ],
+   'inserting a mwheading to the document root should not add any 
extra closing elements'
+   );
+} );

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: dm.Document fixupInsertion: check suggestedParents as well

2017-06-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/361888 )

Change subject: dm.Document fixupInsertion: check suggestedParents as well
..

dm.Document fixupInsertion: check suggestedParents as well

This helps with cases where direct API calls or copy/paste add restricted
elements. The existing check in dm.SurfaceFragment is very narrowly
applicable to FormatAction's case, and didn't help here.

Bug: T164017

Change-Id: I6ef341e7b6d378aab6090bf060d512f7f3c97e8b
---
M src/dm/ve.dm.Document.js
1 file changed, 50 insertions(+), 20 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/88/361888/1

diff --git a/src/dm/ve.dm.Document.js b/src/dm/ve.dm.Document.js
index 196ba05..0b32b3a 100644
--- a/src/dm/ve.dm.Document.js
+++ b/src/dm/ve.dm.Document.js
@@ -1199,6 +1199,9 @@
parentsOK,
// Whether childType matches allowedChildren
childrenOK,
+   //
+   suggestedParents,
+   suggestedParentsOK,
// Array of opening elements to insert (for wrapping the 
to-be-inserted element)
openings,
// Array of closing elements to insert (for splitting nodes)
@@ -1290,6 +1293,40 @@
newData.push( element );
}
 
+   /**
+* Close the current element on the stack and arrange for its later 
reopening
+*
+* This function updates parentNode, parentType, closingStack, 
reopenElements, and closings.
+*
+* @private
+* @method
+* @param {string} childType Current element type we're considering 
(for error reporting only)
+*/
+   function closeElement( childType ) {
+   var popped;
+   // Close the parent and try one level up
+   closings.push( { type: '/' + parentType } );
+   if ( openingStack.length > 0 ) {
+   popped = openingStack.pop();
+   parentType = popped.type;
+   reopenElements.push( ve.copy( popped ) );
+   // The opening was on openingStack, so we're closing a 
node that was opened
+   // within data. Don't track that on closingStack
+   } else {
+   if ( !parentNode.getParent() ) {
+   throw new Error( 'Cannot insert ' + childType + 
' even after closing ' +
+   'all containing nodes (at index ' + i + 
')' );
+   }
+   // openingStack is empty, so we're closing a node that 
was already in the
+   // document. This means we have to reopen it later, so 
track this on
+   // closingStack
+   closingStack.push( parentNode );
+   reopenElements.push( parentNode.getClonedElement() );
+   parentNode = parentNode.getParent();
+   parentType = parentNode.getType();
+   }
+   }
+
parentNode = this.getBranchNodeFromOffset( offset );
parentType = parentNode.getType();
inTextNode = false;
@@ -1336,6 +1373,18 @@
}
} while ( !parentsOK );
 
+   // Check that the node is allowed to have the 
containing node as
+   // its parent. If not, close surrounding nodes until 
the node is
+   // contained in an acceptable parent.
+   suggestedParents = 
ve.dm.nodeFactory.getSuggestedParentNodeTypes( childType );
+   do {
+   suggestedParentsOK = suggestedParents === null 
||
+   suggestedParents.indexOf( parentType ) 
!== -1;
+   if ( !suggestedParentsOK ) {
+   closeElement( childType );
+   }
+   } while ( !suggestedParentsOK );
+
// Check that the containing node can have this node as 
its child. If not, close nodes
// until it's fixed
do {
@@ -1357,26 +1406,7 @@
}
 
// Close the parent and try one level up
-   closings.push( { type: '/' + parentType 
} );
-   if ( openingStack.length > 0 ) {
-   popped = openingStack.pop();
-   parentType = popped.type;
-   reopenElements.push( ve.copy( 
popped ) );
-   // The opening was on 
ope

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWTransclusionDialog: fix conditions for "show options" butt...

2017-06-14 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358984 )

Change subject: MWTransclusionDialog: fix conditions for "show options" button 
disabling
..

MWTransclusionDialog: fix conditions for "show options" button disabling

As I understand it, the button should be enabled whenever there's more than
one option in the sidebar, and disabled otherwise. The previously chosen
conditions weren't perfectly proxying this, and the button would be disabled
whenever editing an already-existing transclusion.

Bug: T167710
Change-Id: Id303b680c072642ae7b66066e28ecc9f1dc90fd7
---
M modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
1 file changed, 2 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
index 2eed0ba..b43e34b 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
@@ -179,7 +179,7 @@
label = ve.msg( 'visualeditor-dialog-action-insert' );
 
this.actions
-   .setAbilities( { mode: single } )
+   .setAbilities( { mode: !single } )
.forEach( { actions: 'insert' }, function ( action ) {
action.setLabel( label );
} );
@@ -242,6 +242,7 @@
this.bookletLayout.toggleOutline( !single );
this.updateTitle();
this.updateModeActionLabel();
+   this.actions.setAbilities( { mode: 
!this.isSingleTemplateTransclusion() } );
 
// HACK blur any active input so that its dropdown will be 
hidden and won't end
// up being mispositioned

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWTransclusionDialog: size footer correctly

2017-06-13 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358632 )

Change subject: MWTransclusionDialog: size footer correctly
..

MWTransclusionDialog: size footer correctly

Changing label means a refresh is needed.

Bug: T167483
Change-Id: Ie4b35696bdf21d2a74e786875615d8753a57972d
---
M modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
1 file changed, 3 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js 
b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
index d0b7280..2eed0ba 100644
--- a/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
+++ b/modules/ve-mw/ui/dialogs/ve.ui.MWTransclusionDialog.js
@@ -273,6 +273,9 @@
ve.msg( 
'visualeditor-dialog-transclusion-single-mode' )
);
} );
+   // The label change may need a layout change (most likely the height of
+   // the footer), so reattach the actions to trigger this.
+   this.attachActions();
 };
 
 /**

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ve.fixupBase: handle Safari behavior

2017-06-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/358174 )

Change subject: ve.fixupBase: handle Safari behavior
..

ve.fixupBase: handle Safari behavior

Protocol relative URLs in a  confuse Safari, and result in a document
whose baseURI is 'about:blank'. This resulted in downstream problems, where
any pasted URL which included '/wiki/' was considered to be an internal URL.

Bug: T166593
Change-Id: I63273c395f146695857b207e324804b6edd55f55
---
M src/ve.utils.js
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/74/358174/1

diff --git a/src/ve.utils.js b/src/ve.utils.js
index 5e5d0d8..d54950e 100644
--- a/src/ve.utils.js
+++ b/src/ve.utils.js
@@ -987,7 +987,12 @@
 ve.fixBase = function ( targetDoc, sourceDoc, fallbackBase ) {
var baseNode = targetDoc.getElementsByTagName( 'base' )[ 0 ];
if ( baseNode ) {
-   if ( !targetDoc.baseURI ) {
+   // Support: Safari
+   // In Safari a base node with an invalid href (e.g. 
protocol-relative)
+   // in a document which has been dynamically created results in
+   // 'about:blank' rather than '' or null. The base's href will 
also be '',
+   // but that works out just setting the base to fallbackBase, so 
it's okay.
+   if ( !targetDoc.baseURI || targetDoc.baseURI === 'about:blank' 
) {
//  tag present but not valid, try resolving its 
URL
baseNode.setAttribute( 'href', ve.resolveUrl( 
baseNode.getAttribute( 'href' ), sourceDoc ) );
if ( !targetDoc.baseURI && fallbackBase ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63273c395f146695857b207e324804b6edd55f55
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Correct numbers in visualeditor-dialog-meta-settings-toc-help

2017-06-01 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/356618 )

Change subject: Correct numbers in visualeditor-dialog-meta-settings-toc-help
..

Correct numbers in visualeditor-dialog-meta-settings-toc-help

Bug: T166029
Change-Id: Ic15834218bed8a78ad2d9de6c0838988ca65cd4b
---
M modules/ve-mw/i18n/en.json
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/i18n/en.json b/modules/ve-mw/i18n/en.json
index 435502f..dfca575 100644
--- a/modules/ve-mw/i18n/en.json
+++ b/modules/ve-mw/i18n/en.json
@@ -189,7 +189,7 @@
"visualeditor-dialog-meta-settings-toc-default": "If needed",
"visualeditor-dialog-meta-settings-toc-disable": "Never",
"visualeditor-dialog-meta-settings-toc-force": "Always",
-   "visualeditor-dialog-meta-settings-toc-help": "You can force a table of 
contents that lists each heading on the page to appear on pages with fewer than 
three headings, or force it to not appear at all. By default, it will appear if 
the page has three or more headings.",
+   "visualeditor-dialog-meta-settings-toc-help": "You can force a table of 
contents that lists each heading on the page to appear on pages with fewer than 
four headings, or force it to not appear at all. By default, it will appear if 
the page has four or more headings.",
"visualeditor-dialog-meta-settings-toc-label": "Show the Table of 
Contents",
"visualeditor-dialog-meta-templatesused-noresults": "No templates 
found.",
"visualeditor-dialog-meta-title": "Options",

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: summarizeTransaction: hide null author

2017-05-21 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354936 )

Change subject: summarizeTransaction: hide null author
..

summarizeTransaction: hide null author

Change-Id: I42c0a6adea88365fa73556bfc6900cf514bb4612
---
M src/ve.debug.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/36/354936/1

diff --git a/src/ve.debug.js b/src/ve.debug.js
index bb59c10..2033579 100644
--- a/src/ve.debug.js
+++ b/src/ve.debug.js
@@ -108,7 +108,7 @@
}
} ).join( '' ) + '\'';
}
-   return '(' + tx.author + ' ' + tx.operations.map( function ( op ) {
+   return '(' + ( tx.author ? ( tx.author + ' ' ) : '' ) + 
tx.operations.map( function ( op ) {
if ( op.type === 'retain' ) {
return ( annotations ? 'annotate ' : 'retain ' ) + 
op.length;
} else if ( op.type === 'replace' ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I42c0a6adea88365fa73556bfc6900cf514bb4612
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: ui.DebugBar: Transaction log

2017-05-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354687 )

Change subject: ui.DebugBar: Transaction log
..

ui.DebugBar: Transaction log

Change-Id: I0a0ddb68ded333809b3b3ebceb1497b013c7b32e
---
M i18n/en.json
M i18n/qqq.json
M src/ui/styles/ve.ui.DebugBar.css
M src/ui/ve.ui.DebugBar.js
4 files changed, 68 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/87/354687/1

diff --git a/i18n/en.json b/i18n/en.json
index 80e3ea2..6a71cf0 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -65,6 +65,7 @@
"visualeditor-debugbar-inputdebug": "Input debugging",
"visualeditor-debugbar-logrange": "Log",
"visualeditor-debugbar-showmodel": "Show model",
+   "visualeditor-debugbar-showtransactions": "Show transactions",
"visualeditor-debugbar-startfilibuster": "Filibuster",
"visualeditor-debugbar-stopfilibuster": "Stop Filibuster",
"visualeditor-debugbar-updatemodel": "Update on changes",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index f477435..342ee49 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -73,6 +73,7 @@
"visualeditor-debugbar-inputdebug": "Label for the button in the debug 
toolbar to run keyboard input in debug mode.",
"visualeditor-debugbar-logrange": "Label for the button in the debug 
toolbar to output the current selection to the JavaScript 
console.\n{{Identical|Log}}",
"visualeditor-debugbar-showmodel": "Label for the button in the debug 
toolbar to show the document model.",
+   "visualeditor-debugbar-showtransactions": "Label for the button in the 
debug toolbar to show the transaction history.",
"visualeditor-debugbar-startfilibuster": "Label for the button in the 
debug toolbar to begin the input response trace debugger.",
"visualeditor-debugbar-stopfilibuster": "Label for the button in the 
debug toolbar to stop the input response trace debugger.",
"visualeditor-debugbar-updatemodel": "Label for the button in the debug 
toolbar to update the shown document model as it changes.",
diff --git a/src/ui/styles/ve.ui.DebugBar.css b/src/ui/styles/ve.ui.DebugBar.css
index 5847577..adafebf 100644
--- a/src/ui/styles/ve.ui.DebugBar.css
+++ b/src/ui/styles/ve.ui.DebugBar.css
@@ -129,3 +129,20 @@
color: #555;
text-shadow: 0 1px 1px #fff;
 }
+
+.ve-ui-debugBar-transactions {
+   display: none;
+}
+
+.ve-ui-debugBar-transactions > ol > li {
+   border-left: #f3f3f3 2em solid;
+}
+
+.ve-ui-debugBar-transactions ol ol {
+   margin: 1em 0;
+   padding-left: 0;
+}
+
+.ve-ui-debugBar-transactions ol ol li {
+   padding-left: 1ex;
+}
diff --git a/src/ui/ve.ui.DebugBar.js b/src/ui/ve.ui.DebugBar.js
index a6d9447..1a94182 100644
--- a/src/ui/ve.ui.DebugBar.js
+++ b/src/ui/ve.ui.DebugBar.js
@@ -39,6 +39,7 @@
this.logRangeButton = new OO.ui.ButtonWidget( { label: ve.msg( 
'visualeditor-debugbar-logrange' ), disabled: true } );
this.showModelToggle = new OO.ui.ToggleButtonWidget( { label: ve.msg( 
'visualeditor-debugbar-showmodel' ) } );
this.updateModelToggle = new OO.ui.ToggleButtonWidget( { label: ve.msg( 
'visualeditor-debugbar-updatemodel' ) } );
+   this.transactionsToggle = new OO.ui.ToggleButtonWidget( { label: 
ve.msg( 'visualeditor-debugbar-showtransactions' ) } );
this.inputDebuggingToggle = new OO.ui.ToggleButtonWidget( { label: 
ve.msg( 'visualeditor-debugbar-inputdebug' ) } );
this.filibusterToggle = new OO.ui.ToggleButtonWidget( { label: ve.msg( 
'visualeditor-debugbar-startfilibuster' ) } );
 
@@ -55,6 +56,8 @@
)
).hide();
 
+   this.$transactions = $( '' );
+
this.$filibuster = $( '' );
 
// Events
@@ -63,9 +66,13 @@
this.updateModelToggle.on( 'change', 
this.onUpdateModelToggleChange.bind( this ) );
this.inputDebuggingToggle.on( 'change', 
this.onInputDebuggingToggleChange.bind( this ) );
this.filibusterToggle.on( 'click', this.onFilibusterToggleClick.bind( 
this ) );
+   this.transactionsToggle.on( 'change', 
this.onTransactionsToggleChange.bind( this ) );
closeButton.on( 'click', this.$element.remove.bind( this.$element ) );
 
-   this.getSurface().getModel().connect( this, { select: 'onSurfaceSelect' 
} );
+   this.getSurface().getModel().connect( this, {
+   select: 'onSurfaceSelect',
+   history: 'onHistory'
+   } );
this.onSurfaceSelect( this.getSurface().getModel().getSelection() );
 
this.$element.addClass( 've-ui-debugBar' );
@@ -77,10 +84,12 @@
this.showModelToggle.$element,
this.inputDebuggingToggle.$element,
this.filibusterToggle.$element,
+   this.transactionsToggle.$element,
$( this.constructor

[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: demo.minimal should use getInitializedPromise

2017-05-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354655 )

Change subject: demo.minimal should use getInitializedPromise
..

demo.minimal should use getInitializedPromise

Change-Id: I3ce04761f0ad624035c307096e81b6d5eebe71f4
---
M demos/ve/demo.minimal.js
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/55/354655/1

diff --git a/demos/ve/demo.minimal.js b/demos/ve/demo.minimal.js
index ddad9eb..0be6f52 100644
--- a/demos/ve/demo.minimal.js
+++ b/demos/ve/demo.minimal.js
@@ -5,7 +5,7 @@
  */
 
 // Set up the platform and wait for i18n messages to load
-new ve.init.sa.Platform( ve.messagePaths ).initialize()
+new ve.init.sa.Platform( ve.messagePaths ).getInitializedPromise()
.fail( function () {
$( '.ve-instance' ).text( 'Sorry, this browser is not 
supported.' );
} )

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I3ce04761f0ad624035c307096e81b6d5eebe71f4
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: dm.MWTransclusionNode: remove TableCellableNode mixin

2017-05-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354558 )

Change subject: dm.MWTransclusionNode: remove TableCellableNode mixin
..

dm.MWTransclusionNode: remove TableCellableNode mixin

Change-Id: Ic08c7ba03ad2bee35a96a750377450475d0efeed
---
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
1 file changed, 0 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 05efec3..cde269c 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -41,8 +41,6 @@
 
 OO.mixinClass( ve.dm.MWTransclusionNode, ve.dm.FocusableNode );
 
-OO.mixinClass( ve.dm.MWTransclusionNode, ve.dm.TableCellableNode );
-
 /* Static members */
 
 ve.dm.MWTransclusionNode.static.name = 'mwTransclusion';

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

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

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: PopupWidget head: position close button absolutely

2017-05-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354458 )

Change subject: PopupWidget head: position close button absolutely
..

PopupWidget head: position close button absolutely

Floating it meant long titles pushed it out of alignment.

Bug: T164584
Change-Id: I6f415fb95fd94a7b978fc5ec952d9445b8d547d3
---
M src/styles/widgets/PopupWidget.less
M src/themes/apex/widgets.less
M src/themes/mediawiki/widgets.less
3 files changed, 5 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/58/354458/1

diff --git a/src/styles/widgets/PopupWidget.less 
b/src/styles/widgets/PopupWidget.less
index 2b0623f..a905a5d 100644
--- a/src/styles/widgets/PopupWidget.less
+++ b/src/styles/widgets/PopupWidget.less
@@ -84,7 +84,9 @@
.oo-ui-unselectable();
 
> .oo-ui-buttonWidget {
-   float: right;
+   position: absolute;
+   top: 0;
+   right: 0;
}
 
> .oo-ui-labelElement-label {
diff --git a/src/themes/apex/widgets.less b/src/themes/apex/widgets.less
index 6a4473e..48fe02c 100644
--- a/src/themes/apex/widgets.less
+++ b/src/themes/apex/widgets.less
@@ -689,7 +689,7 @@
}
 
> .oo-ui-labelElement-label {
-   margin: 0.75em 1em;
+   margin: 0.75em (@size-icon + 0.2) 0.75em 1em;
}
}
 
diff --git a/src/themes/mediawiki/widgets.less 
b/src/themes/mediawiki/widgets.less
index 9d4d74f..bbb8d89 100644
--- a/src/themes/mediawiki/widgets.less
+++ b/src/themes/mediawiki/widgets.less
@@ -1060,7 +1060,7 @@
}
 
> .oo-ui-labelElement-label {
-   margin: 0.75em 1em;
+   margin: 0.75em (@size-icon + 0.2) 0.75em 1em;
}
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I6f415fb95fd94a7b978fc5ec952d9445b8d547d3
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWCategoryInputWidget: missing 'new' for cached redirected o...

2017-05-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/354440 )

Change subject: MWCategoryInputWidget: missing 'new' for cached redirected 
optionwidgets
..

MWCategoryInputWidget: missing 'new' for cached redirected optionwidgets

Bug: T164820
Change-Id: I8b2ae9112af74910cb6ba5097dcec8be86cc1376
---
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js
index ef18c48..bee8bf9 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryInputWidget.js
@@ -238,7 +238,7 @@
optionWidget, labelText;
if ( cachedData && cachedData.redirectFrom ) {
labelText = mw.Title.newFromText( cachedData.redirectFrom[ 0 ] 
).getMainText();
-   optionWidget = OO.ui.MenuOptionWidget( {
+   optionWidget = new OO.ui.MenuOptionWidget( {
data: name,
autoFitLabel: false,
label: $( '' )

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: MobileContext: Fix alignment of label and description

2017-05-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353324 )

Change subject: MobileContext: Fix alignment of label and description
..

MobileContext: Fix alignment of label and description

They were off by about 1px.

Change-Id: I9fbefc67d5e801e6a18044178b2e2de84d2a12ab
---
M src/ui/styles/ve.ui.MobileContext.css
1 file changed, 1 insertion(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/24/353324/1

diff --git a/src/ui/styles/ve.ui.MobileContext.css 
b/src/ui/styles/ve.ui.MobileContext.css
index 6c016bc..03ac49d 100644
--- a/src/ui/styles/ve.ui.MobileContext.css
+++ b/src/ui/styles/ve.ui.MobileContext.css
@@ -14,6 +14,7 @@
 
 .ve-ui-mobileContext .ve-ui-linearContextItem-label {
min-width: auto;
+   line-height: 1.225em;
 }
 
 .ve-ui-mobileContext .ve-ui-linearContextItem-title {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9fbefc67d5e801e6a18044178b2e2de84d2a12ab
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWWikitextDataTransferHandlerFactory: Don't reimplement getText

2017-05-10 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/353096 )

Change subject: MWWikitextDataTransferHandlerFactory: Don't reimplement getText
..

MWWikitextDataTransferHandlerFactory: Don't reimplement getText

I forgot about getText in 41ca5287052, apparently.

Bug: T163237
Change-Id: Ibb646fc03a0293845c4449cbbe6c822ba63751f8
---
M modules/ve-mw/ui/ve.ui.MWWikitextDataTransferHandlerFactory.js
1 file changed, 1 insertion(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ui/ve.ui.MWWikitextDataTransferHandlerFactory.js 
b/modules/ve-mw/ui/ve.ui.MWWikitextDataTransferHandlerFactory.js
index 240ddeb..af9ae70 100644
--- a/modules/ve-mw/ui/ve.ui.MWWikitextDataTransferHandlerFactory.js
+++ b/modules/ve-mw/ui/ve.ui.MWWikitextDataTransferHandlerFactory.js
@@ -62,7 +62,7 @@
// document.
annotations = doc.data.getAnnotationsFromRange( new 
ve.Range( 0, doc.data.getLength() ) );
if ( annotations.getLength() === 1 ) {
-   text = doc.getData().reduce( function ( acc, 
val ) { return ( Array.isArray( acc ) ? acc[ 0 ] : acc ) + val[ 0 ]; } );
+   text = doc.data.getText();
if ( annotations.get( 0 ).getAttribute( 'href' 
) === text ) {
return resolve( text );
}

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: dm.VisualDiff: fix indentation eslint complained about

2017-05-04 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351887 )

Change subject: dm.VisualDiff: fix indentation eslint complained about
..

dm.VisualDiff: fix indentation eslint complained about

Change-Id: I2daefb3f480af5c43948c228efeb1b62cdb86096
---
M src/dm/ve.dm.VisualDiff.js
1 file changed, 10 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/87/351887/1

diff --git a/src/dm/ve.dm.VisualDiff.js b/src/dm/ve.dm.VisualDiff.js
index 534faca..7e9a60d 100644
--- a/src/dm/ve.dm.VisualDiff.js
+++ b/src/dm/ve.dm.VisualDiff.js
@@ -272,11 +272,11 @@
diffInfo[ i ] = {
typeChange: oldNode.type !== 
newNode.type,
attributeChange: !ve.compare( 
oldNode.getAttributes(), newNode.getAttributes() ) ?
-   {
-   oldAttributes: 
oldNode.getAttributes(),
-   newAttributes: 
newNode.getAttributes()
-   } :
-   false
+   {
+   oldAttributes: 
oldNode.getAttributes(),
+   newAttributes: 
newNode.getAttributes()
+   } :
+   false
};
continue;
 
@@ -309,11 +309,11 @@
linearDiff: linearDiff,
typeChange: oldNode.type !== 
newNode.type,
attributeChange: !ve.compare( 
oldNode.getAttributes(), newNode.getAttributes() ) ?
-   {
-   oldAttributes: 
oldNode.getAttributes(),
-   newAttributes: 
newNode.getAttributes()
-   } :
-   false
+   {
+   oldAttributes: 
oldNode.getAttributes(),
+   newAttributes: 
newNode.getAttributes()
+   } :
+   false
};
 
if ( linearDiff ) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2daefb3f480af5c43948c228efeb1b62cdb86096
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: TableAction: Handle non-TableCell cells better

2017-05-04 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351885 )

Change subject: TableAction: Handle non-TableCell cells better
..

TableAction: Handle non-TableCell cells better

This (downstream) lets MWTransclusionTableCells be pasted into tables. Without
this, only their attributes would be pasted in, which was insufficient to turn
a TableCell into a TransclusionTableCell.

Change-Id: I054f12f4218102a12d7a9ea843f9c61e8825c52c
---
M src/ui/actions/ve.ui.TableAction.js
1 file changed, 12 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/85/351885/1

diff --git a/src/ui/actions/ve.ui.TableAction.js 
b/src/ui/actions/ve.ui.TableAction.js
index 54ad95b..9483752 100644
--- a/src/ui/actions/ve.ui.TableAction.js
+++ b/src/ui/actions/ve.ui.TableAction.js
@@ -288,8 +288,18 @@
cell = matrix.getCell( selection.fromRow + row, 
selection.fromCol + col );
cellRange = cell.node.getRange();
importedCell = importedMatrix.getCell( row, col );
-
-   if ( !importedCell.isPlaceholder() ) {
+   if ( !( importedCell instanceof ve.dm.TableCellNode ) ) 
{
+   // Since the imported cell isn't a regular 
TableCellNode, we
+   // can't quite trust our assumptions about how 
it's supposed
+   // to work. As such, it's safer to outright 
replace the cell
+   // rather than trying to be clever and switch 
out the
+   // attributes / data. We shouldn't have gotten 
to this point
+   // without it being Cellable, so this should at 
least work.
+   surfaceModel.change( 
ve.dm.TransactionBuilder.static.newFromReplacement(
+   documentModel, 
cell.node.getOuterRange(),
+   
importedTableNode.getDocument().getData( importedCell.node.getOuterRange() )
+   ) );
+   } else if ( !importedCell.isPlaceholder() ) {
// Remove the existing cell contents
surfaceModel.change( 
ve.dm.TransactionBuilder.static.newFromRemoval( documentModel, cellRange ) );
// Attribute changes are performed separately, 
and removing the whole

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I054f12f4218102a12d7a9ea843f9c61e8825c52c
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWTransclusionNode: Implement MWTransclusionTableCell

2017-05-04 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351883 )

Change subject: MWTransclusionNode: Implement MWTransclusionTableCell
..

MWTransclusionNode: Implement MWTransclusionTableCell

Back in de98382a5508, references to MWTransclusionTableCell were introduced,
but weren't followed through on. So, actually add it. Have cellable
Transclusions use it as their type.

Change-Id: I367f878bfd1c58e20b62368cb78120604b48d791
---
M modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWTableNode.js
M modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
3 files changed, 58 insertions(+), 1 deletion(-)


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

diff --git a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js 
b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
index a8c100f..e077a10 100644
--- a/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
+++ b/modules/ve-mw/ce/nodes/ve.ce.MWTransclusionNode.js
@@ -262,8 +262,32 @@
 
 ve.ce.MWTransclusionInlineNode.static.tagName = 'span';
 
+/**
+ * ContentEditable MediaWiki transclusion table cell node.
+ *
+ * @class
+ * @extends ve.ce.MWTransclusionNode
+ * @constructor
+ * @param {ve.dm.MWTransclusionTableCellNode} model Model to observe
+ */
+ve.ce.MWTransclusionTableCellNode = function VeCeMWTransclusionTableCellNode( 
model ) {
+   // Parent constructor
+   ve.ce.MWTransclusionTableCellNode.super.call( this, model );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ce.MWTransclusionTableCellNode, ve.ce.MWTransclusionNode );
+
+/* Static Properties */
+
+ve.ce.MWTransclusionTableCellNode.static.name = 'mwTransclusionTableCell';
+
+ve.ce.MWTransclusionTableCellNode.static.tagName = 'td';
+
 /* Registration */
 
 ve.ce.nodeFactory.register( ve.ce.MWTransclusionNode );
 ve.ce.nodeFactory.register( ve.ce.MWTransclusionBlockNode );
 ve.ce.nodeFactory.register( ve.ce.MWTransclusionInlineNode );
+ve.ce.nodeFactory.register( ve.ce.MWTransclusionTableCellNode );
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTableNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTableNode.js
index ebb09f4..78092fd 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTableNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTableNode.js
@@ -44,7 +44,7 @@
 // HACK: users of parentNodeTypes should be fixed to check for inherited 
classes.
 ve.dm.TableSectionNode.static.parentNodeTypes.push( 'mwTable' );
 ve.dm.TableCaptionNode.static.parentNodeTypes.push( 'mwTable' );
-ve.dm.TableRowNode.static.childNodeTypes.push( 'mwTransclusionTableCell' );
+ve.dm.TableRowNode.static.childNodeTypes.push( 'mwTransclusionTableCell' ); 
 
 ve.dm.MWTableNode.static.toDataElement = function ( domElements ) {
var attributes = {},
diff --git a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js 
b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
index 353846f..bb1bdef 100644
--- a/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
+++ b/modules/ve-mw/dm/nodes/ve.dm.MWTransclusionNode.js
@@ -89,6 +89,15 @@
  */
 ve.dm.MWTransclusionNode.static.blockType = 'mwTransclusionBlock';
 
+/**
+ * Node type to use when the transclusion is cellable
+ *
+ * @static
+ * @property {string}
+ * @inheritable
+ */
+ve.dm.MWTransclusionNode.static.cellableType = 'mwTransclusionTableCell';
+
 ve.dm.MWTransclusionNode.static.toDataElement = function ( domElements, 
converter ) {
var dataElement,
mwDataJSON = domElements[ 0 ].getAttribute( 'data-mw' ),
@@ -105,6 +114,7 @@
};
 
if ( domElements.length === 1 && [ 'td', 'th' ].indexOf( domElements[ 0 
].nodeName.toLowerCase() ) !== -1 ) {
+   dataElement.type = this.cellableType;
dataElement.attributes.cellable = true;
ve.dm.TableCellableNode.static.setAttributes( 
dataElement.attributes, domElements );
}
@@ -152,6 +162,8 @@
els[ 0 ] = wrapTextNode( els[ 0 ] );
} else if ( originalDomElements ) {
els = [ doc.createElement( originalDomElements[ 0 
].nodeName ) ];
+   } else if ( dataElement.isCellable() ) {
+   els = [ doc.createElement( 'td' ) ];
} else {
els = [ doc.createElement( 'span' ) ];
}
@@ -444,8 +456,29 @@
 
 ve.dm.MWTransclusionInlineNode.static.isContent = true;
 
+/**
+ * DataModel MediaWiki transclusion table cell node.
+ *
+ * @class
+ * @extends ve.dm.MWTransclusionNode
+ *
+ * @constructor
+ * @param {Object} [element] Reference to element in linear model
+ */
+ve.dm.MWTransclusionTableCellNode = function VeDmMWTransclusionTableCellNode() 
{
+   // Parent constructor
+   ve.dm.MWTransclusionTableCellNode.super.apply( this, arguments );
+};
+
+OO.inheritClass( ve.dm.MWTransclusionTableCellNode, ve.dm.MWTransclusionNode );
+
+ve.dm.MWTransclusionTableCell

[MediaWiki-commits] [Gerrit] oojs/ui[master]: ProcessDialog: safe action buttons were misaligned

2017-05-02 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351341 )

Change subject: ProcessDialog: safe action buttons were misaligned
..

ProcessDialog: safe action buttons were misaligned

Bug: T163473
Change-Id: Ide9f30730921b4354e526bf72fd2ae9e1126cc9d
---
M src/themes/mediawiki/windows.less
1 file changed, 4 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/41/351341/1

diff --git a/src/themes/mediawiki/windows.less 
b/src/themes/mediawiki/windows.less
index f4c6dd7..cd38714 100644
--- a/src/themes/mediawiki/windows.less
+++ b/src/themes/mediawiki/windows.less
@@ -174,6 +174,10 @@
.oo-ui-labelElement-label {
line-height: @size-icon;
}
+
+   &:not( .oo-ui-labelElement ) > 
.oo-ui-buttonElement-button {
+   padding: 1.675em 1em;
+   }
}
}
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ide9f30730921b4354e526bf72fd2ae9e1126cc9d
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: MergeCellsContextItem: Make sure we're on a TableSelection

2017-05-01 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351157 )

Change subject: MergeCellsContextItem: Make sure we're on a TableSelection
..

MergeCellsContextItem: Make sure we're on a TableSelection

Bug: T164199
Change-Id: I331350cc0a4a0c8657bfb5c300b1e431a0f60745
---
M src/ui/contextitems/ve.ui.MergeCellsContextItem.js
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/57/351157/1

diff --git a/src/ui/contextitems/ve.ui.MergeCellsContextItem.js 
b/src/ui/contextitems/ve.ui.MergeCellsContextItem.js
index bf8503a..2fbd887 100644
--- a/src/ui/contextitems/ve.ui.MergeCellsContextItem.js
+++ b/src/ui/contextitems/ve.ui.MergeCellsContextItem.js
@@ -53,7 +53,10 @@
 ve.ui.MergeCellsContextItem.prototype.setup = function () {
// If not disabled, selection must be table and spanning multiple 
matrix cells
var selection = this.getFragment().getSurface().getSelection(),
-   isMergeable = selection.isMergeable();
+   // There's some situations involving transclusion table cells 
which
+   // can make us have a LinearSelection here, so make sure this 
will
+   // work:
+   isMergeable = ( selection instanceof ve.dm.TableSelection ) && 
selection.isMergeable();
 
if ( !isMergeable ) {
// Ideally we Could check this in isCompatibleWith, but on the 
model node is available there

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I331350cc0a4a0c8657bfb5c300b1e431a0f60745
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: UrlStringTransferHandler: in source mode, skip annotating if...

2017-05-01 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/351152 )

Change subject: UrlStringTransferHandler: in source mode, skip annotating if 
possible
..

UrlStringTransferHandler: in source mode, skip annotating if possible

This lets us avoid a fraction of a second lag when someone pastes a plain URL
into source mode.

Bug: T163237
Change-Id: Icba5307c5ee9fe8d8556684b60c85d176cde83ef
---
M src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
1 file changed, 7 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/52/351152/1

diff --git a/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js 
b/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
index 0463f8e..5991163 100644
--- a/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
+++ b/src/ui/datatransferhandlers/ve.ui.UrlStringTransferHandler.js
@@ -142,7 +142,13 @@
result.push( ' ' );
}
 
-   ve.dm.Document.static.addAnnotationsToData( content, 
annotationSet );
+   if ( surface.mode !== 'source' || link.href !== title ) {
+   // Optimization: we can skip adding the annotation, 
with an
+   // attendant server-fetch, in certain circumstances: if 
we're in
+   // source mode and the title and href don't differ, If 
so, we're
+   // just going to get the equivalent plain text back 
anyway.
+   ve.dm.Document.static.addAnnotationsToData( content, 
annotationSet );
+   }
for ( i = 0; i < content.length; i++ ) {
result.push( content[ i ] );
}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icba5307c5ee9fe8d8556684b60c85d176cde83ef
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: MobileContext: fix button spacing

2017-04-28 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350962 )

Change subject: MobileContext: fix button spacing
..

MobileContext: fix button spacing

Bug: T163473
Change-Id: I2fb1223c1806d4a9bf3938f7ff8ec16f3c6b5923
---
M build/modules.json
M src/ui/styles/ve.ui.MobileContext.css
A src/ui/styles/ve.ui.MobileWindowManager.css
3 files changed, 19 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/62/350962/1

diff --git a/build/modules.json b/build/modules.json
index de51b8e..4da213d 100644
--- a/build/modules.json
+++ b/build/modules.json
@@ -809,7 +809,8 @@
"src/ui/windowmanagers/ve.ui.MobileWindowManager.js"
],
"styles": [
-   "src/ui/styles/ve.ui.MobileContext.css"
+   "src/ui/styles/ve.ui.MobileContext.css",
+   "src/ui/styles/ve.ui.MobileWindowManager.css"
],
"dependencies": [
"visualEditor.core.build"
diff --git a/src/ui/styles/ve.ui.MobileContext.css 
b/src/ui/styles/ve.ui.MobileContext.css
index b5cf829..40a9d3d 100644
--- a/src/ui/styles/ve.ui.MobileContext.css
+++ b/src/ui/styles/ve.ui.MobileContext.css
@@ -38,3 +38,11 @@
padding: 0.625em 0.5em;
vertical-align: top;
 }
+
+.ve-ui-mobileContext .ve-ui-linearContextItem-actions .oo-ui-buttonWidget:not( 
.oo-ui-labelWidget ) .oo-ui-buttonElement-button {
+   padding: 1.5em 0.5em;
+}
+
+.ve-ui-mobileWindowManager .oo-ui-processDialog-navigation 
.oo-ui-buttonWidget:not( .oo-ui-labelWidget ) .oo-ui-buttonElement-button {
+   padding: 1.6em 1em;
+}
diff --git a/src/ui/styles/ve.ui.MobileWindowManager.css 
b/src/ui/styles/ve.ui.MobileWindowManager.css
new file mode 100644
index 000..ac74529
--- /dev/null
+++ b/src/ui/styles/ve.ui.MobileWindowManager.css
@@ -0,0 +1,9 @@
+/*!
+ * VisualEditor UserInterface MobileContext styles.
+ *
+ * @copyright 2011-2017 VisualEditor Team and others; see 
http://ve.mit-license.org
+ */
+
+.ve-ui-mobileWindowManager .oo-ui-processDialog-navigation 
.oo-ui-buttonWidget:not( .oo-ui-labelWidget ) .oo-ui-buttonElement-button {
+   padding: 1.6em 1em;
+}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2fb1223c1806d4a9bf3938f7ff8ec16f3c6b5923
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: tests: MWInternalLinkAnnotation getFragment

2017-04-27 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350595 )

Change subject: tests: MWInternalLinkAnnotation getFragment
..

tests: MWInternalLinkAnnotation getFragment

Also, fix docs for it. It could also return null for a missing fragment.

Change-Id: Ib6df379c5c3686a59026b6b66f26b3050ede231a
---
M modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
M modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js
2 files changed, 49 insertions(+), 2 deletions(-)


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

diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js 
b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
index c85d8df..9bdf8fa 100644
--- a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
+++ b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
@@ -204,12 +204,12 @@
  *
  * @static
  * @param {string|mw.Title} original Original title
- * @return {string} Fragment for the title, or an empty string if it was 
invalid
+ * @return {string|null} Fragment for the title, or null if it was invalid or 
missing
  */
 ve.dm.MWInternalLinkAnnotation.static.getFragment = function ( original ) {
var title = original instanceof mw.Title ? original : 
mw.Title.newFromText( original );
if ( !title ) {
-   return '';
+   return null;
}
return title.getFragment();
 };
diff --git a/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js 
b/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js
index fc7e7b8..cc7db56 100644
--- a/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js
+++ b/modules/ve-mw/tests/dm/ve.dm.MWInternalLinkAnnotation.test.js
@@ -61,3 +61,50 @@
assert.deepEqual( 
ve.dm.MWInternalLinkAnnotation.static.toDataElement( [ cases[ i ].element ], 
converter ), cases[ i ].expected, cases[ i ].msg );
}
 } );
+
+QUnit.test( 'getFragment', function ( assert ) {
+   var i, l,
+   cases = [
+   {
+   msg: 'No fragment returns null',
+   original: 'Foo',
+   expected: null
+   },
+   {
+   msg: 'Invalid title returns null',
+   original: 'A%20B',
+   expected: null
+   },
+   {
+   msg: 'Blank fragment returns empty string',
+   original: 'Foo#',
+   expected: ''
+   },
+   {
+   msg: 'Extant fragment returns same string',
+   original: 'Foo#bar',
+   expected: 'bar'
+   },
+   {
+   msg: 'Hash-bang works returns full string',
+   original: 'Foo#!bar',
+   expected: '!bar'
+   },
+   {
+   msg: 'Double-hash returns everything after the 
first hash',
+   original: 'Foo##bar',
+   expected: '#bar'
+   },
+   {
+   msg: 'Multi-fragment returns everything after 
the first hash',
+   original: 'Foo#bar#baz#bat',
+   expected: 'bar#baz#bat'
+   }
+   ];
+
+   QUnit.expect( cases.length );
+
+   for ( i = 0, l = cases.length; i < l; i++ ) {
+   assert.deepEqual( 
ve.dm.MWInternalLinkAnnotation.static.getFragment( cases[ i ].original ), 
cases[ i ].expected, cases[ i ].msg );
+   }
+} );

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: LinkAnnotation: fix getFragment behavior

2017-04-27 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350586 )

Change subject: LinkAnnotation: fix getFragment behavior
..

LinkAnnotation: fix getFragment behavior

Make it more consistent with mw.Title. Update tests.

Change-Id: I628b3f8be8a9a7f07b237cecdbac083d55008a73
---
M src/dm/annotations/ve.dm.LinkAnnotation.js
M tests/dm/ve.dm.LinkAnnotation.test.js
2 files changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/86/350586/1

diff --git a/src/dm/annotations/ve.dm.LinkAnnotation.js 
b/src/dm/annotations/ve.dm.LinkAnnotation.js
index 3e91d39..1939308 100644
--- a/src/dm/annotations/ve.dm.LinkAnnotation.js
+++ b/src/dm/annotations/ve.dm.LinkAnnotation.js
@@ -96,7 +96,12 @@
  * @returns {string} The fragment, or an empty string if none is present
  */
 ve.dm.LinkAnnotation.prototype.getFragment = function () {
-   return this.getHref().split( '#' )[ 1 ] || '';
+   var href = this.getHref(),
+   hash = href.indexOf( '#' );
+   if ( hash === -1 ) {
+   return '';
+   }
+   return href.slice( hash + 1 );
 };
 
 /**
diff --git a/tests/dm/ve.dm.LinkAnnotation.test.js 
b/tests/dm/ve.dm.LinkAnnotation.test.js
index de7ef91..7c4b9f0 100644
--- a/tests/dm/ve.dm.LinkAnnotation.test.js
+++ b/tests/dm/ve.dm.LinkAnnotation.test.js
@@ -47,7 +47,7 @@
type: 'link',
attributes: { href: 
'https://www.example.org/##foo' }
} ),
-   expected: ''
+   expected: '#foo'
},
{
msg: 'Multi-fragment returns first one',
@@ -55,7 +55,7 @@
type: 'link',
attributes: { href: 
'https://www.example.org/#foo#bar' }
} ),
-   expected: 'foo'
+   expected: 'foo#bar'
}
];
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I628b3f8be8a9a7f07b237cecdbac083d55008a73
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: DesktopArticleTarget: only destroy notices tool if it exists

2017-04-26 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350432 )

Change subject: DesktopArticleTarget: only destroy notices tool if it exists
..

DesktopArticleTarget: only destroy notices tool if it exists

Bug: T163813
Change-Id: Ib957eac2d3d407f8e683082938ec51d882c2d041
---
M modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
1 file changed, 10 insertions(+), 6 deletions(-)


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

diff --git a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js 
b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
index d0bcc36..264d786 100644
--- a/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
+++ b/modules/ve-mw/init/targets/ve.init.mw.DesktopArticleTarget.js
@@ -801,12 +801,16 @@
this.setFakeRedirectInterface( null );
}
 
-   // Set edit notices, will be shown after meta dialog.
-   if ( editNotices.length ) {
-   actionTools.notices.setNotices( this.getEditNotices() );
-   } else {
-   actionTools.notices.destroy();
-   actionTools.notices = null;
+   if ( actionTools.notices ) {
+   // Set edit notices, will be shown after meta dialog.
+   // Make sure notices actually exists, because this might be a 
mode-switch and
+   // we've already removed it.
+   if ( editNotices.length ) {
+   actionTools.notices.setNotices( this.getEditNotices() );
+   } else {
+   actionTools.notices.destroy();
+   actionTools.notices = null;
+   }
}
 
this.setupUnloadHandlers();

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

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

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: MenuSelectWidget: scroll to the top if filtering and no exac...

2017-04-26 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/350423 )

Change subject: MenuSelectWidget: scroll to the top if filtering and no exact 
match
..

MenuSelectWidget: scroll to the top if filtering and no exact match

Also, make it so filtering doesn't ignore the first keypress into the input.

Bug: T163536
Change-Id: Ib42bf0b9578c45b43b83cb7d8990f3001b5689b5
---
M demos/pages/widgets.js
M src/widgets/MenuSelectWidget.js
2 files changed, 47 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/23/350423/1

diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js
index 27aa493..15d3839 100644
--- a/demos/pages/widgets.js
+++ b/demos/pages/widgets.js
@@ -1306,6 +1306,44 @@
new OO.ui.FieldLayout(
new OO.ui.ComboBoxInputWidget( {
options: [
+   { data: 'asd', label: 
'A Label for asd' },
+   { data: 'fgh', label: 
'A Label for fgh' },
+   { data: 'jkl', label: 
'A Label for jkl' },
+   { data: 'zxc', label: 
'A Label for zxc' },
+   { data: 'vbn', label: 
'A Label for vbn' },
+   { data: 'asd', label: 
'B Label for asd' },
+   { data: 'fgh', label: 
'B Label for fgh' },
+   { data: 'jkl', label: 
'B Label for jkl' },
+   { data: 'zxc', label: 
'B Label for zxc' },
+   { data: 'vbn', label: 
'B Label for vbn' },
+   { data: 'asd', label: 
'C Label for asd' },
+   { data: 'fgh', label: 
'C Label for fgh' },
+   { data: 'jkl', label: 
'C Label for jkl' },
+   { data: 'zxc', label: 
'C Label for zxc' },
+   { data: 'vbn', label: 
'C Label for vbn' },
+   { data: 'asd', label: 
'D Label for asd' },
+   { data: 'fgh', label: 
'D Label for fgh' },
+   { data: 'jkl', label: 
'D Label for jkl' },
+   { data: 'zxc', label: 
'D Label for zxc' },
+   { data: 'vbn', label: 
'D Label for vbn' },
+   { data: 'asd', label: 
'E Label for asd' },
+   { data: 'fgh', label: 
'E Label for fgh' },
+   { data: 'jkl', label: 
'E Label for jkl' },
+   { data: 'zxc', label: 
'E Label for zxc' },
+   { data: 'vbn', label: 
'E Label for vbn' }
+   ],
+   menu: {
+   filterFromInput: true
+   }
+   } ),
+   {
+   label: 'ComboBoxInputWidget 
(filtering on input)',
+   align: 'top'
+   }
+   ),
+   new OO.ui.FieldLayout(
+   new OO.ui.ComboBoxInputWidget( {
+   options: [
{ data: 'Option 1' },
{ data: 'Option 2' },
{ data: 'Option 3' },
diff --git a/src/widgets/MenuSelectWidget.js b/src/widgets/MenuSelectWidget.js
index 8533f96..9d81adc 100644
--- a/src/widgets/MenuSelectWidget.js
+++ b/src/widgets/MenuSelectWidget.js
@@ -147,7 +147,9 @@
anyVisible = false,
len = this.items.length,
showAll = !this.isVisible(),
-   filter = showAll ? null : this.getItemMatcher( 
this.$input.val() );
+   filter = showAll ? null : this.getItemMatcher( 
this.$input.val() ),
+   

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWCategoryWidget: batch requests for category data

2017-04-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349338 )

Change subject: MWCategoryWidget: batch requests for category data
..

MWCategoryWidget: batch requests for category data

API query cuts off after 50 results.

Bug: T163406
Change-Id: I6e83843dd1a22334d9ddec7103ddf318fb181112
---
M modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
1 file changed, 41 insertions(+), 34 deletions(-)


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

diff --git a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js 
b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
index 6834726..1b23e9f 100644
--- a/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
+++ b/modules/ve-mw/ui/widgets/ve.ui.MWCategoryWidget.js
@@ -249,10 +249,11 @@
  */
 ve.ui.MWCategoryWidget.prototype.queryCategoryStatus = function ( 
categoryNames ) {
var widget = this,
+   promises = [], index = 0, batchSize = 50,
categoryNamesToQuery = [];
 
// Get rid of any we already know the hidden status of, or have an entry
-   // if noramlizedTitles (i.e. have been fetched before)
+   // if normalizedTitles (i.e. have been fetched before)
categoryNamesToQuery = categoryNames.filter( function ( name ) {
var cacheEntry;
if ( widget.normalizedTitles[ name ] ) {
@@ -271,41 +272,47 @@
return $.Deferred().resolve( {} ).promise();
}
 
-   return new mw.Api().get( {
-   action: 'query',
-   prop: 'pageprops',
-   titles: categoryNamesToQuery,
-   ppprop: 'hiddencat',
-   redirects: ''
-   } ).then( function ( result ) {
-   var linkCacheUpdate = {},
-   normalizedTitles = {};
-   if ( result && result.query && result.query.pages ) {
-   $.each( result.query.pages, function ( index, pageInfo 
) {
-   linkCacheUpdate[ pageInfo.title ] = {
-   missing: 
Object.prototype.hasOwnProperty.call( pageInfo, 'missing' ),
-   hidden: pageInfo.pageprops &&
-   
Object.prototype.hasOwnProperty.call( pageInfo.pageprops, 'hiddencat' )
-   };
-   } );
-   }
-   if ( result && result.query && result.query.redirects ) {
-   $.each( result.query.redirects, function ( index, 
redirectInfo ) {
-   widget.categoryRedirects[ redirectInfo.from ] = 
redirectInfo.to;
-   } );
-   }
-   ve.init.platform.linkCache.set( linkCacheUpdate );
+   // Batch this up into groups of 50
+   while ( index < categoryNamesToQuery.length ) {
+   promises.push( new mw.Api().get( {
+   action: 'query',
+   prop: 'pageprops',
+   titles: categoryNamesToQuery.slice( index, index + 
batchSize ),
+   ppprop: 'hiddencat',
+   redirects: ''
+   } ).then( function ( result ) {
+   var linkCacheUpdate = {},
+   normalizedTitles = {};
+   if ( result && result.query && result.query.pages ) {
+   $.each( result.query.pages, function ( index, 
pageInfo ) {
+   linkCacheUpdate[ pageInfo.title ] = {
+   missing: 
Object.prototype.hasOwnProperty.call( pageInfo, 'missing' ),
+   hidden: pageInfo.pageprops &&
+   
Object.prototype.hasOwnProperty.call( pageInfo.pageprops, 'hiddencat' )
+   };
+   } );
+   }
+   if ( result && result.query && result.query.redirects ) 
{
+   $.each( result.query.redirects, function ( 
index, redirectInfo ) {
+   widget.categoryRedirects[ 
redirectInfo.from ] = redirectInfo.to;
+   } );
+   }
+   ve.init.platform.linkCache.set( linkCacheUpdate );
 
-   if ( result.query && result.query.normalized ) {
-   $.each( result.query.normalized, function ( index, 
normalisation ) {
-   normalizedTitles[ normalisation.from ] = 
normalisation.to;
-   } );
-   }
+   if ( result.query && result.query.normalized ) {
+   $.each( result.query.normalize

[MediaWiki-commits] [Gerrit] mediawiki...Cite[master]: MWReferenceNode: Don't try to remove from the internal list ...

2017-04-20 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349161 )

Change subject: MWReferenceNode: Don't try to remove from the internal list if 
it's not added
..

MWReferenceNode: Don't try to remove from the internal list if it's not added

Recent changes to setRoot in ve core (719f8c667) cause unroot to occur at a
point we weren't expecting, when adding a new reference.

Bug: T163267
Change-Id: If02ea08bb8b6db3be41d51ab44ce2a74cfe07914
---
M modules/ve-cite/ve.dm.MWReferenceNode.js
1 file changed, 4 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-cite/ve.dm.MWReferenceNode.js 
b/modules/ve-cite/ve.dm.MWReferenceNode.js
index 4da71c9..ceea160 100644
--- a/modules/ve-cite/ve.dm.MWReferenceNode.js
+++ b/modules/ve-cite/ve.dm.MWReferenceNode.js
@@ -391,6 +391,10 @@
  * Unregister the node from the internal list
  */
 ve.dm.MWReferenceNode.prototype.removeFromInternalList = function () {
+   if ( !this.registeredListGroup ) {
+   // Don't try to remove if we haven't been added in the first 
place.
+   return;
+   }
this.getDocument().getInternalList().removeNode(
this.registeredListGroup,
this.registeredListKey,

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: If02ea08bb8b6db3be41d51ab44ce2a74cfe07914
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Cite
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: MWCategoryItemWidget: remove DraggableElement's padding

2017-04-19 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/349157 )

Change subject: MWCategoryItemWidget: remove DraggableElement's padding
..

MWCategoryItemWidget: remove DraggableElement's padding

OOjs UI v0.21.0 changed DraggableElement's padding. Override it here, so it 
doesn't look broken any more.

Bug: T163414
Change-Id: Ic0bc4f9e3e060cf89e6bc7cb22068d1fe1441d75
---
M modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css 
b/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css
index ecd6605..a8e5cac 100644
--- a/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css
+++ b/modules/ve-mw/ui/styles/widgets/ve.ui.MWCategoryItemWidget.css
@@ -7,6 +7,7 @@
 
 .ve-ui-mwCategoryItemWidget {
margin: 0 0.5em 0.5em 0;
+   padding: 0;
 }
 
 .ve-ui-mwCategoryItemWidget .oo-ui-labelElement-label.new {

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

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

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


[MediaWiki-commits] [Gerrit] VisualEditor/VisualEditor[master]: LinkAnnotation: add a getFragment method for consistency wit...

2017-04-17 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348498 )

Change subject: LinkAnnotation: add a getFragment method for consistency with 
MWInternalLinkAnnotation
..

LinkAnnotation: add a getFragment method for consistency with 
MWInternalLinkAnnotation

Change-Id: I11427644cd12a187a51f8de7212d3dff2571e5e2
---
M src/dm/annotations/ve.dm.LinkAnnotation.js
1 file changed, 9 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/98/348498/1

diff --git a/src/dm/annotations/ve.dm.LinkAnnotation.js 
b/src/dm/annotations/ve.dm.LinkAnnotation.js
index 111a3f0..3e91d39 100644
--- a/src/dm/annotations/ve.dm.LinkAnnotation.js
+++ b/src/dm/annotations/ve.dm.LinkAnnotation.js
@@ -91,6 +91,15 @@
 };
 
 /**
+ * Get the fragment / hash for the current href
+ *
+ * @returns {string} The fragment, or an empty string if none is present
+ */
+ve.dm.LinkAnnotation.prototype.getFragment = function () {
+   return this.getHref().split( '#' )[ 1 ] || '';
+};
+
+/**
  * @inheritdoc
  */
 ve.dm.LinkAnnotation.prototype.getComparableObject = function () {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11427644cd12a187a51f8de7212d3dff2571e5e2
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] oojs/ui[master]: Fix typo in frameless button mixin

2017-04-16 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/348404 )

Change subject: Fix typo in frameless button mixin
..

Fix typo in frameless button mixin

Bug: T163085
Change-Id: Ia341f0e2b0ebc25344037105f2a7460e2294314b
---
M src/themes/mediawiki/common.less
1 file changed, 1 insertion(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/04/348404/1

diff --git a/src/themes/mediawiki/common.less b/src/themes/mediawiki/common.less
index 97ef378..e3ac715 100644
--- a/src/themes/mediawiki/common.less
+++ b/src/themes/mediawiki/common.less
@@ -202,7 +202,7 @@
 }
 
 .mw-frameless-button-colored( @child, @link, @hover, @active, @focus ) { // 
following CSS Pseudo Classes
-   > .@{child} {
+   > @{child} {
color: @link;
}
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia341f0e2b0ebc25344037105f2a7460e2294314b
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: DLynch 

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: TemplatePlaceholderPage: abort pending template search after...

2017-04-12 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/347871 )

Change subject: TemplatePlaceholderPage: abort pending template search after 
adding template
..

TemplatePlaceholderPage: abort pending template search after adding template

With precise timing, the lookup menu could appear after the add template
button had been pressed and the user had moved on to the next page.

Bug: T162707
Change-Id: I36941dc7288c6031a0fb189c0946aa6d8f8697e8
---
M modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
1 file changed, 2 insertions(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js 
b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
index 14085e1..553058d 100644
--- a/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
+++ b/modules/ve-mw/ui/pages/ve.ui.MWTemplatePlaceholderPage.js
@@ -117,6 +117,8 @@
part = ve.dm.MWTemplateModel.newFromName( transclusion, name );
transclusion.replacePart( this.placeholder, part );
this.addTemplateInput.pushPending();
+   // abort pending lookups, also, so the menu can't appear after we've 
left the page
+   this.addTemplateInput.closeLookupMenu();
this.addTemplateButton.setDisabled( true );
this.removeButton.setDisabled( true );
 };

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: LinkCache: don't treat a link with a fragment as a selflink

2017-04-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/347644 )

Change subject: LinkCache: don't treat a link with a fragment as a selflink
..

LinkCache: don't treat a link with a fragment as a selflink

This matches the rendered output for the page.

Bug: T162669
Change-Id: I1ea0ab37a2751c0b4669da8a23adf0ce271facea
---
M modules/ve-mw/ce/annotations/ve.ce.MWInternalLinkAnnotation.js
M modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
M modules/ve-mw/init/ve.init.mw.LinkCache.js
M modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
4 files changed, 26 insertions(+), 4 deletions(-)


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

diff --git a/modules/ve-mw/ce/annotations/ve.ce.MWInternalLinkAnnotation.js 
b/modules/ve-mw/ce/annotations/ve.ce.MWInternalLinkAnnotation.js
index e10f848..e549751 100644
--- a/modules/ve-mw/ce/annotations/ve.ce.MWInternalLinkAnnotation.js
+++ b/modules/ve-mw/ce/annotations/ve.ce.MWInternalLinkAnnotation.js
@@ -24,7 +24,7 @@
this.$anchor.addClass( 've-ce-mwInternalLinkAnnotation' );
 
// Style based on link cache information
-   ve.init.platform.linkCache.styleElement( this.model.getAttribute( 
'lookupTitle' ), annotation.$anchor );
+   ve.init.platform.linkCache.styleElement( this.model.getAttribute( 
'lookupTitle' ), annotation.$anchor, this.model.getFragment() );
 };
 
 /* Inheritance */
diff --git a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js 
b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
index 3258bb4..e0eb1e7 100644
--- a/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
+++ b/modules/ve-mw/dm/annotations/ve.dm.MWInternalLinkAnnotation.js
@@ -199,6 +199,20 @@
return title.getPrefixedText();
 };
 
+/**
+ * Get the fragment for a title
+ *
+ * @param {string|mw.Title} original Original title
+ * @return {string} Fragment for the title, or an empty string if it was 
invalid
+ */
+ve.dm.MWInternalLinkAnnotation.static.getFragment = function ( original ) {
+   var title = original instanceof mw.Title ? original : 
mw.Title.newFromText( original );
+   if ( !title ) {
+   return '';
+   }
+   return title.getFragment();
+};
+
 ve.dm.MWInternalLinkAnnotation.static.describeChange = function ( key, change 
) {
if ( key === 'title' ) {
return ve.msg( 'visualeditor-changedesc-link-href', 
change.from, change.to );
@@ -234,6 +248,13 @@
return this.getAttribute( 'normalizedTitle' );
 };
 
+/**
+ * @inheritdoc
+ */
+ve.dm.MWInternalLinkAnnotation.prototype.getFragment = function () {
+   return this.constructor.static.getFragment( this.getAttribute( 
'normalizedTitle' ) );
+};
+
 /* Registration */
 
 ve.dm.modelRegistry.register( ve.dm.MWInternalLinkAnnotation );
diff --git a/modules/ve-mw/init/ve.init.mw.LinkCache.js 
b/modules/ve-mw/init/ve.init.mw.LinkCache.js
index 772193d..34c2ba3 100644
--- a/modules/ve-mw/init/ve.init.mw.LinkCache.js
+++ b/modules/ve-mw/init/ve.init.mw.LinkCache.js
@@ -66,8 +66,9 @@
  *
  * @param {string} title
  * @param {jQuery} $element Element to style
+ * @param {bool} hasFragment Whether the link goes to a fragment
  */
-ve.init.mw.LinkCache.prototype.styleElement = function ( title, $element ) {
+ve.init.mw.LinkCache.prototype.styleElement = function ( title, $element, 
hasFragment ) {
var promise,
cache = this,
cachedMissingData = this.getCached( '_missing/' + title );
@@ -84,7 +85,7 @@
$element.addClass( 'new' );
} else {
// Provided by core MediaWiki, styled like a  
element by default.
-   if ( cache.constructor.static.normalizeTitle( title ) 
=== cache.constructor.static.normalizeTitle( mw.config.get( 
'wgRelevantPageName' ) ) ) {
+   if ( !hasFragment && 
cache.constructor.static.normalizeTitle( title ) === 
cache.constructor.static.normalizeTitle( mw.config.get( 'wgRelevantPageName' ) 
) ) {
$element.addClass( 'mw-selflink' );
}
// Provided by core MediaWiki, no styles by default.
diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js 
b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
index 2020158..1679d99 100644
--- a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
+++ b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
@@ -61,7 +61,7 @@
} );
 
// Style based on link cache information
-   ve.init.platform.linkCache.styleElement( title, $link );
+   ve.init.platform.linkCache.styleElement( title, $link, 
this.model.getFragment() );
 
if ( usePageImages ) {
icon = new OO.ui.Ic

[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: Internal link context popup: selflinks still get link styling

2017-04-11 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/347631 )

Change subject: Internal link context popup: selflinks still get link styling
..

Internal link context popup: selflinks still get link styling

Bug: T162671
Change-Id: I0ba584b90db73ebade81050f0d782945b8934080
---
M modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
1 file changed, 1 insertion(+), 0 deletions(-)


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

diff --git a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js 
b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
index 2020158..180907f 100644
--- a/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
+++ b/modules/ve-mw/ui/contextitems/ve.ui.MWInternalLinkContextItem.js
@@ -62,6 +62,7 @@
 
// Style based on link cache information
ve.init.platform.linkCache.styleElement( title, $link );
+   $link.removeClass( 'mw-selflink' );
 
if ( usePageImages ) {
icon = new OO.ui.IconWidget( { icon: 'page-existing' } );

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

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

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


[MediaWiki-commits] [Gerrit] mediawiki...VisualEditor[master]: ArticleTarget: building summary in source mode, strip links ...

2017-04-05 Thread DLynch (Code Review)
DLynch has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/346566 )

Change subject: ArticleTarget: building summary in source mode, strip links 
from section titles
..

ArticleTarget: building summary in source mode, strip links from section titles

Bug: T162017
Change-Id: I76e96d1e36f7bad0b3e17d8bb842c6ad1172f8cc
---
M .jsduck/categories.json
M modules/ve-mw/init/ve.init.mw.ArticleTarget.js
2 files changed, 15 insertions(+), 2 deletions(-)


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

diff --git a/.jsduck/categories.json b/.jsduck/categories.json
index 14a4ea9..24ca660 100644
--- a/.jsduck/categories.json
+++ b/.jsduck/categories.json
@@ -193,7 +193,9 @@
"ve.QUnit",
"ve.QUnit.assert",
"ve.ce.TestOffset",
-   "ve.ce.TestRunner"
+   "ve.ce.TestRunner",
+   "ve.dm.TestRebaseClient",
+   "ve.dm.TestRebaseServer"
]
}
]
diff --git a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js 
b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
index 53c67a9..8c9830d 100644
--- a/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
+++ b/modules/ve-mw/init/ve.init.mw.ArticleTarget.js
@@ -2055,10 +2055,21 @@
this.goToHeading( headingNode );
}
} else if ( mode === 'source' ) {
+   // With elements of extractSectionTitle + 
stripSectionName TODO:
+   // Arguably, we should just throw this through the API 
and then do
+   // the same extract-text pass we do in visual mode. 
Would save us
+   // having to think about wikitext here.
headingText = 
surface.getModel().getDocument().data.getText(
false,

surface.getModel().getDocument().getDocumentNode().children[ 0 ].getRange()
-   ).replace( /^\s*=+\s*(.*?)\s*=+\s*$/, '$1' );
+   )
+   // Extract the title
+   .replace( /^\s*=+\s*(.*?)\s*=+\s*$/, '$1' )
+   // Remove links
+   .replace( /\[\[:?([^[|]+)\|([^[]+)\]\]/, '$2' )
+   .replace( /\[\[:?([^[]+)\|?\]\]/, '$1' )
+   .replace( new RegExp( '\\[(?:' + 
ve.init.platform.getUnanchoredExternalLinkUrlProtocolsRegExp().source + ')([^ 
]+?) ([^\\[]+)\\]', 'i' ), '$3' )
+   ;
}
if ( headingText ) {
this.initialEditSummary =

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

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

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


  1   2   3   >