mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-14 19:35:38 +00:00
ee69365b82
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
26 lines
749 B
JavaScript
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;
|