mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
61ddfb76e4
Objective: * Make ve.Factory behave like ve.NamedClassFactory * Remove the only remaining use of ve.Factory (actions) * Remove ve.NamedClassFactory Change-Id: Ie302ef5ea31081de7ab0db6091058a59946aef4c
44 lines
955 B
JavaScript
44 lines
955 B
JavaScript
/*!
|
|
* VisualEditor ContentEditable NodeFactory class.
|
|
*
|
|
* @copyright 2011-2013 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
|
|
/**
|
|
* ContentEditable node factory.
|
|
*
|
|
* @class
|
|
* @extends ve.Factory
|
|
* @constructor
|
|
*/
|
|
ve.ce.NodeFactory = function VeCeNodeFactory() {
|
|
// Parent constructor
|
|
ve.Factory.call( this );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.inheritClass( ve.ce.NodeFactory, ve.Factory );
|
|
|
|
/* Methods */
|
|
|
|
/**
|
|
* Check if a node type can be split.
|
|
*
|
|
* @param {string} type Node type
|
|
* @returns {boolean} The node can have grandchildren
|
|
* @throws {Error} Unknown node type
|
|
*/
|
|
ve.ce.NodeFactory.prototype.canNodeBeSplit = function ( type ) {
|
|
if ( type in this.registry ) {
|
|
return this.registry[type].static.canBeSplit;
|
|
}
|
|
throw new Error( 'Unknown node type: ' + type );
|
|
};
|
|
|
|
/* Initialization */
|
|
|
|
// TODO: Move instantiation to a different file
|
|
ve.ce.nodeFactory = new ve.ce.NodeFactory();
|