diff --git a/src/resources/dicts/en.edn b/src/resources/dicts/en.edn index 886eb535a0..fbbc309b3b 100644 --- a/src/resources/dicts/en.edn +++ b/src/resources/dicts/en.edn @@ -339,7 +339,7 @@ :whiteboard/circle "Circle" :whiteboard/triangle "Triangle" :whiteboard/shape "Shape" - :whiteboard/open-page "Open page" + :whiteboard/open-page "Open page" :whiteboard/open-page-in-sidebar "Open page in sidebar" :whiteboard/remove-link "Remove link" :whiteboard/link "Link" @@ -354,6 +354,7 @@ :whiteboard/search-only-pages "Search only pages" :whiteboard/cache-outdated "Cache is outdated. Please click the 'Re-index' button in the graph's dropdown menu." :whiteboard/shape-quick-links "Shape Quick Links" + :whiteboard/edit-pdf "Edit PDF" :page-search "Search in the current page" :graph-search "Search graph" :home "Home" diff --git a/tldraw/apps/tldraw-logseq/src/components/ContextBar/contextBarActionFactory.tsx b/tldraw/apps/tldraw-logseq/src/components/ContextBar/contextBarActionFactory.tsx index 7c03c69e6e..086caf44b8 100644 --- a/tldraw/apps/tldraw-logseq/src/components/ContextBar/contextBarActionFactory.tsx +++ b/tldraw/apps/tldraw-logseq/src/components/ContextBar/contextBarActionFactory.tsx @@ -34,6 +34,7 @@ import { KeyboardShortcut } from '../KeyboardShortcut' export const contextBarActionTypes = [ // Order matters + 'EditPdf', 'LogseqPortalViewMode', 'Geometry', 'AutoResizing', @@ -55,6 +56,7 @@ const singleShapeActions: ContextBarActionType[] = [ 'TwitterLink', 'IFrameSource', 'Links', + 'EditPdf', ] const contextBarActionMapping = new Map() @@ -76,7 +78,7 @@ export const shapeMapping: Record = { html: ['ScaleLevel', 'AutoResizing', 'Links'], image: ['Links'], video: ['Links'], - pdf: ['Links'], + pdf: ['EditPdf', 'Links'], } export const withFillShapes = Object.entries(shapeMapping) @@ -267,6 +269,24 @@ const TwitterLinkAction = observer(() => { ) }) +const EditPdfAction = observer(() => { + const app = useApp() + const { + handlers: { t, setCurrentPdf }, + } = React.useContext(LogseqContext) + const shape = app.selectedShapesArray[0] + + return ( + + ) +}) + const NoFillAction = observer(() => { const app = useApp() const { @@ -510,7 +530,7 @@ contextBarActionMapping.set('StrokeType', StrokeTypeAction) contextBarActionMapping.set('ArrowMode', ArrowModeAction) contextBarActionMapping.set('TextStyle', TextStyleAction) contextBarActionMapping.set('Links', LinksAction) - +contextBarActionMapping.set('EditPdf', EditPdfAction) const getContextBarActionTypes = (type: ShapeType) => { return (shapeMapping[type] ?? []).filter(isNonNullable) }