Mooeypoo has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/200085

Change subject: Add a flag to BranchNode to ignore slugs
......................................................................

Add a flag to BranchNode to ignore slugs

Make it possible to render ve.ce.BranchNode without slugs. This
is particularly useful for preview nodes, like in the context menus.

Bug: T93042
Change-Id: I8105418a3579232df1eb193649170b81ae086f32
---
M src/ce/ve.ce.BranchNode.js
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/VisualEditor/VisualEditor 
refs/changes/85/200085/1

diff --git a/src/ce/ve.ce.BranchNode.js b/src/ce/ve.ce.BranchNode.js
index 43e8a3a..9caeb50 100644
--- a/src/ce/ve.ce.BranchNode.js
+++ b/src/ce/ve.ce.BranchNode.js
@@ -16,13 +16,19 @@
  * @constructor
  * @param {ve.dm.BranchNode} model Model to observe
  * @param {Object} [config] Configuration options
+ * @cfg {boolean} ignoreSlugs Ignore the rendering of slugs
  */
 ve.ce.BranchNode = function VeCeBranchNode( model, config ) {
+       config = config || {};
+
        // Mixin constructor
        ve.BranchNode.call( this );
 
        // Parent constructor
        ve.ce.Node.call( this, model, config );
+
+       // Ignore slugs
+       this.ignoreSlugs = !!config.ignoreSlugs;
 
        // DOM changes (keep in sync with #onSetup)
        this.$element.addClass( 've-ce-branchNode' );
@@ -221,7 +227,9 @@
                }
        }
 
-       this.setupSlugs();
+       if ( !this.ignoreSlugs ) {
+               this.setupSlugs();
+       }
 };
 
 /**

-- 
To view, visit https://gerrit.wikimedia.org/r/200085
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8105418a3579232df1eb193649170b81ae086f32
Gerrit-PatchSet: 1
Gerrit-Project: VisualEditor/VisualEditor
Gerrit-Branch: master
Gerrit-Owner: Mooeypoo <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to