@dxos/plugin-markdown 0.8.4-main.67995b8 → 0.8.4-main.69d29f4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/MarkdownCard-HFNNE4B4.mjs +12 -0
- package/dist/lib/browser/MarkdownCard-HFNNE4B4.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs +12 -0
- package/dist/lib/browser/MarkdownContainer-V7EAADMF.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs +32 -0
- package/dist/lib/browser/anchor-sort-WQ3TL7ZI.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs +58 -0
- package/dist/lib/browser/app-graph-serializer-ULZUJKOD.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs +19 -0
- package/dist/lib/browser/blueprint-definition-TLV4PNZW.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +8 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs +702 -0
- package/dist/lib/browser/chunk-BX73DASG.mjs.map +7 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs +8 -0
- package/dist/lib/browser/chunk-CUGDX7KA.mjs.map +7 -0
- package/dist/lib/browser/chunk-FWQQW6KU.mjs +144 -0
- package/dist/lib/browser/chunk-FWQQW6KU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-K7ZFMSC4.mjs → chunk-JOXYQLKH.mjs} +10 -7
- package/dist/lib/browser/chunk-JOXYQLKH.mjs.map +7 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs +104 -0
- package/dist/lib/browser/chunk-KDKXFKDN.mjs.map +7 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs +167 -0
- package/dist/lib/browser/chunk-LMO5UVKL.mjs.map +7 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs +101 -0
- package/dist/lib/browser/chunk-S45ULIOG.mjs.map +7 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs +60 -0
- package/dist/lib/browser/chunk-VQ3WOAB6.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +32 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +127 -137
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs +53 -0
- package/dist/lib/browser/operation-resolver-EGCWOQKJ.mjs.map +7 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs +213 -0
- package/dist/lib/browser/react-surface-64FZ7T7F.mjs.map +7 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs +35 -0
- package/dist/lib/browser/settings-JY5JE7MI.mjs.map +7 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs +29 -0
- package/dist/lib/browser/state-QE7VSJWJ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +10 -3
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs +13 -0
- package/dist/lib/node-esm/MarkdownCard-GMNXUWWR.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-R6AAKYNG.mjs → anchor-sort-G7D5TAI6.mjs} +12 -12
- package/dist/lib/node-esm/anchor-sort-G7D5TAI6.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs +59 -0
- package/dist/lib/node-esm/app-graph-serializer-W5YMQP7P.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs +20 -0
- package/dist/lib/node-esm/blueprint-definition-HYFA7BKQ.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +9 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs +105 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YGNVDYMB.mjs → chunk-44VJC3QF.mjs} +10 -7
- package/dist/lib/node-esm/chunk-44VJC3QF.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs +703 -0
- package/dist/lib/node-esm/chunk-D4BCFPKK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs +145 -0
- package/dist/lib/node-esm/chunk-EYAFC4N7.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs +61 -0
- package/dist/lib/node-esm/chunk-KXEQCFMB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs +168 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs +102 -0
- package/dist/lib/node-esm/chunk-SDTYEGGL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs +10 -0
- package/dist/lib/node-esm/chunk-W3IIKDV5.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +33 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +127 -137
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-2HIS2AQZ.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs +214 -0
- package/dist/lib/node-esm/react-surface-PKEVHTJK.mjs.map +7 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs +36 -0
- package/dist/lib/node-esm/settings-4UGMPIRY.mjs.map +7 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs +30 -0
- package/dist/lib/node-esm/state-LXE5XIN4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +10 -3
- package/dist/types/src/MarkdownPlugin.d.ts +2 -1
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/functions/create.d.ts +8 -0
- package/dist/types/src/blueprints/functions/create.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/index.d.ts +4 -0
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/open.d.ts +7 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +6 -0
- package/dist/types/src/blueprints/functions/update.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts +2 -0
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +5 -0
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +1 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +3 -0
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +3 -0
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +5 -0
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +7 -16
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/index.d.ts +3 -0
- package/dist/types/src/capabilities/settings/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings/settings.d.ts +6 -0
- package/dist/types/src/capabilities/settings/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/index.d.ts +3 -0
- package/dist/types/src/capabilities/state/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/state/state.d.ts +5 -0
- package/dist/types/src/capabilities/state/state.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts +8 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts +4 -0
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownContainer.d.ts +21 -11
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +55 -5
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +11 -0
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +43 -23
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +8 -15
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +30 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +12 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +4 -2
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +1 -2
- package/dist/types/src/components/Suggestions.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +7 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +3 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts +9 -0
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -0
- package/dist/types/src/hooks/useExtensions.d.ts +21 -0
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts +4 -0
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -0
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts +1 -1
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/testing.d.ts +6 -0
- package/dist/types/src/testing.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +5 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +18 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -39
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +22 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +5 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +2 -2
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +6 -3
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/src/util.test.d.ts +2 -0
- package/dist/types/src/util.test.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +94 -60
- package/src/MarkdownPlugin.tsx +81 -103
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +125 -0
- package/src/blueprints/functions/create.ts +34 -0
- package/src/blueprints/functions/index.ts +7 -0
- package/src/blueprints/functions/open.ts +33 -0
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/blueprints/functions/update.test.ts +149 -0
- package/src/blueprints/functions/update.ts +38 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +36 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +59 -0
- package/src/capabilities/app-graph-serializer/index.ts +7 -0
- package/src/capabilities/artifact-definition/artifact-definition.ts +110 -0
- package/src/capabilities/artifact-definition/index.ts +7 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +25 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +7 -11
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +45 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +100 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +36 -0
- package/src/capabilities/state/index.ts +7 -0
- package/src/capabilities/state/state.ts +31 -0
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +29 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +58 -0
- package/src/components/MarkdownCard/MarkdownCard.tsx +62 -0
- package/src/components/MarkdownCard/index.ts +9 -0
- package/src/components/MarkdownContainer.stories.tsx +80 -57
- package/src/components/MarkdownContainer.tsx +104 -247
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +57 -35
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +220 -272
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +162 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +66 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +94 -77
- package/src/components/Suggestions.stories.tsx +61 -66
- package/src/components/index.ts +10 -3
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/{extensions.tsx → hooks/useExtensions.tsx} +77 -131
- package/src/hooks/useLinkQuery.ts +83 -0
- package/src/hooks/useSelectCurrentThread.tsx +38 -33
- package/src/index.ts +4 -3
- package/src/meta.ts +5 -8
- package/src/testing.ts +27 -0
- package/src/translations.ts +5 -0
- package/src/types/Markdown.ts +11 -9
- package/src/types/MarkdownAction.ts +52 -23
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +13 -0
- package/src/types/index.ts +4 -0
- package/src/types/types.ts +4 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +82 -7
- package/dist/lib/browser/MarkdownContainer-NNBPE6A5.mjs +0 -779
- package/dist/lib/browser/MarkdownContainer-NNBPE6A5.mjs.map +0 -7
- package/dist/lib/browser/MarkdownPreview-7VG3K24R.mjs +0 -80
- package/dist/lib/browser/MarkdownPreview-7VG3K24R.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-Z7JQA7RL.mjs +0 -32
- package/dist/lib/browser/anchor-sort-Z7JQA7RL.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ZT5OVF5G.mjs +0 -52
- package/dist/lib/browser/app-graph-serializer-ZT5OVF5G.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-7VNP5PCP.mjs +0 -145
- package/dist/lib/browser/artifact-definition-7VNP5PCP.mjs.map +0 -7
- package/dist/lib/browser/chunk-CD4E4K7J.mjs +0 -16
- package/dist/lib/browser/chunk-CD4E4K7J.mjs.map +0 -7
- package/dist/lib/browser/chunk-K7ZFMSC4.mjs.map +0 -7
- package/dist/lib/browser/chunk-VCUKIILA.mjs +0 -20
- package/dist/lib/browser/chunk-VCUKIILA.mjs.map +0 -7
- package/dist/lib/browser/chunk-VMX5SDGW.mjs +0 -50
- package/dist/lib/browser/chunk-VMX5SDGW.mjs.map +0 -7
- package/dist/lib/browser/chunk-YHMGUSO7.mjs +0 -80
- package/dist/lib/browser/chunk-YHMGUSO7.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZGY3DYC2.mjs +0 -30
- package/dist/lib/browser/chunk-ZGY3DYC2.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-EBEF7WEI.mjs +0 -60
- package/dist/lib/browser/intent-resolver-EBEF7WEI.mjs.map +0 -7
- package/dist/lib/browser/react-surface-ZPMZT4VU.mjs +0 -208
- package/dist/lib/browser/react-surface-ZPMZT4VU.mjs.map +0 -7
- package/dist/lib/browser/settings-MBDK4TWE.mjs +0 -28
- package/dist/lib/browser/settings-MBDK4TWE.mjs.map +0 -7
- package/dist/lib/browser/state-ZA6PZPUI.mjs +0 -37
- package/dist/lib/browser/state-ZA6PZPUI.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-Q6UO7DKT.mjs +0 -780
- package/dist/lib/node-esm/MarkdownContainer-Q6UO7DKT.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownPreview-UVWR2YK3.mjs +0 -81
- package/dist/lib/node-esm/MarkdownPreview-UVWR2YK3.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-R6AAKYNG.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-X4M5QEI6.mjs +0 -53
- package/dist/lib/node-esm/app-graph-serializer-X4M5QEI6.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-IRIILD7S.mjs +0 -146
- package/dist/lib/node-esm/artifact-definition-IRIILD7S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6GCOJS4Y.mjs +0 -81
- package/dist/lib/node-esm/chunk-6GCOJS4Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-A7LLVI34.mjs +0 -22
- package/dist/lib/node-esm/chunk-A7LLVI34.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-B3J2M4YL.mjs +0 -17
- package/dist/lib/node-esm/chunk-B3J2M4YL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LZK3TLKM.mjs +0 -51
- package/dist/lib/node-esm/chunk-LZK3TLKM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RCIXKCVG.mjs +0 -31
- package/dist/lib/node-esm/chunk-RCIXKCVG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YGNVDYMB.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-L2UGZ72W.mjs +0 -61
- package/dist/lib/node-esm/intent-resolver-L2UGZ72W.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-3JJSTTQP.mjs +0 -209
- package/dist/lib/node-esm/react-surface-3JJSTTQP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-LBDWWPZJ.mjs +0 -29
- package/dist/lib/node-esm/settings-LBDWWPZJ.mjs.map +0 -7
- package/dist/lib/node-esm/state-UIHO2SFZ.mjs +0 -38
- package/dist/lib/node-esm/state-UIHO2SFZ.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort.d.ts +0 -6
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +0 -4
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -11
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings.d.ts +0 -4
- package/dist/types/src/capabilities/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state.d.ts +0 -11
- package/dist/types/src/capabilities/state.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts +0 -6
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts +0 -10
- package/dist/types/src/components/MarkdownPreview/MarkdownPreview.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownPreview/index.d.ts +0 -4
- package/dist/types/src/components/MarkdownPreview/index.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +0 -11
- package/dist/types/src/components/Toolbar.stories.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -4
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/extensions.d.ts +0 -24
- package/dist/types/src/extensions.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -54
- package/src/capabilities/artifact-definition.ts +0 -116
- package/src/capabilities/capabilities.ts +0 -21
- package/src/capabilities/intent-resolver.ts +0 -57
- package/src/capabilities/react-surface.tsx +0 -114
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -30
- package/src/components/MarkdownPreview/MarkdownPreview.stories.tsx +0 -77
- package/src/components/MarkdownPreview/MarkdownPreview.tsx +0 -73
- package/src/components/MarkdownPreview/index.ts +0 -9
- package/src/components/Toolbar.stories.tsx +0 -112
- package/src/events.ts +0 -11
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { type Common } from '@dxos/app-framework';
|
|
9
|
+
import { invariant } from '@dxos/invariant';
|
|
10
|
+
import { type ThemedClassName } from '@dxos/react-ui';
|
|
11
|
+
import { EditorToolbar, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
12
|
+
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
13
|
+
|
|
14
|
+
import { FileUpload, type FileUploadAction } from './FileUpload';
|
|
15
|
+
|
|
16
|
+
export type MarkdownEditorToolbarProps = ThemedClassName<
|
|
17
|
+
{
|
|
18
|
+
id: string;
|
|
19
|
+
editorView?: EditorView;
|
|
20
|
+
onFileUpload?: (file: File) => Promise<Common.FileInfo | undefined>;
|
|
21
|
+
} & Pick<EditorToolbarProps, 'role' | 'state' | 'customActions' | 'onAction' | 'onViewModeChange'>
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
export const MarkdownEditorToolbar = ({
|
|
25
|
+
classNames,
|
|
26
|
+
id,
|
|
27
|
+
role,
|
|
28
|
+
state,
|
|
29
|
+
editorView,
|
|
30
|
+
customActions,
|
|
31
|
+
onAction,
|
|
32
|
+
onFileUpload,
|
|
33
|
+
onViewModeChange,
|
|
34
|
+
}: MarkdownEditorToolbarProps) => {
|
|
35
|
+
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
36
|
+
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
37
|
+
|
|
38
|
+
const handleViewModeChange = useCallback((mode: EditorViewMode) => onViewModeChange?.(mode), [onViewModeChange]);
|
|
39
|
+
|
|
40
|
+
const getView = useCallback(() => {
|
|
41
|
+
invariant(editorView);
|
|
42
|
+
return editorView;
|
|
43
|
+
}, [editorView]);
|
|
44
|
+
|
|
45
|
+
if (!editorView) {
|
|
46
|
+
return <div />;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<>
|
|
51
|
+
<EditorToolbar
|
|
52
|
+
classNames={classNames}
|
|
53
|
+
attendableId={id}
|
|
54
|
+
role={role}
|
|
55
|
+
state={state}
|
|
56
|
+
customActions={customActions}
|
|
57
|
+
getView={getView}
|
|
58
|
+
onAction={onAction}
|
|
59
|
+
onImageUpload={upload ?? undefined}
|
|
60
|
+
onViewModeChange={handleViewModeChange}
|
|
61
|
+
/>
|
|
62
|
+
|
|
63
|
+
{onFileUpload && <FileUpload ref={uploadRef} editorView={editorView} onFileUpload={onFileUpload} />}
|
|
64
|
+
</>
|
|
65
|
+
);
|
|
66
|
+
};
|
|
@@ -5,101 +5,118 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { ControlGroup, ControlItemInput, ControlPage, ControlSection } from '@dxos/react-ui-form';
|
|
9
|
+
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/ui-editor';
|
|
10
10
|
|
|
11
11
|
import { meta } from '../../meta';
|
|
12
12
|
import { type Markdown } from '../../types';
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export type MarkdownSettingsComponentProps = {
|
|
15
|
+
settings: Markdown.Settings;
|
|
16
|
+
onSettingsChange: (fn: (current: Markdown.Settings) => Markdown.Settings) => void;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSettingsComponentProps) => {
|
|
15
20
|
const { t } = useTranslation(meta.id);
|
|
16
21
|
|
|
17
22
|
// TODO(wittjosiah): Add skill test confirmation for entering vim mode.
|
|
18
23
|
return (
|
|
19
|
-
<
|
|
20
|
-
<
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
<Select.
|
|
31
|
-
|
|
32
|
-
<Select.
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
24
|
+
<ControlPage>
|
|
25
|
+
<ControlSection title={t('settings title', { ns: meta.id })}>
|
|
26
|
+
<ControlGroup>
|
|
27
|
+
<ControlItemInput title={t('default view mode label')}>
|
|
28
|
+
<Select.Root
|
|
29
|
+
value={settings.defaultViewMode}
|
|
30
|
+
onValueChange={(value) => {
|
|
31
|
+
onSettingsChange((s) => ({ ...s, defaultViewMode: value as EditorViewMode }));
|
|
32
|
+
}}
|
|
33
|
+
>
|
|
34
|
+
<Select.TriggerButton />
|
|
35
|
+
<Select.Portal>
|
|
36
|
+
<Select.Content>
|
|
37
|
+
<Select.Viewport>
|
|
38
|
+
{EditorViewModes.map((mode) => (
|
|
39
|
+
<Select.Option key={mode} value={mode}>
|
|
40
|
+
{t(`${mode} mode label`, { ns: 'react-ui-editor' })}
|
|
41
|
+
</Select.Option>
|
|
42
|
+
))}
|
|
43
|
+
</Select.Viewport>
|
|
44
|
+
<Select.Arrow />
|
|
45
|
+
</Select.Content>
|
|
46
|
+
</Select.Portal>
|
|
47
|
+
</Select.Root>
|
|
48
|
+
</ControlItemInput>
|
|
49
|
+
|
|
50
|
+
<ControlItemInput title={t('editor input mode label')}>
|
|
51
|
+
<Select.Root
|
|
52
|
+
value={settings.editorInputMode ?? 'default'}
|
|
53
|
+
onValueChange={(value) => {
|
|
54
|
+
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
55
|
+
}}
|
|
56
|
+
>
|
|
57
|
+
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
58
|
+
<Select.Portal>
|
|
59
|
+
<Select.Content>
|
|
60
|
+
<Select.Viewport>
|
|
61
|
+
{EditorInputModes.map((mode) => (
|
|
62
|
+
<Select.Option key={mode} value={mode}>
|
|
63
|
+
{t(`settings editor input mode ${mode} label`)}
|
|
64
|
+
</Select.Option>
|
|
65
|
+
))}
|
|
66
|
+
</Select.Viewport>
|
|
67
|
+
<Select.Arrow />
|
|
68
|
+
</Select.Content>
|
|
69
|
+
</Select.Portal>
|
|
70
|
+
</Select.Root>
|
|
71
|
+
</ControlItemInput>
|
|
41
72
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
50
|
-
<Select.Portal>
|
|
51
|
-
<Select.Content>
|
|
52
|
-
<Select.Viewport>
|
|
53
|
-
{EditorInputModes.map((mode) => (
|
|
54
|
-
<Select.Option key={mode} value={mode}>
|
|
55
|
-
{t(`settings editor input mode ${mode} label`)}
|
|
56
|
-
</Select.Option>
|
|
57
|
-
))}
|
|
58
|
-
</Select.Viewport>
|
|
59
|
-
</Select.Content>
|
|
60
|
-
</Select.Portal>
|
|
61
|
-
</Select.Root>
|
|
62
|
-
</DeprecatedFormInput>
|
|
73
|
+
<ControlItemInput title={t('settings toolbar label')}>
|
|
74
|
+
<Input.Switch
|
|
75
|
+
checked={settings.toolbar}
|
|
76
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, toolbar: !!checked }))}
|
|
77
|
+
/>
|
|
78
|
+
</ControlItemInput>
|
|
63
79
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
<ControlItemInput title={t('settings numbered headings label')}>
|
|
81
|
+
<Input.Switch
|
|
82
|
+
checked={settings.numberedHeadings}
|
|
83
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, numberedHeadings: !!checked }))}
|
|
84
|
+
/>
|
|
85
|
+
</ControlItemInput>
|
|
67
86
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
87
|
+
<ControlItemInput title={t('settings folding label')}>
|
|
88
|
+
<Input.Switch
|
|
89
|
+
checked={settings.folding}
|
|
90
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, folding: !!checked }))}
|
|
91
|
+
/>
|
|
92
|
+
</ControlItemInput>
|
|
74
93
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
<ControlItemInput title={t('settings experimental label')}>
|
|
95
|
+
<Input.Switch
|
|
96
|
+
checked={settings.experimental}
|
|
97
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, experimental: !!checked }))}
|
|
98
|
+
/>
|
|
99
|
+
</ControlItemInput>
|
|
78
100
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
101
|
+
<ControlItemInput title={t('settings debug label')}>
|
|
102
|
+
<Input.Switch
|
|
103
|
+
checked={settings.debug}
|
|
104
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, debug: !!checked }))}
|
|
105
|
+
/>
|
|
106
|
+
</ControlItemInput>
|
|
85
107
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
secondary={
|
|
89
|
-
settings.debug ? (
|
|
90
|
-
<Input.Root>
|
|
108
|
+
{settings.debug && (
|
|
109
|
+
<ControlItemInput title={t('settings debug textarea label', { ns: meta.id })}>
|
|
91
110
|
<Input.TextArea
|
|
92
111
|
rows={5}
|
|
93
112
|
value={settings.typewriter}
|
|
94
|
-
onChange={({ target: { value } }) => (
|
|
113
|
+
onChange={({ target: { value } }) => onSettingsChange((s) => ({ ...s, typewriter: value }))}
|
|
95
114
|
placeholder={t('settings debug placeholder')}
|
|
96
115
|
/>
|
|
97
|
-
</
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
>
|
|
101
|
-
|
|
102
|
-
</DeprecatedFormInput>
|
|
103
|
-
</DeprecatedFormContainer>
|
|
116
|
+
</ControlItemInput>
|
|
117
|
+
)}
|
|
118
|
+
</ControlGroup>
|
|
119
|
+
</ControlSection>
|
|
120
|
+
</ControlPage>
|
|
104
121
|
);
|
|
105
122
|
};
|
|
@@ -2,46 +2,37 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta } from '@storybook/react-vite';
|
|
8
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Match from 'effect/Match';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
9
11
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
10
12
|
|
|
11
|
-
import {
|
|
12
|
-
Capabilities,
|
|
13
|
-
CollaborationActions,
|
|
14
|
-
IntentPlugin,
|
|
15
|
-
SettingsPlugin,
|
|
16
|
-
contributes,
|
|
17
|
-
createIntent,
|
|
18
|
-
useCapability,
|
|
19
|
-
useIntentDispatcher,
|
|
20
|
-
} from '@dxos/app-framework';
|
|
13
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
21
14
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
22
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
|
+
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
23
17
|
import { invariant } from '@dxos/invariant';
|
|
24
|
-
import { DXN } from '@dxos/keys';
|
|
25
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
26
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
27
|
-
import {
|
|
28
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
29
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
30
21
|
import { faker } from '@dxos/random';
|
|
31
|
-
import {
|
|
22
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
32
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
24
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
25
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
26
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
27
|
+
import { render } from '@dxos/storybook-utils';
|
|
28
|
+
import { Message } from '@dxos/types';
|
|
29
|
+
import { type EditorSelection, type Range } from '@dxos/ui-editor';
|
|
38
30
|
|
|
39
|
-
import { MarkdownContainer } from './MarkdownContainer';
|
|
40
31
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
41
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
42
|
-
import { meta } from '../meta';
|
|
43
32
|
import { translations } from '../translations';
|
|
44
|
-
import { Markdown } from '../types';
|
|
33
|
+
import { Markdown, MarkdownCapabilities } from '../types';
|
|
34
|
+
|
|
35
|
+
import { MarkdownContainer } from './MarkdownContainer';
|
|
45
36
|
|
|
46
37
|
faker.seed(1);
|
|
47
38
|
|
|
@@ -55,26 +46,25 @@ const TestItem = Schema.Struct({
|
|
|
55
46
|
description: 'Product description',
|
|
56
47
|
}),
|
|
57
48
|
}).pipe(
|
|
58
|
-
Type.
|
|
49
|
+
Type.object({
|
|
59
50
|
typename: 'dxos.org/type/Test',
|
|
60
51
|
version: '0.1.0',
|
|
61
52
|
}),
|
|
62
53
|
);
|
|
63
54
|
|
|
64
55
|
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
65
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
66
56
|
const { parentRef } = useTextEditor({ initialValue: content });
|
|
67
|
-
const
|
|
57
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
68
58
|
|
|
69
59
|
const space = useSpace();
|
|
70
60
|
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
71
|
-
const queue = useQueue<
|
|
61
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
72
62
|
|
|
73
63
|
const handleInsert = async () => {
|
|
74
64
|
invariant(space);
|
|
75
65
|
invariant(queue);
|
|
76
66
|
await queue.append([
|
|
77
|
-
Obj.make(
|
|
67
|
+
Obj.make(Message.Message, {
|
|
78
68
|
created: new Date().toISOString(),
|
|
79
69
|
sender: { role: 'assistant' },
|
|
80
70
|
blocks: [{ _tag: 'text', text: 'Hello' }],
|
|
@@ -85,8 +75,8 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
85
75
|
|
|
86
76
|
const text = await doc.content.load();
|
|
87
77
|
const accessor = createDocAccessor(text, ['content']);
|
|
88
|
-
const cursor = pipe(
|
|
89
|
-
editorState.getState(
|
|
78
|
+
const cursor = Function.pipe(
|
|
79
|
+
editorState.getState(Obj.getDXN(doc).toString())?.selection,
|
|
90
80
|
Option.fromNullable,
|
|
91
81
|
Option.map(selectionToRange),
|
|
92
82
|
Option.map((range) => toCursorRange(accessor, range.from, range.to)),
|
|
@@ -98,31 +88,31 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
98
88
|
// const message = deref(ref);
|
|
99
89
|
// }
|
|
100
90
|
|
|
101
|
-
void dispatch(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
);
|
|
91
|
+
// void dispatch(
|
|
92
|
+
// createIntent(CollaborationActions.InsertContent, {
|
|
93
|
+
// target: doc as any as TestSchema.Expando,
|
|
94
|
+
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
95
|
+
// at: cursor,
|
|
96
|
+
// label: 'Proposal',
|
|
97
|
+
// }),
|
|
98
|
+
// );
|
|
109
99
|
};
|
|
110
100
|
|
|
111
101
|
return (
|
|
112
|
-
<
|
|
102
|
+
<Layout.Main toolbar>
|
|
113
103
|
<Toolbar.Root>
|
|
114
104
|
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
115
105
|
</Toolbar.Root>
|
|
116
106
|
<div ref={parentRef} className='p-4' />
|
|
117
|
-
</
|
|
107
|
+
</Layout.Main>
|
|
118
108
|
);
|
|
119
109
|
};
|
|
120
110
|
|
|
121
111
|
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
122
112
|
const space = useSpace();
|
|
123
113
|
const [doc, setDoc] = useState<Markdown.Document>();
|
|
124
|
-
const settings =
|
|
125
|
-
const
|
|
114
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
126
116
|
|
|
127
117
|
useEffect(() => {
|
|
128
118
|
if (!space) {
|
|
@@ -130,12 +120,17 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
130
120
|
}
|
|
131
121
|
|
|
132
122
|
const doc = space.db.add(
|
|
133
|
-
Markdown.
|
|
123
|
+
Markdown.make({
|
|
134
124
|
name: 'Test',
|
|
135
125
|
content: document.replaceAll(/\[(\w+)\]/g, (_, label) => {
|
|
136
|
-
const obj = space.db.add(
|
|
126
|
+
const obj = space.db.add(
|
|
127
|
+
Obj.make(TestItem, {
|
|
128
|
+
title: label,
|
|
129
|
+
description: faker.lorem.paragraph(),
|
|
130
|
+
}),
|
|
131
|
+
);
|
|
137
132
|
const dxn = Ref.make(obj).dxn.toString();
|
|
138
|
-
return `[${label}]
|
|
133
|
+
return `[${label}](${dxn})`;
|
|
139
134
|
}),
|
|
140
135
|
}),
|
|
141
136
|
);
|
|
@@ -144,45 +139,45 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
144
139
|
}, [space]);
|
|
145
140
|
|
|
146
141
|
if (!space || !doc) {
|
|
147
|
-
return
|
|
142
|
+
return null;
|
|
148
143
|
}
|
|
149
144
|
|
|
150
145
|
return (
|
|
151
|
-
|
|
152
|
-
<MarkdownContainer id={doc.id}
|
|
146
|
+
<div className='grid grid-cols-2 bs-full overflow-hidden'>
|
|
147
|
+
<MarkdownContainer id={doc.id} subject={doc} settings={settings} editorStateStore={editorState} />
|
|
153
148
|
<TestChat doc={doc} content={chat} />
|
|
154
|
-
|
|
149
|
+
</div>
|
|
155
150
|
);
|
|
156
151
|
};
|
|
157
152
|
|
|
158
|
-
// TODO(burdon): Make consistent.
|
|
159
153
|
const storybook: Meta<typeof DefaultStory> = {
|
|
160
154
|
title: 'plugins/plugin-markdown/Suggestions',
|
|
161
|
-
render: DefaultStory,
|
|
155
|
+
render: render(DefaultStory),
|
|
162
156
|
decorators: [
|
|
157
|
+
withTheme,
|
|
163
158
|
withPluginManager({
|
|
164
159
|
plugins: [
|
|
165
|
-
|
|
166
|
-
|
|
160
|
+
...corePlugins(),
|
|
161
|
+
StorybookPlugin({}),
|
|
167
162
|
ClientPlugin({
|
|
168
163
|
types: [Markdown.Document, TestItem],
|
|
169
|
-
onClientInitialized:
|
|
170
|
-
|
|
171
|
-
|
|
164
|
+
onClientInitialized: ({ client }) =>
|
|
165
|
+
Effect.gen(function* () {
|
|
166
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
+
}),
|
|
172
168
|
}),
|
|
173
|
-
|
|
174
|
-
SettingsPlugin(),
|
|
175
|
-
IntentPlugin(),
|
|
169
|
+
|
|
176
170
|
MarkdownPlugin(),
|
|
177
171
|
PreviewPlugin(),
|
|
178
172
|
],
|
|
179
|
-
capabilities: [contributes(MarkdownCapabilities.Extensions, [() => command()])],
|
|
180
173
|
}),
|
|
181
|
-
withLayout({ fullscreen: true, classNames: 'grid grid-cols-2' }),
|
|
182
174
|
],
|
|
183
175
|
parameters: {
|
|
176
|
+
layout: 'fullscreen',
|
|
177
|
+
controls: {
|
|
178
|
+
disable: true,
|
|
179
|
+
},
|
|
184
180
|
translations,
|
|
185
|
-
controls: { disable: true },
|
|
186
181
|
},
|
|
187
182
|
};
|
|
188
183
|
|
package/src/components/index.ts
CHANGED
|
@@ -2,9 +2,16 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { lazy } from 'react';
|
|
5
|
+
import { type LazyExoticComponent, lazy } from 'react';
|
|
6
6
|
|
|
7
|
+
import { type MarkdownCard as MarkdownCardType } from './MarkdownCard';
|
|
8
|
+
import { type MarkdownContainer as MarkdownContainerType } from './MarkdownContainer';
|
|
9
|
+
|
|
10
|
+
export * from './MarkdownCard';
|
|
11
|
+
export * from './MarkdownContainer';
|
|
7
12
|
export * from './MarkdownSettings';
|
|
8
13
|
|
|
9
|
-
export const
|
|
10
|
-
export const
|
|
14
|
+
export const MarkdownCard: LazyExoticComponent<typeof MarkdownCardType> = lazy(() => import('./MarkdownCard'));
|
|
15
|
+
export const MarkdownContainer: LazyExoticComponent<typeof MarkdownContainerType> = lazy(
|
|
16
|
+
() => import('./MarkdownContainer'),
|
|
17
|
+
);
|
package/src/hooks/index.ts
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type EditorView } from '@codemirror/view';
|
|
6
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
7
|
+
|
|
8
|
+
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import {
|
|
10
|
+
type EditorMenuGroup,
|
|
11
|
+
type UseEditorMenuProps,
|
|
12
|
+
filterMenuGroups,
|
|
13
|
+
formattingCommands,
|
|
14
|
+
linkSlashCommands,
|
|
15
|
+
} from '@dxos/react-ui-editor';
|
|
16
|
+
import { Domino } from '@dxos/ui';
|
|
17
|
+
|
|
18
|
+
import { meta } from '../meta';
|
|
19
|
+
|
|
20
|
+
export type UseEditorMenuOptionsProps = {
|
|
21
|
+
editorView?: EditorView;
|
|
22
|
+
slashCommandGroups?: EditorMenuGroup[];
|
|
23
|
+
onLinkQuery?: (query?: string) => Promise<EditorMenuGroup[]>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export const useEditorMenuOptions = ({
|
|
27
|
+
editorView,
|
|
28
|
+
slashCommandGroups,
|
|
29
|
+
onLinkQuery,
|
|
30
|
+
}: UseEditorMenuOptionsProps): UseEditorMenuProps => {
|
|
31
|
+
const { t } = useTranslation(meta.id);
|
|
32
|
+
|
|
33
|
+
const getMenu = useCallback<NonNullable<UseEditorMenuProps['getMenu']>>(
|
|
34
|
+
({ text, trigger }) => {
|
|
35
|
+
switch (trigger) {
|
|
36
|
+
case '@': {
|
|
37
|
+
return onLinkQuery?.(text) ?? [];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
case '/':
|
|
41
|
+
default: {
|
|
42
|
+
return filterMenuGroups([formattingCommands, linkSlashCommands, ...(slashCommandGroups ?? [])], (item) =>
|
|
43
|
+
text ? toLocalizedString(item.label, t).toLowerCase().includes(text.toLowerCase()) : true,
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
[slashCommandGroups, onLinkQuery],
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const viewRef = useRef(editorView);
|
|
52
|
+
return useMemo<UseEditorMenuProps>(() => {
|
|
53
|
+
const trigger = onLinkQuery ? ['/', '@'] : ['/'];
|
|
54
|
+
const placeholder = {
|
|
55
|
+
delay: 3_000,
|
|
56
|
+
content: () => {
|
|
57
|
+
const pressEl = Domino.of('span').text('Press');
|
|
58
|
+
const triggerEls = trigger.map((text) =>
|
|
59
|
+
Domino.of('span').classNames('mx-1 pli-1.5 pt-[1px] pb-[2px] border border-separator rounded-sm').text(text),
|
|
60
|
+
);
|
|
61
|
+
const forCommandsEl = Domino.of('span').text('for commands.');
|
|
62
|
+
return Domino.of('div').children(pressEl, ...triggerEls, forCommandsEl).root;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return { viewRef, getMenu, trigger, placeholder };
|
|
67
|
+
}, [getMenu, onLinkQuery]);
|
|
68
|
+
};
|