2012-05-01 00:36:22 +00:00
|
|
|
/**
|
2012-05-22 00:39:03 +00:00
|
|
|
* ContentEditable node for an alien block 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.AlienBlockNode} Model to observe
|
2012-05-01 00:36:22 +00:00
|
|
|
*/
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.AlienBlockNode = function( model ) {
|
2012-05-01 00:36:22 +00:00
|
|
|
// Inheritance
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.ce.LeafNode.call( this, 'alienBlock', model );
|
2012-05-10 05:36:25 +00:00
|
|
|
|
2012-05-23 19:03:28 +00:00
|
|
|
// DOM Changes
|
|
|
|
this.$.addClass( 've-ce-alienBlockNode' );
|
|
|
|
|
2012-05-10 05:36:25 +00:00
|
|
|
// Events
|
|
|
|
this.model.addListenerMethod( this, 'update', 'onUpdate' );
|
|
|
|
|
|
|
|
// Intialization
|
|
|
|
var _this = this;
|
|
|
|
|
|
|
|
/* We might need some of those at some point */
|
|
|
|
/*
|
|
|
|
this.$.on( {
|
|
|
|
'mousedown': function() {
|
|
|
|
_this.$.css( '-webkit-user-select', 'none' );
|
|
|
|
},
|
|
|
|
'mouseup': function() {
|
|
|
|
_this.$.css( '-webkit-user-select', '' );
|
|
|
|
},
|
|
|
|
} );
|
|
|
|
|
|
|
|
this.$.attr( 'contenteditable', false );
|
|
|
|
*/
|
|
|
|
|
|
|
|
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.AlienBlockNode.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.AlienBlockNode.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( 'alienBlock', ve.ce.AlienBlockNode );
|
2012-05-01 00:36:22 +00:00
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2012-05-22 00:39:03 +00:00
|
|
|
ve.extendClass( ve.ce.AlienBlockNode, ve.ce.LeafNode );
|