mediawiki-extensions-Visual.../modules/ve/ce/ve.ce.Document.js
Trevor Parscal 255ce870e2 Puttin' em white-spacers where they aught'a be
function() -> function ()
){ -> ) {

Change-Id: I20a85fcf79d7aec64f7f2559e84c0279550d4eea
2012-08-06 18:52:19 -07:00

37 lines
804 B
JavaScript

/**
* VisualEditor content editable Document class.
*
* @copyright 2011-2012 VisualEditor Team and others; see AUTHORS.txt
* @license The MIT License (MIT); see LICENSE.txt
*/
/**
* ContentEditable document.
*
* @class
* @extends {ve.Document}
* @constructor
* @param model {ve.dm.Document} Model to observe
*/
ve.ce.Document = function ( model, surface ) {
// Inheritance
ve.Document.call( this, new ve.ce.DocumentNode( model.getDocumentNode(), surface ) );
// Properties
this.model = model;
};
/* Methods */
ve.ce.Document.prototype.getNodeFromOffset = function ( offset ) {
var node = this.documentNode.getNodeFromOffset( offset );
if ( !node.canHaveChildren() ) {
node = node.getParent();
}
return node;
};
/* Inheritance */
ve.extendClass( ve.ce.Document, ve.Document );