mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-29 00:30:44 +00:00
aaa322642b
Also added tests for initialization of factories at ve.ce.factory and ve.dm.factory Change-Id: Ic6ac74aab86ecdfd4f094d9bb1fa16de930387b7
36 lines
697 B
JavaScript
36 lines
697 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.factory = new ve.ce.NodeFactory();
|