jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/392672 )
Change subject: Disable 'reply' button until something typed ...................................................................... Disable 'reply' button until something typed Bug: T181063 Change-Id: I8dc8d3c4f311767a4242615bf8d9593019ed1812 --- M modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js M modules/flow/ui/widgets/mw.flow.ui.ReplyWidget.js 2 files changed, 16 insertions(+), 4 deletions(-) Approvals: Catrope: Looks good to me, approved jenkins-bot: Verified diff --git a/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js b/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js index 652e383..ba2f328 100644 --- a/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js +++ b/modules/flow/ui/widgets/mw.flow.ui.NewTopicWidget.js @@ -55,7 +55,7 @@ saveMsgKey: mw.user.isAnon() ? 'flow-newtopic-save-anonymously' : 'flow-newtopic-save', autoFocus: false, classes: [ 'flow-ui-newTopicWidget-editor' ], - saveable: mw.config.get( 'wgIsProbablyEditable' ), + saveable: this.isProbablyEditable, leaveCallback: function () { if ( widget.title.getValue() !== '' ) { return false; diff --git a/modules/flow/ui/widgets/mw.flow.ui.ReplyWidget.js b/modules/flow/ui/widgets/mw.flow.ui.ReplyWidget.js index 4906480..a91691b 100644 --- a/modules/flow/ui/widgets/mw.flow.ui.ReplyWidget.js +++ b/modules/flow/ui/widgets/mw.flow.ui.ReplyWidget.js @@ -23,20 +23,22 @@ this.placeholder = config.placeholder; this.editorOptions = config.editor; + this.isProbablyEditable = mw.config.get( 'wgIsProbablyEditable' ); + // Parent constructor mw.flow.ui.ReplyWidget.parent.call( this, config ); this.api = new mw.flow.dm.APIHandler(); this.anonWarning = new mw.flow.ui.AnonWarningWidget( { - isProbablyEditable: mw.config.get( 'wgIsProbablyEditable' ) + isProbablyEditable: this.isProbablyEditable } ); this.anonWarning.toggle( !this.expandable ); this.canNotEdit = new mw.flow.ui.CanNotEditWidget( this.api, { userGroups: mw.config.get( 'wgUserGroups' ), restrictionEdit: mw.config.get( 'wgRestrictionEdit' ), - isProbablyEditable: mw.config.get( 'wgIsProbablyEditable' ) + isProbablyEditable: this.isProbablyEditable } ); this.canNotEdit.toggle( !this.expandable ); @@ -99,6 +101,13 @@ */ mw.flow.ui.ReplyWidget.prototype.onTriggerFocusIn = function () { this.activateEditor(); + }; + + /** + * Repond to editor content change + */ + mw.flow.ui.ReplyWidget.prototype.onEditorChange = function () { + this.editor.editorControlsWidget.toggleSaveable( !this.editor.isEmpty() ); }; /** @@ -167,13 +176,16 @@ placeholder: this.placeholder, saveMsgKey: mw.user.isAnon() ? 'flow-reply-link-anonymously' : 'flow-reply-link', classes: [ 'flow-ui-replyWidget-editor' ], - saveable: mw.config.get( 'wgIsProbablyEditable' ) + saveable: this.isProbablyEditable }, this.editorOptions ) ); + + this.onEditorChange(); this.$editorContainer.append( this.editor.$element ); // Events this.editor.connect( this, { + change: 'onEditorChange', saveContent: 'onEditorSaveContent', cancel: 'onEditorCancel' } ); -- To view, visit https://gerrit.wikimedia.org/r/392672 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8dc8d3c4f311767a4242615bf8d9593019ed1812 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Flow Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Catrope <r...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits