Debian Codegraph @

extensions/VisualEditor/modules/ve-mw/dm/nodes/ve.dm.MWSignatureNode.js

raw symbols SCIP
1 /*!
2 * VisualEditor DataModel MWSignatureNode class.
3 *
4 * @copyright See AUTHORS.txt
5 * @license The MIT License (MIT); see LICENSE.txt
6 */
7
8 /**
9 * DataModel MediaWiki signature node. This defines the behavior of the data model for the
10 * signature, especially the fact that it needs to be converted into a wikitext signature on
11 * save.
12 *
13 * @class
14 * @extends ve.dm.LeafNode
15 *
16 * @constructor
17 * @param {Object} [element] Reference to element in linear model
18 */
19 ve.dm.MWSignatureNode = function VeDmMWSignatureNode() {
20 // Parent constructor
21 ve.dm.MWSignatureNode.super.apply( this, arguments );
22
23 // Mixin constructors
24 ve.dm.GeneratedContentNode.call( this );
25 ve.dm.FocusableNode.call( this );
26 };
27
28 /* Inheritance */
29
30 OO.inheritClass( ve.dm.MWSignatureNode, ve.dm.LeafNode );
31 OO.mixinClass( ve.dm.MWSignatureNode, ve.dm.GeneratedContentNode );
32 OO.mixinClass( ve.dm.MWSignatureNode, ve.dm.FocusableNode );
33
34 /* Static members */
35
36 ve.dm.MWSignatureNode.static.name = 'mwSignature';
37
38 ve.dm.MWSignatureNode.static.isContent = true;
39
40 ve.dm.MWSignatureNode.static.matchTagNames = null;
41
42 ve.dm.MWSignatureNode.static.matchRdfaTypes = [];
43
44 ve.dm.MWSignatureNode.static.matchFunction = function () {
45 return false;
46 };
47
48 ve.dm.MWSignatureNode.static.getTemplateDataElement = function () {
49 return {
50 type: 'mwTransclusionInline',
51 attributes: {
52 mw: {
53 parts: [ '~~~~' ]
54 }
55 }
56 };
57 };
58
59 ve.dm.MWSignatureNode.static.toDomElements = function ( dataElement, doc, converter ) {
60 // Ignore the mwSignature dataElement and create a wikitext transclusion
61 dataElement = this.getTemplateDataElement();
62 return ve.dm.MWTransclusionInlineNode.static.toDomElements( dataElement, doc, converter );
63 };
64
65 // Can't be generated from existing HTML documents, this method should never be called
66 ve.dm.MWSignatureNode.static.toDataElement = null;
67
68 // In previews we look up the rendering of the generated mwTransclusionInline node,
69 // so use that node's hash object.
70 ve.dm.MWSignatureNode.static.getHashObjectForRendering = function () {
71 return ve.dm.MWTransclusionNode.static.getHashObject( this.getTemplateDataElement() );
72 };
73
74 /* Registration */
75
76 ve.dm.modelRegistry.register( ve.dm.MWSignatureNode );