2012-05-01 00:36:22 +00:00
|
|
|
/**
|
2012-05-22 00:39:03 +00:00
|
|
|
* ContentEditable node for an alien inline node.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-01 00:36:22 +00:00
|
|
|
* @class
|
|
|
|
* @constructor
|
|
|
|
* @extends {ve.ce.LeafNode}
|
2012-05-22 00:39:03 +00:00
|
|
|
* @param model {ve.dm.AlienInlineNode} Model to observe
|
2012-05-01 00:36:22 +00:00
|
|
|
*/
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.AlienInlineNode = function( model ) {
|
2012-05-01 00:36:22 +00:00
|
|
|
// Inheritance
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.LeafNode.call( this, 'alienInline', model );
|
2012-05-10 05:36:25 +00:00
|
|
|
|
2012-05-23 19:03:28 +00:00
|
|
|
// DOM Changes
|
|
|
|
this.$.addClass( 've-ce-alienInlineNode' );
|
2012-05-26 06:36:18 +00:00
|
|
|
this.$.attr( 'contenteditable', false );
|
2012-05-23 19:03:28 +00:00
|
|
|
|
2012-05-10 05:36:25 +00:00
|
|
|
// Events
|
|
|
|
this.model.addListenerMethod( this, 'update', 'onUpdate' );
|
|
|
|
|
|
|
|
// Intialization
|
|
|
|
this.onUpdate();
|
2012-05-01 00:36:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Static Members */
|
|
|
|
|
|
|
|
/**
|
2012-05-02 18:29:44 +00:00
|
|
|
* Node rules.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-01 00:36:22 +00:00
|
|
|
* @see ve.ce.NodeFactory
|
2012-05-02 18:29:44 +00:00
|
|
|
* @static
|
|
|
|
* @member
|
2012-05-01 00:36:22 +00:00
|
|
|
*/
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.AlienInlineNode.rules = {
|
2012-05-01 00:36:22 +00:00
|
|
|
'canBeSplit': false
|
|
|
|
};
|
|
|
|
|
2012-05-10 05:36:25 +00:00
|
|
|
/* Methods */
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.AlienInlineNode.prototype.onUpdate = function() {
|
2012-05-10 05:36:25 +00:00
|
|
|
this.$.html( this.model.getAttribute( 'html' ) );
|
|
|
|
};
|
|
|
|
|
2012-05-01 00:36:22 +00:00
|
|
|
/* Registration */
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.factory.register( 'alienInline', ve.ce.AlienInlineNode );
|
2012-05-01 00:36:22 +00:00
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.extendClass( ve.ce.AlienInlineNode, ve.ce.LeafNode );
|