jenkins-bot has submitted this change and it was merged.
Change subject: Update context menu on document update
......................................................................
Update context menu on document update
This way a context item that triggers a dialog will
still get updated (if needed) when the dialog closes.
Bug: T91336
Change-Id: I6cce684842385a82a359c8bac7e63222e96d08c2
---
M src/ui/ve.ui.Context.js
1 file changed, 15 insertions(+), 1 deletion(-)
Approvals:
Catrope: Looks good to me, approved
jenkins-bot: Verified
diff --git a/src/ui/ve.ui.Context.js b/src/ui/ve.ui.Context.js
index ddf694d..ac9a86c 100644
--- a/src/ui/ve.ui.Context.js
+++ b/src/ui/ve.ui.Context.js
@@ -35,7 +35,10 @@
this.updateDimensionsDebounced = ve.debounce(
this.updateDimensions.bind( this ) );
// Events
- this.surface.getModel().connect( this, { contextChange:
'onContextChange' } );
+ this.surface.getModel().connect( this, {
+ contextChange: 'onContextChange',
+ documentUpdate: 'onDocumentUpdate'
+ } );
this.inspectors.connect( this, { opening: 'onInspectorOpening' } );
// Initialization
@@ -100,6 +103,17 @@
};
/**
+ * Handle document update event.
+ */
+ve.ui.Context.prototype.onDocumentUpdate = function () {
+ // Only mind this event if the menu is visible
+ if ( this.isVisible() && !this.isEmpty() ) {
+ // Reuse the debounced context change hanlder
+ this.onContextChange();
+ }
+};
+
+/**
* Handle debounced context change events.
*/
ve.ui.Context.prototype.afterContextChange = function () {
--
To view, visit https://gerrit.wikimedia.org/r/197960
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6cce684842385a82a359c8bac7e63222e96d08c2
Gerrit-PatchSet: 2
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Trevor Parscal <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Jforrester <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits