@dxos/plugin-markdown 0.8.4-main.2e9d522 → 0.8.4-main.3eb6e50203
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-7VIO7R66.mjs +11 -0
- package/dist/lib/browser/MarkdownCard-7VIO7R66.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs +11 -0
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-JBAZRPE7.mjs +33 -0
- package/dist/lib/browser/anchor-sort-JBAZRPE7.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs +59 -0
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs +20 -0
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.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-LHDCHDBW.mjs → chunk-2AAD3W6X.mjs} +14 -9
- package/dist/lib/browser/chunk-2AAD3W6X.mjs.map +7 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs +167 -0
- package/dist/lib/browser/chunk-4GT3QWMK.mjs.map +7 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs +8 -0
- package/dist/lib/browser/chunk-6SM75KL3.mjs.map +7 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs +105 -0
- package/dist/lib/browser/chunk-7AQTX6D5.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs +58 -0
- package/dist/lib/browser/chunk-EZZFREFN.mjs.map +7 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs +796 -0
- package/dist/lib/browser/chunk-HHRUUWGH.mjs.map +7 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs +176 -0
- package/dist/lib/browser/chunk-HQTBT5IY.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +33 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +131 -136
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs +53 -0
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs.map +7 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs +213 -0
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs.map +7 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs +36 -0
- package/dist/lib/browser/settings-V2XOFSD5.mjs.map +7 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs +29 -0
- package/dist/lib/browser/state-6Y3JB64H.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +13 -14
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs +12 -0
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs +12 -0
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-IQMDZRA3.mjs +34 -0
- package/dist/lib/node-esm/anchor-sort-IQMDZRA3.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs +60 -0
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs +21 -0
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.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-AGZOFIK2.mjs +10 -0
- package/dist/lib/node-esm/chunk-AGZOFIK2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs +797 -0
- package/dist/lib/node-esm/chunk-D46D75SK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs +59 -0
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs +106 -0
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs +177 -0
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIR2ABYE.mjs → chunk-MLZQCT2N.mjs} +14 -9
- package/dist/lib/node-esm/chunk-MLZQCT2N.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs +168 -0
- package/dist/lib/node-esm/chunk-USKAPINH.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +34 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +131 -136
- 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-QAGXDA5E.mjs +54 -0
- package/dist/lib/node-esm/operation-resolver-QAGXDA5E.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs +214 -0
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs.map +7 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs +37 -0
- package/dist/lib/node-esm/settings-EXSH2KF4.mjs.map +7 -0
- package/dist/lib/node-esm/state-TVF2XT2T.mjs +30 -0
- package/dist/lib/node-esm/state-TVF2XT2T.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +13 -14
- 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 +14 -0
- package/dist/types/src/blueprints/functions/open.d.ts.map +1 -0
- package/dist/types/src/blueprints/functions/update.d.ts +19 -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 +6 -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 +11 -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 +7 -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 +22 -12
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +84 -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 +6 -4
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +3 -4
- 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 +4 -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 +36 -2
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +45 -0
- package/dist/types/src/types/Markdown.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownAction.d.ts +66 -0
- package/dist/types/src/types/MarkdownAction.d.ts.map +1 -0
- 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 +5 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +4 -60
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +17 -5
- 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 +99 -56
- package/src/MarkdownPlugin.tsx +82 -103
- package/src/blueprints/functions/create.conversations.json +1 -0
- package/src/blueprints/functions/create.test.ts +92 -0
- package/src/blueprints/functions/create.ts +35 -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 +215 -0
- package/src/blueprints/functions/update.ts +79 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/markdown-blueprint.ts +38 -0
- package/src/capabilities/anchor-sort/anchor-sort.ts +37 -0
- package/src/capabilities/anchor-sort/index.ts +7 -0
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +60 -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 +26 -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 +102 -0
- package/src/capabilities/settings/index.ts +7 -0
- package/src/capabilities/settings/settings.ts +37 -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 +30 -0
- package/src/components/MarkdownCard/MarkdownCard.stories.tsx +58 -0
- package/src/components/MarkdownCard/MarkdownCard.tsx +64 -0
- package/src/components/MarkdownCard/index.ts +9 -0
- package/src/components/MarkdownContainer.stories.tsx +81 -61
- package/src/components/MarkdownContainer.tsx +106 -247
- package/src/components/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +58 -36
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +226 -272
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +162 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +66 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +97 -80
- package/src/components/Suggestions.stories.tsx +66 -72
- 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} +78 -131
- package/src/hooks/useLinkQuery.ts +83 -0
- package/src/hooks/useSelectCurrentThread.tsx +39 -34
- package/src/index.ts +7 -3
- package/src/meta.ts +9 -10
- package/src/testing.ts +27 -0
- package/src/translations.ts +9 -2
- package/src/types/Markdown.ts +57 -0
- package/src/types/MarkdownAction.ts +59 -0
- package/src/types/capabilities.ts +38 -0
- package/src/types/events.ts +14 -0
- package/src/types/index.ts +6 -1
- package/src/types/types.ts +7 -50
- package/src/util.test.ts +44 -0
- package/src/util.tsx +100 -11
- package/dist/lib/browser/MarkdownContainer-F3WEEIBX.mjs +0 -778
- package/dist/lib/browser/MarkdownContainer-F3WEEIBX.mjs.map +0 -7
- package/dist/lib/browser/MarkdownPreview-S3C7CGAV.mjs +0 -80
- package/dist/lib/browser/MarkdownPreview-S3C7CGAV.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-UKJJ7ZNP.mjs +0 -32
- package/dist/lib/browser/anchor-sort-UKJJ7ZNP.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-ICLAF662.mjs +0 -52
- package/dist/lib/browser/app-graph-serializer-ICLAF662.mjs.map +0 -7
- package/dist/lib/browser/artifact-definition-R2YYWOPN.mjs +0 -145
- package/dist/lib/browser/artifact-definition-R2YYWOPN.mjs.map +0 -7
- package/dist/lib/browser/chunk-777RIED6.mjs +0 -16
- package/dist/lib/browser/chunk-777RIED6.mjs.map +0 -7
- package/dist/lib/browser/chunk-EPTSAJZM.mjs +0 -22
- package/dist/lib/browser/chunk-EPTSAJZM.mjs.map +0 -7
- package/dist/lib/browser/chunk-LFML7LC6.mjs +0 -51
- package/dist/lib/browser/chunk-LFML7LC6.mjs.map +0 -7
- package/dist/lib/browser/chunk-LHDCHDBW.mjs.map +0 -7
- package/dist/lib/browser/chunk-PHTD5DTR.mjs +0 -20
- package/dist/lib/browser/chunk-PHTD5DTR.mjs.map +0 -7
- package/dist/lib/browser/chunk-UANWRJZU.mjs +0 -79
- package/dist/lib/browser/chunk-UANWRJZU.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs +0 -64
- package/dist/lib/browser/intent-resolver-3MXYO3MW.mjs.map +0 -7
- package/dist/lib/browser/react-surface-C3Z423TV.mjs +0 -206
- package/dist/lib/browser/react-surface-C3Z423TV.mjs.map +0 -7
- package/dist/lib/browser/settings-KN75ZQY6.mjs +0 -28
- package/dist/lib/browser/settings-KN75ZQY6.mjs.map +0 -7
- package/dist/lib/browser/state-LZWTAS65.mjs +0 -37
- package/dist/lib/browser/state-LZWTAS65.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-VOUHL6IU.mjs +0 -779
- package/dist/lib/node-esm/MarkdownContainer-VOUHL6IU.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownPreview-77UFEWXT.mjs +0 -81
- package/dist/lib/node-esm/MarkdownPreview-77UFEWXT.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-IPIS5D5B.mjs +0 -33
- package/dist/lib/node-esm/anchor-sort-IPIS5D5B.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-FLBXQKKR.mjs +0 -53
- package/dist/lib/node-esm/app-graph-serializer-FLBXQKKR.mjs.map +0 -7
- package/dist/lib/node-esm/artifact-definition-MLTAY4LK.mjs +0 -146
- package/dist/lib/node-esm/artifact-definition-MLTAY4LK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7X6TPTJK.mjs +0 -22
- package/dist/lib/node-esm/chunk-7X6TPTJK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ACFGXH2K.mjs +0 -17
- package/dist/lib/node-esm/chunk-ACFGXH2K.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CWTFQSN7.mjs +0 -52
- package/dist/lib/node-esm/chunk-CWTFQSN7.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs +0 -24
- package/dist/lib/node-esm/chunk-CXG7GMYP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs +0 -80
- package/dist/lib/node-esm/chunk-JEEQLO7C.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-VIR2ABYE.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs +0 -65
- package/dist/lib/node-esm/intent-resolver-BZYWV53A.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TTTBYNI2.mjs +0 -207
- package/dist/lib/node-esm/react-surface-TTTBYNI2.mjs.map +0 -7
- package/dist/lib/node-esm/settings-KVP7TVX7.mjs +0 -29
- package/dist/lib/node-esm/settings-KVP7TVX7.mjs.map +0 -7
- package/dist/lib/node-esm/state-NW3W4JCQ.mjs +0 -38
- package/dist/lib/node-esm/state-NW3W4JCQ.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 -42
- 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/dist/types/src/types/schema.d.ts +0 -35
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/anchor-sort.ts +0 -30
- package/src/capabilities/app-graph-serializer.ts +0 -52
- package/src/capabilities/artifact-definition.ts +0 -116
- package/src/capabilities/capabilities.ts +0 -20
- package/src/capabilities/intent-resolver.ts +0 -63
- package/src/capabilities/react-surface.tsx +0 -113
- package/src/capabilities/settings.ts +0 -25
- package/src/capabilities/state.ts +0 -31
- package/src/components/MarkdownPreview/MarkdownPreview.stories.tsx +0 -81
- package/src/components/MarkdownPreview/MarkdownPreview.tsx +0 -73
- package/src/components/MarkdownPreview/index.ts +0 -9
- package/src/components/Toolbar.stories.tsx +0 -113
- package/src/events.ts +0 -11
- package/src/types/schema.ts +0 -39
|
@@ -6,56 +6,52 @@ import { type ViewUpdate } from '@codemirror/view';
|
|
|
6
6
|
import React, { type AnchorHTMLAttributes, type ReactNode, useMemo } from 'react';
|
|
7
7
|
import { createRoot } from 'react-dom/client';
|
|
8
8
|
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
type PromiseIntentDispatcher,
|
|
13
|
-
useCapabilities,
|
|
14
|
-
useIntentDispatcher,
|
|
15
|
-
} from '@dxos/app-framework';
|
|
9
|
+
import { type Capabilities } from '@dxos/app-framework';
|
|
10
|
+
import { useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
16
12
|
import { debounceAndThrottle } from '@dxos/async';
|
|
13
|
+
import { Obj } from '@dxos/echo';
|
|
14
|
+
import { createDocAccessor } from '@dxos/echo-db';
|
|
17
15
|
import { invariant } from '@dxos/invariant';
|
|
18
|
-
import {
|
|
16
|
+
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
19
17
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
20
18
|
import { Icon, ThemeProvider } from '@dxos/react-ui';
|
|
21
19
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
22
21
|
import {
|
|
23
|
-
|
|
22
|
+
Cursor,
|
|
24
23
|
type EditorStateStore,
|
|
24
|
+
EditorView,
|
|
25
25
|
type EditorViewMode,
|
|
26
26
|
type Extension,
|
|
27
27
|
InputModeExtensions,
|
|
28
|
+
type PreviewOptions,
|
|
29
|
+
type RenderCallback,
|
|
28
30
|
createDataExtensions,
|
|
29
|
-
autocomplete,
|
|
30
31
|
decorateMarkdown,
|
|
32
|
+
documentId,
|
|
31
33
|
folding,
|
|
32
34
|
formattingKeymap,
|
|
33
35
|
linkTooltip,
|
|
34
36
|
listener,
|
|
35
37
|
preview,
|
|
38
|
+
replacer,
|
|
36
39
|
selectionState,
|
|
37
40
|
typewriter,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
} from '
|
|
44
|
-
import { defaultTx } from '@dxos/react-ui-theme';
|
|
45
|
-
import { type DataType } from '@dxos/schema';
|
|
46
|
-
import { isNotFalsy } from '@dxos/util';
|
|
41
|
+
} from '@dxos/ui-editor';
|
|
42
|
+
import { defaultTx } from '@dxos/ui-theme';
|
|
43
|
+
import { isTruthy } from '@dxos/util';
|
|
44
|
+
|
|
45
|
+
import { Markdown } from '../types';
|
|
46
|
+
import { setFallbackName } from '../util';
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
import { type DocumentType, type MarkdownSettingsProps } from './types';
|
|
50
|
-
import { setFallbackName } from './util';
|
|
48
|
+
export type DocumentType = Markdown.Document | Text.Text | { id: string; text: string };
|
|
51
49
|
|
|
52
|
-
type ExtensionsOptions = {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
query?: QueryResult<DocumentType>;
|
|
58
|
-
settings: MarkdownSettingsProps;
|
|
50
|
+
export type ExtensionsOptions = {
|
|
51
|
+
id: string;
|
|
52
|
+
object?: DocumentType;
|
|
53
|
+
invokePromise?: Capabilities.OperationInvoker['invokePromise'];
|
|
54
|
+
settings?: Markdown.Settings;
|
|
59
55
|
selectionManager?: SelectionManager;
|
|
60
56
|
viewMode?: EditorViewMode;
|
|
61
57
|
editorStateStore?: EditorStateStore;
|
|
@@ -64,104 +60,82 @@ type ExtensionsOptions = {
|
|
|
64
60
|
|
|
65
61
|
// TODO(burdon): Merge with createBaseExtensions below.
|
|
66
62
|
export const useExtensions = ({
|
|
67
|
-
document,
|
|
68
63
|
id,
|
|
69
|
-
|
|
64
|
+
object,
|
|
70
65
|
settings,
|
|
71
66
|
selectionManager,
|
|
72
67
|
viewMode,
|
|
73
68
|
editorStateStore,
|
|
74
69
|
previewOptions,
|
|
75
70
|
}: ExtensionsOptions): Extension[] => {
|
|
76
|
-
const {
|
|
71
|
+
const { invokePromise } = useOperationInvoker();
|
|
77
72
|
const identity = useIdentity();
|
|
78
|
-
const space = getSpace(
|
|
73
|
+
const space = getSpace(object);
|
|
74
|
+
|
|
75
|
+
// Get the content reference from Document objects.
|
|
76
|
+
const contentRef = Obj.instanceOf(Markdown.Document, object) ? (object as Markdown.Document).content : undefined;
|
|
77
|
+
// Use useObject to trigger re-render when the reference loads (returns snapshot for reactivity).
|
|
78
|
+
useObject(contentRef);
|
|
79
|
+
// Get the actual live object target via .target (needed for createDocAccessor).
|
|
80
|
+
const target = contentRef?.target ?? (Obj.instanceOf(Text.Text, object) ? object : undefined);
|
|
79
81
|
|
|
80
82
|
// TODO(wittjosiah): Autocomplete is not working and this query is causing performance issues.
|
|
81
83
|
// TODO(burdon): Unsubscribe.
|
|
82
84
|
// const query = space?.db.query(Filter.type(DocumentType));
|
|
83
85
|
// query?.subscribe();
|
|
86
|
+
|
|
84
87
|
const baseExtensions = useMemo(
|
|
85
88
|
() =>
|
|
86
89
|
createBaseExtensions({
|
|
87
|
-
document,
|
|
88
90
|
id,
|
|
89
|
-
|
|
91
|
+
object,
|
|
90
92
|
settings,
|
|
91
93
|
selectionManager,
|
|
92
94
|
viewMode,
|
|
93
95
|
previewOptions,
|
|
94
|
-
|
|
95
|
-
// query,
|
|
96
|
+
invokePromise,
|
|
96
97
|
}),
|
|
97
98
|
[
|
|
98
|
-
document,
|
|
99
99
|
id,
|
|
100
|
-
|
|
100
|
+
object,
|
|
101
101
|
viewMode,
|
|
102
|
-
|
|
102
|
+
invokePromise,
|
|
103
103
|
previewOptions,
|
|
104
104
|
settings,
|
|
105
|
-
settings
|
|
106
|
-
settings
|
|
107
|
-
settings
|
|
108
|
-
settings
|
|
109
|
-
settings
|
|
105
|
+
settings?.debug,
|
|
106
|
+
settings?.editorInputMode,
|
|
107
|
+
settings?.folding,
|
|
108
|
+
settings?.numberedHeadings,
|
|
109
|
+
settings?.typewriter,
|
|
110
110
|
selectionManager,
|
|
111
111
|
],
|
|
112
112
|
);
|
|
113
113
|
|
|
114
|
-
const extensionProviders = useCapabilities(MarkdownCapabilities.Extensions);
|
|
115
|
-
|
|
116
|
-
//
|
|
117
|
-
// External extensions from other plugins.
|
|
118
|
-
//
|
|
119
|
-
const pluginExtensions = useMemo<Extension[]>(() => {
|
|
120
|
-
if (!document) {
|
|
121
|
-
return [];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return extensionProviders.flat().reduce((acc: Extension[], provider) => {
|
|
125
|
-
const extension = typeof provider === 'function' ? provider({ document }) : provider;
|
|
126
|
-
if (extension) {
|
|
127
|
-
acc.push(extension);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
return acc;
|
|
131
|
-
}, []);
|
|
132
|
-
}, [extensionProviders, document]);
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
// Basic plugins.
|
|
136
|
-
//
|
|
137
114
|
return useMemo<Extension[]>(
|
|
138
115
|
() =>
|
|
139
116
|
[
|
|
117
|
+
// TODO(burdon): Pass this in?
|
|
140
118
|
// NOTE: Data extensions must be first so that automerge is updated before other extensions compute their state.
|
|
141
|
-
|
|
142
|
-
createDataExtensions({
|
|
143
|
-
id: document.id,
|
|
144
|
-
text: document.content.target && createDocAccessor(document.content.target, ['content']),
|
|
145
|
-
space,
|
|
146
|
-
identity,
|
|
147
|
-
}),
|
|
148
|
-
text &&
|
|
149
|
-
id &&
|
|
119
|
+
target &&
|
|
150
120
|
createDataExtensions({
|
|
151
121
|
id,
|
|
152
|
-
text: createDocAccessor(
|
|
153
|
-
space,
|
|
122
|
+
text: createDocAccessor(target, ['content']),
|
|
123
|
+
messenger: space,
|
|
154
124
|
identity,
|
|
155
125
|
}),
|
|
156
|
-
|
|
157
|
-
|
|
126
|
+
|
|
127
|
+
// TODO(burdon): Reconcile with effect in parent.
|
|
128
|
+
Obj.instanceOf(Markdown.Document, object) &&
|
|
158
129
|
listener({
|
|
159
|
-
onChange: (text) =>
|
|
130
|
+
onChange: ({ text }) => {
|
|
131
|
+
setFallbackName(object as Markdown.Document, text);
|
|
132
|
+
},
|
|
160
133
|
}),
|
|
134
|
+
|
|
161
135
|
baseExtensions,
|
|
162
|
-
|
|
163
|
-
].filter(
|
|
164
|
-
[
|
|
136
|
+
selectionState(editorStateStore),
|
|
137
|
+
].filter(isTruthy),
|
|
138
|
+
[identity, space, id, object, target, baseExtensions],
|
|
165
139
|
);
|
|
166
140
|
};
|
|
167
141
|
|
|
@@ -169,20 +143,19 @@ export const useExtensions = ({
|
|
|
169
143
|
* Create extension instances for editor.
|
|
170
144
|
*/
|
|
171
145
|
const createBaseExtensions = ({
|
|
172
|
-
document,
|
|
173
146
|
id,
|
|
174
|
-
|
|
147
|
+
object,
|
|
148
|
+
invokePromise,
|
|
175
149
|
settings,
|
|
176
150
|
selectionManager,
|
|
177
|
-
query,
|
|
178
151
|
viewMode,
|
|
179
152
|
previewOptions,
|
|
180
153
|
}: ExtensionsOptions): Extension[] => {
|
|
181
154
|
const extensions: Extension[] = [
|
|
182
155
|
selectionManager && selectionChange(selectionManager),
|
|
183
|
-
settings
|
|
184
|
-
settings
|
|
185
|
-
].filter(
|
|
156
|
+
settings?.editorInputMode && InputModeExtensions[settings.editorInputMode],
|
|
157
|
+
settings?.folding && folding(),
|
|
158
|
+
].filter(isTruthy);
|
|
186
159
|
|
|
187
160
|
//
|
|
188
161
|
// Markdown
|
|
@@ -193,54 +166,27 @@ const createBaseExtensions = ({
|
|
|
193
166
|
formattingKeymap(),
|
|
194
167
|
decorateMarkdown({
|
|
195
168
|
selectionChangeDelay: 100,
|
|
196
|
-
numberedHeadings: settings
|
|
169
|
+
numberedHeadings: settings?.numberedHeadings ? { from: 2 } : undefined,
|
|
197
170
|
// TODO(wittjosiah): For internal links, consider ignoring the link text and rendering the label of the object being linked to.
|
|
171
|
+
// TODO(burdon): Create dx-tag.
|
|
198
172
|
renderLinkButton:
|
|
199
|
-
|
|
200
|
-
? createLinkRenderer((
|
|
201
|
-
void
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
options: {
|
|
206
|
-
pivotId: document ? fullyQualifiedId(document) : id,
|
|
207
|
-
},
|
|
208
|
-
}),
|
|
209
|
-
);
|
|
173
|
+
invokePromise && (object || id)
|
|
174
|
+
? createLinkRenderer((targetId: string) => {
|
|
175
|
+
void invokePromise(LayoutOperation.Open, {
|
|
176
|
+
subject: [targetId],
|
|
177
|
+
pivotId: object && Obj.isObject(object) ? Obj.getDXN(object).toString() : id,
|
|
178
|
+
});
|
|
210
179
|
})
|
|
211
180
|
: undefined,
|
|
212
181
|
}),
|
|
213
182
|
linkTooltip(renderLinkTooltip),
|
|
214
183
|
preview(previewOptions),
|
|
184
|
+
replacer(),
|
|
215
185
|
],
|
|
216
186
|
);
|
|
217
187
|
}
|
|
218
188
|
|
|
219
|
-
|
|
220
|
-
// Autocomplete object links.
|
|
221
|
-
//
|
|
222
|
-
if (query) {
|
|
223
|
-
extensions.push(
|
|
224
|
-
autocomplete({
|
|
225
|
-
onSearch: (text: string) => {
|
|
226
|
-
// TODO(burdon): Specify filter (e.g., stack).
|
|
227
|
-
return query.objects
|
|
228
|
-
.map<AutocompleteResult | undefined>((object) =>
|
|
229
|
-
object.name?.length && object.id !== document?.id
|
|
230
|
-
? {
|
|
231
|
-
label: object.name,
|
|
232
|
-
// TODO(burdon): Factor out URL builder.
|
|
233
|
-
apply: `[${object.name}](/${fullyQualifiedId(object)})`,
|
|
234
|
-
}
|
|
235
|
-
: undefined,
|
|
236
|
-
)
|
|
237
|
-
.filter(isNotFalsy);
|
|
238
|
-
},
|
|
239
|
-
}),
|
|
240
|
-
);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (settings.debug) {
|
|
189
|
+
if (settings?.debug) {
|
|
244
190
|
const items = settings.typewriter?.split(/[,\n]/) ?? '';
|
|
245
191
|
if (items) {
|
|
246
192
|
extensions.push(typewriter({ items }));
|
|
@@ -250,7 +196,7 @@ const createBaseExtensions = ({
|
|
|
250
196
|
return extensions;
|
|
251
197
|
};
|
|
252
198
|
|
|
253
|
-
|
|
199
|
+
const selectionChange = (selectionManager: SelectionManager) => {
|
|
254
200
|
return EditorView.updateListener.of(
|
|
255
201
|
debounceAndThrottle((update: ViewUpdate) => {
|
|
256
202
|
if (update.selectionSet) {
|
|
@@ -263,6 +209,7 @@ export const selectionChange = (selectionManager: SelectionManager) => {
|
|
|
263
209
|
to: cursorConverter.toCursor(range.to),
|
|
264
210
|
}))
|
|
265
211
|
.filter(({ from, to }) => to > from);
|
|
212
|
+
|
|
266
213
|
selectionManager.updateMultiRange(id, ranges);
|
|
267
214
|
}
|
|
268
215
|
}, 100),
|
|
@@ -321,8 +268,8 @@ const renderLinkTooltip: RenderCallback<{ url: string }> = (el, { url }) => {
|
|
|
321
268
|
);
|
|
322
269
|
};
|
|
323
270
|
|
|
324
|
-
// TODO(burdon):
|
|
325
|
-
|
|
271
|
+
// TODO(burdon): REMOVE.
|
|
272
|
+
const renderRoot = <T extends Element>(root: T, node: ReactNode): T => {
|
|
326
273
|
createRoot(root).render(<ThemeProvider tx={defaultTx}>{node}</ThemeProvider>);
|
|
327
274
|
return root;
|
|
328
275
|
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Option from 'effect/Option';
|
|
6
|
+
import { useCallback, useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { usePluginManager } from '@dxos/app-framework/ui';
|
|
9
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
10
|
+
import { type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
11
|
+
import { EntityKind, SystemTypeAnnotation, getTypeAnnotation } from '@dxos/echo/internal';
|
|
12
|
+
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
13
|
+
import { type EditorMenuGroup, type EditorMenuItem } from '@dxos/react-ui-editor';
|
|
14
|
+
import { insertAtCursor, insertAtLineStart } from '@dxos/ui-editor';
|
|
15
|
+
|
|
16
|
+
export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
17
|
+
const { t } = useTranslation();
|
|
18
|
+
|
|
19
|
+
const manager = usePluginManager();
|
|
20
|
+
const resolve = useCallback(
|
|
21
|
+
(typename: string) =>
|
|
22
|
+
manager.capabilities.getAll(AppCapabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
23
|
+
[manager],
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const filter = useMemo(
|
|
27
|
+
() =>
|
|
28
|
+
Filter.or(
|
|
29
|
+
...(db?.schemaRegistry.query({ location: ['database', 'runtime'] }).runSync() ?? [])
|
|
30
|
+
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
31
|
+
.filter((schema) => !SystemTypeAnnotation.get(schema).pipe(Option.getOrElse(() => false)))
|
|
32
|
+
.map((schema) => Filter.typename(Type.getTypename(schema))),
|
|
33
|
+
),
|
|
34
|
+
[db],
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const handleLinkQuery = useCallback(
|
|
38
|
+
async (query?: string): Promise<EditorMenuGroup[]> => {
|
|
39
|
+
const name = query?.startsWith('@') ? query.slice(1).toLowerCase() : (query?.toLowerCase() ?? '');
|
|
40
|
+
const results = await db?.query(Query.select(filter)).run();
|
|
41
|
+
|
|
42
|
+
// TODO(wittjosiah): Use `Obj.Unknown` type.
|
|
43
|
+
const getLabel = (object: any) => {
|
|
44
|
+
const label = Obj.getLabel(object);
|
|
45
|
+
if (label) {
|
|
46
|
+
return label;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// TODO(wittjosiah): Remove metadata labels.
|
|
50
|
+
const type = Obj.getTypename(object)!;
|
|
51
|
+
const metadata = resolve(type);
|
|
52
|
+
return metadata.label?.(object) || ['object name placeholder', { ns: type, default: 'New object' }];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const items =
|
|
56
|
+
results
|
|
57
|
+
?.filter((object) => toLocalizedString(getLabel(object), t).toLowerCase().includes(name))
|
|
58
|
+
// TODO(wittjosiah): Remove `any` type.
|
|
59
|
+
.map((object: any): EditorMenuItem => {
|
|
60
|
+
const metadata = resolve(Obj.getTypename(object)!);
|
|
61
|
+
const label = toLocalizedString(getLabel(object), t);
|
|
62
|
+
return {
|
|
63
|
+
id: object.id,
|
|
64
|
+
label,
|
|
65
|
+
icon: metadata.icon,
|
|
66
|
+
onSelect: ({ view, head }) => {
|
|
67
|
+
const link = `[${label}](${Obj.getDXN(object)})`;
|
|
68
|
+
if (query?.startsWith('@')) {
|
|
69
|
+
insertAtLineStart(view, head, `!${link}\n`);
|
|
70
|
+
} else {
|
|
71
|
+
insertAtCursor(view, head, `${link} `);
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}) ?? [];
|
|
76
|
+
|
|
77
|
+
return [{ id: 'echo', items }];
|
|
78
|
+
},
|
|
79
|
+
[db, filter, resolve],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
return handleLinkQuery;
|
|
83
|
+
};
|
|
@@ -3,54 +3,59 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { EditorView } from '@codemirror/view';
|
|
6
|
-
import
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
7
|
import { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { useOperationResolver } from '@dxos/app-framework/ui';
|
|
10
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
11
|
import { invariant } from '@dxos/invariant';
|
|
11
|
-
import {
|
|
12
|
+
import { OperationResolver } from '@dxos/operation';
|
|
13
|
+
import { Cursor, setSelection } from '@dxos/ui-editor';
|
|
12
14
|
|
|
13
|
-
import {
|
|
15
|
+
import { meta } from '../meta';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* Handle scrolling and selection of the current thread in a markdown editor.
|
|
17
19
|
*/
|
|
18
|
-
export const useSelectCurrentThread = (editorView: EditorView |
|
|
19
|
-
const
|
|
20
|
+
export const useSelectCurrentThread = (editorView: EditorView | null, documentId: string) => {
|
|
21
|
+
const scrollIntoViewHandler = useMemo(
|
|
20
22
|
() =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
+
OperationResolver.make({
|
|
24
|
+
operation: LayoutOperation.ScrollIntoView,
|
|
23
25
|
position: 'hoist',
|
|
24
|
-
filter: (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
resolve: ({ options: { cursor } }) => {
|
|
32
|
-
invariant(editorView, 'Editor view is not defined.');
|
|
33
|
-
const range = Cursor.getRangeFromCursor(editorView.state, cursor!);
|
|
34
|
-
if (range) {
|
|
35
|
-
const selection = editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
36
|
-
const effects = [
|
|
37
|
-
// NOTE: This does not use the DOM scrollIntoView function.
|
|
38
|
-
EditorView.scrollIntoView(range.from, { y: 'start', yMargin: 96 }),
|
|
39
|
-
];
|
|
40
|
-
if (selection) {
|
|
41
|
-
// Update the editor selection to get bi-directional highlighting.
|
|
42
|
-
effects.push(setSelection.of({ current: documentId }));
|
|
26
|
+
filter: (input) => !!editorView && input.subject === documentId && !!input.cursor,
|
|
27
|
+
handler: (input) =>
|
|
28
|
+
Effect.sync(() => {
|
|
29
|
+
invariant(editorView, 'Editor view is not defined.');
|
|
30
|
+
const cursor = input.cursor;
|
|
31
|
+
if (!cursor) {
|
|
32
|
+
return;
|
|
43
33
|
}
|
|
34
|
+
const range = Cursor.getRangeFromCursor(editorView.state, cursor);
|
|
35
|
+
if (range) {
|
|
36
|
+
const selection =
|
|
37
|
+
editorView.state.selection.main.from !== range.from ? { anchor: range.from } : undefined;
|
|
38
|
+
const effects = [
|
|
39
|
+
// NOTE: This does not use the DOM scrollIntoView function.
|
|
40
|
+
EditorView.scrollIntoView(range.from, {
|
|
41
|
+
y: 'start',
|
|
42
|
+
yMargin: 96,
|
|
43
|
+
}),
|
|
44
|
+
];
|
|
45
|
+
if (selection) {
|
|
46
|
+
// Update the editor selection to get bi-directional highlighting.
|
|
47
|
+
effects.push(setSelection.of({ current: documentId }));
|
|
48
|
+
}
|
|
44
49
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
editorView.dispatch({
|
|
51
|
+
effects,
|
|
52
|
+
selection: selection ? { anchor: range.from } : undefined,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
51
56
|
}),
|
|
52
57
|
[documentId, editorView],
|
|
53
58
|
);
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
useOperationResolver(meta.id, scrollIntoViewHandler);
|
|
56
61
|
};
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,12 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { MarkdownCapabilities } from './
|
|
6
|
-
|
|
7
|
-
export * from './MarkdownPlugin';
|
|
5
|
+
export { MarkdownCapabilities, MarkdownEvents } from './types';
|
|
6
|
+
|
|
8
7
|
export * from './meta';
|
|
8
|
+
export * from './types';
|
|
9
9
|
export * from './util';
|
|
10
|
+
|
|
11
|
+
export * from './MarkdownPlugin';
|
|
12
|
+
|
|
13
|
+
export { MarkdownEditor } from './components/MarkdownEditor';
|
package/src/meta.ts
CHANGED
|
@@ -2,19 +2,18 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: MARKDOWN_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'dxos.org/plugin/markdown',
|
|
11
10
|
name: 'Markdown',
|
|
12
|
-
description: `
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Your AI agent will have access to all markdown docs in your Space which means you can use them to extend the memory of your personal agent and add long term context for automated workflows.
|
|
11
|
+
description: trim`
|
|
12
|
+
Full-featured collaborative markdown editor with real-time editing, inline comments, and rich formatting.
|
|
13
|
+
Supports AI-powered editing assistance and seamlessly integrates with other workspace objects.
|
|
16
14
|
`,
|
|
17
|
-
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown',
|
|
18
15
|
icon: 'ph--text-aa--regular',
|
|
16
|
+
iconHue: 'indigo',
|
|
17
|
+
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown',
|
|
19
18
|
screenshots: ['https://dxos.network/plugin-details-markdown-dark.png'],
|
|
20
19
|
};
|
package/src/testing.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Toolkit from '@effect/ai/Toolkit';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
|
|
8
|
+
import { SpaceProperties } from '@dxos/client-protocol';
|
|
9
|
+
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
+
import { Database } from '@dxos/echo';
|
|
11
|
+
import { Collection } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
// TODO(wittjosiah): Factor out.
|
|
14
|
+
export const WithProperties = <A, E, R>(effect: Effect.Effect<A, E, R>): Effect.Effect<A, E, R | Database.Service> =>
|
|
15
|
+
Effect.zipRight(
|
|
16
|
+
Effect.gen(function* () {
|
|
17
|
+
// TODO(wittjosiah): Remove cast.
|
|
18
|
+
yield* Database.add(
|
|
19
|
+
Obj.make(SpaceProperties, {
|
|
20
|
+
[Collection.Collection.typename]: Ref.make(Collection.make()),
|
|
21
|
+
}) as any,
|
|
22
|
+
);
|
|
23
|
+
}),
|
|
24
|
+
effect,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
export const testToolkit = Toolkit.empty as Toolkit.Toolkit<any>;
|
package/src/translations.ts
CHANGED
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
6
7
|
|
|
7
8
|
import { meta } from './meta';
|
|
8
|
-
import {
|
|
9
|
+
import { Markdown } from './types';
|
|
9
10
|
|
|
10
11
|
export const translations = [
|
|
11
12
|
{
|
|
12
13
|
'en-US': {
|
|
13
|
-
[
|
|
14
|
+
[Markdown.Document.typename]: {
|
|
14
15
|
'typename label': 'Document',
|
|
15
16
|
'typename label_zero': 'Documents',
|
|
16
17
|
'typename label_one': 'Document',
|
|
@@ -18,9 +19,11 @@ export const translations = [
|
|
|
18
19
|
'object name placeholder': 'New document',
|
|
19
20
|
'rename object label': 'Rename document',
|
|
20
21
|
'delete object label': 'Delete document',
|
|
22
|
+
'object deleted label': 'Document deleted',
|
|
21
23
|
},
|
|
22
24
|
[meta.id]: {
|
|
23
25
|
'plugin name': 'Editor',
|
|
26
|
+
'settings title': 'Editor settings',
|
|
24
27
|
'choose markdown from space dialog title': 'Choose one or more documents to add',
|
|
25
28
|
// TODO(burdon): Style-guide for user-facing text (e.g., hints, questions, capitalization, etc.)
|
|
26
29
|
'empty choose markdown from space message': 'None available; try creating a new one instead?',
|
|
@@ -42,7 +45,11 @@ export const translations = [
|
|
|
42
45
|
'upload image label': 'Upload image',
|
|
43
46
|
'fallback title': 'Untitled',
|
|
44
47
|
'navigate to document label': 'Open document',
|
|
48
|
+
'words label_zero': 'words',
|
|
49
|
+
'words label_one': 'word',
|
|
50
|
+
'words label_other': 'words',
|
|
45
51
|
},
|
|
46
52
|
},
|
|
47
53
|
},
|
|
54
|
+
...editorTranslations,
|
|
48
55
|
] as const satisfies Resource[];
|