ve-cite: Add dependency on ext.visualEditor.mwtransclusion

ReferencesListNode needs to be registered after
MWTransclusionNode so that it has a higher specificity
when matching.

Change-Id: I93610fac2ec9715a14b34efb76abc55d2d2c6900
This commit is contained in:
Ed Sanders 2020-12-13 22:08:14 +00:00
parent 8bda698bb3
commit 10f7f716f0
2 changed files with 5 additions and 1 deletions

View file

@ -48,6 +48,9 @@ ve.dm.MWReferencesListNode.static.matchTagNames = null;
ve.dm.MWReferencesListNode.static.matchRdfaTypes = [ 'mw:Extension/references', 'mw:Transclusion' ];
// This node has the same specificity as ve.dm.MWTranslcusionNode and only matches
// ahead of it because it is registered later (via a dependency in ResourceLoader)
// TODO: Make this less fragile.
ve.dm.MWReferencesListNode.static.matchFunction = function ( domElement ) {
function isRefList( el ) {
return el && el.nodeType === Node.ELEMENT_NODE && ( el.getAttribute( 'typeof' ) || '' ).indexOf( 'mw:Extension/references' ) !== -1;

View file

@ -87,7 +87,8 @@ class CiteHooks {
've.ce.MWReferenceNode.css',
],
"dependencies" => [
"ext.visualEditor.mwcore"
"ext.visualEditor.mwcore",
"ext.visualEditor.mwtransclusion"
],
"messages" => [
"cite-ve-referenceslist-isempty",