mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 02:51:50 +00:00
f6864b0c04
Change-Id: I96db0f28bb220f1c3b23990824e9523278cb8f9b
36 lines
699 B
JavaScript
36 lines
699 B
JavaScript
/**
|
|
* ContentEditable node factory.
|
|
*
|
|
* @class
|
|
* @extends {ve.NodeFactory}
|
|
* @constructor
|
|
*/
|
|
ve.ce.NodeFactory = function() {
|
|
// Inheritance
|
|
ve.NodeFactory.call( this );
|
|
};
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Checks if a given node type can be split.
|
|
*
|
|
* @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 */
|
|
|
|
ve.extendClass( ve.ce.NodeFactory, ve.NodeFactory );
|
|
|
|
/* Initialization */
|
|
|
|
ve.ce.nodeFactory = new ve.ce.NodeFactory();
|