mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 22:35:41 +00:00
Fixed misnamed method, and off by one issue when getting content data from a document
This commit is contained in:
parent
33e19f7275
commit
2d7d4866bc
|
@ -618,7 +618,7 @@ es.DocumentModel.prototype.getElementFromNode = function( node ) {
|
|||
* @method
|
||||
* @param {es.DocumentModelNode} node Node to get element data for
|
||||
*/
|
||||
es.DocumentModel.prototype.getContentDataFromNode = function( node ) {
|
||||
es.DocumentModel.prototype.getElementDataFromNode = function( node ) {
|
||||
var length = node.getElementLength();
|
||||
var offset = this.getOffsetFromNode( node );
|
||||
if ( offset !== -1 ) {
|
||||
|
@ -652,7 +652,9 @@ es.DocumentModel.prototype.getContentDataFromNode = function( node, range ) {
|
|||
}
|
||||
var offset = this.getOffsetFromNode( node );
|
||||
if ( offset !== -1 ) {
|
||||
offset++;
|
||||
if ( node.type !== 'document' ) {
|
||||
offset++;
|
||||
}
|
||||
return this.data.slice( offset + range.start, offset + range.end );
|
||||
}
|
||||
return null;
|
||||
|
|
Loading…
Reference in a new issue