2013-04-17 17:53:26 +00:00
|
|
|
/*!
|
|
|
|
* 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
|
|
|
|
* @constructor
|
|
|
|
* @param {ve.dm.MWReferenceListNode} model Model to observe
|
|
|
|
*/
|
|
|
|
ve.ce.MWReferenceListNode = function VeCeMWReferenceListNode( model ) {
|
|
|
|
// Parent constructor
|
|
|
|
ve.ce.LeafNode.call( this, model, $( '<div>' ) );
|
|
|
|
|
|
|
|
// DOM Changes
|
|
|
|
this.$.addClass( 've-ce-MWreferenceListNode', 'reference' )
|
|
|
|
.attr( 'contenteditable', false );
|
|
|
|
|
|
|
|
// Events
|
2013-05-01 22:21:32 +00:00
|
|
|
this.model.connect( this, { 'update': 'onUpdate' } );
|
2013-04-17 17:53:26 +00:00
|
|
|
|
|
|
|
// Initialization
|
|
|
|
this.onUpdate();
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.inheritClass( ve.ce.MWReferenceListNode, ve.ce.LeafNode );
|
|
|
|
|
|
|
|
/* Static Properties */
|
|
|
|
|
|
|
|
ve.ce.MWReferenceListNode.static.name = 'MWreferenceList';
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
ve.ce.MWReferenceListNode.prototype.onUpdate = function () {
|
|
|
|
this.$.html( this.model.getAttribute( 'html' ) );
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Registration */
|
|
|
|
|
|
|
|
ve.ce.nodeFactory.register( ve.ce.MWReferenceListNode );
|