@dxos/plugin-markdown 0.8.4-main.fcfe5033a5 → 0.8.4-staging.60fe92afc8
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/LICENSE +102 -5
- package/README.md +1 -1
- package/dist/lib/neutral/EditableMarkdownCard-AW7MD35U.mjs +34 -0
- package/dist/lib/neutral/EditableMarkdownCard-AW7MD35U.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownArticle-LWT5RFFJ.mjs +126 -0
- package/dist/lib/neutral/MarkdownArticle-LWT5RFFJ.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownCard-TBLIRDBO.mjs +108 -0
- package/dist/lib/neutral/MarkdownCard-TBLIRDBO.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs +62 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.node.mjs +25 -0
- package/dist/lib/neutral/MarkdownPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs +23 -0
- package/dist/lib/neutral/MarkdownPlugin.workerd.mjs.map +7 -0
- package/dist/lib/{browser/MarkdownSettings-62YSRY7L.mjs → neutral/MarkdownSettings-YCTZJL5V.mjs} +4 -4
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs.map +7 -0
- package/dist/lib/neutral/anchor-sort-UXN4RHFX.mjs +32 -0
- package/dist/lib/neutral/anchor-sort-UXN4RHFX.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-builder-BWBA23FF.mjs +67 -0
- package/dist/lib/neutral/app-graph-builder-BWBA23FF.mjs.map +7 -0
- package/dist/lib/neutral/app-graph-serializer-EN5E3BMG.mjs +56 -0
- package/dist/lib/neutral/app-graph-serializer-EN5E3BMG.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-DSPXK77L.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-DSPXK77L.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +29 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/node.mjs +11 -0
- package/dist/lib/neutral/capabilities/node.mjs.map +7 -0
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs +30 -0
- package/dist/lib/neutral/chunk-36QFEVOZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-67DKWOKF.mjs +10 -0
- package/dist/lib/neutral/chunk-67DKWOKF.mjs.map +7 -0
- package/dist/lib/neutral/chunk-CIJD7P6X.mjs +8 -0
- package/dist/lib/neutral/chunk-CIJD7P6X.mjs.map +7 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs +98 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs.map +7 -0
- package/dist/lib/{browser/blueprints/index.mjs → neutral/chunk-LXNSKCPD.mjs} +10 -17
- package/dist/lib/neutral/chunk-LXNSKCPD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Y2LQRUU7.mjs +285 -0
- package/dist/lib/neutral/chunk-Y2LQRUU7.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-EGY7RPPW.mjs +32 -0
- package/dist/lib/neutral/comment-config-EGY7RPPW.mjs.map +7 -0
- package/dist/lib/{browser → neutral/components}/index.mjs +33 -287
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +13 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-JK35XC4R.mjs +29 -0
- package/dist/lib/neutral/create-JK35XC4R.mjs.map +7 -0
- package/dist/lib/{browser/create-markdown-LU5IDKMH.mjs → neutral/create-markdown-7MLE625M.mjs} +5 -7
- package/dist/lib/neutral/create-markdown-7MLE625M.mjs.map +7 -0
- package/dist/lib/neutral/create-object-MU2LGXG6.mjs +31 -0
- package/dist/lib/neutral/create-object-MU2LGXG6.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +317 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +48 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/navigation-resolver-3KBOMN4U.mjs +14 -0
- package/dist/lib/neutral/navigation-resolver-3KBOMN4U.mjs.map +7 -0
- package/dist/lib/{browser/open-AFSOZZ6G.mjs → neutral/open-5YC77C4O.mjs} +5 -6
- package/dist/lib/neutral/open-5YC77C4O.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-2ARMPBGZ.mjs +13 -0
- package/dist/lib/neutral/operation-handler-2ARMPBGZ.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-XYZJBKHZ.mjs +119 -0
- package/dist/lib/neutral/react-surface-XYZJBKHZ.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-GAFB7W55.mjs +38 -0
- package/dist/lib/neutral/scroll-to-anchor-GAFB7W55.mjs.map +7 -0
- package/dist/lib/neutral/set-view-mode-N7UHYMPG.mjs +24 -0
- package/dist/lib/neutral/set-view-mode-N7UHYMPG.mjs.map +7 -0
- package/dist/lib/neutral/settings-TDGDLCUR.mjs +34 -0
- package/dist/lib/neutral/settings-TDGDLCUR.mjs.map +7 -0
- package/dist/lib/neutral/state-5COCF5PN.mjs +44 -0
- package/dist/lib/neutral/state-5COCF5PN.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +30 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +44 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/lib/{browser/update-HZNVYBMO.mjs → neutral/update-markdown-NNINDDV5.mjs} +9 -10
- package/dist/lib/neutral/update-markdown-NNINDDV5.mjs.map +7 -0
- package/dist/types/src/MarkdownPlugin.d.ts +1 -0
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/{cli/plugin.d.ts → MarkdownPlugin.node.d.ts} +2 -1
- package/dist/types/src/MarkdownPlugin.node.d.ts.map +1 -0
- package/dist/types/src/MarkdownPlugin.test.d.ts +2 -0
- package/dist/types/src/MarkdownPlugin.test.d.ts.map +1 -0
- package/dist/types/src/MarkdownPlugin.workerd.d.ts +4 -0
- package/dist/types/src/MarkdownPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +6 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/comment-config.d.ts +6 -0
- package/dist/types/src/capabilities/comment-config.d.ts.map +1 -0
- package/dist/types/src/capabilities/create-object.d.ts +11 -0
- package/dist/types/src/capabilities/create-object.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +15 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/navigation-resolver.d.ts +6 -0
- package/dist/types/src/capabilities/navigation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/node.d.ts +7 -1
- package/dist/types/src/capabilities/node.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +2 -2
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts +1 -1
- package/dist/types/src/components/MarkdownEditor/FileUpload.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +14 -6
- 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 +2 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +2 -2
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +46 -46
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -1
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.d.ts +15 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.d.ts +9 -0
- package/dist/types/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/containers/EditableMarkdownCard/index.d.ts +3 -0
- package/dist/types/src/containers/EditableMarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/{MarkdownContainer/MarkdownContainer.d.ts → MarkdownArticle/MarkdownArticle.d.ts} +14 -10
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.stories.d.ts +97 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +3 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useEditorMenuOptions.d.ts.map +1 -1
- package/dist/types/src/hooks/useExtensions.d.ts +2 -1
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useLinkQuery.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +1 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create-markdown.d.ts +3 -3
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +3 -3
- package/dist/types/src/operations/create.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +1 -2
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts +3 -3
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/operations/scroll-to-anchor.d.ts +3 -3
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -1
- package/dist/types/src/operations/set-view-mode.d.ts +3 -3
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -1
- package/dist/types/src/operations/update-markdown.d.ts +5 -0
- package/dist/types/src/operations/update-markdown.d.ts.map +1 -0
- package/dist/types/src/paths.d.ts +3 -0
- package/dist/types/src/paths.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/testing.d.ts +1 -0
- package/dist/types/src/testing.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +70 -51
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +12 -10
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownCapabilities.d.ts +32 -0
- package/dist/types/src/types/MarkdownCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/MarkdownEvents.d.ts +3 -0
- package/dist/types/src/types/MarkdownEvents.d.ts.map +1 -0
- package/dist/types/src/{operations/definitions.d.ts → types/MarkdownOperation.d.ts} +17 -17
- package/dist/types/src/types/MarkdownOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +14 -1
- package/dist/types/src/types/Settings.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +3 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +1 -0
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +127 -107
- package/src/MarkdownPlugin.node.ts +20 -0
- package/src/MarkdownPlugin.test.ts +26 -0
- package/src/MarkdownPlugin.tsx +12 -52
- package/src/MarkdownPlugin.workerd.ts +19 -0
- package/src/blueprints/markdown-blueprint.ts +8 -9
- package/src/capabilities/anchor-sort.ts +3 -3
- package/src/capabilities/app-graph-builder.ts +63 -0
- package/src/capabilities/app-graph-serializer.ts +9 -10
- package/src/capabilities/blueprint-definition.ts +6 -4
- package/src/capabilities/comment-config.ts +36 -0
- package/src/capabilities/create-object.ts +33 -0
- package/src/capabilities/index.ts +17 -2
- package/src/capabilities/navigation-resolver.ts +19 -0
- package/src/capabilities/node.ts +3 -1
- package/src/capabilities/operation-handler.ts +1 -1
- package/src/capabilities/react-surface.tsx +17 -10
- package/src/capabilities/state.ts +4 -4
- package/src/components/MarkdownEditor/FileUpload.tsx +42 -37
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +5 -4
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +41 -30
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +4 -3
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +9 -6
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +2 -1
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +3 -3
- package/src/containers/EditableMarkdownCard/EditableMarkdownCard.stories.tsx +86 -0
- package/src/containers/EditableMarkdownCard/EditableMarkdownCard.tsx +44 -0
- package/src/containers/EditableMarkdownCard/index.ts +6 -0
- package/src/containers/{MarkdownContainer/MarkdownContainer.stories.tsx → MarkdownArticle/MarkdownArticle.stories.tsx} +15 -9
- package/src/containers/{MarkdownContainer/MarkdownContainer.tsx → MarkdownArticle/MarkdownArticle.tsx} +8 -7
- package/src/containers/MarkdownArticle/index.ts +6 -0
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +8 -7
- package/src/containers/MarkdownCard/MarkdownCard.tsx +29 -21
- package/src/containers/MarkdownCard/snippet.ts +3 -1
- package/src/containers/index.ts +3 -2
- package/src/hooks/useExtensions.tsx +13 -9
- package/src/hooks/useLinkQuery.ts +21 -35
- package/src/index.ts +3 -7
- package/src/meta.ts +17 -7
- package/src/operations/create-markdown.ts +3 -4
- package/src/operations/create.conversations.json +1 -1
- package/src/operations/create.test.ts +11 -13
- package/src/operations/create.ts +22 -9
- package/src/operations/index.ts +2 -4
- package/src/operations/open.ts +3 -3
- package/src/operations/scroll-to-anchor.ts +18 -16
- package/src/operations/set-view-mode.ts +3 -4
- package/src/operations/{update.ts → update-markdown.ts} +4 -4
- package/src/operations/update.conversations.json +1 -1
- package/src/operations/update.test.ts +14 -16
- package/src/paths.ts +11 -0
- package/src/plugin.ts +11 -0
- package/src/testing.ts +22 -9
- package/src/translations.ts +4 -3
- package/src/types/Markdown.ts +10 -11
- package/src/types/MarkdownCapabilities.ts +51 -0
- package/src/types/MarkdownEvents.ts +14 -0
- package/src/{operations/definitions.ts → types/MarkdownOperation.ts} +24 -11
- package/src/types/Settings.ts +23 -3
- package/src/types/index.ts +3 -2
- package/src/types/types.ts +4 -1
- package/src/util.tsx +2 -2
- package/dist/lib/browser/MarkdownSettings-62YSRY7L.mjs.map +0 -7
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-4KOZEH2H.mjs +0 -121
- package/dist/lib/browser/chunk-4KOZEH2H.mjs.map +0 -7
- package/dist/lib/browser/chunk-QFPZONKP.mjs +0 -158
- package/dist/lib/browser/chunk-QFPZONKP.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -39
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-YL5ELZWP.mjs +0 -30
- package/dist/lib/browser/create-YL5ELZWP.mjs.map +0 -7
- package/dist/lib/browser/create-markdown-LU5IDKMH.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/open-AFSOZZ6G.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -14
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/scroll-to-anchor-IPXV32A6.mjs +0 -49
- package/dist/lib/browser/scroll-to-anchor-IPXV32A6.mjs.map +0 -7
- package/dist/lib/browser/set-view-mode-2QWB24RR.mjs +0 -26
- package/dist/lib/browser/set-view-mode-2QWB24RR.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -16
- package/dist/lib/browser/update-HZNVYBMO.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownSettings-QMPISOEU.mjs +0 -33
- package/dist/lib/node-esm/MarkdownSettings-QMPISOEU.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -52
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3OPDJJJH.mjs +0 -122
- package/dist/lib/node-esm/chunk-3OPDJJJH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-JUGS6RKO.mjs +0 -159
- package/dist/lib/node-esm/chunk-JUGS6RKO.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -40
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-SMQAIM3V.mjs +0 -31
- package/dist/lib/node-esm/create-SMQAIM3V.mjs.map +0 -7
- package/dist/lib/node-esm/create-markdown-X2OASYKG.mjs +0 -23
- package/dist/lib/node-esm/create-markdown-X2OASYKG.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -633
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/open-SRWLLOKE.mjs +0 -22
- package/dist/lib/node-esm/open-SRWLLOKE.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -15
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/scroll-to-anchor-M76GXKYQ.mjs +0 -50
- package/dist/lib/node-esm/scroll-to-anchor-M76GXKYQ.mjs.map +0 -7
- package/dist/lib/node-esm/set-view-mode-6BB6KIDS.mjs +0 -27
- package/dist/lib/node-esm/set-view-mode-6BB6KIDS.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -17
- package/dist/lib/node-esm/update-4CELTLXK.mjs +0 -46
- package/dist/lib/node-esm/update-4CELTLXK.mjs.map +0 -7
- package/dist/types/src/capabilities/artifact-definition.d.ts +0 -5
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/cli/index.d.ts +0 -2
- package/dist/types/src/cli/index.d.ts.map +0 -1
- package/dist/types/src/cli/plugin.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +0 -77
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +0 -3
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +0 -1
- package/dist/types/src/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/operations/update.d.ts +0 -5
- package/dist/types/src/operations/update.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -33
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/events.d.ts +0 -5
- package/dist/types/src/types/events.d.ts.map +0 -1
- package/src/capabilities/artifact-definition.ts +0 -110
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -39
- package/src/containers/MarkdownContainer/index.ts +0 -6
- package/src/types/capabilities.ts +0 -50
- package/src/types/events.ts +0 -14
- /package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{node-esm/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
|
|
9
|
+
import { ProcessManagerPlugin } from '@dxos/app-framework';
|
|
10
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
|
+
import { Filter, Obj } from '@dxos/echo';
|
|
12
|
+
import { ClientPlugin, initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
|
+
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
|
+
import { random } from '@dxos/random';
|
|
15
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
16
|
+
import { Card } from '@dxos/react-ui';
|
|
17
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor/translations';
|
|
18
|
+
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
19
|
+
import { Loading, withTheme } from '@dxos/react-ui/testing';
|
|
20
|
+
import { Text } from '@dxos/schema';
|
|
21
|
+
|
|
22
|
+
import { translations } from '#translations';
|
|
23
|
+
import { Markdown } from '#types';
|
|
24
|
+
|
|
25
|
+
import { EditableMarkdownCard, type EditableMarkdownCardProps } from './EditableMarkdownCard';
|
|
26
|
+
|
|
27
|
+
random.seed(1234);
|
|
28
|
+
|
|
29
|
+
const EditableMarkdownCardStory = ({ ...args }: Omit<EditableMarkdownCardProps, 'subject'>) => {
|
|
30
|
+
const [space] = useSpaces();
|
|
31
|
+
const [doc] = useQuery(space?.db, Filter.type(Markdown.Document));
|
|
32
|
+
if (!doc) {
|
|
33
|
+
return <Loading data={{ space: !!space }} />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<CardContainer icon='ph--text-aa--regular'>
|
|
38
|
+
<Card.Root border={false}>
|
|
39
|
+
<Card.Header>
|
|
40
|
+
<Card.DragHandle />
|
|
41
|
+
<Card.Title>{Obj.getLabel(doc)}</Card.Title>
|
|
42
|
+
<Card.Menu />
|
|
43
|
+
</Card.Header>
|
|
44
|
+
<EditableMarkdownCard subject={doc} {...args} />
|
|
45
|
+
</Card.Root>
|
|
46
|
+
</CardContainer>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const meta: Meta<typeof EditableMarkdownCardStory> = {
|
|
51
|
+
title: 'plugins/plugin-markdown/containers/EditableMarkdownCard',
|
|
52
|
+
component: EditableMarkdownCardStory,
|
|
53
|
+
decorators: [
|
|
54
|
+
withTheme(),
|
|
55
|
+
withPluginManager({
|
|
56
|
+
plugins: [
|
|
57
|
+
...corePlugins(),
|
|
58
|
+
ProcessManagerPlugin(),
|
|
59
|
+
ClientPlugin({
|
|
60
|
+
types: [Markdown.Document, Text.Text],
|
|
61
|
+
onClientInitialized: ({ client }) =>
|
|
62
|
+
Effect.gen(function* () {
|
|
63
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
64
|
+
personalSpace.db.add(
|
|
65
|
+
Markdown.make({
|
|
66
|
+
name: random.lorem.words(3),
|
|
67
|
+
content: '# Title\n' + random.lorem.paragraphs(3),
|
|
68
|
+
}),
|
|
69
|
+
);
|
|
70
|
+
}),
|
|
71
|
+
}),
|
|
72
|
+
],
|
|
73
|
+
}),
|
|
74
|
+
],
|
|
75
|
+
parameters: {
|
|
76
|
+
layout: 'centered',
|
|
77
|
+
translations: [...translations, ...editorTranslations],
|
|
78
|
+
},
|
|
79
|
+
tags: ['cards'],
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export default meta;
|
|
83
|
+
|
|
84
|
+
type Story = StoryObj<typeof meta>;
|
|
85
|
+
|
|
86
|
+
export const Default: Story = {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2026 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { Obj } from '@dxos/echo';
|
|
8
|
+
import { useObject } from '@dxos/react-client/echo';
|
|
9
|
+
import { Card } from '@dxos/react-ui';
|
|
10
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
11
|
+
import { Text } from '@dxos/schema';
|
|
12
|
+
|
|
13
|
+
import { MarkdownEditor, MarkdownEditorProvider } from '#components';
|
|
14
|
+
import { Markdown } from '#types';
|
|
15
|
+
|
|
16
|
+
export type EditableMarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Full-bleed editable variant of {@link MarkdownCard}. Activated by the host
|
|
20
|
+
* passing `editable: true` on the card surface data (e.g. plugin-board cells).
|
|
21
|
+
* Renders a plain editor (no app-graph toolbar / file upload / link queries)
|
|
22
|
+
* so it stays self-contained inside the card; the regular MarkdownArticle
|
|
23
|
+
* remains the canonical surface for full article views.
|
|
24
|
+
*/
|
|
25
|
+
export const EditableMarkdownCard = ({ subject }: EditableMarkdownCardProps) => {
|
|
26
|
+
const id = Obj.getURI(subject);
|
|
27
|
+
const [docContent] = useObject(Obj.instanceOf(Markdown.Document, subject) ? subject.content : undefined, 'content');
|
|
28
|
+
const [textContent] = useObject(Obj.instanceOf(Text.Text, subject) ? subject : undefined, 'content');
|
|
29
|
+
const initialValue = docContent ?? textContent;
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Card.Section classNames='overflow-hidden'>
|
|
33
|
+
<Card.Row fullWidth>
|
|
34
|
+
<MarkdownEditorProvider id={id} object={subject} viewMode='source'>
|
|
35
|
+
{(editorRootProps) => (
|
|
36
|
+
<Editor.Root {...editorRootProps}>
|
|
37
|
+
<MarkdownEditor.Content compact initialValue={initialValue} />
|
|
38
|
+
</Editor.Root>
|
|
39
|
+
)}
|
|
40
|
+
</MarkdownEditorProvider>
|
|
41
|
+
</Card.Row>
|
|
42
|
+
</Card.Section>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
@@ -12,9 +12,10 @@ import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
|
12
12
|
import { AppActivationEvents, LayoutOperation } from '@dxos/app-toolkit';
|
|
13
13
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
14
14
|
import { Obj, Query } from '@dxos/echo';
|
|
15
|
-
import {
|
|
15
|
+
import { DXN } from '@dxos/keys';
|
|
16
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
16
17
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
18
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
18
19
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
19
20
|
import { random } from '@dxos/random';
|
|
20
21
|
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
@@ -25,21 +26,26 @@ import { Text } from '@dxos/schema';
|
|
|
25
26
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
26
27
|
import { Organization, Person } from '@dxos/types';
|
|
27
28
|
|
|
29
|
+
import { translations } from '#translations';
|
|
28
30
|
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '#types';
|
|
29
31
|
|
|
30
32
|
import { MarkdownPlugin } from '../../MarkdownPlugin';
|
|
31
|
-
import { translations } from '../../translations';
|
|
32
33
|
|
|
33
34
|
random.seed(1);
|
|
34
35
|
|
|
35
36
|
const generator: ValueGenerator = random as any;
|
|
36
37
|
|
|
37
38
|
/** Minimal plugin that contributes an empty Extensions capability for stories. */
|
|
38
|
-
const MarkdownExtensionsPlugin = Plugin.define(
|
|
39
|
+
const MarkdownExtensionsPlugin = Plugin.define(
|
|
40
|
+
Plugin.makeMeta({
|
|
41
|
+
key: DXN.make('org.dxos.plugin.markdown.story.markdownExtensions'),
|
|
42
|
+
name: 'Story Extensions',
|
|
43
|
+
}),
|
|
44
|
+
).pipe(
|
|
39
45
|
Plugin.addModule({
|
|
40
46
|
id: 'extensions',
|
|
41
47
|
activatesOn: MarkdownEvents.SetupExtensions,
|
|
42
|
-
activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.
|
|
48
|
+
activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.ExtensionProvider, [])),
|
|
43
49
|
}),
|
|
44
50
|
Plugin.make,
|
|
45
51
|
);
|
|
@@ -48,7 +54,7 @@ const DefaultStory = () => {
|
|
|
48
54
|
const { invokePromise } = useOperationInvoker();
|
|
49
55
|
const [space] = useSpaces();
|
|
50
56
|
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
51
|
-
const id = doc && Obj.
|
|
57
|
+
const id = doc && Obj.getURI(doc);
|
|
52
58
|
const data = useMemo(() => ({ subject: doc, attendableId: id ?? 'story' }), [doc, id]);
|
|
53
59
|
const attentionAttrs = useAttentionAttributes(id);
|
|
54
60
|
|
|
@@ -66,7 +72,7 @@ const DefaultStory = () => {
|
|
|
66
72
|
};
|
|
67
73
|
|
|
68
74
|
const meta = {
|
|
69
|
-
title: 'plugins/plugin-markdown/containers/
|
|
75
|
+
title: 'plugins/plugin-markdown/containers/MarkdownArticle',
|
|
70
76
|
render: DefaultStory,
|
|
71
77
|
decorators: [
|
|
72
78
|
withLayout({ layout: 'column' }),
|
|
@@ -98,8 +104,8 @@ const meta = {
|
|
|
98
104
|
context.args.content ?? '',
|
|
99
105
|
// TODO(burdon): Popovers not currently working.
|
|
100
106
|
'## Here are some objects',
|
|
101
|
-
`})`,
|
|
108
|
+
`})`,
|
|
103
109
|
'',
|
|
104
110
|
'END',
|
|
105
111
|
'',
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import { useLinkQuery } from '#hooks';
|
|
27
27
|
import { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '#types';
|
|
28
28
|
|
|
29
|
-
export type
|
|
29
|
+
export type MarkdownArticleProps = AppSurface.ObjectArticleProps<
|
|
30
30
|
Markdown.Document | Text.Text,
|
|
31
31
|
{
|
|
32
32
|
id: string;
|
|
@@ -37,9 +37,9 @@ export type MarkdownContainerProps = AppSurface.ObjectArticleProps<
|
|
|
37
37
|
Pick<MarkdownEditorContentProps, 'editorStateStore'>
|
|
38
38
|
>;
|
|
39
39
|
|
|
40
|
-
export const
|
|
40
|
+
export const MarkdownArticle = forwardRef<HTMLDivElement, MarkdownArticleProps>(
|
|
41
41
|
(
|
|
42
|
-
{ role, subject: object, id, attendableId, settings, extensionProviders, onSelectObject, ...props },
|
|
42
|
+
{ role, subject: object, id, attendableId, settings, extensionProviders, onSelectObject, viewMode, ...props },
|
|
43
43
|
forwardedRef,
|
|
44
44
|
) => {
|
|
45
45
|
const db = Obj.isObject(object) ? Obj.getDatabase(object) : undefined;
|
|
@@ -48,24 +48,24 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
48
48
|
const initialValue = docContent ?? textContent;
|
|
49
49
|
|
|
50
50
|
// Extensions from other plugins.
|
|
51
|
-
const otherExtensionProviders = useCapabilities(MarkdownCapabilities.
|
|
51
|
+
const otherExtensionProviders = useCapabilities(MarkdownCapabilities.ExtensionProvider);
|
|
52
52
|
const extensions = useMemo<Extension[]>(() => {
|
|
53
53
|
if (!Obj.instanceOf(Markdown.Document, object) && !Obj.instanceOf(Text.Text, object)) {
|
|
54
54
|
return [];
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
const document = Obj.instanceOf(Markdown.Document, object) ? object : undefined;
|
|
57
58
|
return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]
|
|
58
59
|
.flat()
|
|
59
60
|
.reduce((acc: Extension[], provider) => {
|
|
60
|
-
const extension =
|
|
61
|
-
typeof provider === 'function' ? provider({ document: object as Markdown.Document }) : provider;
|
|
61
|
+
const extension = typeof provider === 'function' ? provider({ document, viewMode }) : provider;
|
|
62
62
|
if (extension) {
|
|
63
63
|
acc.push(extension);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return acc;
|
|
67
67
|
}, []);
|
|
68
|
-
}, [extensionProviders, otherExtensionProviders, object]);
|
|
68
|
+
}, [extensionProviders, otherExtensionProviders, object, viewMode]);
|
|
69
69
|
|
|
70
70
|
// Toolbar actions from app graph.
|
|
71
71
|
const { graph } = useAppGraph();
|
|
@@ -118,6 +118,7 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
118
118
|
compact={role !== 'article'}
|
|
119
119
|
extensions={extensions}
|
|
120
120
|
settings={settings}
|
|
121
|
+
viewMode={viewMode}
|
|
121
122
|
onAction={runAction}
|
|
122
123
|
onFileUpload={handleFileUpload}
|
|
123
124
|
onLinkQuery={handleLinkQuery}
|
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import { ProcessManagerPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
|
-
import { Markdown } from '@dxos/plugin-markdown
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
13
13
|
import { random } from '@dxos/random';
|
|
14
14
|
import { Card } from '@dxos/react-ui';
|
|
15
15
|
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
16
16
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
17
|
|
|
18
|
-
import { translations } from '
|
|
18
|
+
import { translations } from '#translations';
|
|
19
|
+
|
|
19
20
|
import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
20
21
|
|
|
21
22
|
random.seed(1234);
|
|
@@ -33,11 +34,11 @@ const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
|
33
34
|
return (
|
|
34
35
|
<CardContainer icon='ph--text-aa--regular'>
|
|
35
36
|
<Card.Root border={false}>
|
|
36
|
-
<Card.
|
|
37
|
+
<Card.Header>
|
|
37
38
|
<Card.DragHandle />
|
|
38
39
|
<Card.Title>{Obj.getLabel(subject)}</Card.Title>
|
|
39
40
|
<Card.Menu />
|
|
40
|
-
</Card.
|
|
41
|
+
</Card.Header>
|
|
41
42
|
<MarkdownCard subject={subject} {...args} />
|
|
42
43
|
</Card.Root>
|
|
43
44
|
</CardContainer>
|
|
@@ -50,7 +51,7 @@ const meta: Meta<typeof MarkdownCardStory> = {
|
|
|
50
51
|
decorators: [
|
|
51
52
|
withTheme(),
|
|
52
53
|
withPluginManager({
|
|
53
|
-
plugins: [
|
|
54
|
+
plugins: [ProcessManagerPlugin(), ClientPlugin({})],
|
|
54
55
|
}),
|
|
55
56
|
],
|
|
56
57
|
parameters: {
|
|
@@ -21,39 +21,47 @@ export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
|
21
21
|
|
|
22
22
|
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
23
23
|
const { t } = useTranslation(meta.id);
|
|
24
|
-
|
|
24
|
+
// NOTE: Newline is added so that Fade does not obscure the last line.
|
|
25
|
+
const snippet = useMemo(() => getSnippet(subject) + '\n', [subject]);
|
|
25
26
|
const extensions = useMemo(() => [snippetExtension({ height: 300, scale: 0.8 })], []);
|
|
26
27
|
const info = getInfo(subject);
|
|
27
28
|
|
|
28
29
|
return (
|
|
29
|
-
<Card.
|
|
30
|
+
<Card.Body>
|
|
30
31
|
{snippet && (
|
|
31
|
-
<Card.Section className='relative
|
|
32
|
-
<
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
'z-10 absolute bottom-0 inset-x-0 h-12 w-full',
|
|
43
|
-
'bg-gradient-to-b from-transparent to-(--surface-bg) pointer-events-none',
|
|
44
|
-
)}
|
|
45
|
-
/>
|
|
32
|
+
<Card.Section className='relative'>
|
|
33
|
+
<Card.Row fullWidth>
|
|
34
|
+
<MarkdownEditorProvider id={subject.id} viewMode='readonly' extensions={extensions}>
|
|
35
|
+
{(editorRootProps) => (
|
|
36
|
+
<Editor.Root {...editorRootProps}>
|
|
37
|
+
<MarkdownEditor.Content initialValue={snippet} slots={{ content: { className: 'px-2!' } }} compact />
|
|
38
|
+
</Editor.Root>
|
|
39
|
+
)}
|
|
40
|
+
</MarkdownEditorProvider>
|
|
41
|
+
<Fade />
|
|
42
|
+
</Card.Row>
|
|
46
43
|
</Card.Section>
|
|
47
44
|
)}
|
|
48
45
|
<Card.Section>
|
|
49
|
-
<Card.
|
|
50
|
-
|
|
51
|
-
|
|
46
|
+
<Card.Row fullWidth>
|
|
47
|
+
<Card.Text classNames='px-2 text-xs text-description'>
|
|
48
|
+
{info.words} {t('words.label', { count: info.words })}
|
|
49
|
+
</Card.Text>
|
|
50
|
+
</Card.Row>
|
|
52
51
|
</Card.Section>
|
|
53
|
-
</Card.
|
|
52
|
+
</Card.Body>
|
|
54
53
|
);
|
|
55
54
|
};
|
|
56
55
|
|
|
56
|
+
const Fade = () => (
|
|
57
|
+
<div
|
|
58
|
+
className={mx(
|
|
59
|
+
'z-10 absolute bottom-0 inset-x-0 h-6 w-full',
|
|
60
|
+
'bg-gradient-to-b from-transparent to-(--surface-bg) pointer-events-none',
|
|
61
|
+
)}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
|
|
57
65
|
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string, maxLines = 16) => {
|
|
58
66
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
59
67
|
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, maxLines);
|
|
@@ -26,7 +26,9 @@ export const snippet = ({ height, scale = 1 }: SnippetOptions) => {
|
|
|
26
26
|
EditorState.readOnly.of(true),
|
|
27
27
|
EditorView.editable.of(false),
|
|
28
28
|
EditorState.transactionFilter.of((tr) => {
|
|
29
|
-
if (tr.selection)
|
|
29
|
+
if (tr.selection) {
|
|
30
|
+
return [];
|
|
31
|
+
} // Drop any selection changes.
|
|
30
32
|
return tr;
|
|
31
33
|
}),
|
|
32
34
|
EditorView.theme({
|
package/src/containers/index.ts
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
import { type ComponentType, lazy } from 'react';
|
|
6
6
|
|
|
7
|
-
export type {
|
|
7
|
+
export type { MarkdownArticleProps } from './MarkdownArticle';
|
|
8
8
|
|
|
9
9
|
export const MarkdownCard: ComponentType<any> = lazy(() => import('./MarkdownCard'));
|
|
10
|
-
export const
|
|
10
|
+
export const EditableMarkdownCard: ComponentType<any> = lazy(() => import('./EditableMarkdownCard'));
|
|
11
|
+
export const MarkdownArticle: ComponentType<any> = lazy(() => import('./MarkdownArticle'));
|
|
@@ -8,7 +8,7 @@ import { useMemo } from 'react';
|
|
|
8
8
|
import { fromUrlPath } from '@dxos/app-toolkit';
|
|
9
9
|
import { debounceAndThrottle } from '@dxos/async';
|
|
10
10
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { createDocAccessor } from '@dxos/echo-
|
|
11
|
+
import { createDocAccessor } from '@dxos/echo-client';
|
|
12
12
|
import { invariant } from '@dxos/invariant';
|
|
13
13
|
import { getSpace, useObject } from '@dxos/react-client/echo';
|
|
14
14
|
import { useIdentity } from '@dxos/react-client/halo';
|
|
@@ -20,11 +20,9 @@ import {
|
|
|
20
20
|
Cursor,
|
|
21
21
|
type EditorStateStore,
|
|
22
22
|
EditorView,
|
|
23
|
-
type EditorViewMode,
|
|
24
23
|
type Extension,
|
|
25
24
|
InputModeExtensions,
|
|
26
25
|
type PreviewOptions,
|
|
27
|
-
type RenderCallback,
|
|
28
26
|
createDataExtensions,
|
|
29
27
|
decorateMarkdown,
|
|
30
28
|
documentId,
|
|
@@ -35,8 +33,9 @@ import {
|
|
|
35
33
|
preview,
|
|
36
34
|
replacer,
|
|
37
35
|
selectionState,
|
|
38
|
-
|
|
36
|
+
snippets,
|
|
39
37
|
} from '@dxos/ui-editor';
|
|
38
|
+
import { type EditorViewMode, type RenderCallback } from '@dxos/ui-editor/types';
|
|
40
39
|
import { isTruthy, safeUrl } from '@dxos/util';
|
|
41
40
|
|
|
42
41
|
import { Markdown } from '#types';
|
|
@@ -113,7 +112,6 @@ export const useExtensions = ({
|
|
|
113
112
|
settings?.editorInputMode,
|
|
114
113
|
settings?.folding,
|
|
115
114
|
settings?.numberedHeadings,
|
|
116
|
-
settings?.typewriter,
|
|
117
115
|
platform,
|
|
118
116
|
onSelectObject,
|
|
119
117
|
],
|
|
@@ -188,9 +186,9 @@ const createBaseExtensions = ({
|
|
|
188
186
|
}
|
|
189
187
|
|
|
190
188
|
if (settings?.debug) {
|
|
191
|
-
const items = settings.
|
|
189
|
+
const items = settings.snippets?.split(/[,\n]/) ?? '';
|
|
192
190
|
if (items) {
|
|
193
|
-
extensions.push(
|
|
191
|
+
extensions.push(snippets({ items }));
|
|
194
192
|
}
|
|
195
193
|
}
|
|
196
194
|
|
|
@@ -202,12 +200,18 @@ const selectionChange = (selectionManager: SelectionManager) => {
|
|
|
202
200
|
const id = update.state.facet(documentId);
|
|
203
201
|
const cursorConverter = update.state.facet(Cursor.converter);
|
|
204
202
|
const selection = update.state.selection;
|
|
203
|
+
// NOTE: Filter on numeric offsets BEFORE converting to cursor strings.
|
|
204
|
+
// Cursors are opaque (Automerge-encoded), so a lexicographic `to > from`
|
|
205
|
+
// comparison is nondeterministic — it would let some cursor-placements
|
|
206
|
+
// (where from === to numerically) through and reject genuine selections
|
|
207
|
+
// depending on encoding, which made the comment button's enabled state
|
|
208
|
+
// appear random across different lines.
|
|
205
209
|
const ranges = selection.ranges
|
|
210
|
+
.filter((range) => range.to > range.from)
|
|
206
211
|
.map((range) => ({
|
|
207
212
|
from: cursorConverter.toCursor(range.from),
|
|
208
213
|
to: cursorConverter.toCursor(range.to),
|
|
209
|
-
}))
|
|
210
|
-
.filter(({ from, to }) => to > from);
|
|
214
|
+
}));
|
|
211
215
|
|
|
212
216
|
selectionManager.updateMultiRange(id, ranges);
|
|
213
217
|
}, 100);
|
|
@@ -5,11 +5,10 @@
|
|
|
5
5
|
import * as Option from 'effect/Option';
|
|
6
6
|
import { useCallback, useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Annotation, type Database, Filter, Obj, Query, Type } from '@dxos/echo';
|
|
9
|
+
import { HiddenAnnotation, getTypeAnnotation } from '@dxos/echo/Annotation';
|
|
10
|
+
import { Kind as EntityKind } from '@dxos/echo/Entity';
|
|
11
|
+
import { type Label, toLocalizedString, useTranslation } from '@dxos/react-ui';
|
|
13
12
|
import { type EditorMenuGroup, type EditorMenuItem } from '@dxos/react-ui-editor';
|
|
14
13
|
import { insertAtCursor, insertAtLineStart } from '@dxos/ui-editor';
|
|
15
14
|
|
|
@@ -18,20 +17,13 @@ import { Markdown } from '../types';
|
|
|
18
17
|
export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
19
18
|
const { t } = useTranslation();
|
|
20
19
|
|
|
21
|
-
const manager = usePluginManager();
|
|
22
|
-
const resolve = useCallback(
|
|
23
|
-
(typename: string) =>
|
|
24
|
-
manager.capabilities.getAll(AppCapabilities.Metadata).find(({ id }) => id === typename)?.metadata ?? {},
|
|
25
|
-
[manager],
|
|
26
|
-
);
|
|
27
|
-
|
|
28
20
|
const filter = useMemo(
|
|
29
21
|
() =>
|
|
30
22
|
Filter.or(
|
|
31
|
-
...(db
|
|
32
|
-
.filter((schema) => getTypeAnnotation(schema)?.kind !== EntityKind.Relation)
|
|
33
|
-
.filter((schema) => !
|
|
34
|
-
.map((schema) => Filter.
|
|
23
|
+
...(db ? db.graph.registry.list().filter(Type.isType) : [])
|
|
24
|
+
.filter((schema) => getTypeAnnotation(Type.getSchema(schema))?.kind !== EntityKind.Relation)
|
|
25
|
+
.filter((schema) => !HiddenAnnotation.get(Type.getSchema(schema)).pipe(Option.getOrElse(() => false)))
|
|
26
|
+
.map((schema) => Filter.type(Type.getURI(schema))),
|
|
35
27
|
),
|
|
36
28
|
[db],
|
|
37
29
|
);
|
|
@@ -42,32 +34,26 @@ export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
|
42
34
|
const name = query?.startsWith('@') ? query.slice(1).toLowerCase() : (query?.toLowerCase() ?? '');
|
|
43
35
|
const results = await db?.query(Query.select(filter)).run();
|
|
44
36
|
|
|
45
|
-
|
|
46
|
-
const getLabel = (object: any) => {
|
|
47
|
-
const label = Obj.getLabel(object);
|
|
48
|
-
if (label) {
|
|
49
|
-
return label;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// TODO(wittjosiah): Remove metadata labels.
|
|
37
|
+
const getLabel = (object: Obj.Unknown): Label => {
|
|
53
38
|
const type = Obj.getTypename(object)!;
|
|
54
|
-
|
|
55
|
-
return metadata.label?.(object) || ['object-name.placeholder', { ns: type, defaultValue: 'New object' }];
|
|
39
|
+
return Obj.getLabel(object) ?? ['object-name.placeholder', { ns: type, defaultValue: 'New object' }];
|
|
56
40
|
};
|
|
57
41
|
|
|
58
42
|
const items =
|
|
59
43
|
results
|
|
60
44
|
?.filter((object) => toLocalizedString(getLabel(object), t).toLowerCase().includes(name))
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
45
|
+
.map((object: Obj.Unknown): EditorMenuItem => {
|
|
46
|
+
const type = Obj.getType(object);
|
|
47
|
+
const icon = type
|
|
48
|
+
? Option.getOrUndefined(Annotation.IconAnnotation.get(Type.getSchema(type)))?.icon
|
|
49
|
+
: undefined;
|
|
64
50
|
const label = toLocalizedString(getLabel(object), t);
|
|
65
51
|
return {
|
|
66
52
|
id: object.id,
|
|
67
53
|
label,
|
|
68
|
-
icon
|
|
54
|
+
icon,
|
|
69
55
|
onSelect: ({ view, head }) => {
|
|
70
|
-
const link = `[${label}](${Obj.
|
|
56
|
+
const link = `[${label}](${Obj.getURI(object)})`;
|
|
71
57
|
// "@@" inserts a block embed on its own line instead of an inline link.
|
|
72
58
|
if (query?.startsWith('@')) {
|
|
73
59
|
insertAtLineStart(view, head, `!${link}\n`);
|
|
@@ -81,13 +67,13 @@ export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
|
81
67
|
// Add "Create new document" option at the end.
|
|
82
68
|
const createItem: EditorMenuItem = {
|
|
83
69
|
id: 'create-document',
|
|
84
|
-
label: ['add-object.label', { ns: Markdown.Document
|
|
70
|
+
label: ['add-object.label', { ns: Type.getTypename(Markdown.Document) }],
|
|
85
71
|
icon: 'ph--plus--regular',
|
|
86
72
|
onSelect: ({ view, head }) => {
|
|
87
73
|
const doc = Markdown.make({ name: name || undefined });
|
|
88
74
|
db?.add(doc);
|
|
89
|
-
const label = name || t('object-name.placeholder', { ns: Markdown.Document
|
|
90
|
-
const link = `[${label}](${Obj.
|
|
75
|
+
const label = name || t('object-name.placeholder', { ns: Type.getTypename(Markdown.Document) });
|
|
76
|
+
const link = `[${label}](${Obj.getURI(doc)})`;
|
|
91
77
|
if (query?.startsWith('@')) {
|
|
92
78
|
insertAtLineStart(view, head, `!${link}\n`);
|
|
93
79
|
} else {
|
|
@@ -101,7 +87,7 @@ export const useLinkQuery = (db: Database.Database | undefined) => {
|
|
|
101
87
|
{ id: 'create', items: [createItem] },
|
|
102
88
|
];
|
|
103
89
|
},
|
|
104
|
-
[db, filter,
|
|
90
|
+
[db, filter, t],
|
|
105
91
|
);
|
|
106
92
|
|
|
107
93
|
return handleLinkQuery;
|
package/src/index.ts
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export * from './blueprints';
|
|
7
6
|
export * from './meta';
|
|
7
|
+
export * from './operations';
|
|
8
|
+
export * from './paths';
|
|
8
9
|
export * from './types';
|
|
9
10
|
export * from './util';
|
|
10
|
-
|
|
11
|
-
export * from './MarkdownPlugin';
|
|
12
|
-
|
|
13
|
-
export { MarkdownEditor, MarkdownEditorProvider } from './components';
|
|
14
|
-
export type { MarkdownEditorEditorRootProps } from './components';
|
package/src/meta.ts
CHANGED
|
@@ -2,18 +2,28 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { DXN } from '@dxos/keys';
|
|
6
7
|
import { trim } from '@dxos/util';
|
|
7
8
|
|
|
8
|
-
export const meta
|
|
9
|
-
|
|
9
|
+
export const meta = Plugin.makeMeta({
|
|
10
|
+
key: DXN.make('org.dxos.plugin.markdown'),
|
|
10
11
|
name: 'Markdown',
|
|
12
|
+
author: 'DXOS',
|
|
11
13
|
description: trim`
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
A full-featured markdown editor for authoring documents in your space. Edits flow through a collaborative CodeMirror surface backed by ECHO Text, so every keystroke replicates to other peers in real time without merge conflicts or lost work.
|
|
15
|
+
|
|
16
|
+
Documents can be opened in source, preview, or read-only mode and rendered as a full-surface article or as embeddable cards. An optional formatting toolbar exposes headings, lists, links, and other common markdown actions, and dispositional toolbar actions contributed by other plugins are surfaced inline alongside it.
|
|
17
|
+
|
|
18
|
+
The editor integrates with the rest of the workspace through @ references that link to any ECHO object, image and file uploads stored in the active space, and anchored comment threads on text ranges. Comments can optionally be routed to an AI agent on every message or only on @mention.
|
|
19
|
+
|
|
20
|
+
A built-in blueprint exposes create, open, and update operations as tools for AI agents. Updates are applied as compact find-and-replace diffs against the document, making it safe for agents to edit large documents incrementally while you continue collaborating.
|
|
14
21
|
`,
|
|
15
22
|
icon: 'ph--text-aa--regular',
|
|
16
23
|
iconHue: 'indigo',
|
|
17
24
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-markdown',
|
|
18
|
-
screenshots: [
|
|
19
|
-
|
|
25
|
+
screenshots: [
|
|
26
|
+
'https://customer-5rxcjpyab08avpmn.cloudflarestream.com/cdf2656365bb1fd327c1fc2105d75e5a/iframe?poster=https%3A%2F%2Fcustomer-5rxcjpyab08avpmn.cloudflarestream.com%2Fcdf2656365bb1fd327c1fc2105d75e5a%2Fthumbnails%2Fthumbnail.jpg%3Ftime%3D%26height%3D600',
|
|
27
|
+
'https://dxos.network/plugin-details-markdown-dark.png',
|
|
28
|
+
],
|
|
29
|
+
});
|