Hi Robert,

Really a lot of thanks for the reply, its a complex system and all help is really appreciated.

I had also grabbed every single plugin from the REL1_35, and checked them.  Most seem to inherit from ve.ui/ce/dm.MWExtensionXXX 

Looking at how the {{SomeReferenmnce}} transclusion works I noticed that "Parser functions" also exist as {{#SomeParserFunction}}, and for the VisualEditor they both result in a mwTransclusion model element.

For parser functions I guessed that ve.dm.MWTransclusion* would be the right inheritance class for someone trying to extend the VisualEditor.   To stop my extension matching everything I added a matchTagNames, and a matchFunction to narrow things down.

So now I get correct model output in the VE debug view.  mwTransclusion for regular templates, and for ONLY my parser function I get the mwMyParserFunction for example.


However the on-focus the ContextItem routines appears to find two menu items, transclusion AND my plugin.

This appears because the DEFAULT transclusion ContextItem inherits from ve.dm.MWTransclusion and so the "ContextRegistryCandidate.isCompatibleWith( model )" results in a true for transclusion and anything inheriting from it.

Much like for <tag/> extensions, shouldnt VisualEditor also offer a ve.dm.MWTransclusionExtension type?

Am I approaching this the wrong way, I am quite confused now how to handle this case correctly.

Cheers,
Luc

Date: Wed, 25 Nov 2020 08:50:19 +0000
From: Robert Vogel <vogel@hallowelt.com>
To: For developers discussing technical aspects and organization of
    Wikimedia projects <wikitech-l@lists.wikimedia.org>
Subject: Re: [Wikitech-l] VisualEditor inheriting from TransclusionNode in parser function extension?
Message-ID:
   
Content-Type: text/plain; charset="utf-8"

Hi Luc!

>From my expierience inheritance of dialogs is rather hard to do and also probably not meant to be done.
In the end it might be easier to actually implement a standalone dialog.

If you are interested in ways to modify existing dialogs and adding stuff to VisualEditor in general, you may want to have a look at the BlueSpiceVisualEditorConnector extension [1-5].