mediawiki-extensions-Visual.../modules/ve/ce/ve.ce.Document.js
Catrope 74ed8e8766 Rename ve_foo_bar back to VeFooBar per discussion
Change-Id: Ibf6d4f08c4761727b2e3952a76e474c8221b38f9
2012-09-06 16:15:55 -07:00

37 lines
824 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 VeCeDocument( model, surface ) {
// Parent constructor
ve.Document.call( this, new ve.ce.DocumentNode( model.getDocumentNode(), surface ) );
// Properties
this.model = model;
};
/* Inheritance */
ve.inheritClass( ve.ce.Document, ve.Document );
/* Methods */
ve.ce.Document.prototype.getNodeFromOffset = function ( offset ) {
var node = this.documentNode.getNodeFromOffset( offset );
if ( !node.canHaveChildren() ) {
node = node.getParent();
}
return node;
};