@dxos/plugin-markdown 0.8.4-main.1da679c → 0.8.4-main.21d9917
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/MarkdownContainer-V7EAADMF.mjs +12 -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-Z7P6JGGW.mjs → chunk-JOXYQLKH.mjs} +9 -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 +124 -145
- 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-J2BK2XLZ.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-J7A6TUB2.mjs → chunk-44VJC3QF.mjs} +9 -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 +124 -145
- 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/{functions → blueprints/functions}/open.d.ts +1 -1
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/{functions/diff.d.ts → blueprints/functions/update.d.ts} +2 -2
- 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 +6 -17
- 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 +5 -4
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts +5 -6
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- 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 +9 -6
- 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 +5 -110
- 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 +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- 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 +4 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +17 -15
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +64 -31
- 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 +89 -58
- package/src/MarkdownPlugin.tsx +79 -110
- 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/{functions → blueprints/functions}/open.ts +8 -5
- package/src/blueprints/functions/update.conversations.json +1 -0
- package/src/blueprints/functions/update.test.ts +149 -0
- package/src/{functions/diff.ts → blueprints/functions/update.ts} +8 -5
- 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 +6 -12
- 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 +28 -49
- package/src/components/MarkdownCard/MarkdownCard.tsx +42 -55
- package/src/components/MarkdownContainer.stories.tsx +70 -58
- package/src/components/MarkdownContainer.tsx +104 -249
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +55 -36
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +221 -271
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +162 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +66 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +51 -54
- 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} +72 -98
- package/src/hooks/useLinkQuery.ts +83 -0
- package/src/hooks/useSelectCurrentThread.tsx +38 -33
- package/src/index.ts +1 -2
- package/src/meta.ts +5 -5
- package/src/testing.ts +27 -0
- package/src/translations.ts +4 -0
- package/src/types/Markdown.ts +11 -10
- package/src/types/MarkdownAction.ts +49 -19
- 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 +3 -2
- package/src/util.test.ts +44 -0
- package/src/util.tsx +82 -7
- package/dist/lib/browser/MarkdownCard-JLUQITYK.mjs +0 -80
- package/dist/lib/browser/MarkdownCard-JLUQITYK.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-OZ5DHEIA.mjs +0 -750
- package/dist/lib/browser/MarkdownContainer-OZ5DHEIA.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-SUD373SW.mjs +0 -32
- package/dist/lib/browser/anchor-sort-SUD373SW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-GH7JJZB7.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-GH7JJZB7.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-JSNGFAZB.mjs +0 -11
- package/dist/lib/browser/chunk-BEE7VQPU.mjs +0 -78
- package/dist/lib/browser/chunk-BEE7VQPU.mjs.map +0 -7
- package/dist/lib/browser/chunk-LAVZ2W6X.mjs +0 -50
- package/dist/lib/browser/chunk-LAVZ2W6X.mjs.map +0 -7
- package/dist/lib/browser/chunk-ODB2PTBP.mjs +0 -28
- package/dist/lib/browser/chunk-ODB2PTBP.mjs.map +0 -7
- package/dist/lib/browser/chunk-OY6CGPOO.mjs +0 -16
- package/dist/lib/browser/chunk-OY6CGPOO.mjs.map +0 -7
- package/dist/lib/browser/chunk-SQLSKQRQ.mjs +0 -22
- package/dist/lib/browser/chunk-SQLSKQRQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-UM2GILLR.mjs +0 -102
- package/dist/lib/browser/chunk-UM2GILLR.mjs.map +0 -7
- package/dist/lib/browser/chunk-Z7P6JGGW.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-SUBIHVU7.mjs +0 -62
- package/dist/lib/browser/intent-resolver-SUBIHVU7.mjs.map +0 -7
- package/dist/lib/browser/react-surface-JBQHF4GR.mjs +0 -215
- package/dist/lib/browser/react-surface-JBQHF4GR.mjs.map +0 -7
- package/dist/lib/browser/settings-T5ZMC5TH.mjs +0 -28
- package/dist/lib/browser/settings-T5ZMC5TH.mjs.map +0 -7
- package/dist/lib/browser/state-6QODXCSZ.mjs +0 -37
- package/dist/lib/browser/state-6QODXCSZ.mjs.map +0 -7
- package/dist/lib/browser/toolkit-GNADYSGW.mjs +0 -74
- package/dist/lib/browser/toolkit-GNADYSGW.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-XL5EVSJ7.mjs +0 -81
- package/dist/lib/node-esm/MarkdownCard-XL5EVSJ7.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-Z4I23DPN.mjs +0 -751
- package/dist/lib/node-esm/MarkdownContainer-Z4I23DPN.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-J2BK2XLZ.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-LRYCXG7N.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-LRYCXG7N.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-KX3Y5JHC.mjs +0 -12
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs +0 -17
- package/dist/lib/node-esm/chunk-CB2R4YIY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FXILAQ5F.mjs +0 -79
- package/dist/lib/node-esm/chunk-FXILAQ5F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J7A6TUB2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KAXL7TWD.mjs +0 -103
- package/dist/lib/node-esm/chunk-KAXL7TWD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MJZPYYIH.mjs +0 -24
- package/dist/lib/node-esm/chunk-MJZPYYIH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O6EXWGGS.mjs +0 -51
- package/dist/lib/node-esm/chunk-O6EXWGGS.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VCG2U522.mjs +0 -29
- package/dist/lib/node-esm/chunk-VCG2U522.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YZEGYWGA.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-YZEGYWGA.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-JOXUHXQJ.mjs +0 -216
- package/dist/lib/node-esm/react-surface-JOXUHXQJ.mjs.map +0 -7
- package/dist/lib/node-esm/settings-LGG22OH4.mjs +0 -29
- package/dist/lib/node-esm/settings-LGG22OH4.mjs.map +0 -7
- package/dist/lib/node-esm/state-W3PECOJX.mjs +0 -38
- package/dist/lib/node-esm/state-W3PECOJX.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-ZCFWOGNH.mjs +0 -75
- package/dist/lib/node-esm/toolkit-ZCFWOGNH.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 -3
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-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/capabilities/toolkit.d.ts +0 -4
- package/dist/types/src/capabilities/toolkit.d.ts.map +0 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +0 -48
- 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 -22
- package/dist/types/src/extensions.d.ts.map +0 -1
- package/dist/types/src/functions/diff.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.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 -111
- package/src/capabilities/blueprint-definition.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -21
- package/src/capabilities/intent-resolver.ts +0 -57
- package/src/capabilities/react-surface.tsx +0 -115
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/capabilities/toolkit.ts +0 -47
- package/src/components/Toolbar.stories.tsx +0 -118
- package/src/events.ts +0 -11
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{blueprint-definition-JSNGFAZB.mjs.map → MarkdownCard-HFNNE4B4.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprint-definition-KX3Y5JHC.mjs.map → browser/MarkdownContainer-V7EAADMF.mjs.map} +0 -0
|
@@ -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,13 +5,18 @@
|
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { Input, Select, useTranslation } from '@dxos/react-ui';
|
|
8
|
-
import { type EditorInputMode, EditorInputModes, type EditorViewMode, EditorViewModes } from '@dxos/react-ui-editor';
|
|
9
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.
|
|
@@ -23,7 +28,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
23
28
|
<Select.Root
|
|
24
29
|
value={settings.defaultViewMode}
|
|
25
30
|
onValueChange={(value) => {
|
|
26
|
-
|
|
31
|
+
onSettingsChange((s) => ({ ...s, defaultViewMode: value as EditorViewMode }));
|
|
27
32
|
}}
|
|
28
33
|
>
|
|
29
34
|
<Select.TriggerButton />
|
|
@@ -46,7 +51,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
46
51
|
<Select.Root
|
|
47
52
|
value={settings.editorInputMode ?? 'default'}
|
|
48
53
|
onValueChange={(value) => {
|
|
49
|
-
|
|
54
|
+
onSettingsChange((s) => ({ ...s, editorInputMode: value as EditorInputMode }));
|
|
50
55
|
}}
|
|
51
56
|
>
|
|
52
57
|
<Select.TriggerButton placeholder={t('select editor input mode placeholder')} />
|
|
@@ -66,29 +71,38 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
66
71
|
</ControlItemInput>
|
|
67
72
|
|
|
68
73
|
<ControlItemInput title={t('settings toolbar label')}>
|
|
69
|
-
<Input.Switch
|
|
74
|
+
<Input.Switch
|
|
75
|
+
checked={settings.toolbar}
|
|
76
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, toolbar: !!checked }))}
|
|
77
|
+
/>
|
|
70
78
|
</ControlItemInput>
|
|
71
79
|
|
|
72
80
|
<ControlItemInput title={t('settings numbered headings label')}>
|
|
73
81
|
<Input.Switch
|
|
74
82
|
checked={settings.numberedHeadings}
|
|
75
|
-
onCheckedChange={(checked) => (
|
|
83
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, numberedHeadings: !!checked }))}
|
|
76
84
|
/>
|
|
77
85
|
</ControlItemInput>
|
|
78
86
|
|
|
79
87
|
<ControlItemInput title={t('settings folding label')}>
|
|
80
|
-
<Input.Switch
|
|
88
|
+
<Input.Switch
|
|
89
|
+
checked={settings.folding}
|
|
90
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, folding: !!checked }))}
|
|
91
|
+
/>
|
|
81
92
|
</ControlItemInput>
|
|
82
93
|
|
|
83
94
|
<ControlItemInput title={t('settings experimental label')}>
|
|
84
95
|
<Input.Switch
|
|
85
96
|
checked={settings.experimental}
|
|
86
|
-
onCheckedChange={(checked) => (
|
|
97
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, experimental: !!checked }))}
|
|
87
98
|
/>
|
|
88
99
|
</ControlItemInput>
|
|
89
100
|
|
|
90
101
|
<ControlItemInput title={t('settings debug label')}>
|
|
91
|
-
<Input.Switch
|
|
102
|
+
<Input.Switch
|
|
103
|
+
checked={settings.debug}
|
|
104
|
+
onCheckedChange={(checked) => onSettingsChange((s) => ({ ...s, debug: !!checked }))}
|
|
105
|
+
/>
|
|
92
106
|
</ControlItemInput>
|
|
93
107
|
|
|
94
108
|
{settings.debug && (
|
|
@@ -96,7 +110,7 @@ export const MarkdownSettings = ({ settings }: { settings: Markdown.Settings })
|
|
|
96
110
|
<Input.TextArea
|
|
97
111
|
rows={5}
|
|
98
112
|
value={settings.typewriter}
|
|
99
|
-
onChange={({ target: { value } }) => (
|
|
113
|
+
onChange={({ target: { value } }) => onSettingsChange((s) => ({ ...s, typewriter: value }))}
|
|
100
114
|
placeholder={t('settings debug placeholder')}
|
|
101
115
|
/>
|
|
102
116
|
</ControlItemInput>
|
|
@@ -2,42 +2,35 @@
|
|
|
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
|
-
IntentPlugin,
|
|
14
|
-
SettingsPlugin,
|
|
15
|
-
contributes,
|
|
16
|
-
useCapability,
|
|
17
|
-
useIntentDispatcher,
|
|
18
|
-
} from '@dxos/app-framework';
|
|
13
|
+
import { useAtomCapability, useCapability } from '@dxos/app-framework/react';
|
|
19
14
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
20
15
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
16
|
+
import { createDocAccessor, toCursorRange } from '@dxos/echo-db';
|
|
21
17
|
import { invariant } from '@dxos/invariant';
|
|
22
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
23
19
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
24
|
-
import {
|
|
25
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
26
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
20
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
27
21
|
import { faker } from '@dxos/random';
|
|
28
|
-
import {
|
|
22
|
+
import { useQueue, useSpace } from '@dxos/react-client/echo';
|
|
29
23
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
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';
|
|
35
30
|
|
|
36
|
-
import { MarkdownCapabilities } from '../capabilities';
|
|
37
31
|
import { MarkdownPlugin } from '../MarkdownPlugin';
|
|
38
|
-
import { meta } from '../meta';
|
|
39
32
|
import { translations } from '../translations';
|
|
40
|
-
import { Markdown } from '../types';
|
|
33
|
+
import { Markdown, MarkdownCapabilities } from '../types';
|
|
41
34
|
|
|
42
35
|
import { MarkdownContainer } from './MarkdownContainer';
|
|
43
36
|
|
|
@@ -53,26 +46,25 @@ const TestItem = Schema.Struct({
|
|
|
53
46
|
description: 'Product description',
|
|
54
47
|
}),
|
|
55
48
|
}).pipe(
|
|
56
|
-
Type.
|
|
49
|
+
Type.object({
|
|
57
50
|
typename: 'dxos.org/type/Test',
|
|
58
51
|
version: '0.1.0',
|
|
59
52
|
}),
|
|
60
53
|
);
|
|
61
54
|
|
|
62
55
|
const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, content }) => {
|
|
63
|
-
const { dispatchPromise: dispatch } = useIntentDispatcher();
|
|
64
56
|
const { parentRef } = useTextEditor({ initialValue: content });
|
|
65
|
-
const
|
|
57
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
66
58
|
|
|
67
59
|
const space = useSpace();
|
|
68
60
|
const queueDxn = useMemo(() => space && space.queues.create().dxn, [space]);
|
|
69
|
-
const queue = useQueue<
|
|
61
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
70
62
|
|
|
71
63
|
const handleInsert = async () => {
|
|
72
64
|
invariant(space);
|
|
73
65
|
invariant(queue);
|
|
74
66
|
await queue.append([
|
|
75
|
-
Obj.make(
|
|
67
|
+
Obj.make(Message.Message, {
|
|
76
68
|
created: new Date().toISOString(),
|
|
77
69
|
sender: { role: 'assistant' },
|
|
78
70
|
blocks: [{ _tag: 'text', text: 'Hello' }],
|
|
@@ -83,8 +75,8 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
83
75
|
|
|
84
76
|
const text = await doc.content.load();
|
|
85
77
|
const accessor = createDocAccessor(text, ['content']);
|
|
86
|
-
const cursor = pipe(
|
|
87
|
-
editorState.getState(
|
|
78
|
+
const cursor = Function.pipe(
|
|
79
|
+
editorState.getState(Obj.getDXN(doc).toString())?.selection,
|
|
88
80
|
Option.fromNullable,
|
|
89
81
|
Option.map(selectionToRange),
|
|
90
82
|
Option.map((range) => toCursorRange(accessor, range.from, range.to)),
|
|
@@ -98,7 +90,7 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
98
90
|
|
|
99
91
|
// void dispatch(
|
|
100
92
|
// createIntent(CollaborationActions.InsertContent, {
|
|
101
|
-
// target: doc as any as
|
|
93
|
+
// target: doc as any as TestSchema.Expando,
|
|
102
94
|
// object: Ref.fromDXN(new DXN(DXN.kind.QUEUE, [...queue.dxn.parts, message.id])),
|
|
103
95
|
// at: cursor,
|
|
104
96
|
// label: 'Proposal',
|
|
@@ -107,20 +99,20 @@ const TestChat: FC<{ doc: Markdown.Document; content: string }> = ({ doc, conten
|
|
|
107
99
|
};
|
|
108
100
|
|
|
109
101
|
return (
|
|
110
|
-
<
|
|
102
|
+
<Layout.Main toolbar>
|
|
111
103
|
<Toolbar.Root>
|
|
112
104
|
<IconButton icon='ph--plus--regular' disabled={!queue} label='Insert' onClick={handleInsert} />
|
|
113
105
|
</Toolbar.Root>
|
|
114
106
|
<div ref={parentRef} className='p-4' />
|
|
115
|
-
</
|
|
107
|
+
</Layout.Main>
|
|
116
108
|
);
|
|
117
109
|
};
|
|
118
110
|
|
|
119
111
|
const DefaultStory = ({ document, chat }: { document: string; chat: string }) => {
|
|
120
112
|
const space = useSpace();
|
|
121
113
|
const [doc, setDoc] = useState<Markdown.Document>();
|
|
122
|
-
const settings =
|
|
123
|
-
const
|
|
114
|
+
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
115
|
+
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
124
116
|
|
|
125
117
|
useEffect(() => {
|
|
126
118
|
if (!space) {
|
|
@@ -128,10 +120,15 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
128
120
|
}
|
|
129
121
|
|
|
130
122
|
const doc = space.db.add(
|
|
131
|
-
Markdown.
|
|
123
|
+
Markdown.make({
|
|
132
124
|
name: 'Test',
|
|
133
125
|
content: document.replaceAll(/\[(\w+)\]/g, (_, label) => {
|
|
134
|
-
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
|
+
);
|
|
135
132
|
const dxn = Ref.make(obj).dxn.toString();
|
|
136
133
|
return `[${label}](${dxn})`;
|
|
137
134
|
}),
|
|
@@ -142,45 +139,45 @@ const DefaultStory = ({ document, chat }: { document: string; chat: string }) =>
|
|
|
142
139
|
}, [space]);
|
|
143
140
|
|
|
144
141
|
if (!space || !doc) {
|
|
145
|
-
return
|
|
142
|
+
return null;
|
|
146
143
|
}
|
|
147
144
|
|
|
148
145
|
return (
|
|
149
|
-
|
|
150
|
-
<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} />
|
|
151
148
|
<TestChat doc={doc} content={chat} />
|
|
152
|
-
|
|
149
|
+
</div>
|
|
153
150
|
);
|
|
154
151
|
};
|
|
155
152
|
|
|
156
|
-
// TODO(burdon): Make consistent.
|
|
157
153
|
const storybook: Meta<typeof DefaultStory> = {
|
|
158
154
|
title: 'plugins/plugin-markdown/Suggestions',
|
|
159
|
-
render: DefaultStory,
|
|
155
|
+
render: render(DefaultStory),
|
|
160
156
|
decorators: [
|
|
157
|
+
withTheme,
|
|
161
158
|
withPluginManager({
|
|
162
159
|
plugins: [
|
|
163
|
-
|
|
164
|
-
|
|
160
|
+
...corePlugins(),
|
|
161
|
+
StorybookPlugin({}),
|
|
165
162
|
ClientPlugin({
|
|
166
163
|
types: [Markdown.Document, TestItem],
|
|
167
|
-
onClientInitialized:
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
onClientInitialized: ({ client }) =>
|
|
165
|
+
Effect.gen(function* () {
|
|
166
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
167
|
+
}),
|
|
170
168
|
}),
|
|
171
|
-
|
|
172
|
-
SettingsPlugin(),
|
|
173
|
-
IntentPlugin(),
|
|
169
|
+
|
|
174
170
|
MarkdownPlugin(),
|
|
175
171
|
PreviewPlugin(),
|
|
176
172
|
],
|
|
177
|
-
capabilities: [contributes(MarkdownCapabilities.Extensions, [() => command()])],
|
|
178
173
|
}),
|
|
179
|
-
withLayout({ fullscreen: true, classNames: 'grid grid-cols-2' }),
|
|
180
174
|
],
|
|
181
175
|
parameters: {
|
|
176
|
+
layout: 'fullscreen',
|
|
177
|
+
controls: {
|
|
178
|
+
disable: true,
|
|
179
|
+
},
|
|
182
180
|
translations,
|
|
183
|
-
controls: { disable: true },
|
|
184
181
|
},
|
|
185
182
|
};
|
|
186
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
|
+
};
|