Mattflaschen has uploaded a new change for review.
https://gerrit.wikimedia.org/r/251175
Change subject: Fix regression in edit post and edit topic summary due to OO UI
changes
......................................................................
Fix regression in edit post and edit topic summary due to OO UI changes
This was a regression in Firefox due to the nodes not being in the DOM.
It's solved by doing the phase that requires being in the DOM outside
of the constructor, when the initializer has put it in the DOM.
This was caused by Ie4f66b15f4f5ec9932d5fd72e12b4453724e3742 .
I believe the specific change was I4109d5ad6089035cf689e11667e6ec2bb007d6ce
which affects how OOjs UI handles text selection ranges.
Bug: T117698
Change-Id: I5de75d586594122eb634a219513f8d53dec4fd22
---
M modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
M modules/flow/ui/widgets/mw.flow.ui.EditTopicSummaryWidget.js
M modules/mw.flow.Initializer.js
3 files changed, 55 insertions(+), 41 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow
refs/changes/75/251175/1
diff --git a/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
b/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
index 656d35b..1255341 100644
--- a/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
+++ b/modules/flow/ui/widgets/mw.flow.ui.EditPostWidget.js
@@ -50,15 +50,38 @@
this.editor.$element
);
- // Load the editor
+ };
+
+ /* Initialization */
+
+ OO.inheritClass( mw.flow.ui.EditPostWidget, OO.ui.Widget );
+
+ /* Events */
+
+ /**
+ * Save the content of the reply
+ * @event saveContent
+ * @param {string} workflow The workflow this reply was saved under
+ * @param {string} content The content of the reply
+ * @param {string} contentFormat The format of the content of this reply
+ */
+
+ /* Methods */
+
+ /**
+ * Activate the widget. These needs to be called when it's visible and
in the body.
+ */
+ mw.flow.ui.EditPostWidget.prototype.activate = function () {
+ var widget, contentFormat;
+
this.editor.pushPending();
this.editor.activate();
// Get the post from the API
- var widget = this,
- contentFormat = this.editor.getContentFormat();
+ widget = this;
+ contentFormat = this.editor.getContentFormat();
- this.api.getPost( topicId, postId, contentFormat ).then(
+ this.api.getPost( this.topicId, this.postId, contentFormat
).then(
function ( post ) {
var content = OO.getProp( post, 'content',
'content' ),
format = OO.getProp( post, 'content',
'format' );
@@ -84,24 +107,7 @@
// Focus again: pending editors are disabled and can't
be focused
widget.editor.focus();
} );
-
};
-
- /* Initialization */
-
- OO.inheritClass( mw.flow.ui.EditPostWidget, OO.ui.Widget );
-
- /* Events */
-
- /**
- * Save the content of the reply
- * @event saveContent
- * @param {string} workflow The workflow this reply was saved under
- * @param {string} content The content of the reply
- * @param {string} contentFormat The format of the content of this reply
- */
-
- /* Methods */
/**
* Respond to editor cancel
diff --git a/modules/flow/ui/widgets/mw.flow.ui.EditTopicSummaryWidget.js
b/modules/flow/ui/widgets/mw.flow.ui.EditTopicSummaryWidget.js
index 123a233..a834e3b 100644
--- a/modules/flow/ui/widgets/mw.flow.ui.EditTopicSummaryWidget.js
+++ b/modules/flow/ui/widgets/mw.flow.ui.EditTopicSummaryWidget.js
@@ -50,16 +50,39 @@
this.error.$element,
this.editor.$element
);
+ };
+
+ /* Initialization */
+
+ OO.inheritClass( mw.flow.ui.EditTopicSummaryWidget, OO.ui.Widget );
+
+ /* Events */
+
+ /**
+ * Save the content of the reply
+ * @event saveContent
+ * @param {string} workflow The workflow this reply was saved under
+ * @param {string} content The content of the reply
+ * @param {string} contentFormat The format of the content of this reply
+ */
+
+ /* Methods */
+
+ /**
+ * Activate the widget. These needs to be called when it's visible and
in the body.
+ */
+ mw.flow.ui.EditTopicSummaryWidget.prototype.activate = function () {
+ var widget, contentFormat;
// Load the editor
this.editor.pushPending();
this.editor.activate();
// Get the post from the API
- var widget = this,
- contentFormat = this.editor.getContentFormat();
+ widget = this;
+ contentFormat = this.editor.getContentFormat();
- this.api.getTopicSummary( topicId, contentFormat ).then(
+ this.api.getTopicSummary( this.topicId, contentFormat ).then(
function ( topicSummary ) {
var content = OO.getProp( topicSummary,
'content', 'content' ),
format = OO.getProp( topicSummary,
'content', 'format' );
@@ -85,24 +108,7 @@
// Focus again: pending editors are disabled and can't
be focused
widget.editor.focus();
} );
-
};
-
- /* Initialization */
-
- OO.inheritClass( mw.flow.ui.EditTopicSummaryWidget, OO.ui.Widget );
-
- /* Events */
-
- /**
- * Save the content of the reply
- * @event saveContent
- * @param {string} workflow The workflow this reply was saved under
- * @param {string} content The content of the reply
- * @param {string} contentFormat The format of the content of this reply
- */
-
- /* Methods */
/**
* Respond to editor cancel
diff --git a/modules/mw.flow.Initializer.js b/modules/mw.flow.Initializer.js
index a1b338f..ab98443 100644
--- a/modules/mw.flow.Initializer.js
+++ b/modules/mw.flow.Initializer.js
@@ -442,6 +442,7 @@
} );
$postMain.replaceWith( editPostWidget.$element );
+ editPostWidget.activate();
event.preventDefault();
} );
@@ -620,6 +621,7 @@
$topicSummary.remove();
$summaryContainer.append( editTopicSummaryWidget.$element );
+ editTopicSummaryWidget.activate();
};
/**
--
To view, visit https://gerrit.wikimedia.org/r/251175
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I5de75d586594122eb634a219513f8d53dec4fd22
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits