Bump/embed pdfv2.8.0 (#5921)

please merge #5919, alternatively, just push this and delete that PR
because this is a continuation of that.

This PR bumps the embed PDF version to 2.8.0 and also adds comments
functionaliy

---------

Co-authored-by: ConnorYoh <[email protected]>
Co-authored-by: Anthony Stirling <[email protected]>
This commit is contained in:
EthanHealy01
2026-03-23 14:35:39 +00:00
committed by GitHub
co-authored by ConnorYoh Anthony Stirling
parent 41945543e0
commit c46156f37f
23 changed files with 1932 additions and 629 deletions
+13 -2
View File
@@ -22,6 +22,9 @@ const DRAWING_TOOLS: AnnotationToolId[] = [
'inkHighlighter',
'text',
'note',
'textComment',
'insertText',
'replaceText',
'square',
'circle',
'line',
@@ -43,6 +46,9 @@ const KNOWN_ANNOTATION_TOOLS: AnnotationToolId[] = [
'inkHighlighter',
'text',
'note',
'textComment',
'insertText',
'replaceText',
'square',
'circle',
'line',
@@ -75,7 +81,7 @@ const Annotate = (_props: BaseToolProps) => {
const viewerContext = useContext(ViewerContext);
const viewerContextRef = useRef(viewerContext);
useEffect(() => { viewerContextRef.current = viewerContext; }, [viewerContext]);
const { getZoomState, registerImmediateZoomUpdate, applyChanges, activeFileIndex, panActions } = useViewer();
const { getZoomState, registerImmediateZoomUpdate, applyChanges, activeFileIndex, panActions, setCommentsSidebarVisible } = useViewer();
const [activeTool, setActiveTool] = useState<AnnotationToolId>('select');
@@ -312,6 +318,11 @@ const Annotate = (_props: BaseToolProps) => {
annotationApiRef?.current?.setAnnotationStyle?.(toolId, options);
annotationApiRef?.current?.activateAnnotationTool?.(toolId === 'stamp' ? 'stamp' : toolId, options);
// Auto-open comments sidebar when a comment tool is selected
if (['textComment', 'insertText', 'replaceText'].includes(toolId)) {
setCommentsSidebarVisible(true);
}
// Reset flag after a short delay
setTimeout(() => {
manualToolSwitch.current = false;
@@ -346,7 +357,7 @@ const Annotate = (_props: BaseToolProps) => {
const unsubscribe = annotationApiRef?.current?.onAnnotationEvent?.((event: AnnotationEvent) => {
if (event.type === 'create' && event.committed) {
const toolId = activeToolRef.current;
if (toolId === 'text' || toolId === 'note') {
if (['text', 'note', 'textComment', 'insertText', 'replaceText'].includes(toolId)) {
setActiveTool('select');
activeToolRef.current = 'select';
annotationApiRef?.current?.activateAnnotationTool?.('select');
@@ -209,6 +209,12 @@ export function AnnotationPanel(props: AnnotationPanelProps) {
{ id: 'polygon', label: t('annotation.polygon', 'Polygon'), icon: 'change-history' },
];
const commentTools: { id: AnnotationToolId; label: string; icon: string }[] = [
{ id: 'textComment', label: t('annotation.comment', 'Comment'), icon: 'comment' },
{ id: 'insertText', label: t('annotation.insertText', 'Insert Text'), icon: 'add-comment' },
{ id: 'replaceText', label: t('annotation.replaceText', 'Replace Text'), icon: 'find-replace' },
];
const otherTools: { id: AnnotationToolId; label: string; icon: string }[] = [
{ id: 'text', label: t('annotation.text', 'Text box'), icon: 'text-fields' },
{ id: 'note', label: t('annotation.note', 'Note'), icon: 'sticky-note-2' },
@@ -778,6 +784,11 @@ export function AnnotationPanel(props: AnnotationPanelProps) {
{renderToolButtons(shapeTools)}
</Box>
<Box>
<Text size="sm" fw={600} mb="xs">{t('annotation.comments', 'Comments')}</Text>
{renderToolButtons(commentTools)}
</Box>
<Box>
<Text size="sm" fw={600} mb="xs">{t('annotation.notesStamps', 'Notes & Stamps')}</Text>
{renderToolButtons(otherTools)}