r104935 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104934‎ | r104935 | r104936 >
Date:01:36, 2 December 2011
Author:inez
Status:deferred
Tags:
Comment:
getAnnotationsFromRange should return list of annotations even if there are elment offset in between of them
Modified paths:
  • /trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js (modified) (history)

Diff [purge]

Index: trunk/extensions/VisualEditor/modules/es/models/es.DocumentModel.js
@@ -705,8 +705,13 @@
706706 'partial': [],
707707 'all': []
708708 },
709 - map = {};
 709+ map = {},
 710+ elementsCount = 0;
710711 for ( var i = range.start; i < range.end; i++ ) {
 712+ if ( es.DocumentModel.isElementData( this.data, i ) ) {
 713+ elementsCount++;
 714+ continue;
 715+ }
711716 for ( var j = 1; j < this.data[i].length; j++ ) {
712717 hash = this.data[i][j].hash;
713718 if ( hash in map ) {
@@ -718,13 +723,14 @@
719724 }
720725 var length = range.getLength();
721726 for ( var hash in map ) {
722 - if ( map[hash][1] === length ) {
 727+ if ( map[hash][1] === length - elementsCount ) {
723728 annotations.full.push( map[hash][0] );
724729 } else {
725730 annotations.partial.push( map[hash][0] );
726731 }
727732 annotations.all.push( map[hash][0] );
728733 }
 734+ console.log(annotations);
729735 return annotations;
730736 };
731737

Status & tagging log