@dxos/plugin-markdown 0.8.4-main.c1de068 → 0.8.4-main.c85a9c8dae
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-5NPSEJ2M.mjs +61 -0
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +7 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs +108 -0
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +7 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs +106 -0
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +7 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs +34 -0
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs +60 -0
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +7 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs +783 -0
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +7 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs +8 -0
- package/dist/lib/browser/chunk-HK6EGNP5.mjs.map +7 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs +154 -0
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-LHDCHDBW.mjs → chunk-RJO5W5YX.mjs} +15 -8
- package/dist/lib/browser/chunk-RJO5W5YX.mjs.map +7 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs +178 -0
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +7 -0
- package/dist/lib/browser/chunk-YBMRREXE.mjs +28 -0
- package/dist/lib/browser/chunk-YBMRREXE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +35 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +133 -136
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs +54 -0
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +7 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +115 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +7 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs +38 -0
- package/dist/lib/browser/settings-7FMWKB7N.mjs.map +7 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs +31 -0
- package/dist/lib/browser/state-7UJKJDGE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +14 -14
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs +62 -0
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs +109 -0
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +7 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs +107 -0
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +7 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs +35 -0
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs +61 -0
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +10 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-VIR2ABYE.mjs → chunk-ANIFP6M2.mjs} +15 -8
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs +10 -0
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs +784 -0
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs +179 -0
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs +29 -0
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs +155 -0
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +36 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +133 -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-2MEWKRFP.mjs +55 -0
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs +116 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +7 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs +39 -0
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs.map +7 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs +32 -0
- package/dist/lib/node-esm/state-EEPLRAOT.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +14 -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 +42 -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 +4 -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 +6 -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/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/index.d.ts +1 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts +8 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +27 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +88 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts +8 -0
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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 +15 -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 +46 -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 +17 -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/MarkdownEditor/FileUpload.tsx +63 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +61 -37
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +235 -271
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +161 -0
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +67 -0
- package/src/components/index.ts +2 -7
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +68 -0
- package/src/containers/MarkdownCard/MarkdownCard.tsx +61 -0
- package/src/containers/MarkdownCard/index.ts +7 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +136 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +114 -0
- package/src/containers/MarkdownContainer/index.ts +7 -0
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +122 -0
- package/src/containers/MarkdownSettings/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useEditorMenuOptions.ts +68 -0
- package/src/hooks/useExtensions.tsx +245 -0
- 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 +65 -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/MarkdownContainer.d.ts +0 -18
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts +0 -9
- package/dist/types/src/components/MarkdownContainer.stories.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/MarkdownSettings/MarkdownSettings.d.ts +0 -6
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -12
- package/dist/types/src/components/Suggestions.stories.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/MarkdownContainer.stories.tsx +0 -103
- package/src/components/MarkdownContainer.tsx +0 -254
- 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/MarkdownSettings/MarkdownSettings.tsx +0 -105
- package/src/components/MarkdownSettings/index.ts +0 -5
- package/src/components/Suggestions.stories.tsx +0 -221
- package/src/components/Toolbar.stories.tsx +0 -113
- package/src/events.ts +0 -11
- package/src/extensions.tsx +0 -328
- package/src/types/schema.ts +0 -39
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/echo';
|
|
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[];
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Annotation, Obj, Ref, Type } from '@dxos/echo';
|
|
8
|
+
import { DescriptionAnnotation, FormInputAnnotation, LabelAnnotation } from '@dxos/echo/internal';
|
|
9
|
+
import { Text } from '@dxos/schema';
|
|
10
|
+
import { EditorInputMode, EditorViewMode } from '@dxos/ui-editor/types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Document Item type.
|
|
14
|
+
*/
|
|
15
|
+
export const Document = Schema.Struct({
|
|
16
|
+
name: Schema.optional(Schema.String),
|
|
17
|
+
description: Schema.optional(Schema.String),
|
|
18
|
+
fallbackName: Schema.String.pipe(FormInputAnnotation.set(false), Schema.optional),
|
|
19
|
+
content: Ref.Ref(Text.Text).pipe(FormInputAnnotation.set(false)),
|
|
20
|
+
}).pipe(
|
|
21
|
+
Type.object({
|
|
22
|
+
typename: 'dxos.org/type/Document',
|
|
23
|
+
version: '0.1.0',
|
|
24
|
+
}),
|
|
25
|
+
LabelAnnotation.set(['name', 'fallbackName']),
|
|
26
|
+
DescriptionAnnotation.set('description'),
|
|
27
|
+
Annotation.IconAnnotation.set({
|
|
28
|
+
icon: 'ph--text-aa--regular',
|
|
29
|
+
hue: 'green',
|
|
30
|
+
}),
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
export type Document = Schema.Schema.Type<typeof Document>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Document factory.
|
|
37
|
+
*/
|
|
38
|
+
export const make = ({
|
|
39
|
+
content = '',
|
|
40
|
+
...props
|
|
41
|
+
}: Partial<{ name: string; fallbackName: string; content: string }> = {}) => {
|
|
42
|
+
const doc = Obj.make(Document, { ...props, content: Ref.make(Text.make(content)) });
|
|
43
|
+
// TODO(dmaretskyi): We need a better way to set parents when creating hierarchies.
|
|
44
|
+
Obj.setParent(doc.content.target!, doc);
|
|
45
|
+
return doc;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Plugin settings.
|
|
50
|
+
*/
|
|
51
|
+
export const Settings = Schema.mutable(
|
|
52
|
+
Schema.Struct({
|
|
53
|
+
defaultViewMode: EditorViewMode,
|
|
54
|
+
editorInputMode: Schema.optional(EditorInputMode),
|
|
55
|
+
experimental: Schema.optional(Schema.Boolean),
|
|
56
|
+
debug: Schema.optional(Schema.Boolean),
|
|
57
|
+
toolbar: Schema.optional(Schema.Boolean),
|
|
58
|
+
typewriter: Schema.optional(Schema.String),
|
|
59
|
+
// TODO(burdon): Per document settings.
|
|
60
|
+
numberedHeadings: Schema.optional(Schema.Boolean),
|
|
61
|
+
folding: Schema.optional(Schema.Boolean),
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Collection } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
import { SpaceSchema } from '@dxos/react-client/echo';
|
|
11
|
+
import { EditorViewMode } from '@dxos/ui-editor/types';
|
|
12
|
+
|
|
13
|
+
import { meta } from '../meta';
|
|
14
|
+
|
|
15
|
+
import { Document } from './Markdown';
|
|
16
|
+
|
|
17
|
+
const MARKDOWN_OPERATION = `${meta.id}/operation`;
|
|
18
|
+
|
|
19
|
+
export namespace MarkdownOperation {
|
|
20
|
+
export const OnCreateSpace = Operation.make({
|
|
21
|
+
meta: { key: `${MARKDOWN_OPERATION}/on-create-space`, name: 'On Create Space' },
|
|
22
|
+
services: [Capability.Service],
|
|
23
|
+
schema: {
|
|
24
|
+
input: Schema.Struct({
|
|
25
|
+
space: SpaceSchema,
|
|
26
|
+
rootCollection: Collection.Collection,
|
|
27
|
+
isDefault: Schema.optional(Schema.Boolean),
|
|
28
|
+
}),
|
|
29
|
+
output: Schema.Void,
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const Create = Operation.make({
|
|
34
|
+
meta: { key: `${MARKDOWN_OPERATION}/create`, name: 'Create Markdown Document' },
|
|
35
|
+
services: [Capability.Service],
|
|
36
|
+
schema: {
|
|
37
|
+
input: Schema.Struct({
|
|
38
|
+
name: Schema.optional(Schema.String),
|
|
39
|
+
content: Schema.optional(Schema.String),
|
|
40
|
+
}),
|
|
41
|
+
output: Schema.Struct({
|
|
42
|
+
object: Document,
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// TODO(wittjosiah): This appears to be unused.
|
|
48
|
+
export const SetViewMode = Operation.make({
|
|
49
|
+
meta: { key: `${MARKDOWN_OPERATION}/set-view-mode`, name: 'Set View Mode' },
|
|
50
|
+
services: [Capability.Service],
|
|
51
|
+
schema: {
|
|
52
|
+
input: Schema.Struct({
|
|
53
|
+
id: Schema.String,
|
|
54
|
+
viewMode: EditorViewMode,
|
|
55
|
+
}),
|
|
56
|
+
output: Schema.Void,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Atom } from '@effect-atom/atom-react';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Capability } from '@dxos/app-framework';
|
|
9
|
+
import { type EditorStateStore, type EditorViewMode } from '@dxos/ui-editor';
|
|
10
|
+
|
|
11
|
+
import { meta } from '../meta';
|
|
12
|
+
|
|
13
|
+
import type * as Markdown from './Markdown';
|
|
14
|
+
import { type MarkdownExtensionProvider } from './types';
|
|
15
|
+
|
|
16
|
+
/** Schema for persisted markdown state. */
|
|
17
|
+
export const MarkdownStateSchema = Schema.mutable(
|
|
18
|
+
Schema.Struct({
|
|
19
|
+
viewMode: Schema.Record({ key: Schema.String, value: Schema.String }),
|
|
20
|
+
}),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
export type MarkdownState = {
|
|
24
|
+
viewMode: Record<string, EditorViewMode>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export namespace MarkdownCapabilities {
|
|
28
|
+
export const Settings = Capability.make<Atom.Writable<Markdown.Settings>>(`${meta.id}/capability/settings`);
|
|
29
|
+
|
|
30
|
+
/** Persisted state atom for view mode per document. */
|
|
31
|
+
export const State = Capability.make<Atom.Writable<MarkdownState>>(`${meta.id}/capability/state`);
|
|
32
|
+
|
|
33
|
+
/** Editor state store for cursor positions, scroll state, etc. */
|
|
34
|
+
export const EditorState = Capability.make<EditorStateStore>(`${meta.id}/capability/editor-state`);
|
|
35
|
+
|
|
36
|
+
// TODO(burdon): Move to ./types (external API)?
|
|
37
|
+
export const Extensions = Capability.make<MarkdownExtensionProvider[]>(`${meta.id}/capability/extensions`);
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ActivationEvent } from '@dxos/app-framework';
|
|
6
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
7
|
+
|
|
8
|
+
import { meta } from '../meta';
|
|
9
|
+
|
|
10
|
+
export namespace MarkdownEvents {
|
|
11
|
+
export const SetupExtensions: ActivationEvent.ActivationEvent = AppActivationEvents.createStateEvent(
|
|
12
|
+
`${meta.id}/event/setup-extensions`,
|
|
13
|
+
);
|
|
14
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -2,5 +2,10 @@
|
|
|
2
2
|
// Copyright 2024 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export * from './
|
|
5
|
+
export * as MarkdownAction from './MarkdownAction';
|
|
6
|
+
export { MarkdownOperation } from './MarkdownAction';
|
|
7
|
+
export * as Markdown from './Markdown';
|
|
8
|
+
|
|
9
|
+
export * from './capabilities';
|
|
10
|
+
export * from './events';
|
|
6
11
|
export * from './types';
|
package/src/types/types.ts
CHANGED
|
@@ -2,44 +2,17 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { type Extension } from '@codemirror/state';
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { type Extension } from '@dxos/react-ui-editor';
|
|
9
|
-
import { EditorInputMode, EditorViewMode } from '@dxos/react-ui-editor/types';
|
|
7
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
10
8
|
|
|
11
|
-
import {
|
|
12
|
-
import { MARKDOWN_PLUGIN } from '../meta';
|
|
9
|
+
import { type Document } from './Markdown';
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
// TODO(burdon): Remove these from ./types since not part of plugin-markdown API?
|
|
12
|
+
// TODO(wittjosiah): MarkdownExtensionProvider is a part of the MarkdownCapabilities api which should be in ./types.
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
input: Schema.Struct({
|
|
19
|
-
spaceId: Type.SpaceId,
|
|
20
|
-
name: Schema.optional(Schema.String),
|
|
21
|
-
content: Schema.optional(Schema.String),
|
|
22
|
-
}),
|
|
23
|
-
output: Schema.Struct({
|
|
24
|
-
object: DocumentType,
|
|
25
|
-
}),
|
|
26
|
-
}) {}
|
|
27
|
-
|
|
28
|
-
export class SetViewMode extends Schema.TaggedClass<SetViewMode>()(`${MARKDOWN_ACTION}/set-view-mode`, {
|
|
29
|
-
input: Schema.Struct({
|
|
30
|
-
id: Schema.String,
|
|
31
|
-
viewMode: EditorViewMode,
|
|
32
|
-
}),
|
|
33
|
-
output: Schema.Void,
|
|
34
|
-
}) {}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export type MarkdownProperties = Record<string, any>;
|
|
38
|
-
|
|
39
|
-
// TODO(burdon): Async.
|
|
40
|
-
export type MarkdownExtensionProvider = (props: { document?: DocumentType }) => Extension | undefined;
|
|
41
|
-
|
|
42
|
-
export type OnChange = (text: string) => void;
|
|
14
|
+
// TODO(burdon): Async?
|
|
15
|
+
export type MarkdownExtensionProvider = (props: { document?: Document }) => Extension | undefined;
|
|
43
16
|
|
|
44
17
|
export type MarkdownPluginState = {
|
|
45
18
|
// Codemirror extensions provided by other plugins.
|
|
@@ -49,19 +22,3 @@ export type MarkdownPluginState = {
|
|
|
49
22
|
// View mode per document.
|
|
50
23
|
viewMode: Record<string, EditorViewMode>;
|
|
51
24
|
};
|
|
52
|
-
|
|
53
|
-
export const MarkdownSettingsSchema = Schema.mutable(
|
|
54
|
-
Schema.Struct({
|
|
55
|
-
defaultViewMode: EditorViewMode,
|
|
56
|
-
editorInputMode: Schema.optional(EditorInputMode),
|
|
57
|
-
experimental: Schema.optional(Schema.Boolean),
|
|
58
|
-
debug: Schema.optional(Schema.Boolean),
|
|
59
|
-
toolbar: Schema.optional(Schema.Boolean),
|
|
60
|
-
typewriter: Schema.optional(Schema.String),
|
|
61
|
-
// TODO(burdon): Per document settings.
|
|
62
|
-
numberedHeadings: Schema.optional(Schema.Boolean),
|
|
63
|
-
folding: Schema.optional(Schema.Boolean),
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
export type MarkdownSettingsProps = Schema.Schema.Type<typeof MarkdownSettingsSchema>;
|
package/src/util.test.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { describe, expect, it } from 'vitest';
|
|
6
|
+
|
|
7
|
+
import { trim } from '@dxos/util';
|
|
8
|
+
|
|
9
|
+
import { getFallbackName } from './util';
|
|
10
|
+
|
|
11
|
+
describe('markdown utils', () => {
|
|
12
|
+
it('getFallbackName', () => {
|
|
13
|
+
const tests = [
|
|
14
|
+
{
|
|
15
|
+
content: '',
|
|
16
|
+
expected: '',
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
content: trim`
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
# Welcome to Composer by DXOS
|
|
23
|
+
|
|
24
|
+
## What is Composer?
|
|
25
|
+
`,
|
|
26
|
+
expected: 'Welcome to Composer by DXOS',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
content: trim`
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
This document is about the decetralized platform DXOS.
|
|
35
|
+
`,
|
|
36
|
+
expected: 'This document is about the…',
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
tests.forEach(({ content, expected }) => {
|
|
41
|
+
expect(getFallbackName(content)).toBe(expected);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
package/src/util.tsx
CHANGED
|
@@ -3,11 +3,25 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { debounce } from '@dxos/async';
|
|
6
|
-
import { Obj
|
|
6
|
+
import { Obj } from '@dxos/echo';
|
|
7
7
|
import { type TypedObjectSerializer } from '@dxos/plugin-space/types';
|
|
8
|
-
import { DataType } from '@dxos/schema';
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import { Markdown } from './types';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Checks if an object conforms to the interface needed to render an editor.
|
|
13
|
+
* @deprecated Use Schema.instanceOf(Markdown.Document, data)
|
|
14
|
+
*/
|
|
15
|
+
// TODO(burdon): Normalize types (from FilesPlugin).
|
|
16
|
+
export const isEditorModel = (data: any): data is { id: string; text: string } =>
|
|
17
|
+
data &&
|
|
18
|
+
typeof data === 'object' &&
|
|
19
|
+
'id' in data &&
|
|
20
|
+
typeof data.id === 'string' &&
|
|
21
|
+
'text' in data &&
|
|
22
|
+
typeof data.text === 'string';
|
|
23
|
+
|
|
24
|
+
export type MarkdownProperties = Record<string, any>;
|
|
11
25
|
|
|
12
26
|
export const isMarkdownProperties = (data: unknown): data is MarkdownProperties =>
|
|
13
27
|
(Obj.isObject(data) as boolean)
|
|
@@ -18,22 +32,97 @@ export const isMarkdownProperties = (data: unknown): data is MarkdownProperties
|
|
|
18
32
|
|
|
19
33
|
const nonTitleChars = /[^\w ]/g;
|
|
20
34
|
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
// Lines matching these patterns are skipped.
|
|
36
|
+
const skipPatterns = [
|
|
37
|
+
/^!\[/, // Image.
|
|
38
|
+
/^---\s*$/, // Horizontal rule.
|
|
39
|
+
/^```/, // Code block fence.
|
|
40
|
+
/^\s*$/, // Empty or whitespace-only.
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
// Patterns to extract title text (first capture group is used).
|
|
44
|
+
const titlePatterns = [
|
|
45
|
+
/^#{1,6}\s+(.+)/, // Heading.
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Extracts a fallback name by scanning lines for the first heading or text fragment.
|
|
50
|
+
*/
|
|
51
|
+
export const getFallbackName = (content = ''): string => {
|
|
52
|
+
const len = content.length;
|
|
53
|
+
|
|
54
|
+
let i = 0;
|
|
55
|
+
while (i < len) {
|
|
56
|
+
// Find end of line.
|
|
57
|
+
let lineEnd = i;
|
|
58
|
+
while (lineEnd < len && content[lineEnd] !== '\n') {
|
|
59
|
+
lineEnd++;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const line = content.slice(i, lineEnd).trim();
|
|
63
|
+
i = lineEnd + 1;
|
|
64
|
+
|
|
65
|
+
// Skip lines matching skip patterns.
|
|
66
|
+
if (skipPatterns.some((pattern) => pattern.test(line))) {
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Check for title patterns.
|
|
71
|
+
for (const pattern of titlePatterns) {
|
|
72
|
+
const match = pattern.exec(line);
|
|
73
|
+
if (match) {
|
|
74
|
+
const text = match[1].replaceAll(nonTitleChars, '').trim();
|
|
75
|
+
if (text.length > 0) {
|
|
76
|
+
return text;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Use line as plain text fallback.
|
|
82
|
+
const maxLen = 32;
|
|
83
|
+
const text = line.replaceAll(nonTitleChars, '').trim();
|
|
84
|
+
if (text.length > 0) {
|
|
85
|
+
if (text.length > maxLen) {
|
|
86
|
+
const words = text.split(/\s+/);
|
|
87
|
+
let result = '';
|
|
88
|
+
for (const word of words) {
|
|
89
|
+
const next = result.length === 0 ? word : result + ' ' + word;
|
|
90
|
+
if (next.length > maxLen) {
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
result = next;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return result + '…';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return text;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return '';
|
|
23
104
|
};
|
|
24
105
|
|
|
25
|
-
|
|
26
|
-
|
|
106
|
+
// TODO(burdon): Option to strip Markdown.
|
|
107
|
+
export const getContentSnippet = (content = '', maxLines = 3) => {
|
|
108
|
+
const abstract = content
|
|
109
|
+
.split('\n')
|
|
110
|
+
.filter((line) => !line.startsWith('!'))
|
|
111
|
+
.filter((line) => line.trim() !== '');
|
|
112
|
+
|
|
113
|
+
return abstract.slice(0, maxLines).join('\n') ?? '';
|
|
27
114
|
};
|
|
28
115
|
|
|
29
|
-
export const setFallbackName = debounce((doc:
|
|
116
|
+
export const setFallbackName = debounce((doc: Markdown.Document, content = '') => {
|
|
30
117
|
const name = getFallbackName(content);
|
|
31
118
|
if (doc.fallbackName !== name) {
|
|
32
|
-
doc
|
|
119
|
+
Obj.change(doc, (d) => {
|
|
120
|
+
d.fallbackName = name;
|
|
121
|
+
});
|
|
33
122
|
}
|
|
34
123
|
}, 200);
|
|
35
124
|
|
|
36
|
-
export const serializer: TypedObjectSerializer<
|
|
125
|
+
export const serializer: TypedObjectSerializer<Markdown.Document> = {
|
|
37
126
|
serialize: async ({ object }): Promise<string> => {
|
|
38
127
|
const { content } = await object.content.load();
|
|
39
128
|
return JSON.stringify({ name: object.name, fallbackName: object.fallbackName, content });
|
|
@@ -41,6 +130,6 @@ export const serializer: TypedObjectSerializer<DocumentType> = {
|
|
|
41
130
|
|
|
42
131
|
deserialize: async ({ content: serialized }) => {
|
|
43
132
|
const { name, fallbackName, content } = JSON.parse(serialized);
|
|
44
|
-
return
|
|
133
|
+
return Markdown.make({ name, fallbackName, content });
|
|
45
134
|
},
|
|
46
135
|
};
|