Esanders has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/354871 )
Change subject: WIP Export to wikitext dialog
......................................................................
WIP Export to wikitext dialog
Change-Id: I49841fd17dd106154a2f53df2e051c6dc0cc3910
---
M extension.json
M lib/ve
M modules/ve-mw-collab/ve.init.mw.CollabTarget.css
M modules/ve-mw-collab/ve.init.mw.CollabTarget.js
A modules/ve-mw-collab/ve.ui.MWExportDialog.js
5 files changed, 102 insertions(+), 5 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor
refs/changes/71/354871/1
diff --git a/extension.json b/extension.json
index f0265b6..d445e86 100644
--- a/extension.json
+++ b/extension.json
@@ -434,7 +434,8 @@
},
"ext.visualEditor.collabTarget": {
"scripts": [
-
"modules/ve-mw-collab/ve.init.mw.CollabTarget.js"
+
"modules/ve-mw-collab/ve.init.mw.CollabTarget.js",
+ "modules/ve-mw-collab/ve.ui.MWExportDialog.js"
],
"dependencies": [
"ext.visualEditor.base",
diff --git a/lib/ve b/lib/ve
index ee59e9d..b3ad56e 160000
--- a/lib/ve
+++ b/lib/ve
@@ -1 +1 @@
-Subproject commit ee59e9d337c2fcf040e5975476ec3b93725004f8
+Subproject commit b3ad56e0ee3bf8fbece27441dec34297f87f3a06
diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.css
b/modules/ve-mw-collab/ve.init.mw.CollabTarget.css
index 9d862e4..c3cbf0a 100644
--- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.css
+++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.css
@@ -14,7 +14,7 @@
.ve-init-mw-collabTarget .ve-ui-authorListWidget {
display: inline-block;
- margin: 0.3125em;
+ vertical-align: middle;
}
/* MW theme hack */
diff --git a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
index 841ab0f..668146e 100644
--- a/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
+++ b/modules/ve-mw-collab/ve.init.mw.CollabTarget.js
@@ -67,7 +67,7 @@
* @inheritdoc
*/
ve.init.mw.CollabTarget.prototype.surfaceReady = function () {
- var synchronizer, authorList,
+ var synchronizer, authorList, exportButton,
surfaceView = this.getSurface().getView();
// Parent method
@@ -79,13 +79,28 @@
{ server: this.rebaserUrl }
);
authorList = new ve.ui.AuthorListWidget( synchronizer );
+ exportButton = new OO.ui.ButtonWidget( {
+ label: 'Export', // TODO: i18n
+ flags: [ 'progressive', 'primary' ]
+ } );
- this.getToolbar().$actions.append( authorList.$element );
+ exportButton.connect( this, { click: 'onExportButtonClick' } );
+
+ this.getToolbar().$actions.append( authorList.$element,
exportButton.$element );
surfaceView.setSynchronizer( synchronizer );
surfaceView.focus();
};
/**
+ * Handle click events from the export button
+ */
+ve.init.mw.CollabTarget.prototype.onExportButtonClick = function () {
+ var surface = this.getSurface(),
+ windowAction = ve.ui.actionFactory.create( 'window', surface );
+ windowAction.open( 'mwExport', { surface: surface } );
+};
+
+/**
* @inheritdoc
*/
ve.init.mw.CollabTarget.prototype.attachToolbar = function () {
diff --git a/modules/ve-mw-collab/ve.ui.MWExportDialog.js
b/modules/ve-mw-collab/ve.ui.MWExportDialog.js
new file mode 100644
index 0000000..d799f2c
--- /dev/null
+++ b/modules/ve-mw-collab/ve.ui.MWExportDialog.js
@@ -0,0 +1,81 @@
+/*!
+ * VisualEditor UserInterface MWExportDialog class.
+ *
+ * @copyright 2011-2017 VisualEditor Team and others; see AUTHORS.txt
+ * @license The MIT License (MIT); see LICENSE.txt
+ */
+
+/**
+ * Dialog for exporting CollabTarget pages
+ *
+ * @class
+ * @extends OO.ui.ProcessDialog
+ *
+ * @constructor
+ * @param {Object} [config] Config options
+ */
+ve.ui.MWExportDialog = function VeUiMwExportDialog( config ) {
+ // Parent constructor
+ ve.ui.MWExportDialog.super.call( this, config );
+
+ // Initialization
+ this.$element.addClass( 've-ui-mwExportDialog' );
+};
+
+/* Inheritance */
+
+OO.inheritClass( ve.ui.MWExportDialog, OO.ui.ProcessDialog );
+
+/* Static Properties */
+
+ve.ui.MWExportDialog.static.name = 'mwExport';
+
+ve.ui.MWExportDialog.static.title = 'Export'; // TODO: i18n
+
+ve.ui.MWExportDialog.static.actions = [
+ {
+ label: OO.ui.deferMsg( 'visualeditor-dialog-action-done' ),
+ flags: 'safe'
+ }
+];
+
+ve.ui.MWExportDialog.static.size = 'larger';
+
+/**
+ * @inheritdoc
+ */
+ve.ui.MWExportDialog.prototype.initialize = function () {
+ // Parent method
+ ve.ui.MWExportDialog.super.prototype.initialize.call( this );
+
+ this.$wikitext = $( '<pre>' );
+ this.$body.append( this.$wikitext );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.MWExportDialog.prototype.getSetupProcess = function ( data ) {
+ return ve.ui.MWExportDialog.super.prototype.getSetupProcess.call( this,
data )
+ .next( function () {
+ var dialog = this;
+ ve.init.target.getWikitextFragment(
data.surface.getModel().getDocument() ).then( function ( wikitext ) {
+ dialog.$wikitext.text( wikitext );
+ dialog.updateSize();
+ } );
+ }, this );
+};
+
+/**
+ * @inheritdoc
+ */
+ve.ui.MWExportDialog.prototype.getTeardownProcess = function ( data ) {
+ return ve.ui.MWExportDialog.super.prototype.getTeardownProcess.call(
this, data )
+ .next( function () {
+ this.$wikitext.empty();
+ }, this );
+};
+
+/* Registration */
+
+ve.ui.windowFactory.register( ve.ui.MWExportDialog );
--
To view, visit https://gerrit.wikimedia.org/r/354871
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I49841fd17dd106154a2f53df2e051c6dc0cc3910
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits