Mooeypoo has uploaded a new change for review. https://gerrit.wikimedia.org/r/202462
Change subject: Allow extra properties for ve.ui.Surface ...................................................................... Allow extra properties for ve.ui.Surface When creating a surface, allow for extra properties to be defined. This is mostly helpful to specify whether the surface is created within a specific dialog, especially when certain tools require different operation when they are applied on the main surface rather than a dialog surface. The best example of those is the citation tools, which require a different operation when they are activated within the reference dialog. Bug: T94621 Change-Id: I709eeb0de47562990e709ba9d36ea0c5bd479ff6 --- M src/ui/ve.ui.Surface.js M src/ui/widgets/ve.ui.SurfaceWidget.js 2 files changed, 11 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor refs/changes/62/202462/1 diff --git a/src/ui/ve.ui.Surface.js b/src/ui/ve.ui.Surface.js index 6e211c2..b4d72a4 100644 --- a/src/ui/ve.ui.Surface.js +++ b/src/ui/ve.ui.Surface.js @@ -30,6 +30,7 @@ OO.EventEmitter.call( this, config ); // Properties + this.properties = config.properties || {}; this.globalOverlay = new ve.ui.Overlay( { classes: ['ve-ui-overlay-global'] } ); this.localOverlay = new ve.ui.Overlay( { $: this.$, classes: ['ve-ui-overlay-local'] } ); this.$selections = this.$( '<div>' ); @@ -441,3 +442,11 @@ ve.ui.Surface.prototype.stopFilibuster = function () { this.filibuster.stop(); }; + +/** + * Get the special properties defined for this surface. + * @return {Object} Properties for the surface. + */ +ve.ui.Surface.prototype.getProperties = function () { + return this.properties; +}; diff --git a/src/ui/widgets/ve.ui.SurfaceWidget.js b/src/ui/widgets/ve.ui.SurfaceWidget.js index 7aa4ea1..91ce0bf 100644 --- a/src/ui/widgets/ve.ui.SurfaceWidget.js +++ b/src/ui/widgets/ve.ui.SurfaceWidget.js @@ -29,7 +29,8 @@ this.surface = ve.init.target.createSurface( doc, { $: this.$, excludeCommands: config.excludeCommands, - importRules: config.importRules + importRules: config.importRules, + properties: config.properties || {} } ); this.toolbar = new ve.ui.Toolbar(); -- To view, visit https://gerrit.wikimedia.org/r/202462 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I709eeb0de47562990e709ba9d36ea0c5bd479ff6 Gerrit-PatchSet: 1 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Mooeypoo <mor...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits