mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
6b34f09df2
And added a license to some files that didn't have it yet Change-Id: I3a7e60374d1198d369a0475b8f65f7415012a337
43 lines
872 B
JavaScript
43 lines
872 B
JavaScript
/**
|
|
* VisualEditor content editable NodeFactory class.
|
|
*
|
|
* @copyright 2011-2012 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() {
|
|
// Inheritance
|
|
ve.Factory.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.Factory );
|
|
|
|
/* Initialization */
|
|
|
|
ve.ce.nodeFactory = new ve.ce.NodeFactory();
|