2012-04-30 23:36:02 +00:00
|
|
|
/**
|
|
|
|
* ContentEditable node factory.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-04-30 23:36:02 +00:00
|
|
|
* @class
|
2012-05-31 23:50:16 +00:00
|
|
|
* @extends {ve.Factory}
|
2012-04-30 23:36:02 +00:00
|
|
|
* @constructor
|
|
|
|
*/
|
|
|
|
ve.ce.NodeFactory = function() {
|
|
|
|
// Inheritance
|
2012-05-31 23:50:16 +00:00
|
|
|
ve.Factory.call( this );
|
2012-04-30 23:36:02 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Checks if a given node type can be split.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-04-30 23:36:02 +00:00
|
|
|
* @param {String} type Node type
|
|
|
|
* @returns {Boolean} The node can have grandchildren
|
|
|
|
* @throws 'Unknown node type'
|
|
|
|
*/
|
|
|
|
ve.ce.NodeFactory.prototype.canNodeBeSplit = function( type ) {
|
|
|
|
if ( type in this.registry ) {
|
|
|
|
return this.registry[type].rules.canBeSplit;
|
|
|
|
}
|
|
|
|
throw 'Unknown node type: ' + type;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Inheritance */
|
|
|
|
|
2012-05-31 23:50:16 +00:00
|
|
|
ve.extendClass( ve.ce.NodeFactory, ve.Factory );
|
2012-04-30 23:36:02 +00:00
|
|
|
|
|
|
|
/* Initialization */
|
|
|
|
|
2012-05-31 22:20:58 +00:00
|
|
|
ve.ce.nodeFactory = new ve.ce.NodeFactory();
|