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(a)hallowelt.com>
To: For developers discussing technical aspects and organization of
Wikimedia projects <wikitech-l(a)lists.wikimedia.org>
Subject: Re: [Wikitech-l] VisualEditor inheriting from TransclusionNode in parser function
extension?Message-ID:
<AM0PR08MB446861FE8E6A6B2589C66942AEFA0(a)AM0PR08MB4468.eurprd08.prod.outlook.com>
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].
[1]
https://github.com/wikimedia/mediawiki-extensions-BlueSpiceVisualEditorConn…
[2]
https://github.com/wikimedia/mediawiki-extensions-BlueSpiceVisualEditorConn…
[3]
https://github.com/wikimedia/mediawiki-extensions-BlueSpiceVisualEditorConn…
[4]
https://github.com/wikimedia/mediawiki-extensions-BlueSpiceVisualEditorConn…
[5]
https://github.com/wikimedia/mediawiki-extensions-BlueSpiceVisualEditorConn…