mediawiki-extensions-Visual.../modules/ve-mw/dm/metaitems/ve.dm.MWAlienMetaItem.js
Bartosz Dziewoński 1fc11e0146 Handle <noinclude> etc. as nodes rather than metaitems
The difference is that metaitems are not visible on the editing
surface, and their exact position is not preserved when the paragraph
containing them is edited.

This behavior is desirable for e.g. categories, but not for
<noinclude> and related tags, which are intentionally placed in
specific places in the text.

Note that we don't really have any editing interface for these nodes
yet. But you can see them (and they come with descriptions and links
to documentation pages), and delete or copy-paste them.

Bug: T250937
Change-Id: I104e7abbd650567df0e59813653c46a66d955d58
2020-06-01 18:47:14 +02:00

42 lines
1.1 KiB
JavaScript

/*!
* VisualEditor DataModel MWAlienMetaItem class.
*
* @copyright 2011-2020 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* DataModel MW-specific meta item.
*
* @class
* @abstract
* @extends ve.dm.AlienMetaItem
* @constructor
* @param {Object} element Reference to element in meta-linmod
*/
ve.dm.MWAlienMetaItem = function VeDmMWAlienMetaItem() {
// Parent constructor
ve.dm.MWAlienMetaItem.super.apply( this, arguments );
};
/* Inheritance */
OO.inheritClass( ve.dm.MWAlienMetaItem, ve.dm.AlienMetaItem );
/* Static Properties */
ve.dm.MWAlienMetaItem.static.name = 'mwAlienMeta';
ve.dm.MWAlienMetaItem.static.matchRdfaTypes = [
// HACK: Avoid matching things that are better handled by MWAlienExtensionNode or MWIncludesNode
/^mw:(?!Extension|Includes)/
];
// toDataElement inherited from AlienMetaItem, will return regular alienMeta elements but
// that's fine. This class is only here so that <meta>/<link> tags with an mw: type are correctly
// mapped to AlienMetaItem rather than AlienNode.
/* Registration */
ve.dm.modelRegistry.register( ve.dm.MWAlienMetaItem );