@@ -881,6 +881,37 @@ export const commands: Record<string, Command<State>> = {
881881 } ,
882882 } ,
883883
884+ 'annotation:add-callout' : {
885+ id : 'annotation:add-callout' ,
886+ labelKey : 'annotation.callout' ,
887+ icon : 'callout' ,
888+ iconProps : ( { state } ) => ( {
889+ primaryColor : getToolDefaultsById ( state . plugins . annotation , 'freeTextCallout' ) ?. strokeColor ,
890+ secondaryColor : getToolDefaultsById ( state . plugins . annotation , 'freeTextCallout' ) ?. color ,
891+ } ) ,
892+ categories : [ 'annotation' , 'annotation-text' ] ,
893+ action : ( { registry, documentId } ) => {
894+ const annotation = registry . getPlugin < AnnotationPlugin > ( ANNOTATION_PLUGIN_ID ) ?. provides ( ) ;
895+ const annotationScope = annotation ?. forDocument ( documentId ) ;
896+ if ( ! annotationScope ) return ;
897+
898+ if ( annotationScope . getActiveTool ( ) ?. id === 'freeTextCallout' ) {
899+ annotationScope . setActiveTool ( null ) ;
900+ } else {
901+ annotationScope . setActiveTool ( 'freeTextCallout' ) ;
902+ }
903+ } ,
904+ active : ( { state, documentId } ) => {
905+ return (
906+ state . plugins [ ANNOTATION_PLUGIN_ID ] ?. documents [ documentId ] ?. activeToolId ===
907+ 'freeTextCallout'
908+ ) ;
909+ } ,
910+ disabled : ( { state, documentId } ) => {
911+ return lacksPermission ( state , documentId , PdfPermissionFlag . ModifyAnnotations ) ;
912+ } ,
913+ } ,
914+
884915 'annotation:add-highlight' : {
885916 id : 'annotation:add-highlight' ,
886917 labelKey : 'annotation.highlight' ,
0 commit comments