@@ -341,26 +341,33 @@ gui.AnnotationViewManager = function AnnotationViewManager(canvas, odfFragment,
341341 this . getMinimumHeightForAnnotationPane = getMinimumHeightForAnnotationPane ;
342342
343343 /**
344- * Adds an annotation to track, and wraps and highlights it
345- * @param {!odf.AnnotationElement } annotation
344+ * Adds annotations to track, and wraps and highlights them
345+ * @param {!Array.<! odf.AnnotationElement> } annotationElements
346346 * @return {undefined }
347347 */
348- function addAnnotation ( annotation ) {
348+ function addAnnotations ( annotationElements ) {
349+ if ( annotationElements . length === 0 ) {
350+ return ;
351+ }
352+
349353 showAnnotationsPane ( true ) ;
350354
351- // TODO: make use of the fact that current list is already sorted
352- // instead just iterate over the list until the right index to insert is found
353- annotations . push ( annotation ) ;
355+ annotationElements . forEach ( function ( annotation ) {
356+ // TODO: make use of the fact that current list is already sorted
357+ // instead just iterate over the list until the right index to insert is found
358+ annotations . push ( annotation ) ;
359+
360+ wrapAnnotation ( annotation ) ;
361+ if ( annotation . annotationEndElement ) {
362+ highlightAnnotation ( annotation ) ;
363+ }
364+ } ) ;
354365
355366 sortAnnotations ( ) ;
356367
357- wrapAnnotation ( annotation ) ;
358- if ( annotation . annotationEndElement ) {
359- highlightAnnotation ( annotation ) ;
360- }
361368 rerenderAnnotations ( ) ;
362369 }
363- this . addAnnotation = addAnnotation ;
370+ this . addAnnotations = addAnnotations ;
364371
365372 /**
366373 * Unhighlights, unwraps, and ejects an annotation from the tracking
0 commit comments