@@ -585,6 +585,8 @@ class AnnotationEditorUIManager {
585585
586586 #activeEditor = null ;
587587
588+ #allEditableAnnotations = null ;
589+
588590 #allEditors = new Map ( ) ;
589591
590592 #allLayers = new Map ( ) ;
@@ -663,6 +665,8 @@ class AnnotationEditorUIManager {
663665
664666 #showAllStates = null ;
665667
668+ #pdfDocument = null ;
669+
666670 #previousStates = {
667671 isEditing : false ,
668672 isEmpty : true ,
@@ -846,6 +850,7 @@ class AnnotationEditorUIManager {
846850 this . #altTextManager = altTextManager ;
847851 this . #commentManager = commentManager ;
848852 this . #signatureManager = signatureManager ;
853+ this . #pdfDocument = pdfDocument ;
849854 this . _eventBus = eventBus ;
850855 eventBus . _on ( "editingaction" , this . onEditingAction . bind ( this ) , { signal } ) ;
851856 eventBus . _on ( "pagechanging" , this . onPageChanging . bind ( this ) , { signal } ) ;
@@ -928,6 +933,7 @@ class AnnotationEditorUIManager {
928933 this . #floatingToolbar = null ;
929934 this . #mainHighlightColorPicker?. destroy ( ) ;
930935 this . #mainHighlightColorPicker = null ;
936+ this . #allEditableAnnotations = null ;
931937 if ( this . #focusMainContainerTimeoutId) {
932938 clearTimeout ( this . #focusMainContainerTimeoutId) ;
933939 this . #focusMainContainerTimeoutId = null ;
@@ -937,6 +943,7 @@ class AnnotationEditorUIManager {
937943 this . #translationTimeoutId = null ;
938944 }
939945 this . _editorUndoBar ?. destroy ( ) ;
946+ this . #pdfDocument = null ;
940947 }
941948
942949 combinedSignal ( ac ) {
@@ -1790,6 +1797,10 @@ class AnnotationEditorUIManager {
17901797 this . #updateModeCapability = Promise . withResolvers ( ) ;
17911798 this . #currentDrawingSession?. commitOrRemove ( ) ;
17921799
1800+ if ( this . #mode === AnnotationEditorType . POPUP ) {
1801+ this . #commentManager?. hideSidebar ( ) ;
1802+ }
1803+
17931804 this . #mode = mode ;
17941805 if ( mode === AnnotationEditorType . NONE ) {
17951806 this . setEditingState ( false ) ;
@@ -1800,9 +1811,18 @@ class AnnotationEditorUIManager {
18001811 this . #updateModeCapability. resolve ( ) ;
18011812 return ;
18021813 }
1814+
18031815 if ( mode === AnnotationEditorType . SIGNATURE ) {
18041816 await this . #signatureManager?. loadSignatures ( ) ;
18051817 }
1818+ if ( mode === AnnotationEditorType . POPUP ) {
1819+ this . #allEditableAnnotations ||=
1820+ await this . #pdfDocument. getAnnotationsByType (
1821+ new Set ( this . #editorTypes. map ( editorClass => editorClass . _editorType ) )
1822+ ) ;
1823+ this . #commentManager?. showSidebar ( this . #allEditableAnnotations) ;
1824+ }
1825+
18061826 this . setEditingState ( true ) ;
18071827 await this . #enableAll( ) ;
18081828 this . unselectAll ( ) ;
0 commit comments