2012-05-03 20:21:13 +00:00
|
|
|
/**
|
|
|
|
* ContentEditable document.
|
2012-05-14 22:05:09 +00:00
|
|
|
*
|
2012-05-03 20:21:13 +00:00
|
|
|
* @class
|
2012-05-10 04:11:09 +00:00
|
|
|
* @extends {ve.Document}
|
2012-05-03 20:21:13 +00:00
|
|
|
* @constructor
|
|
|
|
* @param model {ve.dm.Document} Model to observe
|
|
|
|
*/
|
|
|
|
ve.ce.Document = function( model ) {
|
2012-05-10 04:11:09 +00:00
|
|
|
// Inheritance
|
|
|
|
ve.Document.call( this, new ve.ce.DocumentNode( model.getDocumentNode() ) );
|
|
|
|
|
2012-05-03 20:21:13 +00:00
|
|
|
// Properties
|
2012-05-10 04:11:09 +00:00
|
|
|
this.model = model;
|
2012-05-03 20:21:13 +00:00
|
|
|
};
|
2012-05-10 04:11:09 +00:00
|
|
|
|
2012-05-30 21:38:02 +00:00
|
|
|
/* Methods */
|
|
|
|
|
|
|
|
ve.ce.Document.prototype.getNodeFromOffset = function( offset ) {
|
|
|
|
var node = this.documentNode.getNodeFromOffset( offset );
|
|
|
|
if ( !node.canHaveChildren() ) {
|
|
|
|
node = node.getParent();
|
|
|
|
}
|
|
|
|
return node;
|
|
|
|
};
|
|
|
|
|
2012-05-10 04:11:09 +00:00
|
|
|
/* Inheritance */
|
|
|
|
|
|
|
|
ve.extendClass( ve.ce.Document, ve.Document );
|