re: AnnotationSet, fix JS error in getFirstLinkAnnotation.

Change-Id: I6a3cb4eb2164bf1c4c8f715e42117ac06cccac04
This commit is contained in:
Rob Moen 2012-09-24 17:14:22 -07:00
parent 5075d79c4b
commit 4613707909

View file

@ -94,17 +94,16 @@ ve.ui.LinkInspector.prototype.getAllLinkAnnotationsFromSelection = function () {
};
ve.ui.LinkInspector.prototype.getFirstLinkAnnotation = function ( annotations ) {
var i, annotation, arr = annotations.get();
for ( i = 0; i < arr.length; i++ ) {
var i;
for ( i = 0; i < annotations.length; i++ ) {
// Use the first one with a recognized type (there should only be one, this is just in case)
annotation = arr[i];
if (
annotation.type === 'link/WikiLink' ||
annotation.type === 'link/ExtLink' ||
annotation.type === 'link/ExtLink/Numbered' ||
annotation.type === 'link/ExtLink/URL'
annotations[i].type === 'link/WikiLink' ||
annotations[i].type === 'link/ExtLink' ||
annotations[i].type === 'link/ExtLink/Numbered' ||
annotations[i].type === 'link/ExtLink/URL'
) {
return annotation;
return annotations[i];
}
}
return null;