mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-03 02:16:51 +00:00
8858ed932f
Really Roan? How dare you! See I3f5116d7dfbaa5889b7c5cac01d7341272749c58 Change-Id: Ia0ae514fc07752edb7b7100716e09163d3bfacba
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
/*!
|
|
* VisualEditor ContentEditable MWReferenceListNode class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable MediaWiki reference list node.
|
|
*
|
|
* @class
|
|
* @extends ve.ce.LeafNode
|
|
* @mixins ve.ce.ProtectedNode
|
|
*
|
|
* @constructor
|
|
* @param {ve.dm.MWReferenceListNode} model Model to observe
|
|
*/
|
|
ve.ce.MWReferenceListNode = function VeCeMWReferenceListNode( model ) {
|
|
// Parent constructor
|
|
ve.ce.LeafNode.call( this, model, $( '<div>' ) );
|
|
|
|
// Mixin constructors
|
|
ve.ce.ProtectedNode.call( this );
|
|
|
|
// DOM Changes
|
|
this.$.addClass( 've-ce-MWreferenceListNode', 'reference' )
|
|
.attr( 'contenteditable', false );
|
|
|
|
// Events
|
|
this.model.connect( this, { 'update': 'onUpdate' } );
|
|
|
|
// Initialization
|
|
this.onUpdate();
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.ce.MWReferenceListNode, ve.ce.LeafNode );
|
|
|
|
ve.mixinClass( ve.ce.MWReferenceListNode, ve.ce.ProtectedNode );
|
|
|
|
/* Static Properties */
|
|
|
|
ve.ce.MWReferenceListNode.static.name = 'MWreferenceList';
|
|
|
|
/* Methods */
|
|
|
|
ve.ce.MWReferenceListNode.prototype.onUpdate = function () {
|
|
this.$.html( ve.copyArray( this.model.getAttribute( 'domElements' ) || [] ) );
|
|
};
|
|
|
|
/* Registration */
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWReferenceListNode );
|