@dxos/plugin-markdown 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-WHK3ORP7.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/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-A3CQYGCN.mjs → chunk-JOXYQLKH.mjs} +5 -6
- 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-WIPSLZ6L.mjs +60 -0
- package/dist/lib/browser/chunk-WIPSLZ6L.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 +122 -144
- 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-SRPLD3ED.mjs +213 -0
- package/dist/lib/browser/react-surface-SRPLD3ED.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-MCWEFW4F.mjs → MarkdownCard-WJPLQTFS.mjs} +5 -5
- package/dist/lib/node-esm/MarkdownContainer-LUSMORP2.mjs +13 -0
- package/dist/lib/node-esm/{anchor-sort-4SXYVYXT.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/chunk-3JYPCC7M.mjs +105 -0
- package/dist/lib/node-esm/chunk-3JYPCC7M.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SJ2QRGPM.mjs → chunk-44VJC3QF.mjs} +5 -6
- 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-PRV35A7Z.mjs +168 -0
- package/dist/lib/node-esm/chunk-PRV35A7Z.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-RQP7G7XW.mjs +61 -0
- package/dist/lib/node-esm/chunk-RQP7G7XW.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 +122 -144
- 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-RONSOJIQ.mjs +214 -0
- package/dist/lib/node-esm/react-surface-RONSOJIQ.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 -5
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts +19 -5
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +1 -0
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +10 -9
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +16 -12
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +4 -4
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/types/src/components/index.d.ts +5 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +1 -1
- 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 +5 -5
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts +3 -3
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +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 +1 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +16 -16
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +63 -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 +86 -58
- package/src/MarkdownPlugin.tsx +61 -92
- 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 +4 -3
- 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} +6 -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 +25 -43
- package/src/components/MarkdownCard/MarkdownCard.tsx +29 -50
- package/src/components/MarkdownContainer.stories.tsx +52 -66
- package/src/components/MarkdownContainer.tsx +97 -107
- package/src/components/MarkdownEditor/FileUpload.tsx +3 -3
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +19 -21
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +28 -29
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +50 -22
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +9 -6
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +24 -10
- package/src/components/Suggestions.stories.tsx +34 -38
- package/src/components/index.ts +8 -3
- package/src/hooks/index.ts +1 -1
- package/src/hooks/{usePopoverMenuOptions.ts → useEditorMenuOptions.ts} +19 -22
- package/src/hooks/useExtensions.tsx +34 -30
- package/src/hooks/useLinkQuery.ts +22 -21
- package/src/hooks/useSelectCurrentThread.tsx +37 -32
- package/src/index.ts +1 -2
- package/src/meta.ts +2 -2
- package/src/testing.ts +27 -0
- package/src/translations.ts +1 -0
- package/src/types/Markdown.ts +8 -9
- package/src/types/MarkdownAction.ts +48 -18
- 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 +79 -11
- package/dist/lib/browser/MarkdownCard-SLM6QZYC.mjs +0 -12
- package/dist/lib/browser/MarkdownContainer-UZFQC6XY.mjs +0 -15
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs +0 -32
- package/dist/lib/browser/anchor-sort-4XPPLMZS.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs +0 -51
- package/dist/lib/browser/app-graph-serializer-QQFV4K6P.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-BC5R3T72.mjs +0 -11
- package/dist/lib/browser/chunk-2LLVTQCK.mjs +0 -51
- package/dist/lib/browser/chunk-2LLVTQCK.mjs.map +0 -7
- package/dist/lib/browser/chunk-3VILQLA4.mjs +0 -95
- package/dist/lib/browser/chunk-3VILQLA4.mjs.map +0 -7
- package/dist/lib/browser/chunk-5AYTOIUF.mjs +0 -822
- package/dist/lib/browser/chunk-5AYTOIUF.mjs.map +0 -7
- package/dist/lib/browser/chunk-A3CQYGCN.mjs.map +0 -7
- package/dist/lib/browser/chunk-BQTYJOFB.mjs +0 -28
- package/dist/lib/browser/chunk-BQTYJOFB.mjs.map +0 -7
- package/dist/lib/browser/chunk-GLEYXJX3.mjs +0 -22
- package/dist/lib/browser/chunk-GLEYXJX3.mjs.map +0 -7
- package/dist/lib/browser/chunk-IBCHVMZW.mjs +0 -16
- package/dist/lib/browser/chunk-IBCHVMZW.mjs.map +0 -7
- package/dist/lib/browser/chunk-JAETS5LE.mjs +0 -106
- package/dist/lib/browser/chunk-JAETS5LE.mjs.map +0 -7
- package/dist/lib/browser/chunk-UKTCPHLI.mjs +0 -79
- package/dist/lib/browser/chunk-UKTCPHLI.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs +0 -62
- package/dist/lib/browser/intent-resolver-VQGMBNXZ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs +0 -217
- package/dist/lib/browser/react-surface-WOMJOPJE.mjs.map +0 -7
- package/dist/lib/browser/settings-LBXJHVBU.mjs +0 -28
- package/dist/lib/browser/settings-LBXJHVBU.mjs.map +0 -7
- package/dist/lib/browser/state-BTUKVZHY.mjs +0 -37
- package/dist/lib/browser/state-BTUKVZHY.mjs.map +0 -7
- package/dist/lib/browser/toolkit-YPIVDB4A.mjs +0 -66
- package/dist/lib/browser/toolkit-YPIVDB4A.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-KAQOK7K5.mjs +0 -16
- package/dist/lib/node-esm/anchor-sort-4SXYVYXT.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs +0 -52
- package/dist/lib/node-esm/app-graph-serializer-KBVRLQN2.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-FPNOTEYC.mjs +0 -12
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs +0 -823
- package/dist/lib/node-esm/chunk-2Q4WCKWT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs +0 -107
- package/dist/lib/node-esm/chunk-DOB2MJAX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GGKPPGWA.mjs +0 -24
- package/dist/lib/node-esm/chunk-GGKPPGWA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs +0 -17
- package/dist/lib/node-esm/chunk-GMMVSXQ6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JELROKGD.mjs +0 -80
- package/dist/lib/node-esm/chunk-JELROKGD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QH4MC5BE.mjs +0 -52
- package/dist/lib/node-esm/chunk-QH4MC5BE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs +0 -29
- package/dist/lib/node-esm/chunk-SHAMSMKQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SJ2QRGPM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs +0 -96
- package/dist/lib/node-esm/chunk-YYSASY7X.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs +0 -63
- package/dist/lib/node-esm/intent-resolver-Q4XVI5EX.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs +0 -218
- package/dist/lib/node-esm/react-surface-FAMZTAXK.mjs.map +0 -7
- package/dist/lib/node-esm/settings-2YRA67H6.mjs +0 -29
- package/dist/lib/node-esm/settings-2YRA67H6.mjs.map +0 -7
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs +0 -38
- package/dist/lib/node-esm/state-K6EH7SRZ.mjs.map +0 -7
- package/dist/lib/node-esm/toolkit-36BFLIR3.mjs +0 -67
- package/dist/lib/node-esm/toolkit-36BFLIR3.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 -20
- package/dist/types/src/capabilities/toolkit.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/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/dist/types/src/hooks/usePopoverMenuOptions.d.ts +0 -9
- package/dist/types/src/hooks/usePopoverMenuOptions.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 -112
- package/src/capabilities/blueprint-definition.ts +0 -39
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -58
- package/src/capabilities/react-surface.tsx +0 -93
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/capabilities/toolkit.ts +0 -53
- package/src/events.ts +0 -11
- package/src/functions/index.ts +0 -6
- /package/dist/lib/browser/{MarkdownCard-SLM6QZYC.mjs.map → MarkdownCard-WHK3ORP7.mjs.map} +0 -0
- /package/dist/lib/browser/{MarkdownContainer-UZFQC6XY.mjs.map → MarkdownContainer-V7EAADMF.mjs.map} +0 -0
- /package/dist/lib/browser/{blueprint-definition-BC5R3T72.mjs.map → blueprints/index.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownCard-MCWEFW4F.mjs.map → MarkdownCard-WJPLQTFS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{MarkdownContainer-KAQOK7K5.mjs.map → MarkdownContainer-LUSMORP2.mjs.map} +0 -0
- /package/dist/lib/node-esm/{blueprint-definition-FPNOTEYC.mjs.map → blueprints/index.mjs.map} +0 -0
|
@@ -3,119 +3,109 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Extension } from '@codemirror/state';
|
|
6
|
-
import {
|
|
7
|
-
import React, { useMemo } from 'react';
|
|
6
|
+
import { Atom } from '@effect-atom/atom-react';
|
|
7
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { Common } from '@dxos/app-framework';
|
|
10
|
+
import { type SurfaceComponentProps, useAppGraph, useCapabilities } from '@dxos/app-framework/react';
|
|
10
11
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
12
|
+
import { useActionRunner } from '@dxos/plugin-graph';
|
|
13
|
+
import { useObject } from '@dxos/react-client/echo';
|
|
12
14
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
16
|
+
import { Text } from '@dxos/schema';
|
|
15
17
|
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { Markdown, type MarkdownPluginState } from '../types';
|
|
18
|
+
import { useLinkQuery } from '../hooks';
|
|
19
|
+
import { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '../types';
|
|
19
20
|
|
|
20
21
|
import { MarkdownEditor, type MarkdownEditorContentProps, type MarkdownEditorRootProps } from './MarkdownEditor';
|
|
21
22
|
|
|
22
|
-
export type MarkdownContainerProps =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
Pick<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<MarkdownEditor.Toolbar id={attendableId ?? id} role={role} customActions={customActions} />
|
|
110
|
-
)}
|
|
111
|
-
<MarkdownEditor.Content
|
|
112
|
-
initialValue={isDocument ? object.content?.target?.content : isText ? object.content : object.text}
|
|
113
|
-
scrollPastEnd={role === 'article'}
|
|
114
|
-
/>
|
|
115
|
-
<MarkdownEditor.Blocks />
|
|
116
|
-
</MarkdownEditor.Root>
|
|
117
|
-
</StackItem.Content>
|
|
118
|
-
);
|
|
119
|
-
};
|
|
23
|
+
export type MarkdownContainerProps = SurfaceComponentProps<
|
|
24
|
+
Markdown.Document | Text.Text,
|
|
25
|
+
{
|
|
26
|
+
id: string;
|
|
27
|
+
settings: Markdown.Settings;
|
|
28
|
+
selectionManager?: SelectionManager;
|
|
29
|
+
} & Pick<MarkdownEditorRootProps, 'viewMode' | 'onViewModeChange'> &
|
|
30
|
+
Pick<MarkdownEditorContentProps, 'editorStateStore'> &
|
|
31
|
+
Pick<MarkdownPluginState, 'extensionProviders'>
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerProps>(
|
|
35
|
+
({ role, subject: object, id, settings, extensionProviders, ...props }, forwardedRef) => {
|
|
36
|
+
const db = Obj.isObject(object) ? Obj.getDatabase(object) : undefined;
|
|
37
|
+
const attendableId = Obj.instanceOf(Markdown.Document, object) ? Obj.getDXN(object).toString() : undefined;
|
|
38
|
+
const [docContent] = useObject(Obj.instanceOf(Markdown.Document, object) ? object.content : undefined, 'content');
|
|
39
|
+
const [textContent] = useObject(Obj.instanceOf(Text.Text, object) ? object : undefined, 'content');
|
|
40
|
+
const initialValue = docContent ?? textContent;
|
|
41
|
+
|
|
42
|
+
// Extensions from other plugins.
|
|
43
|
+
// TODO(burdon): Document MarkdownPluginState.extensionProviders
|
|
44
|
+
const otherExtensionProviders = useCapabilities(MarkdownCapabilities.Extensions);
|
|
45
|
+
const extensions = useMemo<Extension[]>(() => {
|
|
46
|
+
if (!Obj.instanceOf(Markdown.Document, object) && !Obj.instanceOf(Text.Text, object)) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]
|
|
51
|
+
.flat()
|
|
52
|
+
.reduce((acc: Extension[], provider) => {
|
|
53
|
+
const extension =
|
|
54
|
+
typeof provider === 'function' ? provider({ document: object as Markdown.Document }) : provider;
|
|
55
|
+
if (extension) {
|
|
56
|
+
acc.push(extension);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return acc;
|
|
60
|
+
}, []);
|
|
61
|
+
}, [extensionProviders, otherExtensionProviders, object]);
|
|
62
|
+
|
|
63
|
+
// Toolbar actions from app graph.
|
|
64
|
+
const { graph } = useAppGraph();
|
|
65
|
+
const runAction = useActionRunner();
|
|
66
|
+
const customActions = useMemo(() => {
|
|
67
|
+
return Atom.make((get) => {
|
|
68
|
+
const actions = get(graph.actions(id));
|
|
69
|
+
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
70
|
+
const edges = nodes.map((node) => ({ source: 'root', target: node.id }));
|
|
71
|
+
return { nodes, edges };
|
|
72
|
+
});
|
|
73
|
+
}, [graph]);
|
|
74
|
+
|
|
75
|
+
// File upload.
|
|
76
|
+
const [upload] = useCapabilities(Common.Capability.FileUploader);
|
|
77
|
+
const handleFileUpload = useMemo(() => {
|
|
78
|
+
if (!db || !upload) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return async (file: File) => upload(db, file);
|
|
83
|
+
}, [db, upload]);
|
|
84
|
+
|
|
85
|
+
// Query for @ refs.
|
|
86
|
+
const handleLinkQuery = useLinkQuery(db);
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<Layout.Main toolbar={settings.toolbar} ref={forwardedRef}>
|
|
90
|
+
<MarkdownEditor.Root
|
|
91
|
+
id={attendableId ?? id}
|
|
92
|
+
object={object}
|
|
93
|
+
extensions={extensions}
|
|
94
|
+
settings={settings}
|
|
95
|
+
onAction={runAction}
|
|
96
|
+
onFileUpload={handleFileUpload}
|
|
97
|
+
onLinkQuery={handleLinkQuery}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
{settings.toolbar && (
|
|
101
|
+
<MarkdownEditor.Toolbar id={attendableId ?? id} role={role} customActions={customActions} />
|
|
102
|
+
)}
|
|
103
|
+
<MarkdownEditor.Content initialValue={initialValue} scrollPastEnd={role === 'article'} />
|
|
104
|
+
<MarkdownEditor.Blocks />
|
|
105
|
+
</MarkdownEditor.Root>
|
|
106
|
+
</Layout.Main>
|
|
107
|
+
);
|
|
108
|
+
},
|
|
109
|
+
);
|
|
120
110
|
|
|
121
111
|
export default MarkdownContainer;
|
|
@@ -7,8 +7,8 @@ import React, { forwardRef, useEffect, useImperativeHandle } from 'react';
|
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
8
|
import { useDropzone } from 'react-dropzone';
|
|
9
9
|
|
|
10
|
-
import { type
|
|
11
|
-
import { addLink } from '@dxos/
|
|
10
|
+
import { type Common } from '@dxos/app-framework';
|
|
11
|
+
import { addLink } from '@dxos/ui-editor';
|
|
12
12
|
|
|
13
13
|
export const IMAGE_FILES = ['.jpg', '.jpeg', '.png', '.gif'];
|
|
14
14
|
|
|
@@ -16,7 +16,7 @@ export type FileUploadAction = () => void;
|
|
|
16
16
|
|
|
17
17
|
export type FileUploadProps = {
|
|
18
18
|
editorView?: EditorView;
|
|
19
|
-
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
19
|
+
onFileUpload?: (file: File) => Promise<Common.FileInfo | undefined>;
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// TODO(burdon): Factor out.
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React from 'react';
|
|
7
8
|
|
|
8
|
-
import { IntentPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { Filter } from '@dxos/echo';
|
|
11
|
-
import { AttentionPlugin } from '@dxos/plugin-attention';
|
|
10
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
12
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
-
import {
|
|
12
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
13
|
+
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
14
14
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
15
15
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
16
16
|
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
17
|
-
import {
|
|
17
|
+
import { Layout } from '@dxos/react-ui-mosaic';
|
|
18
18
|
|
|
19
19
|
import { translations } from '../../translations';
|
|
20
20
|
import { Markdown } from '../../types';
|
|
@@ -28,22 +28,20 @@ type StoryProps = Omit<MarkdownEditorRootProps, 'id' | 'extensions'>;
|
|
|
28
28
|
const DefaultStory = (props: StoryProps) => {
|
|
29
29
|
const space = useSpace();
|
|
30
30
|
const [doc] = useQuery(space?.db, Filter.type(Markdown.Document));
|
|
31
|
-
const id = doc &&
|
|
31
|
+
const id = doc && Obj.getDXN(doc).toString();
|
|
32
32
|
const attentionAttrs = useAttentionAttributes(id);
|
|
33
|
-
|
|
34
33
|
if (!id) {
|
|
35
34
|
return null;
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
// TODO(burdon): Toolbar attention isn't working in this story.
|
|
39
37
|
return (
|
|
40
38
|
<div className='contents' {...attentionAttrs}>
|
|
41
|
-
<
|
|
39
|
+
<Layout.Main toolbar>
|
|
42
40
|
<MarkdownEditor.Root id={id} object={doc} {...props}>
|
|
43
41
|
<MarkdownEditor.Toolbar id={id} />
|
|
44
42
|
<MarkdownEditor.Content />
|
|
45
43
|
</MarkdownEditor.Root>
|
|
46
|
-
</
|
|
44
|
+
</Layout.Main>
|
|
47
45
|
</div>
|
|
48
46
|
);
|
|
49
47
|
};
|
|
@@ -54,22 +52,22 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
54
52
|
render: DefaultStory as any,
|
|
55
53
|
decorators: [
|
|
56
54
|
withTheme,
|
|
57
|
-
withLayout({
|
|
58
|
-
// TODO(burdon): Create story without client.
|
|
55
|
+
withLayout({ layout: 'column' }),
|
|
59
56
|
withPluginManager({
|
|
60
57
|
plugins: [
|
|
58
|
+
...corePlugins(),
|
|
61
59
|
ClientPlugin({
|
|
62
60
|
types: [Markdown.Document],
|
|
63
|
-
onClientInitialized:
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
onClientInitialized: ({ client }) =>
|
|
62
|
+
Effect.gen(function* () {
|
|
63
|
+
yield* Effect.promise(() => client.halo.createIdentity());
|
|
64
|
+
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
65
|
+
const space = client.spaces.default;
|
|
66
|
+
yield* Effect.promise(() => space.waitUntilReady());
|
|
67
|
+
|
|
68
|
+
space.db.add(Markdown.make({ content }));
|
|
69
|
+
}),
|
|
70
70
|
}),
|
|
71
|
-
IntentPlugin(),
|
|
72
|
-
AttentionPlugin(),
|
|
73
71
|
],
|
|
74
72
|
}),
|
|
75
73
|
],
|
|
@@ -4,31 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Extension } from '@codemirror/state';
|
|
6
6
|
import { type EditorView } from '@codemirror/view';
|
|
7
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
7
8
|
import { createContext } from '@radix-ui/react-context';
|
|
8
9
|
import React, { type PropsWithChildren, useMemo, useState } from 'react';
|
|
9
10
|
import { createPortal } from 'react-dom';
|
|
10
11
|
|
|
11
|
-
import { Surface } from '@dxos/app-framework';
|
|
12
|
+
import { Surface } from '@dxos/app-framework/react';
|
|
12
13
|
import { DXN } from '@dxos/keys';
|
|
13
|
-
import { type Live } from '@dxos/live-object';
|
|
14
14
|
import { useClient } from '@dxos/react-client';
|
|
15
15
|
import {
|
|
16
|
+
EditorMenuProvider,
|
|
16
17
|
type EditorToolbarState,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type UsePopoverMenu,
|
|
21
|
-
useEditorToolbarState,
|
|
22
|
-
usePopoverMenu,
|
|
18
|
+
type UseEditorMenu,
|
|
19
|
+
useEditorMenu,
|
|
20
|
+
useEditorToolbar,
|
|
23
21
|
} from '@dxos/react-ui-editor';
|
|
22
|
+
import { type PreviewBlock, type PreviewOptions } from '@dxos/ui-editor';
|
|
24
23
|
import { isNonNullable } from '@dxos/util';
|
|
25
24
|
|
|
26
25
|
import {
|
|
27
26
|
type DocumentType,
|
|
28
27
|
type ExtensionsOptions,
|
|
29
|
-
type
|
|
28
|
+
type UseEditorMenuOptionsProps,
|
|
29
|
+
useEditorMenuOptions,
|
|
30
30
|
useExtensions,
|
|
31
|
-
usePopoverMenuOptions,
|
|
32
31
|
} from '../../hooks';
|
|
33
32
|
|
|
34
33
|
import {
|
|
@@ -49,10 +48,10 @@ type MarkdownEditorContextValue = {
|
|
|
49
48
|
setEditorView: (view: EditorView) => void;
|
|
50
49
|
extensions: Extension[];
|
|
51
50
|
previewBlocks: PreviewBlock[];
|
|
52
|
-
toolbarState:
|
|
53
|
-
popoverMenu: Omit<
|
|
51
|
+
toolbarState: Atom.Writable<EditorToolbarState>;
|
|
52
|
+
popoverMenu: Omit<UseEditorMenu, 'extension'>;
|
|
54
53
|
} & (Pick<ExtensionsOptions, 'viewMode'> &
|
|
55
|
-
Pick<NaturalMarkdownToolbarProps, 'editorView' | 'onFileUpload' | 'onViewModeChange'>);
|
|
54
|
+
Pick<NaturalMarkdownToolbarProps, 'editorView' | 'onAction' | 'onFileUpload' | 'onViewModeChange'>);
|
|
56
55
|
|
|
57
56
|
const [MarkdownEditorContextProvider, useMarkdownEditorContext] =
|
|
58
57
|
createContext<MarkdownEditorContextValue>('MarkdownEditor.Context');
|
|
@@ -65,8 +64,8 @@ type MarkdownEditorRootProps = PropsWithChildren<
|
|
|
65
64
|
{
|
|
66
65
|
object?: DocumentType;
|
|
67
66
|
extensions?: Extension[];
|
|
68
|
-
} & Pick<MarkdownEditorContextValue, 'id' | 'onFileUpload' | 'onViewModeChange' | 'viewMode'> &
|
|
69
|
-
Pick<
|
|
67
|
+
} & Pick<MarkdownEditorContextValue, 'id' | 'onAction' | 'onFileUpload' | 'onViewModeChange' | 'viewMode'> &
|
|
68
|
+
Pick<UseEditorMenuOptionsProps, 'slashCommandGroups' | 'onLinkQuery'> &
|
|
70
69
|
Pick<ExtensionsOptions, 'editorStateStore' | 'selectionManager' | 'settings'>
|
|
71
70
|
>;
|
|
72
71
|
|
|
@@ -78,7 +77,7 @@ const MarkdownEditorRoot = ({
|
|
|
78
77
|
selectionManager,
|
|
79
78
|
settings,
|
|
80
79
|
viewMode,
|
|
81
|
-
extensions:
|
|
80
|
+
extensions: extensionsProp,
|
|
82
81
|
slashCommandGroups,
|
|
83
82
|
onLinkQuery,
|
|
84
83
|
...props
|
|
@@ -100,15 +99,15 @@ const MarkdownEditorRoot = ({
|
|
|
100
99
|
);
|
|
101
100
|
|
|
102
101
|
// Toolbar state.
|
|
103
|
-
const toolbarState =
|
|
102
|
+
const toolbarState = useEditorToolbar({ viewMode });
|
|
104
103
|
|
|
105
104
|
// Context menu.
|
|
106
|
-
const menuOptions =
|
|
105
|
+
const menuOptions = useEditorMenuOptions({
|
|
107
106
|
editorView,
|
|
108
107
|
slashCommandGroups,
|
|
109
108
|
onLinkQuery,
|
|
110
109
|
});
|
|
111
|
-
const { extension: menuExtension, ...menuProps } =
|
|
110
|
+
const { extension: menuExtension, ...menuProps } = useEditorMenu(menuOptions);
|
|
112
111
|
|
|
113
112
|
// Extensions.
|
|
114
113
|
const coreExtensions = useExtensions({
|
|
@@ -122,8 +121,8 @@ const MarkdownEditorRoot = ({
|
|
|
122
121
|
});
|
|
123
122
|
|
|
124
123
|
const extensions = useMemo(
|
|
125
|
-
() => [coreExtensions, menuExtension,
|
|
126
|
-
[coreExtensions, menuExtension,
|
|
124
|
+
() => [coreExtensions, menuExtension, extensionsProp].filter(isNonNullable),
|
|
125
|
+
[coreExtensions, menuExtension, extensionsProp],
|
|
127
126
|
);
|
|
128
127
|
|
|
129
128
|
return (
|
|
@@ -154,25 +153,25 @@ type MarkdownEditorContentProps = Omit<NaturalMarkdownEditorContentProps, 'id' |
|
|
|
154
153
|
const MarkdownEditorContent = (props: MarkdownEditorContentProps) => {
|
|
155
154
|
const {
|
|
156
155
|
id,
|
|
157
|
-
extensions,
|
|
158
156
|
editorView,
|
|
159
157
|
setEditorView,
|
|
160
|
-
toolbarState,
|
|
161
158
|
viewMode,
|
|
159
|
+
toolbarState,
|
|
160
|
+
extensions,
|
|
162
161
|
popoverMenu: { groupsRef, ...menuProps },
|
|
163
162
|
} = useMarkdownEditorContext(MarkdownEditorContent.displayName);
|
|
164
163
|
|
|
165
164
|
return (
|
|
166
|
-
<
|
|
165
|
+
<EditorMenuProvider view={editorView} groups={groupsRef.current} {...menuProps}>
|
|
167
166
|
<NaturalMarkdownEditorContent
|
|
168
167
|
{...props}
|
|
169
168
|
id={id}
|
|
170
|
-
extensions={extensions}
|
|
171
|
-
toolbarState={toolbarState}
|
|
172
169
|
viewMode={viewMode}
|
|
170
|
+
toolbarState={toolbarState}
|
|
171
|
+
extensions={extensions}
|
|
173
172
|
ref={setEditorView}
|
|
174
173
|
/>
|
|
175
|
-
</
|
|
174
|
+
</EditorMenuProvider>
|
|
176
175
|
);
|
|
177
176
|
};
|
|
178
177
|
|
|
@@ -184,7 +183,7 @@ MarkdownEditorContent.displayName = 'MarkdownEditor.Content';
|
|
|
184
183
|
|
|
185
184
|
type MarkdownEditorToolbarProps = Omit<
|
|
186
185
|
NaturalMarkdownToolbarProps,
|
|
187
|
-
'state' | 'editorView' | 'onFileUpload' | 'onViewModeChange'
|
|
186
|
+
'state' | 'editorView' | 'onAction' | 'onFileUpload' | 'onViewModeChange'
|
|
188
187
|
>;
|
|
189
188
|
|
|
190
189
|
const MarkdownEditorToolbar = (props: MarkdownEditorToolbarProps) => {
|
|
@@ -218,7 +217,7 @@ MarkdownEditorBlocks.displayName = 'MarkdownEditor.Blocks';
|
|
|
218
217
|
const PreviewBlock = ({ el, link }: PreviewBlock) => {
|
|
219
218
|
const client = useClient();
|
|
220
219
|
const dxn = DXN.parse(link.ref);
|
|
221
|
-
const subject = client.graph.
|
|
220
|
+
const subject = client.graph.makeRef(dxn).target;
|
|
222
221
|
const data = useMemo(() => ({ subject }), [subject]);
|
|
223
222
|
|
|
224
223
|
return createPortal(<Surface role='card--transclusion' data={data} limit={1} />, el);
|
|
@@ -3,28 +3,31 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
|
-
import
|
|
6
|
+
import { type Atom, RegistryContext } from '@effect-atom/atom-react';
|
|
7
|
+
import React, { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo } from 'react';
|
|
7
8
|
|
|
8
|
-
import { type
|
|
9
|
-
import {
|
|
9
|
+
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
10
|
+
import {
|
|
11
|
+
type EditorMenuGroup,
|
|
12
|
+
type EditorToolbarState,
|
|
13
|
+
type UseTextEditorProps,
|
|
14
|
+
useTextEditor,
|
|
15
|
+
} from '@dxos/react-ui-editor';
|
|
10
16
|
import {
|
|
11
17
|
type EditorSelectionState,
|
|
12
18
|
type EditorStateStore,
|
|
13
|
-
type EditorToolbarState,
|
|
14
19
|
type EditorViewMode,
|
|
15
|
-
type
|
|
16
|
-
type UseTextEditorProps,
|
|
20
|
+
type ThemeExtensionsOptions,
|
|
17
21
|
createBasicExtensions,
|
|
18
22
|
createMarkdownExtensions,
|
|
19
23
|
createThemeExtensions,
|
|
20
24
|
dropFile,
|
|
21
|
-
editorGutter,
|
|
22
25
|
editorSlots,
|
|
23
26
|
formattingListener,
|
|
24
27
|
processEditorPayload,
|
|
25
28
|
stackItemContentEditorClassNames,
|
|
26
|
-
|
|
27
|
-
} from '@dxos/
|
|
29
|
+
} from '@dxos/ui-editor';
|
|
30
|
+
import { mx } from '@dxos/ui-theme';
|
|
28
31
|
import { isTruthy } from '@dxos/util';
|
|
29
32
|
|
|
30
33
|
import { useSelectCurrentThread } from '../../hooks';
|
|
@@ -32,27 +35,51 @@ import { meta } from '../../meta';
|
|
|
32
35
|
|
|
33
36
|
import { type MarkdownEditorToolbarProps } from './MarkdownEditorToolbar';
|
|
34
37
|
|
|
35
|
-
export type MarkdownEditorContentProps = {
|
|
38
|
+
export type MarkdownEditorContentProps = ThemedClassName<{
|
|
36
39
|
id: string;
|
|
37
40
|
role?: string;
|
|
38
41
|
viewMode?: EditorViewMode;
|
|
39
42
|
scrollPastEnd?: boolean;
|
|
40
|
-
slashCommandGroups?:
|
|
43
|
+
slashCommandGroups?: EditorMenuGroup[];
|
|
41
44
|
editorStateStore?: EditorStateStore;
|
|
42
|
-
toolbarState?:
|
|
43
|
-
onLinkQuery?: (query?: string) => Promise<
|
|
44
|
-
}
|
|
45
|
+
toolbarState?: Atom.Writable<EditorToolbarState>;
|
|
46
|
+
onLinkQuery?: (query?: string) => Promise<EditorMenuGroup[]>;
|
|
47
|
+
}> &
|
|
48
|
+
// prettier-ignore
|
|
49
|
+
Pick<UseTextEditorProps, 'initialValue' | 'extensions'> &
|
|
50
|
+
Pick<MarkdownEditorToolbarProps, 'onFileUpload'> &
|
|
51
|
+
Pick<ThemeExtensionsOptions, 'slots'>;
|
|
45
52
|
|
|
46
53
|
export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEditorContentProps>(
|
|
47
54
|
(
|
|
48
|
-
{
|
|
55
|
+
{
|
|
56
|
+
classNames,
|
|
57
|
+
id,
|
|
58
|
+
role,
|
|
59
|
+
viewMode,
|
|
60
|
+
initialValue,
|
|
61
|
+
editorStateStore,
|
|
62
|
+
toolbarState,
|
|
63
|
+
extensions,
|
|
64
|
+
scrollPastEnd,
|
|
65
|
+
slots = editorSlots,
|
|
66
|
+
onFileUpload,
|
|
67
|
+
},
|
|
49
68
|
forwardedRef,
|
|
50
69
|
) => {
|
|
51
70
|
const { t } = useTranslation(meta.id);
|
|
52
71
|
const { themeMode } = useThemeContext();
|
|
72
|
+
const registry = useContext(RegistryContext);
|
|
53
73
|
|
|
54
|
-
//
|
|
55
|
-
const
|
|
74
|
+
// Callback to update toolbar state atom.
|
|
75
|
+
const updateToolbarState = useCallback(
|
|
76
|
+
(formatting: EditorToolbarState) => {
|
|
77
|
+
if (toolbarState) {
|
|
78
|
+
registry.set(toolbarState, { ...registry.get(toolbarState), ...formatting });
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
[registry, toolbarState],
|
|
82
|
+
);
|
|
56
83
|
|
|
57
84
|
// Restore last selection and scroll point.
|
|
58
85
|
const { scrollTo, selection } = useMemo<EditorSelectionState>(() => editorStateStore?.getState(id) ?? {}, [id]);
|
|
@@ -69,7 +96,7 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
69
96
|
selection,
|
|
70
97
|
// TODO(wittjosiah): Autofocus based on layout is racy.
|
|
71
98
|
// autoFocus: layoutPlugin?.provides.layout ? layoutPlugin?.provides.layout.scrollIntoView === id : true,
|
|
72
|
-
|
|
99
|
+
selectionEnd: true,
|
|
73
100
|
}),
|
|
74
101
|
initialValue,
|
|
75
102
|
extensions: [
|
|
@@ -81,12 +108,11 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
81
108
|
}),
|
|
82
109
|
createThemeExtensions({
|
|
83
110
|
themeMode,
|
|
84
|
-
slots
|
|
111
|
+
slots,
|
|
85
112
|
syntaxHighlighting: true,
|
|
86
113
|
}),
|
|
87
114
|
createMarkdownExtensions(),
|
|
88
|
-
formattingListener(
|
|
89
|
-
editorGutter,
|
|
115
|
+
toolbarState && formattingListener(updateToolbarState),
|
|
90
116
|
role !== 'section' &&
|
|
91
117
|
onFileUpload &&
|
|
92
118
|
dropFile({
|
|
@@ -106,7 +132,9 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
106
132
|
);
|
|
107
133
|
|
|
108
134
|
useImperativeHandle<EditorView | null, EditorView | null>(forwardedRef, () => editorView, [editorView]);
|
|
135
|
+
|
|
109
136
|
useSelectCurrentThread(editorView, id);
|
|
137
|
+
|
|
110
138
|
useTest(editorView);
|
|
111
139
|
|
|
112
140
|
return (
|
|
@@ -114,7 +142,7 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
114
142
|
role='none'
|
|
115
143
|
ref={parentRef}
|
|
116
144
|
data-testid='composer.markdownRoot'
|
|
117
|
-
className={stackItemContentEditorClassNames(role)}
|
|
145
|
+
className={mx(stackItemContentEditorClassNames(role), classNames)}
|
|
118
146
|
data-popover-collision-boundary={true}
|
|
119
147
|
{...focusAttributes}
|
|
120
148
|
/>
|