mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-01 09:26:37 +00:00
d8ee3c2c29
Stack traces, line numbers, etc. All the approaches I've seen are bad hacks. This is the best way to go. Change-Id: Ib12e9d2ecfe610bcc89d046005e35cc13efa3d99
43 lines
887 B
JavaScript
43 lines
887 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 new Error( 'Unknown node type: ' + type );
|
|
};
|
|
|
|
/* Inheritance */
|
|
|
|
ve.extendClass( ve.ce.NodeFactory, ve.Factory );
|
|
|
|
/* Initialization */
|
|
|
|
ve.ce.nodeFactory = new ve.ce.NodeFactory();
|