mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-15 18:39:52 +00:00
6afed5e5cc
Change-Id: Ie51d8e48171fb1f84045d1560ee603cee62b91f6
30 lines
620 B
JavaScript
30 lines
620 B
JavaScript
/**
|
|
* 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 );
|