@dxos/plugin-markdown 0.8.4-main.7996785055 → 0.8.4-main.8baae0fced
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-LXBXN3OW.mjs +32 -0
- package/dist/lib/neutral/EditableMarkdownCard-LXBXN3OW.mjs.map +7 -0
- package/dist/lib/{node-esm/MarkdownContainer-25WFZLCC.mjs → neutral/MarkdownArticle-Z4QRU3WD.mjs} +25 -25
- package/dist/lib/neutral/MarkdownArticle-Z4QRU3WD.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownCard-INMBLUL4.mjs +102 -0
- package/dist/lib/neutral/MarkdownCard-INMBLUL4.mjs.map +7 -0
- package/dist/lib/neutral/MarkdownPlugin.mjs +58 -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/neutral/MarkdownSettings-YCTZJL5V.mjs +32 -0
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs.map +7 -0
- package/dist/lib/{browser/anchor-sort-PSCEA6EJ.mjs → neutral/anchor-sort-L4VCKDO6.mjs} +5 -7
- package/dist/lib/neutral/anchor-sort-L4VCKDO6.mjs.map +7 -0
- package/dist/lib/{browser/app-graph-serializer-DAVFEX7R.mjs → neutral/app-graph-serializer-YI72EEVM.mjs} +11 -19
- package/dist/lib/neutral/app-graph-serializer-YI72EEVM.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-33OK2KUL.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-33OK2KUL.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +2 -4
- package/dist/lib/neutral/capabilities/index.mjs +25 -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-5JWFZVBC.mjs +8 -0
- package/dist/lib/neutral/chunk-5JWFZVBC.mjs.map +7 -0
- package/dist/lib/{browser/chunk-RYZHVXZ5.mjs → neutral/chunk-ISCL3BB2.mjs} +3 -8
- package/dist/lib/neutral/chunk-ISCL3BB2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs +98 -0
- package/dist/lib/neutral/chunk-KDN4GKG2.mjs.map +7 -0
- package/dist/lib/{browser/chunk-ZN75YHSV.mjs → neutral/chunk-LXNSKCPD.mjs} +8 -14
- package/dist/lib/neutral/chunk-LXNSKCPD.mjs.map +7 -0
- package/dist/lib/neutral/chunk-SOLAMEK3.mjs +276 -0
- package/dist/lib/neutral/chunk-SOLAMEK3.mjs.map +7 -0
- package/dist/lib/neutral/comment-config-7VTHRUIZ.mjs +30 -0
- package/dist/lib/neutral/comment-config-7VTHRUIZ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +370 -0
- 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/{browser/create-QD27F6E7.mjs → neutral/create-3PGJ2NEK.mjs} +6 -8
- package/dist/lib/neutral/create-3PGJ2NEK.mjs.map +7 -0
- package/dist/lib/neutral/create-markdown-5LS46GMH.mjs +20 -0
- package/dist/lib/neutral/create-markdown-5LS46GMH.mjs.map +7 -0
- package/dist/lib/neutral/create-object-ZA6VXLJJ.mjs +27 -0
- package/dist/lib/neutral/create-object-ZA6VXLJJ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +321 -0
- package/dist/lib/neutral/hooks/index.mjs.map +7 -0
- package/dist/lib/neutral/index.mjs +42 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/{browser/open-YDABYPCA.mjs → neutral/open-WCYGBLAG.mjs} +6 -7
- package/dist/lib/neutral/open-WCYGBLAG.mjs.map +7 -0
- package/dist/lib/{browser/operation-handler-W3QXMMMQ.mjs → neutral/operation-handler-2ARMPBGZ.mjs} +4 -8
- package/dist/lib/neutral/operation-handler-2ARMPBGZ.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/{browser/react-surface-N7FV3PXH.mjs → neutral/react-surface-SG4YNXBS.mjs} +33 -34
- package/dist/lib/neutral/react-surface-SG4YNXBS.mjs.map +7 -0
- package/dist/lib/{browser/scroll-to-anchor-3CGV3XI7.mjs → neutral/scroll-to-anchor-6FIOKVKT.mjs} +8 -10
- package/dist/lib/neutral/scroll-to-anchor-6FIOKVKT.mjs.map +7 -0
- package/dist/lib/neutral/set-view-mode-37RSPFEN.mjs +24 -0
- package/dist/lib/neutral/set-view-mode-37RSPFEN.mjs.map +7 -0
- package/dist/lib/{browser/settings-3UMXG4TP.mjs → neutral/settings-TDGDLCUR.mjs} +7 -11
- package/dist/lib/neutral/settings-TDGDLCUR.mjs.map +7 -0
- package/dist/lib/{browser/state-IYKJ6EV3.mjs → neutral/state-5COCF5PN.mjs} +6 -10
- package/dist/lib/neutral/state-5COCF5PN.mjs.map +7 -0
- package/dist/lib/neutral/testing.mjs +19 -0
- package/dist/lib/neutral/testing.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +43 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +16 -0
- package/dist/lib/{browser/update-WKAMI4AD.mjs → neutral/update-markdown-5EDRD3SH.mjs} +9 -10
- package/dist/lib/neutral/update-markdown-5EDRD3SH.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 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/artifact-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/comment-config.d.ts +12 -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 +22 -7
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/node.d.ts +10 -0
- package/dist/types/src/capabilities/node.d.ts.map +1 -0
- package/dist/types/src/capabilities/{operation-handler/operation-handler.d.ts → operation-handler.d.ts} +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/{settings/settings.d.ts → settings.d.ts} +1 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +6 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts +29 -23
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +2 -2
- 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 -6
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts +6 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts +94 -0
- package/dist/types/src/components/MarkdownSettings/MarkdownSettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts +2 -0
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -0
- package/dist/types/src/components/index.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/index.d.ts +3 -0
- package/dist/types/src/containers/EditableMarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownArticle/MarkdownArticle.d.ts +36 -0
- 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 +1 -1
- 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/index.d.ts +1 -2
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts +7 -5
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +3 -3
- 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 +4 -2
- 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 +2 -3
- package/dist/types/src/index.d.ts.map +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/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 -63
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +15 -15
- 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} +6 -3
- package/dist/types/src/types/MarkdownOperation.d.ts.map +1 -0
- package/dist/types/src/types/Settings.d.ts +17 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +5 -3
- 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 +2 -2
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +123 -90
- package/src/MarkdownPlugin.node.ts +20 -0
- package/src/MarkdownPlugin.test.ts +26 -0
- package/src/MarkdownPlugin.tsx +12 -55
- package/src/MarkdownPlugin.workerd.ts +19 -0
- package/src/blueprints/markdown-blueprint.ts +8 -9
- package/src/capabilities/{anchor-sort/anchor-sort.ts → anchor-sort.ts} +1 -1
- package/src/capabilities/{app-graph-serializer/app-graph-serializer.ts → app-graph-serializer.ts} +6 -7
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +5 -6
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/comment-config.ts +32 -0
- package/src/capabilities/create-object.ts +30 -0
- package/src/capabilities/index.ts +16 -7
- package/src/capabilities/{operation-handler/index.ts → node.ts} +3 -1
- package/src/capabilities/{operation-handler/operation-handler.ts → operation-handler.ts} +2 -2
- package/src/capabilities/react-surface.tsx +127 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +2 -2
- package/src/capabilities/{state/state.ts → state.ts} +5 -5
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +24 -19
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +100 -87
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +10 -14
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +6 -17
- package/src/components/MarkdownSettings/MarkdownSettings.stories.tsx +40 -0
- package/src/components/MarkdownSettings/MarkdownSettings.tsx +35 -0
- package/src/components/MarkdownSettings/index.ts +5 -0
- package/src/components/index.ts +4 -0
- package/src/containers/EditableMarkdownCard/EditableMarkdownCard.tsx +42 -0
- package/src/containers/EditableMarkdownCard/index.ts +6 -0
- package/src/containers/{MarkdownContainer/MarkdownContainer.stories.tsx → MarkdownArticle/MarkdownArticle.stories.tsx} +15 -13
- package/src/containers/{MarkdownContainer/MarkdownContainer.tsx → MarkdownArticle/MarkdownArticle.tsx} +38 -26
- package/src/containers/MarkdownArticle/index.ts +6 -0
- package/src/containers/MarkdownCard/MarkdownCard.stories.tsx +10 -10
- package/src/containers/MarkdownCard/MarkdownCard.tsx +25 -15
- package/src/containers/MarkdownCard/index.ts +1 -3
- package/src/containers/MarkdownCard/snippet.ts +27 -48
- package/src/containers/index.ts +3 -3
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +14 -13
- package/src/hooks/useLinkQuery.ts +33 -27
- package/src/index.ts +2 -6
- package/src/meta.ts +5 -1
- package/src/operations/create-markdown.ts +3 -5
- package/src/operations/create.conversations.json +1 -1
- package/src/operations/create.test.ts +25 -22
- package/src/operations/create.ts +3 -4
- package/src/operations/index.ts +2 -4
- package/src/operations/open.ts +3 -3
- package/src/operations/scroll-to-anchor.ts +3 -5
- package/src/operations/set-view-mode.ts +3 -5
- package/src/operations/{update.ts → update-markdown.ts} +3 -3
- package/src/operations/update.conversations.json +1 -1
- package/src/operations/update.test.ts +45 -48
- package/src/plugin.ts +11 -0
- package/src/testing.ts +8 -3
- package/src/translations.ts +25 -38
- package/src/types/Markdown.ts +11 -21
- package/src/types/MarkdownCapabilities.ts +51 -0
- package/src/types/MarkdownEvents.ts +14 -0
- package/src/{operations/definitions.ts → types/MarkdownOperation.ts} +6 -3
- package/src/types/Settings.ts +65 -0
- package/src/types/index.ts +6 -4
- package/src/types/types.ts +4 -1
- package/src/util.tsx +4 -4
- package/dist/lib/browser/MarkdownCard-ZHQBD4AV.mjs +0 -122
- package/dist/lib/browser/MarkdownCard-ZHQBD4AV.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-XEUOYBPA.mjs +0 -125
- package/dist/lib/browser/MarkdownContainer-XEUOYBPA.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSettings-OD7AJSSJ.mjs +0 -106
- package/dist/lib/browser/MarkdownSettings-OD7AJSSJ.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-PSCEA6EJ.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-DAVFEX7R.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-LHVNOMJT.mjs +0 -19
- package/dist/lib/browser/blueprint-definition-LHVNOMJT.mjs.map +0 -7
- package/dist/lib/browser/chunk-5VT6IW5B.mjs +0 -84
- package/dist/lib/browser/chunk-5VT6IW5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-CJSWKCKU.mjs +0 -60
- package/dist/lib/browser/chunk-CJSWKCKU.mjs.map +0 -7
- package/dist/lib/browser/chunk-G6BRWY3G.mjs +0 -158
- package/dist/lib/browser/chunk-G6BRWY3G.mjs.map +0 -7
- package/dist/lib/browser/chunk-M2XFCKXA.mjs +0 -8
- package/dist/lib/browser/chunk-M2XFCKXA.mjs.map +0 -7
- package/dist/lib/browser/chunk-RYZHVXZ5.mjs.map +0 -7
- package/dist/lib/browser/chunk-XWYF5LFE.mjs +0 -8
- package/dist/lib/browser/chunk-XWYF5LFE.mjs.map +0 -7
- package/dist/lib/browser/chunk-YALLVET2.mjs +0 -757
- package/dist/lib/browser/chunk-YALLVET2.mjs.map +0 -7
- package/dist/lib/browser/chunk-ZN75YHSV.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -44
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/create-QD27F6E7.mjs.map +0 -7
- package/dist/lib/browser/create-markdown-LEAJPLHT.mjs +0 -22
- package/dist/lib/browser/create-markdown-LEAJPLHT.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -164
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/open-YDABYPCA.mjs.map +0 -7
- package/dist/lib/browser/operation-handler-W3QXMMMQ.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/react-surface-N7FV3PXH.mjs.map +0 -7
- package/dist/lib/browser/scroll-to-anchor-3CGV3XI7.mjs.map +0 -7
- package/dist/lib/browser/set-view-mode-XLD3RXW4.mjs +0 -26
- package/dist/lib/browser/set-view-mode-XLD3RXW4.mjs.map +0 -7
- package/dist/lib/browser/settings-3UMXG4TP.mjs.map +0 -7
- package/dist/lib/browser/state-IYKJ6EV3.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/browser/update-WKAMI4AD.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-VB3NHVX4.mjs +0 -123
- package/dist/lib/node-esm/MarkdownCard-VB3NHVX4.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-25WFZLCC.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownSettings-U7GJ4OP3.mjs +0 -107
- package/dist/lib/node-esm/MarkdownSettings-U7GJ4OP3.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-6GD4SGQL.mjs +0 -35
- package/dist/lib/node-esm/anchor-sort-6GD4SGQL.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-JURUUUBI.mjs +0 -64
- package/dist/lib/node-esm/app-graph-serializer-JURUUUBI.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-3LUZEJ4Z.mjs +0 -20
- package/dist/lib/node-esm/blueprint-definition-3LUZEJ4Z.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -11
- package/dist/lib/node-esm/chunk-6LHNAAMP.mjs +0 -159
- package/dist/lib/node-esm/chunk-6LHNAAMP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CRUJMQR2.mjs +0 -758
- package/dist/lib/node-esm/chunk-CRUJMQR2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CW4FZNMZ.mjs +0 -29
- package/dist/lib/node-esm/chunk-CW4FZNMZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-EPNCYA73.mjs +0 -85
- package/dist/lib/node-esm/chunk-EPNCYA73.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FC3GPLJG.mjs +0 -61
- package/dist/lib/node-esm/chunk-FC3GPLJG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-G6W4DJBM.mjs +0 -51
- package/dist/lib/node-esm/chunk-G6W4DJBM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JLOCBILO.mjs +0 -10
- package/dist/lib/node-esm/chunk-JLOCBILO.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YWQQYV76.mjs +0 -10
- package/dist/lib/node-esm/chunk-YWQQYV76.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -45
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-X7H4LYI5.mjs +0 -31
- package/dist/lib/node-esm/create-X7H4LYI5.mjs.map +0 -7
- package/dist/lib/node-esm/create-markdown-7POKQDVQ.mjs +0 -23
- package/dist/lib/node-esm/create-markdown-7POKQDVQ.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -165
- 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-FZVFWXC7.mjs +0 -22
- package/dist/lib/node-esm/open-FZVFWXC7.mjs.map +0 -7
- package/dist/lib/node-esm/operation-handler-TP26H7QE.mjs +0 -18
- package/dist/lib/node-esm/operation-handler-TP26H7QE.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/react-surface-XSKLSF6A.mjs +0 -121
- package/dist/lib/node-esm/react-surface-XSKLSF6A.mjs.map +0 -7
- package/dist/lib/node-esm/scroll-to-anchor-KWBJLM5Q.mjs +0 -50
- package/dist/lib/node-esm/scroll-to-anchor-KWBJLM5Q.mjs.map +0 -7
- package/dist/lib/node-esm/set-view-mode-FFEKYLU3.mjs +0 -27
- package/dist/lib/node-esm/set-view-mode-FFEKYLU3.mjs.map +0 -7
- package/dist/lib/node-esm/settings-UAN22O42.mjs +0 -39
- package/dist/lib/node-esm/settings-UAN22O42.mjs.map +0 -7
- package/dist/lib/node-esm/state-62IBFPTK.mjs +0 -49
- package/dist/lib/node-esm/state-62IBFPTK.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- package/dist/lib/node-esm/update-WPEFBY4M.mjs +0 -46
- package/dist/lib/node-esm/update-WPEFBY4M.mjs.map +0 -7
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts.map +0 -1
- package/dist/types/src/capabilities/anchor-sort/index.d.ts +0 -3
- package/dist/types/src/capabilities/anchor-sort/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts.map +0 -1
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts +0 -3
- package/dist/types/src/capabilities/app-graph-serializer/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/artifact-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/artifact-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -4
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/index.d.ts +0 -3
- package/dist/types/src/capabilities/settings/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/settings/settings.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/index.d.ts +0 -3
- package/dist/types/src/capabilities/state/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/state/state.d.ts +0 -6
- package/dist/types/src/capabilities/state/state.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 +0 -30
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +0 -89
- 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/containers/MarkdownSettings/MarkdownSettings.d.ts +0 -8
- package/dist/types/src/containers/MarkdownSettings/MarkdownSettings.d.ts.map +0 -1
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +0 -3
- package/dist/types/src/containers/MarkdownSettings/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 -34
- 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/anchor-sort/index.ts +0 -7
- package/src/capabilities/app-graph-serializer/index.ts +0 -7
- package/src/capabilities/artifact-definition/index.ts +0 -7
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -120
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -40
- package/src/containers/MarkdownContainer/index.ts +0 -6
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +0 -122
- package/src/containers/MarkdownSettings/index.ts +0 -7
- package/src/types/capabilities.ts +0 -50
- package/src/types/events.ts +0 -14
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser/operations/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{browser/types → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/blueprints/index.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm → neutral}/operations/index.mjs.map +0 -0
- /package/dist/lib/{node-esm → neutral}/types/index.mjs.map +0 -0
- /package/dist/types/src/capabilities/{anchor-sort/anchor-sort.d.ts → anchor-sort.d.ts} +0 -0
- /package/dist/types/src/capabilities/{app-graph-serializer/app-graph-serializer.d.ts → app-graph-serializer.d.ts} +0 -0
- /package/dist/types/src/capabilities/{artifact-definition/artifact-definition.d.ts → artifact-definition.d.ts} +0 -0
- /package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
|
@@ -6,46 +6,35 @@ 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 {
|
|
10
|
-
import {
|
|
9
|
+
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
|
-
import { composable, composableProps } from '@dxos/ui-theme';
|
|
14
13
|
|
|
15
14
|
export type MarkdownEditorToolbarProps = {
|
|
16
15
|
id: string;
|
|
17
16
|
editorView?: EditorView;
|
|
18
17
|
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
19
|
-
} & Pick<EditorToolbarProps, 'role' | '
|
|
18
|
+
} & Pick<EditorToolbarProps, 'role' | 'customActions' | 'onAction' | 'onViewModeChange'>;
|
|
20
19
|
|
|
21
20
|
export const MarkdownEditorToolbar = composable<HTMLDivElement, MarkdownEditorToolbarProps>(
|
|
22
|
-
(
|
|
23
|
-
{ id, role, state, editorView, customActions, onAction, onFileUpload, onViewModeChange, ...props },
|
|
24
|
-
forwardedRef,
|
|
25
|
-
) => {
|
|
21
|
+
({ id, role, editorView, customActions, onAction, onFileUpload, onViewModeChange, ...props }, forwardedRef) => {
|
|
26
22
|
const { className, ...rest } = composableProps(props);
|
|
27
23
|
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
28
24
|
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
29
25
|
|
|
30
|
-
const getView = useCallback(() => {
|
|
31
|
-
invariant(editorView);
|
|
32
|
-
return editorView;
|
|
33
|
-
}, [editorView]);
|
|
34
|
-
|
|
35
26
|
if (!editorView) {
|
|
36
27
|
return <div className={className} {...rest} ref={forwardedRef} />;
|
|
37
28
|
}
|
|
38
29
|
|
|
39
30
|
return (
|
|
40
|
-
<div
|
|
41
|
-
<
|
|
31
|
+
<div className='contents' ref={forwardedRef}>
|
|
32
|
+
<Editor.Toolbar
|
|
42
33
|
{...rest}
|
|
43
34
|
classNames={className}
|
|
44
35
|
attendableId={id}
|
|
45
36
|
role={role}
|
|
46
|
-
state={state}
|
|
47
37
|
customActions={customActions}
|
|
48
|
-
getView={getView}
|
|
49
38
|
onAction={onAction}
|
|
50
39
|
onImageUpload={upload ?? undefined}
|
|
51
40
|
onViewModeChange={onViewModeChange}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
9
|
+
import { translations } from '#translations';
|
|
10
|
+
|
|
11
|
+
import { MarkdownSettings } from './MarkdownSettings';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'plugins/plugin-markdown/components/MarkdownSettings',
|
|
15
|
+
tags: ['settings'],
|
|
16
|
+
component: MarkdownSettings,
|
|
17
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'fullscreen',
|
|
20
|
+
translations,
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof MarkdownSettings>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
settings: {
|
|
31
|
+
defaultViewMode: 'preview',
|
|
32
|
+
editorInputMode: 'default',
|
|
33
|
+
toolbar: true,
|
|
34
|
+
numberedHeadings: false,
|
|
35
|
+
folding: false,
|
|
36
|
+
experimental: false,
|
|
37
|
+
debug: false,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Input } from '@dxos/react-ui';
|
|
9
|
+
import { Settings as SettingsForm, type SettingsFieldProps } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { Markdown } from '#types';
|
|
13
|
+
|
|
14
|
+
export type MarkdownSettingsProps = AppSurface.SettingsArticleProps<Markdown.Settings>;
|
|
15
|
+
|
|
16
|
+
const SnippetsField = ({ value, onChange, readonly }: SettingsFieldProps<string | undefined>) => (
|
|
17
|
+
<Input.TextArea disabled={readonly} rows={5} value={value ?? ''} onChange={(event) => onChange(event.target.value)} />
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export const MarkdownSettings = ({ settings, onSettingsChange }: MarkdownSettingsProps) => {
|
|
21
|
+
return (
|
|
22
|
+
<SettingsForm.Viewport>
|
|
23
|
+
<SettingsForm.Section title={meta.name ?? 'Editor'}>
|
|
24
|
+
<SettingsForm.FieldSet
|
|
25
|
+
readonly={!onSettingsChange}
|
|
26
|
+
schema={Markdown.Settings}
|
|
27
|
+
visible={(path, values) => path !== 'snippets' || !!values.debug}
|
|
28
|
+
fieldMap={{ snippets: SnippetsField }}
|
|
29
|
+
values={settings}
|
|
30
|
+
onValuesChanged={(values) => onSettingsChange?.(() => values)}
|
|
31
|
+
/>
|
|
32
|
+
</SettingsForm.Section>
|
|
33
|
+
</SettingsForm.Viewport>
|
|
34
|
+
);
|
|
35
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,42 @@
|
|
|
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.getDXN(subject).toString();
|
|
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
|
+
<MarkdownEditorProvider id={id} object={subject} viewMode='source'>
|
|
34
|
+
{(editorRootProps) => (
|
|
35
|
+
<Editor.Root {...editorRootProps}>
|
|
36
|
+
<MarkdownEditor.Content compact initialValue={initialValue} />
|
|
37
|
+
</Editor.Root>
|
|
38
|
+
)}
|
|
39
|
+
</MarkdownEditorProvider>
|
|
40
|
+
</Card.Section>
|
|
41
|
+
);
|
|
42
|
+
};
|
|
@@ -10,27 +10,29 @@ import { Capability, Plugin } from '@dxos/app-framework';
|
|
|
10
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
11
11
|
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
12
12
|
import { AppActivationEvents, LayoutOperation } from '@dxos/app-toolkit';
|
|
13
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
13
14
|
import { Obj, Query } from '@dxos/echo';
|
|
14
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
15
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
15
16
|
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
16
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
17
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
17
18
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
18
|
-
import {
|
|
19
|
-
import { useQuery,
|
|
19
|
+
import { random } from '@dxos/random';
|
|
20
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
20
21
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
21
|
-
import { withLayout } from '@dxos/react-ui/testing';
|
|
22
22
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
23
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
23
24
|
import { Text } from '@dxos/schema';
|
|
24
25
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
25
26
|
import { Organization, Person } from '@dxos/types';
|
|
26
27
|
|
|
28
|
+
import { translations } from '#translations';
|
|
29
|
+
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '#types';
|
|
30
|
+
|
|
27
31
|
import { MarkdownPlugin } from '../../MarkdownPlugin';
|
|
28
|
-
import { translations } from '../../translations';
|
|
29
|
-
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '../../types';
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
random.seed(1);
|
|
32
34
|
|
|
33
|
-
const generator: ValueGenerator =
|
|
35
|
+
const generator: ValueGenerator = random as any;
|
|
34
36
|
|
|
35
37
|
/** Minimal plugin that contributes an empty Extensions capability for stories. */
|
|
36
38
|
const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions', name: 'Story Extensions' }).pipe(
|
|
@@ -44,10 +46,10 @@ const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions'
|
|
|
44
46
|
|
|
45
47
|
const DefaultStory = () => {
|
|
46
48
|
const { invokePromise } = useOperationInvoker();
|
|
47
|
-
const space =
|
|
49
|
+
const [space] = useSpaces();
|
|
48
50
|
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
49
|
-
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
50
51
|
const id = doc && Obj.getDXN(doc).toString();
|
|
52
|
+
const data = useMemo(() => ({ subject: doc, attendableId: id ?? 'story' }), [doc, id]);
|
|
51
53
|
const attentionAttrs = useAttentionAttributes(id);
|
|
52
54
|
|
|
53
55
|
useAsyncEffect(async () => {
|
|
@@ -58,13 +60,13 @@ const DefaultStory = () => {
|
|
|
58
60
|
|
|
59
61
|
return (
|
|
60
62
|
<div className='contents' {...attentionAttrs}>
|
|
61
|
-
<Surface.Surface
|
|
63
|
+
<Surface.Surface type={AppSurface.Article} data={data} limit={1} />
|
|
62
64
|
</div>
|
|
63
65
|
);
|
|
64
66
|
};
|
|
65
67
|
|
|
66
68
|
const meta = {
|
|
67
|
-
title: 'plugins/plugin-markdown/containers/
|
|
69
|
+
title: 'plugins/plugin-markdown/containers/MarkdownArticle',
|
|
68
70
|
render: DefaultStory,
|
|
69
71
|
decorators: [
|
|
70
72
|
withLayout({ layout: 'column' }),
|
|
@@ -8,33 +8,38 @@ import React, { forwardRef, useCallback, useMemo } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { useCapabilities, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
10
10
|
import { AppCapabilities, LayoutOperation } from '@dxos/app-toolkit';
|
|
11
|
-
import {
|
|
12
|
-
import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
11
|
+
import { AppSurface, useAppGraph } from '@dxos/app-toolkit/ui';
|
|
13
12
|
import { Obj } from '@dxos/echo';
|
|
14
13
|
import { useActionRunner } from '@dxos/plugin-graph';
|
|
15
14
|
import { useObject } from '@dxos/react-client/echo';
|
|
16
15
|
import { Panel } from '@dxos/react-ui';
|
|
17
16
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
17
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
18
18
|
import { Text } from '@dxos/schema';
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
import {
|
|
21
|
+
MarkdownEditor,
|
|
22
|
+
MarkdownEditorProvider,
|
|
23
|
+
type MarkdownEditorContentProps,
|
|
24
|
+
type MarkdownEditorProviderProps,
|
|
25
|
+
} from '#components';
|
|
26
|
+
import { useLinkQuery } from '#hooks';
|
|
27
|
+
import { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '#types';
|
|
23
28
|
|
|
24
|
-
export type
|
|
29
|
+
export type MarkdownArticleProps = AppSurface.ObjectArticleProps<
|
|
25
30
|
Markdown.Document | Text.Text,
|
|
26
31
|
{
|
|
27
32
|
id: string;
|
|
28
33
|
settings: Markdown.Settings;
|
|
29
34
|
selectionManager?: SelectionManager;
|
|
30
35
|
} & Pick<MarkdownPluginState, 'extensionProviders'> &
|
|
31
|
-
Pick<
|
|
36
|
+
Pick<MarkdownEditorProviderProps, 'viewMode' | 'onSelectObject' | 'onViewModeChange'> &
|
|
32
37
|
Pick<MarkdownEditorContentProps, 'editorStateStore'>
|
|
33
38
|
>;
|
|
34
39
|
|
|
35
|
-
export const
|
|
40
|
+
export const MarkdownArticle = forwardRef<HTMLDivElement, MarkdownArticleProps>(
|
|
36
41
|
(
|
|
37
|
-
{ role, subject: object, id, attendableId, settings, extensionProviders, onSelectObject, ...props },
|
|
42
|
+
{ role, subject: object, id, attendableId, settings, extensionProviders, onSelectObject, viewMode, ...props },
|
|
38
43
|
forwardedRef,
|
|
39
44
|
) => {
|
|
40
45
|
const db = Obj.isObject(object) ? Obj.getDatabase(object) : undefined;
|
|
@@ -49,18 +54,18 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
49
54
|
return [];
|
|
50
55
|
}
|
|
51
56
|
|
|
57
|
+
const document = Obj.instanceOf(Markdown.Document, object) ? object : undefined;
|
|
52
58
|
return [...(otherExtensionProviders ?? []), ...(extensionProviders ?? [])]
|
|
53
59
|
.flat()
|
|
54
60
|
.reduce((acc: Extension[], provider) => {
|
|
55
|
-
const extension =
|
|
56
|
-
typeof provider === 'function' ? provider({ document: object as Markdown.Document }) : provider;
|
|
61
|
+
const extension = typeof provider === 'function' ? provider({ document, viewMode }) : provider;
|
|
57
62
|
if (extension) {
|
|
58
63
|
acc.push(extension);
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
return acc;
|
|
62
67
|
}, []);
|
|
63
|
-
}, [extensionProviders, otherExtensionProviders, object]);
|
|
68
|
+
}, [extensionProviders, otherExtensionProviders, object, viewMode]);
|
|
64
69
|
|
|
65
70
|
// Toolbar actions from app graph.
|
|
66
71
|
const { graph } = useAppGraph();
|
|
@@ -97,38 +102,45 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
97
102
|
void invokePromise?.(LayoutOperation.Open, {
|
|
98
103
|
subject: [targetId],
|
|
99
104
|
pivotId: attendableId,
|
|
105
|
+
// TODO(wittjosiah): This should probably pre-validate.
|
|
106
|
+
navigation: 'immediate',
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
},
|
|
103
|
-
[onSelectObject, invokePromise,
|
|
110
|
+
[onSelectObject, invokePromise, attendableId],
|
|
104
111
|
);
|
|
105
112
|
|
|
106
113
|
return (
|
|
107
|
-
<
|
|
114
|
+
<MarkdownEditorProvider
|
|
108
115
|
id={id}
|
|
109
116
|
attendableId={attendableId}
|
|
110
117
|
object={object}
|
|
111
118
|
compact={role !== 'article'}
|
|
112
119
|
extensions={extensions}
|
|
113
120
|
settings={settings}
|
|
121
|
+
viewMode={viewMode}
|
|
114
122
|
onAction={runAction}
|
|
115
123
|
onFileUpload={handleFileUpload}
|
|
116
124
|
onLinkQuery={handleLinkQuery}
|
|
117
125
|
onSelectObject={handleSelectObject}
|
|
118
126
|
{...props}
|
|
119
127
|
>
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
<Panel.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
128
|
+
{(editorRootProps) => (
|
|
129
|
+
<Editor.Root {...editorRootProps}>
|
|
130
|
+
<Panel.Root role={role} ref={forwardedRef}>
|
|
131
|
+
{settings.toolbar && (
|
|
132
|
+
<Panel.Toolbar classNames='bg-toolbar-surface'>
|
|
133
|
+
<MarkdownEditor.Toolbar classNames='dx-document' customActions={customActions} />
|
|
134
|
+
</Panel.Toolbar>
|
|
135
|
+
)}
|
|
136
|
+
<Panel.Content>
|
|
137
|
+
<MarkdownEditor.Content initialValue={initialValue} />
|
|
138
|
+
<MarkdownEditor.Blocks />
|
|
139
|
+
</Panel.Content>
|
|
140
|
+
</Panel.Root>
|
|
141
|
+
</Editor.Root>
|
|
142
|
+
)}
|
|
143
|
+
</MarkdownEditorProvider>
|
|
132
144
|
);
|
|
133
145
|
},
|
|
134
146
|
);
|
|
@@ -5,28 +5,28 @@
|
|
|
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
|
|
13
|
-
import {
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client/testing';
|
|
12
|
+
import { Markdown } from '@dxos/plugin-markdown';
|
|
13
|
+
import { random } from '@dxos/random';
|
|
14
14
|
import { Card } from '@dxos/react-ui';
|
|
15
|
-
import { withTheme } from '@dxos/react-ui/testing';
|
|
16
15
|
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
16
|
+
import { withTheme } from '@dxos/react-ui/testing';
|
|
17
17
|
|
|
18
|
-
import { translations } from '
|
|
18
|
+
import { translations } from '#translations';
|
|
19
19
|
|
|
20
20
|
import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
random.seed(1234);
|
|
23
23
|
|
|
24
24
|
const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
25
25
|
const subject = useMemo(
|
|
26
26
|
() =>
|
|
27
27
|
Markdown.make({
|
|
28
|
-
name:
|
|
29
|
-
content:
|
|
28
|
+
name: random.lorem.words(3),
|
|
29
|
+
content: '# Title\n' + random.lorem.paragraphs(5),
|
|
30
30
|
}),
|
|
31
31
|
[],
|
|
32
32
|
);
|
|
@@ -51,7 +51,7 @@ const meta: Meta<typeof MarkdownCardStory> = {
|
|
|
51
51
|
decorators: [
|
|
52
52
|
withTheme(),
|
|
53
53
|
withPluginManager({
|
|
54
|
-
plugins: [
|
|
54
|
+
plugins: [ProcessManagerPlugin(), ClientPlugin({})],
|
|
55
55
|
}),
|
|
56
56
|
],
|
|
57
57
|
parameters: {
|
|
@@ -6,13 +6,15 @@ import React, { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
8
|
import { Card, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
9
10
|
import { Text } from '@dxos/schema';
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
10
12
|
|
|
11
|
-
import { MarkdownEditor } from '
|
|
12
|
-
import { meta } from '
|
|
13
|
-
import { Markdown } from '
|
|
14
|
-
import { getContentSnippet } from '../../util';
|
|
13
|
+
import { MarkdownEditor, MarkdownEditorProvider } from '#components';
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
import { Markdown } from '#types';
|
|
15
16
|
|
|
17
|
+
import { getContentSnippet } from '../../util';
|
|
16
18
|
import { snippet as snippetExtension } from './snippet';
|
|
17
19
|
|
|
18
20
|
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
@@ -20,34 +22,42 @@ export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
|
20
22
|
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
21
23
|
const { t } = useTranslation(meta.id);
|
|
22
24
|
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
23
|
-
const extensions = useMemo(() => [snippetExtension({ height:
|
|
25
|
+
const extensions = useMemo(() => [snippetExtension({ height: 300, scale: 0.8 })], []);
|
|
24
26
|
const info = getInfo(subject);
|
|
25
27
|
|
|
26
28
|
return (
|
|
27
29
|
<Card.Content>
|
|
28
30
|
{snippet && (
|
|
29
|
-
<Card.Section className='px-1'>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
<Card.Section className='relative px-1'>
|
|
32
|
+
<MarkdownEditorProvider id={subject.id} viewMode='readonly' extensions={extensions}>
|
|
33
|
+
{(editorRootProps) => (
|
|
34
|
+
<Editor.Root {...editorRootProps}>
|
|
35
|
+
<MarkdownEditor.Content initialValue={snippet} slots={{ content: { className: 'm-0' } }} />
|
|
36
|
+
</Editor.Root>
|
|
37
|
+
)}
|
|
38
|
+
</MarkdownEditorProvider>
|
|
39
|
+
<div
|
|
40
|
+
className={mx(
|
|
41
|
+
'z-10 absolute bottom-0 inset-x-0 h-12 w-full',
|
|
42
|
+
'bg-gradient-to-b from-transparent to-(--surface-bg) pointer-events-none',
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
33
45
|
</Card.Section>
|
|
34
46
|
)}
|
|
35
47
|
<Card.Section>
|
|
36
48
|
<Card.Text classNames='px-1.5 text-xs text-description'>
|
|
37
|
-
{info.words} {t('words
|
|
49
|
+
{info.words} {t('words.label', { count: info.words })}
|
|
38
50
|
</Card.Text>
|
|
39
51
|
</Card.Section>
|
|
40
52
|
</Card.Content>
|
|
41
53
|
);
|
|
42
54
|
};
|
|
43
55
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
56
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string, maxLines = 16) => {
|
|
47
57
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
48
|
-
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback,
|
|
58
|
+
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, maxLines);
|
|
49
59
|
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
50
|
-
return getContentSnippet(subject.content ?? fallback,
|
|
60
|
+
return getContentSnippet(subject.content ?? fallback, maxLines);
|
|
51
61
|
}
|
|
52
62
|
};
|
|
53
63
|
|
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { EditorState } from '@codemirror/state';
|
|
6
|
+
import { EditorView } from '@codemirror/view';
|
|
6
7
|
|
|
7
8
|
export type SnippetOptions = {
|
|
8
|
-
/** Maximum height of the editor in pixels.
|
|
9
|
+
/** Maximum height of the editor in pixels. Overflowing content is hidden. */
|
|
9
10
|
height: number;
|
|
10
11
|
/** Zoom factor applied to the editor (e.g. 0.5 renders at 50%). @default 1 */
|
|
11
12
|
scale?: number;
|
|
@@ -13,63 +14,41 @@ export type SnippetOptions = {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* CodeMirror extension for rendering a non-scrollable snippet of editor content.
|
|
16
|
-
* Constrains the editor to the given height
|
|
17
|
-
* and disables scrolling entirely.
|
|
18
|
-
*
|
|
19
|
-
*
|
|
17
|
+
* Constrains the editor to the given height via CSS `max-height`, wraps long
|
|
18
|
+
* lines (`pre-wrap`), and disables scrolling entirely.
|
|
19
|
+
*
|
|
20
|
+
* NOTE: Uses CSS `zoom` rather than `transform: scale` because `zoom` affects
|
|
21
|
+
* layout, so line wrapping fills the full visual width of the container.
|
|
22
|
+
* `transform: scale` only scales paint output, leaving empty space on the right.
|
|
20
23
|
*/
|
|
21
24
|
export const snippet = ({ height, scale = 1 }: SnippetOptions) => {
|
|
22
|
-
// Internal height is divided by scale so the visible area matches the requested height.
|
|
23
|
-
const internalHeight = Math.round(height / scale);
|
|
24
|
-
|
|
25
|
-
const clipPlugin = ViewPlugin.fromClass(
|
|
26
|
-
class SnippetPlugin implements PluginValue {
|
|
27
|
-
private clipHeight = 0;
|
|
28
|
-
|
|
29
|
-
update(update: ViewUpdate) {
|
|
30
|
-
update.view.requestMeasure({
|
|
31
|
-
// key dedupliactes concurrent requests within the same animation frame.
|
|
32
|
-
key: this,
|
|
33
|
-
read: (view) => {
|
|
34
|
-
const containerHeight = view.dom.clientHeight;
|
|
35
|
-
if (containerHeight === 0) {
|
|
36
|
-
return 0;
|
|
37
|
-
}
|
|
38
|
-
// Find the block (line) at the very bottom of the visible area.
|
|
39
|
-
const block = view.lineBlockAtHeight(containerHeight - 1);
|
|
40
|
-
// If the block overflows the container, clip at the block's top edge.
|
|
41
|
-
return block.top + block.height > containerHeight ? block.top : containerHeight;
|
|
42
|
-
},
|
|
43
|
-
write: (clipHeight, view) => {
|
|
44
|
-
if (clipHeight > 0 && clipHeight !== this.clipHeight) {
|
|
45
|
-
this.clipHeight = clipHeight;
|
|
46
|
-
view.dom.style.maxHeight = `${clipHeight}px`;
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
|
|
54
25
|
return [
|
|
55
|
-
|
|
26
|
+
EditorState.readOnly.of(true),
|
|
27
|
+
EditorView.editable.of(false),
|
|
28
|
+
EditorState.transactionFilter.of((tr) => {
|
|
29
|
+
if (tr.selection) {
|
|
30
|
+
return [];
|
|
31
|
+
} // Drop any selection changes.
|
|
32
|
+
return tr;
|
|
33
|
+
}),
|
|
56
34
|
EditorView.theme({
|
|
35
|
+
// Outer editor element: clip to the caller-specified height.
|
|
57
36
|
'&': {
|
|
58
|
-
maxHeight: `${
|
|
37
|
+
maxHeight: `${height}px`,
|
|
59
38
|
overflow: 'hidden',
|
|
60
|
-
...(scale !== 1 && { zoom: `${scale}` }),
|
|
61
39
|
},
|
|
62
|
-
'.cm-
|
|
63
|
-
|
|
64
|
-
|
|
40
|
+
'.cm-scroller': {
|
|
41
|
+
// Prevent scroll; scale up the inner clip so the final pixel height matches `height`.
|
|
42
|
+
maxHeight: `${height / scale}px`,
|
|
43
|
+
overflow: 'hidden !important',
|
|
65
44
|
padding: '0',
|
|
66
45
|
},
|
|
67
|
-
'.cm-
|
|
46
|
+
'.cm-content': {
|
|
47
|
+
// zoom (unlike transform: scale) affects layout, so line-wrapping fills the full visual width of the container.
|
|
48
|
+
zoom: scale,
|
|
49
|
+
margin: '0',
|
|
68
50
|
padding: '0',
|
|
69
51
|
},
|
|
70
|
-
'.cm-scroller': {
|
|
71
|
-
overflow: 'hidden !important',
|
|
72
|
-
},
|
|
73
52
|
}),
|
|
74
53
|
];
|
|
75
54
|
};
|
package/src/containers/index.ts
CHANGED
|
@@ -4,8 +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
|
|
11
|
-
export const
|
|
10
|
+
export const EditableMarkdownCard: ComponentType<any> = lazy(() => import('./EditableMarkdownCard'));
|
|
11
|
+
export const MarkdownArticle: ComponentType<any> = lazy(() => import('./MarkdownArticle'));
|