mediawiki-extensions-Discus.../modules/dt-ve/dt.dm.MWSignatureNode.js
Bartosz Dziewoński ee69365b82 Signature handling in visual mode
Load 'ext.visualEditor.mwsignature' (which implements VE's existing
handling for signatures), then subclass and override a bunch of things
in order to:

* Replace the context menu with a note that you don't need to type the
  signature when commenting using the reply widget

* Override the sequence/command to insert signature so that it selects
  it afterwards and thus displays the context menu

* Treat signatures as signature nodes when switching from wikitext,
  instead of the normal pre-save transform turning them into regular
  links and text

Bug: T255738
Change-Id: Icb542451c2307ab51e56bd627804096c7b5552c8
2020-07-16 01:32:19 +02:00

26 lines
749 B
JavaScript

function DtDmMWSignatureNode() {
// Parent constructor
DtDmMWSignatureNode.super.apply( this, arguments );
}
OO.inheritClass( DtDmMWSignatureNode, ve.dm.MWSignatureNode );
DtDmMWSignatureNode.static.name = 'dtMwSignature';
// Match the special marker we use when switching from source to visual mode
DtDmMWSignatureNode.static.matchTagNames = [ 'span' ];
DtDmMWSignatureNode.static.matchRdfaTypes = null;
DtDmMWSignatureNode.static.matchFunction = function ( domElement ) {
return domElement.getAttribute( 'data-dtsignatureforswitching' ) !== null;
};
DtDmMWSignatureNode.static.toDataElement = function () {
return { type: 'dtMwSignature' };
};
ve.dm.modelRegistry.register( DtDmMWSignatureNode );
module.exports = DtDmMWSignatureNode;