@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,36 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { createDocAccessor, getTextInRange } from '@dxos/echo-client';
|
|
11
|
+
|
|
12
|
+
import { MarkdownOperation } from '#types';
|
|
13
|
+
import { Markdown } from '#types';
|
|
14
|
+
|
|
15
|
+
// NOTE: Explicit annotation required: d.ts emit cannot portably name the inferred @dxos/compute types (TS2883).
|
|
16
|
+
const activate: () => Effect.Effect<
|
|
17
|
+
Capability.Capability<typeof AppCapabilities.CommentConfig>,
|
|
18
|
+
never,
|
|
19
|
+
Capability.Service
|
|
20
|
+
> = Effect.fnUntraced(function* () {
|
|
21
|
+
const config: AppCapabilities.CommentConfig = {
|
|
22
|
+
id: Type.getTypename(Markdown.Document),
|
|
23
|
+
comments: 'anchored',
|
|
24
|
+
selectionMode: 'multi-range',
|
|
25
|
+
getAnchorLabel: (doc: Markdown.Document, anchor: string): string | undefined => {
|
|
26
|
+
if (doc.content) {
|
|
27
|
+
const [start, end] = anchor.split(':');
|
|
28
|
+
return getTextInRange(createDocAccessor(doc.content.target!, ['content']), start, end);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
scrollToAnchor: MarkdownOperation.ScrollToAnchor,
|
|
32
|
+
};
|
|
33
|
+
return Capability.contributes(AppCapabilities.CommentConfig, config);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
export default activate;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Type } from '@dxos/echo';
|
|
10
|
+
import { SpaceOperation } from '@dxos/plugin-space';
|
|
11
|
+
import { SpaceCapabilities } from '@dxos/plugin-space';
|
|
12
|
+
|
|
13
|
+
import { Markdown } from '#types';
|
|
14
|
+
|
|
15
|
+
import { getDocumentsPath } from '../paths';
|
|
16
|
+
|
|
17
|
+
export default Capability.makeModule(
|
|
18
|
+
Effect.fnUntraced(function* () {
|
|
19
|
+
return Capability.contributes(SpaceCapabilities.CreateObjectEntry, {
|
|
20
|
+
id: Type.getTypename(Markdown.Document),
|
|
21
|
+
createObject: (props, options) =>
|
|
22
|
+
Effect.gen(function* () {
|
|
23
|
+
const object = Markdown.make(props);
|
|
24
|
+
return yield* Operation.invoke(SpaceOperation.AddObject, {
|
|
25
|
+
object,
|
|
26
|
+
target: options.target,
|
|
27
|
+
hidden: true,
|
|
28
|
+
targetNodeId: options.targetNodeId ?? getDocumentsPath(options.db.spaceId),
|
|
29
|
+
});
|
|
30
|
+
}),
|
|
31
|
+
});
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
@@ -3,11 +3,26 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import {
|
|
6
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
7
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
7
8
|
|
|
9
|
+
export const AppGraphBuilder = Capability.lazy('AppGraphBuilder', () => import('./app-graph-builder'));
|
|
10
|
+
export const NavigationResolver = Capability.lazy('NavigationResolver', () => import('./navigation-resolver'));
|
|
8
11
|
export const AnchorSort = Capability.lazy('AnchorSort', () => import('./anchor-sort'));
|
|
9
12
|
export const AppGraphSerializer = Capability.lazy('AppGraphSerializer', () => import('./app-graph-serializer'));
|
|
10
|
-
|
|
13
|
+
// The contributed capability type references Operation types from @dxos/compute, so the lazy
|
|
14
|
+
// wrapper needs an explicit annotation to keep the inferred type portable (TS2883).
|
|
15
|
+
export const CommentConfig: Capability.LazyCapability<
|
|
16
|
+
void,
|
|
17
|
+
Capability.Capability<typeof AppCapabilities.CommentConfig>
|
|
18
|
+
> = Capability.lazy('CommentConfig', () => import('./comment-config'));
|
|
19
|
+
export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
|
|
20
|
+
// The contributed capability type references Blueprint types from @dxos/compute, so the lazy
|
|
21
|
+
// wrapper needs an explicit annotation to keep the inferred type portable (TS2883).
|
|
22
|
+
export const BlueprintDefinition: Capability.LazyCapability<
|
|
23
|
+
void,
|
|
24
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
25
|
+
> = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));
|
|
11
26
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
12
27
|
'OperationHandler',
|
|
13
28
|
() => import('./operation-handler'),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities, createTypeSectionPathResolver } from '@dxos/app-toolkit';
|
|
9
|
+
|
|
10
|
+
import { Markdown } from '#types';
|
|
11
|
+
|
|
12
|
+
export default Capability.makeModule(
|
|
13
|
+
Effect.fnUntraced(function* () {
|
|
14
|
+
return Capability.contributes(
|
|
15
|
+
AppCapabilities.NavigationPathResolver,
|
|
16
|
+
createTypeSectionPathResolver(Markdown.Document),
|
|
17
|
+
);
|
|
18
|
+
}),
|
|
19
|
+
);
|
package/src/capabilities/node.ts
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { Capability } from '@dxos/app-framework';
|
|
6
|
-
import { OperationHandlerSet } from '@dxos/
|
|
6
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
7
|
+
|
|
8
|
+
export const CreateObject = Capability.lazy('CreateObject', () => import('./create-object'));
|
|
7
9
|
|
|
8
10
|
export const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(
|
|
9
11
|
'OperationHandler',
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as Effect from 'effect/Effect';
|
|
6
6
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import type { OperationHandlerSet } from '@dxos/
|
|
8
|
+
import type { OperationHandlerSet } from '@dxos/compute';
|
|
9
9
|
|
|
10
10
|
import { MarkdownOperationHandlerSet } from '#operations';
|
|
11
11
|
|
|
@@ -10,17 +10,18 @@ import {
|
|
|
10
10
|
Surface,
|
|
11
11
|
useAtomCapability,
|
|
12
12
|
useAtomCapabilityState,
|
|
13
|
+
useCapabilities,
|
|
13
14
|
useCapability,
|
|
14
15
|
useSettingsState,
|
|
15
16
|
} from '@dxos/app-framework/ui';
|
|
16
17
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
17
18
|
import { Obj } from '@dxos/echo';
|
|
18
|
-
import { AttentionCapabilities } from '@dxos/plugin-attention
|
|
19
|
+
import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
19
20
|
import { Text } from '@dxos/schema';
|
|
20
|
-
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
21
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
21
22
|
|
|
22
23
|
import { MarkdownSettings } from '#components';
|
|
23
|
-
import { MarkdownCard,
|
|
24
|
+
import { MarkdownCard, EditableMarkdownCard, MarkdownArticle, type MarkdownArticleProps } from '#containers';
|
|
24
25
|
import { meta } from '#meta';
|
|
25
26
|
import { Markdown, MarkdownCapabilities } from '#types';
|
|
26
27
|
|
|
@@ -36,7 +37,7 @@ export default Capability.makeModule(() =>
|
|
|
36
37
|
component: ({ data, role, ref }) => {
|
|
37
38
|
return (
|
|
38
39
|
<Container
|
|
39
|
-
id={Obj.
|
|
40
|
+
id={Obj.getURI(data.subject)}
|
|
40
41
|
attendableId={data.attendableId}
|
|
41
42
|
subject={data.subject}
|
|
42
43
|
role={role}
|
|
@@ -57,7 +58,7 @@ export default Capability.makeModule(() =>
|
|
|
57
58
|
component: ({ data, role, ref }) => {
|
|
58
59
|
return (
|
|
59
60
|
<Container
|
|
60
|
-
id={Obj.
|
|
61
|
+
id={Obj.getURI(data.subject)}
|
|
61
62
|
attendableId={data.attendableId}
|
|
62
63
|
subject={data.subject}
|
|
63
64
|
role={role}
|
|
@@ -67,16 +68,22 @@ export default Capability.makeModule(() =>
|
|
|
67
68
|
},
|
|
68
69
|
}),
|
|
69
70
|
Surface.create({
|
|
70
|
-
id: 'surface.
|
|
71
|
+
id: 'surface.pluginSettings',
|
|
71
72
|
filter: AppSurface.settings(AppSurface.Article, meta.id),
|
|
72
73
|
component: ({ data: { subject } }) => {
|
|
73
74
|
const { settings, updateSettings } = useSettingsState<Markdown.Settings>(subject.atom);
|
|
74
75
|
return <MarkdownSettings settings={settings} onSettingsChange={updateSettings} />;
|
|
75
76
|
},
|
|
76
77
|
}),
|
|
78
|
+
Surface.create({
|
|
79
|
+
id: 'surface.editable',
|
|
80
|
+
position: 'first',
|
|
81
|
+
filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text], (data) => data.editable === true),
|
|
82
|
+
component: ({ data }) => <EditableMarkdownCard subject={data.subject} />,
|
|
83
|
+
}),
|
|
77
84
|
Surface.create({
|
|
78
85
|
id: 'surface.preview',
|
|
79
|
-
filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text]),
|
|
86
|
+
filter: AppSurface.object(AppSurface.Card, [Markdown.Document, Text.Text], (data) => data.editable !== true),
|
|
80
87
|
component: ({ data }) => <MarkdownCard {...data} />,
|
|
81
88
|
}),
|
|
82
89
|
]),
|
|
@@ -94,17 +101,17 @@ const Container = forwardRef<
|
|
|
94
101
|
const settings = useAtomCapability(MarkdownCapabilities.Settings);
|
|
95
102
|
const [state, setState] = useAtomCapabilityState(MarkdownCapabilities.State);
|
|
96
103
|
const editorState = useCapability(MarkdownCapabilities.EditorState);
|
|
97
|
-
const extensions =
|
|
104
|
+
const extensions = useCapabilities(MarkdownCapabilities.ExtensionProvider);
|
|
98
105
|
const extensionProviders = useMemo(() => extensions.flat(), [extensions]);
|
|
99
106
|
|
|
100
107
|
const viewMode: EditorViewMode = (id && state.viewMode[id]) || settings?.defaultViewMode || 'source';
|
|
101
|
-
const handleViewModeChange = useCallback<NonNullable<
|
|
108
|
+
const handleViewModeChange = useCallback<NonNullable<MarkdownArticleProps['onViewModeChange']>>(
|
|
102
109
|
(mode) => setState((current) => ({ ...current, viewMode: { ...current.viewMode, [id]: mode } })),
|
|
103
110
|
[id, setState],
|
|
104
111
|
);
|
|
105
112
|
|
|
106
113
|
return (
|
|
107
|
-
<
|
|
114
|
+
<MarkdownArticle
|
|
108
115
|
role={role}
|
|
109
116
|
subject={subject}
|
|
110
117
|
id={id}
|
|
@@ -9,10 +9,10 @@ import { createKvsStore } from '@dxos/effect';
|
|
|
9
9
|
import { createEditorStateStore } from '@dxos/ui-editor';
|
|
10
10
|
|
|
11
11
|
import { meta } from '#meta';
|
|
12
|
-
import {
|
|
12
|
+
import { MarkdownCapabilities } from '#types';
|
|
13
13
|
|
|
14
|
-
const createEditorViewRegistry = (): EditorViewRegistry => {
|
|
15
|
-
const views = new Map<string, EditorViewEntry>();
|
|
14
|
+
const createEditorViewRegistry = (): MarkdownCapabilities.EditorViewRegistry => {
|
|
15
|
+
const views = new Map<string, MarkdownCapabilities.EditorViewEntry>();
|
|
16
16
|
return {
|
|
17
17
|
register: (attendableId, view, documentId) => {
|
|
18
18
|
views.set(attendableId, { view, documentId });
|
|
@@ -29,7 +29,7 @@ export default Capability.makeModule(
|
|
|
29
29
|
// Persisted state using KVS store.
|
|
30
30
|
const stateAtom = createKvsStore({
|
|
31
31
|
key: `${meta.id}.state`,
|
|
32
|
-
schema:
|
|
32
|
+
schema: MarkdownCapabilities.StateSchema,
|
|
33
33
|
defaultValue: () => ({ viewMode: {} }),
|
|
34
34
|
});
|
|
35
35
|
|
|
@@ -15,49 +15,54 @@ export const IMAGE_FILES = ['.jpg', '.jpeg', '.png', '.gif'];
|
|
|
15
15
|
export type FileUploadAction = () => void;
|
|
16
16
|
|
|
17
17
|
export type FileUploadProps = {
|
|
18
|
-
|
|
18
|
+
// Provided as a getter (not a value prop) so the live `EditorView` is never carried in a React prop
|
|
19
|
+
// that React 19.2's dev render-logger would walk into a cross-origin frame. See
|
|
20
|
+
// `react-ui-editor/.../controller.ts` for the full rationale.
|
|
21
|
+
getView?: () => EditorView | null;
|
|
19
22
|
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
20
23
|
};
|
|
21
24
|
|
|
22
25
|
// TODO(burdon): Factor out.
|
|
23
26
|
// TODO(burdon): Move to root? (support drag into document via dropzone).
|
|
24
|
-
export const FileUpload = forwardRef<FileUploadAction, FileUploadProps>(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const info = await onFileUpload(file);
|
|
50
|
-
if (info) {
|
|
51
|
-
addLink({ url: info.url, image: true })(editorView);
|
|
52
|
-
}
|
|
27
|
+
export const FileUpload = forwardRef<FileUploadAction, FileUploadProps>(({ getView, onFileUpload }, forwardedRef) => {
|
|
28
|
+
// https://react-dropzone.js.org
|
|
29
|
+
const { acceptedFiles, open, inputRef } = useDropzone({
|
|
30
|
+
disabled: !onFileUpload,
|
|
31
|
+
multiple: false,
|
|
32
|
+
noDrag: true,
|
|
33
|
+
accept: {
|
|
34
|
+
'image/*': IMAGE_FILES,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
useImperativeHandle(forwardedRef, () => open, []);
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (acceptedFiles.length && onFileUpload) {
|
|
42
|
+
requestAnimationFrame(async () => {
|
|
43
|
+
const editorView = getView?.();
|
|
44
|
+
if (!editorView) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// NOTE: Clone file since react-dropzone patches in a non-standard `path` property, which confuses IPFS.
|
|
48
|
+
const f = acceptedFiles[0];
|
|
49
|
+
const file = new File([f], f.name, {
|
|
50
|
+
type: f.type,
|
|
51
|
+
lastModified: f.lastModified,
|
|
53
52
|
});
|
|
54
|
-
}
|
|
55
|
-
}, [editorView, acceptedFiles, onFileUpload]);
|
|
56
53
|
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
// TODO(burdon): Factor out.
|
|
55
|
+
const info = await onFileUpload(file);
|
|
56
|
+
if (info) {
|
|
57
|
+
addLink({ url: info.url, image: true })(editorView);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
59
60
|
}
|
|
61
|
+
}, [getView, acceptedFiles, onFileUpload]);
|
|
62
|
+
|
|
63
|
+
if (!onFileUpload) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
60
66
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
67
|
+
return <>{createPortal(<input ref={inputRef} />, document.body)} </>;
|
|
68
|
+
});
|
|
@@ -8,19 +8,20 @@ import React from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
10
|
import { Filter, Obj } from '@dxos/echo';
|
|
11
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
12
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
13
13
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
14
14
|
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
15
15
|
import { Panel } from '@dxos/react-ui';
|
|
16
16
|
import { AttendableContainer } from '@dxos/react-ui-attention';
|
|
17
|
-
import { Editor
|
|
17
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
18
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor/translations';
|
|
18
19
|
import { Loading, withLayout } from '@dxos/react-ui/testing';
|
|
19
20
|
import { Text } from '@dxos/schema';
|
|
20
21
|
|
|
22
|
+
import { translations } from '#translations';
|
|
21
23
|
import { Markdown } from '#types';
|
|
22
24
|
|
|
23
|
-
import { translations } from '../../translations';
|
|
24
25
|
import { MarkdownEditor, MarkdownEditorProvider, type MarkdownEditorProviderProps } from './MarkdownEditor';
|
|
25
26
|
|
|
26
27
|
type DefaultStoryProps = Omit<MarkdownEditorProviderProps, 'id' | 'extensions' | 'children'>;
|
|
@@ -28,7 +29,7 @@ type DefaultStoryProps = Omit<MarkdownEditorProviderProps, 'id' | 'extensions' |
|
|
|
28
29
|
const DefaultStory = (props: DefaultStoryProps) => {
|
|
29
30
|
const [space] = useSpaces();
|
|
30
31
|
const [doc] = useQuery(space?.db, Filter.type(Markdown.Document));
|
|
31
|
-
const id = doc && Obj.
|
|
32
|
+
const id = doc && Obj.getURI(doc);
|
|
32
33
|
if (!id) {
|
|
33
34
|
return <Loading data={{ id }} />;
|
|
34
35
|
}
|
|
@@ -12,9 +12,10 @@ import { createPortal } from 'react-dom';
|
|
|
12
12
|
import { Surface } from '@dxos/app-framework/ui';
|
|
13
13
|
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
14
14
|
import { Obj } from '@dxos/echo';
|
|
15
|
-
import {
|
|
15
|
+
import { URI } from '@dxos/keys';
|
|
16
16
|
import { useClient } from '@dxos/react-client';
|
|
17
17
|
import { type ThemedClassName } from '@dxos/react-ui';
|
|
18
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
18
19
|
import {
|
|
19
20
|
type EditorRootProps,
|
|
20
21
|
type EditorToolbarState,
|
|
@@ -22,7 +23,6 @@ import {
|
|
|
22
23
|
useEditorContext,
|
|
23
24
|
} from '@dxos/react-ui-editor';
|
|
24
25
|
import { type PreviewBlock, type PreviewOptions } from '@dxos/ui-editor';
|
|
25
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
26
26
|
import { isNonNullable } from '@dxos/util';
|
|
27
27
|
|
|
28
28
|
import {
|
|
@@ -172,32 +172,39 @@ const MARKDOWN_EDITOR_CONTENT_NAME = 'MarkdownEditor.Content';
|
|
|
172
172
|
|
|
173
173
|
type MarkdownEditorContentProps = Omit<NaturalMarkdownEditorContentProps, 'id' | 'extensions' | 'toolbarState'>;
|
|
174
174
|
|
|
175
|
-
const MarkdownEditorContent = composable<HTMLDivElement, MarkdownEditorContentProps>(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
);
|
|
175
|
+
const MarkdownEditorContent = composable<HTMLDivElement, MarkdownEditorContentProps>(
|
|
176
|
+
({ compact: compactProp, ...props }, _forwardedRef) => {
|
|
177
|
+
const {
|
|
178
|
+
id,
|
|
179
|
+
attendableId,
|
|
180
|
+
compact = compactProp,
|
|
181
|
+
viewMode,
|
|
182
|
+
onFileUpload,
|
|
183
|
+
} = useMarkdownEditorContext(MARKDOWN_EDITOR_CONTENT_NAME);
|
|
184
|
+
const { extensions, setController, state } = useEditorContext(MARKDOWN_EDITOR_CONTENT_NAME);
|
|
186
185
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
}
|
|
186
|
+
const handleRef = useCallback(
|
|
187
|
+
(view: EditorView | null) => {
|
|
188
|
+
setController(createEditorController(view));
|
|
189
|
+
},
|
|
190
|
+
[setController],
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
return (
|
|
194
|
+
<NaturalMarkdownEditorContent
|
|
195
|
+
{...composableProps(props)}
|
|
196
|
+
id={id}
|
|
197
|
+
attendableId={attendableId}
|
|
198
|
+
compact={compact}
|
|
199
|
+
viewMode={viewMode}
|
|
200
|
+
toolbarState={state as Atom.Writable<EditorToolbarState>}
|
|
201
|
+
extensions={extensions}
|
|
202
|
+
onFileUpload={onFileUpload}
|
|
203
|
+
ref={handleRef}
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
},
|
|
207
|
+
);
|
|
201
208
|
|
|
202
209
|
MarkdownEditorContent.displayName = MARKDOWN_EDITOR_CONTENT_NAME;
|
|
203
210
|
|
|
@@ -208,7 +215,7 @@ MarkdownEditorContent.displayName = MARKDOWN_EDITOR_CONTENT_NAME;
|
|
|
208
215
|
const MARKDOWN_EDITOR_TOOLBAR_NAME = 'MarkdownEditor.Toolbar';
|
|
209
216
|
|
|
210
217
|
type MarkdownEditorToolbarProps = ThemedClassName<
|
|
211
|
-
Omit<NaturalMarkdownToolbarProps, '
|
|
218
|
+
Omit<NaturalMarkdownToolbarProps, 'getView' | 'onAction' | 'onFileUpload' | 'onViewModeChange' | 'id'>
|
|
212
219
|
>;
|
|
213
220
|
|
|
214
221
|
const MarkdownEditorToolbar = (props: MarkdownEditorToolbarProps) => {
|
|
@@ -217,11 +224,15 @@ const MarkdownEditorToolbar = (props: MarkdownEditorToolbarProps) => {
|
|
|
217
224
|
|
|
218
225
|
const { controller } = useEditorContext(MARKDOWN_EDITOR_TOOLBAR_NAME);
|
|
219
226
|
|
|
227
|
+
// Stable getter identity (changes only when the controller does) so the FileUpload effect, whose
|
|
228
|
+
// deps include `getView`, does not re-run every render and re-upload the same file.
|
|
229
|
+
const getView = useCallback(() => controller?.view ?? null, [controller]);
|
|
230
|
+
|
|
220
231
|
return (
|
|
221
232
|
<NaturalMarkdownToolbar
|
|
222
233
|
{...props}
|
|
223
234
|
id={attendableId ?? id}
|
|
224
|
-
|
|
235
|
+
getView={getView}
|
|
225
236
|
onAction={onAction}
|
|
226
237
|
onFileUpload={onFileUpload}
|
|
227
238
|
onViewModeChange={onViewModeChange}
|
|
@@ -255,7 +266,7 @@ MarkdownEditorBlocks.displayName = MARKDOWN_EDITOR_BLOCKS_NAME;
|
|
|
255
266
|
|
|
256
267
|
const PreviewBlock = ({ el, link }: PreviewBlock) => {
|
|
257
268
|
const client = useClient();
|
|
258
|
-
const dxn =
|
|
269
|
+
const dxn = URI.make(link.dxn);
|
|
259
270
|
const subject = client.graph.makeRef(dxn).target;
|
|
260
271
|
const data = useMemo(() => ({ subject }), [subject]);
|
|
261
272
|
|
|
@@ -17,7 +17,6 @@ import {
|
|
|
17
17
|
import {
|
|
18
18
|
type EditorSelectionState,
|
|
19
19
|
type EditorStateStore,
|
|
20
|
-
type EditorViewMode,
|
|
21
20
|
type ThemeExtensionsOptions,
|
|
22
21
|
mobileSlots,
|
|
23
22
|
createBasicExtensions,
|
|
@@ -28,7 +27,9 @@ import {
|
|
|
28
27
|
formattingListener,
|
|
29
28
|
processEditorPayload,
|
|
30
29
|
editorClassNames,
|
|
30
|
+
scrollbarAutohide,
|
|
31
31
|
} from '@dxos/ui-editor';
|
|
32
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
32
33
|
import { mx } from '@dxos/ui-theme';
|
|
33
34
|
import { isTruthy } from '@dxos/util';
|
|
34
35
|
|
|
@@ -114,6 +115,7 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
114
115
|
syntaxHighlighting: true,
|
|
115
116
|
}),
|
|
116
117
|
createMarkdownExtensions(),
|
|
118
|
+
scrollbarAutohide(),
|
|
117
119
|
toolbarState && formattingListener(updateToolbarState),
|
|
118
120
|
role !== 'section' &&
|
|
119
121
|
onFileUpload &&
|
|
@@ -130,7 +132,7 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
130
132
|
extensions,
|
|
131
133
|
].filter(isTruthy),
|
|
132
134
|
}),
|
|
133
|
-
[id, viewMode, themeMode, extensions],
|
|
135
|
+
[id, viewMode, themeMode, extensions, compact],
|
|
134
136
|
);
|
|
135
137
|
|
|
136
138
|
useImperativeHandle<EditorView | null, EditorView | null>(forwardedRef, () => editorView, [editorView]);
|
|
@@ -149,7 +151,6 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
149
151
|
<div
|
|
150
152
|
{...focusAttributes}
|
|
151
153
|
className={mx(editorClassNames(role), classNames)}
|
|
152
|
-
role='none'
|
|
153
154
|
data-testid='composer.markdownRoot'
|
|
154
155
|
data-popover-collision-boundary={true}
|
|
155
156
|
ref={parentRef}
|
|
@@ -6,29 +6,32 @@ import { type EditorView } from '@codemirror/view';
|
|
|
6
6
|
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type FileInfo } from '@dxos/app-toolkit';
|
|
9
|
+
import { composable, composableProps } from '@dxos/react-ui';
|
|
9
10
|
import { Editor, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
10
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
11
11
|
|
|
12
12
|
import { FileUpload, type FileUploadAction } from './FileUpload';
|
|
13
13
|
|
|
14
14
|
export type MarkdownEditorToolbarProps = {
|
|
15
15
|
id: string;
|
|
16
|
-
|
|
16
|
+
// Provided as a getter (not a value prop) so the live `EditorView` is never carried in a React prop
|
|
17
|
+
// that React 19.2's dev render-logger would walk into a cross-origin frame. See
|
|
18
|
+
// `react-ui-editor/.../controller.ts` for the full rationale.
|
|
19
|
+
getView?: () => EditorView | null;
|
|
17
20
|
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
18
21
|
} & Pick<EditorToolbarProps, 'role' | 'customActions' | 'onAction' | 'onViewModeChange'>;
|
|
19
22
|
|
|
20
23
|
export const MarkdownEditorToolbar = composable<HTMLDivElement, MarkdownEditorToolbarProps>(
|
|
21
|
-
({ id, role,
|
|
24
|
+
({ id, role, getView, customActions, onAction, onFileUpload, onViewModeChange, ...props }, forwardedRef) => {
|
|
22
25
|
const { className, ...rest } = composableProps(props);
|
|
23
26
|
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
24
27
|
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
25
28
|
|
|
26
|
-
if (!
|
|
29
|
+
if (!getView?.()) {
|
|
27
30
|
return <div className={className} {...rest} ref={forwardedRef} />;
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
return (
|
|
31
|
-
<div
|
|
34
|
+
<div className='contents' ref={forwardedRef}>
|
|
32
35
|
<Editor.Toolbar
|
|
33
36
|
{...rest}
|
|
34
37
|
classNames={className}
|
|
@@ -40,7 +43,7 @@ export const MarkdownEditorToolbar = composable<HTMLDivElement, MarkdownEditorTo
|
|
|
40
43
|
onViewModeChange={onViewModeChange}
|
|
41
44
|
/>
|
|
42
45
|
|
|
43
|
-
{onFileUpload && <FileUpload ref={uploadRef}
|
|
46
|
+
{onFileUpload && <FileUpload ref={uploadRef} getView={getView} onFileUpload={onFileUpload} />}
|
|
44
47
|
</div>
|
|
45
48
|
);
|
|
46
49
|
},
|
|
@@ -6,7 +6,8 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
|
|
7
7
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
8
|
|
|
9
|
-
import { translations } from '
|
|
9
|
+
import { translations } from '#translations';
|
|
10
|
+
|
|
10
11
|
import { MarkdownSettings } from './MarkdownSettings';
|
|
11
12
|
|
|
12
13
|
const meta = {
|
|
@@ -13,7 +13,7 @@ import { Markdown } from '#types';
|
|
|
13
13
|
|
|
14
14
|
export type MarkdownSettingsProps = AppSurface.SettingsArticleProps<Markdown.Settings>;
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const SnippetsField = ({ value, onChange, readonly }: SettingsFieldProps<string | undefined>) => (
|
|
17
17
|
<Input.TextArea disabled={readonly} rows={5} value={value ?? ''} onChange={(event) => onChange(event.target.value)} />
|
|
18
18
|
);
|
|
19
19
|
|
|
@@ -24,8 +24,8 @@ export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSetting
|
|
|
24
24
|
<SettingsForm.FieldSet
|
|
25
25
|
readonly={!onSettingsChange}
|
|
26
26
|
schema={Markdown.Settings}
|
|
27
|
-
visible={(path, values) => path !== '
|
|
28
|
-
fieldMap={{
|
|
27
|
+
visible={(path, values) => path !== 'snippets' || !!values.debug}
|
|
28
|
+
fieldMap={{ snippets: SnippetsField }}
|
|
29
29
|
values={settings}
|
|
30
30
|
onValuesChanged={(values) => onSettingsChange?.(() => values)}
|
|
31
31
|
/>
|