@dxos/plugin-markdown 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/neutral/EditableMarkdownCard-P4F4TIUM.mjs +32 -0
- package/dist/lib/neutral/EditableMarkdownCard-P4F4TIUM.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/{browser/MarkdownContainer-KER2N5M2.mjs → neutral/MarkdownContainer-2BDGD3PL.mjs} +51 -33
- package/dist/lib/neutral/MarkdownContainer-2BDGD3PL.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/MarkdownSettings-YCTZJL5V.mjs +32 -0
- package/dist/lib/neutral/MarkdownSettings-YCTZJL5V.mjs.map +7 -0
- package/dist/lib/{browser/anchor-sort-EHJGOCYW.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-QBZDVASK.mjs → neutral/app-graph-serializer-3XFKP4ER.mjs} +10 -14
- package/dist/lib/neutral/app-graph-serializer-3XFKP4ER.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 -3
- 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/{browser/chunk-YBMRREXE.mjs → neutral/chunk-3LYCPEVP.mjs} +2 -9
- package/dist/lib/{browser/chunk-YBMRREXE.mjs.map → neutral/chunk-3LYCPEVP.mjs.map} +3 -3
- package/dist/lib/neutral/chunk-6N7AD3IU.mjs +8 -0
- package/dist/lib/neutral/chunk-6N7AD3IU.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/neutral/chunk-LXNSKCPD.mjs +44 -0
- 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/neutral/create-3PGJ2NEK.mjs +28 -0
- 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 +322 -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/neutral/open-WCYGBLAG.mjs +20 -0
- package/dist/lib/neutral/open-WCYGBLAG.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/{node-esm/react-surface-LC5CI6VP.mjs → neutral/react-surface-TB4TY57T.mjs} +41 -38
- package/dist/lib/neutral/react-surface-TB4TY57T.mjs.map +7 -0
- package/dist/lib/neutral/scroll-to-anchor-6FIOKVKT.mjs +47 -0
- 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-7FMWKB7N.mjs → neutral/settings-TDGDLCUR.mjs} +7 -11
- 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 +20 -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/neutral/types/index.mjs.map +7 -0
- package/dist/lib/neutral/update-markdown-5EDRD3SH.mjs +44 -0
- 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/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.d.ts +6 -0
- 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 +33 -22
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts +3 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts +6 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +6 -5
- 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/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 +17 -0
- package/dist/types/src/containers/MarkdownCard/snippet.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts +18 -9
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts +70 -61
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +2 -2
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -1
- package/dist/types/src/containers/index.d.ts +2 -2
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -1
- package/dist/types/src/hooks/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 +10 -6
- 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/operations/create-markdown.d.ts +5 -0
- package/dist/types/src/operations/create-markdown.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/create.test.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts +5 -0
- package/dist/types/src/operations/scroll-to-anchor.d.ts.map +1 -0
- package/dist/types/src/operations/set-view-mode.d.ts +5 -0
- package/dist/types/src/operations/set-view-mode.d.ts.map +1 -0
- 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/operations/update.test.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.map +1 -1
- package/dist/types/src/translations.d.ts +70 -62
- 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/types/MarkdownOperation.d.ts +64 -0
- 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 -5
- 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 +125 -85
- package/src/MarkdownPlugin.node.ts +20 -0
- package/src/MarkdownPlugin.test.ts +26 -0
- package/src/MarkdownPlugin.tsx +15 -55
- package/src/blueprints/markdown-blueprint.ts +9 -12
- 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} +9 -5
- package/src/capabilities/{artifact-definition/artifact-definition.ts → artifact-definition.ts} +4 -4
- 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/node.ts +13 -0
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +127 -0
- package/src/capabilities/{settings/settings.ts → settings.ts} +2 -2
- package/src/capabilities/state.ts +47 -0
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +38 -35
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +120 -92
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +25 -17
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +37 -57
- 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/MarkdownCard/MarkdownCard.stories.tsx +8 -8
- package/src/containers/MarkdownCard/MarkdownCard.tsx +28 -22
- package/src/containers/MarkdownCard/index.ts +1 -3
- package/src/containers/MarkdownCard/snippet.ts +54 -0
- package/src/containers/MarkdownContainer/MarkdownContainer.stories.tsx +20 -21
- package/src/containers/MarkdownContainer/MarkdownContainer.tsx +65 -33
- package/src/containers/MarkdownContainer/index.ts +2 -3
- package/src/containers/index.ts +2 -2
- package/src/hooks/index.ts +0 -1
- package/src/hooks/useEditorMenuOptions.ts +2 -2
- package/src/hooks/useExtensions.tsx +57 -40
- package/src/hooks/useLinkQuery.ts +35 -26
- package/src/index.ts +2 -6
- package/src/meta.ts +1 -1
- package/src/operations/create-markdown.ts +19 -0
- package/src/operations/create.conversations.json +1 -0
- package/src/{blueprints/functions → operations}/create.test.ts +27 -22
- package/src/operations/create.ts +26 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/open.ts +25 -0
- package/src/operations/scroll-to-anchor.ts +38 -0
- package/src/operations/set-view-mode.ts +23 -0
- package/src/operations/update-markdown.ts +51 -0
- package/src/operations/update.conversations.json +1 -0
- package/src/{blueprints/functions → operations}/update.test.ts +47 -48
- package/src/plugin.ts +11 -0
- package/src/translations.ts +25 -37
- package/src/types/Markdown.ts +13 -23
- package/src/types/MarkdownCapabilities.ts +51 -0
- package/src/types/MarkdownEvents.ts +14 -0
- package/src/types/MarkdownOperation.ts +122 -0
- package/src/types/Settings.ts +65 -0
- package/src/types/index.ts +6 -6
- package/src/types/types.ts +4 -1
- package/src/util.tsx +4 -4
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs +0 -61
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +0 -7
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs +0 -106
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +0 -7
- package/dist/lib/browser/anchor-sort-EHJGOCYW.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs +0 -18
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +0 -7
- package/dist/lib/browser/chunk-7JEOX3X6.mjs +0 -783
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +0 -7
- package/dist/lib/browser/chunk-HK6EGNP5.mjs +0 -8
- package/dist/lib/browser/chunk-HK6EGNP5.mjs.map +0 -7
- package/dist/lib/browser/chunk-P3TN2W6M.mjs +0 -154
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +0 -7
- package/dist/lib/browser/chunk-RJO5W5YX.mjs +0 -59
- package/dist/lib/browser/chunk-RJO5W5YX.mjs.map +0 -7
- package/dist/lib/browser/chunk-W24NJ6WB.mjs +0 -178
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +0 -7
- package/dist/lib/browser/cli/index.mjs +0 -35
- package/dist/lib/browser/cli/index.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -157
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs +0 -54
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +0 -7
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +0 -115
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +0 -7
- package/dist/lib/browser/settings-7FMWKB7N.mjs.map +0 -7
- package/dist/lib/browser/state-7UJKJDGE.mjs +0 -31
- package/dist/lib/browser/state-7UJKJDGE.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -18
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs +0 -62
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs +0 -109
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs +0 -107
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +0 -7
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs +0 -35
- package/dist/lib/node-esm/anchor-sort-QWZO6B2R.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs +0 -61
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -10
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs +0 -60
- package/dist/lib/node-esm/chunk-ANIFP6M2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs +0 -10
- package/dist/lib/node-esm/chunk-KCH3EL53.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs +0 -784
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs +0 -179
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs +0 -29
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs +0 -155
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +0 -7
- package/dist/lib/node-esm/cli/index.mjs +0 -36
- package/dist/lib/node-esm/cli/index.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -158
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs +0 -55
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +0 -7
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs +0 -39
- package/dist/lib/node-esm/settings-DBK2SPWT.mjs.map +0 -7
- package/dist/lib/node-esm/state-EEPLRAOT.mjs +0 -32
- package/dist/lib/node-esm/state-EEPLRAOT.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -19
- package/dist/types/src/blueprints/functions/create.d.ts +0 -8
- package/dist/types/src/blueprints/functions/create.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/create.test.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/index.d.ts +0 -42
- package/dist/types/src/blueprints/functions/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/open.d.ts +0 -14
- package/dist/types/src/blueprints/functions/open.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.d.ts +0 -19
- package/dist/types/src/blueprints/functions/update.d.ts.map +0 -1
- package/dist/types/src/blueprints/functions/update.test.d.ts.map +0 -1
- 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-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.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 -5
- 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/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/hooks/useSelectCurrentThread.d.ts +0 -6
- package/dist/types/src/hooks/useSelectCurrentThread.d.ts.map +0 -1
- package/dist/types/src/types/MarkdownAction.d.ts +0 -66
- package/dist/types/src/types/MarkdownAction.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -22
- 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/blueprints/functions/create.conversations.json +0 -1
- package/src/blueprints/functions/create.ts +0 -35
- package/src/blueprints/functions/index.ts +0 -15
- package/src/blueprints/functions/open.ts +0 -33
- package/src/blueprints/functions/update.conversations.json +0 -1
- package/src/blueprints/functions/update.ts +0 -79
- 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/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -45
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -102
- package/src/capabilities/settings/index.ts +0 -7
- package/src/capabilities/state/index.ts +0 -7
- package/src/capabilities/state/state.ts +0 -31
- package/src/cli/index.ts +0 -5
- package/src/cli/plugin.ts +0 -30
- package/src/containers/MarkdownSettings/MarkdownSettings.tsx +0 -122
- package/src/containers/MarkdownSettings/index.ts +0 -7
- package/src/hooks/useSelectCurrentThread.tsx +0 -61
- package/src/types/MarkdownAction.ts +0 -59
- package/src/types/capabilities.ts +0 -38
- package/src/types/events.ts +0 -14
- /package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- /package/dist/lib/{browser/types/index.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/types/index.mjs.map → neutral/meta.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
- /package/dist/types/src/{blueprints/functions → operations}/create.test.d.ts +0 -0
- /package/dist/types/src/{blueprints/functions → operations}/update.test.d.ts +0 -0
|
@@ -6,6 +6,7 @@ import { type EditorView } from '@codemirror/view';
|
|
|
6
6
|
import { type Atom, RegistryContext } from '@effect-atom/atom-react';
|
|
7
7
|
import React, { forwardRef, useCallback, useContext, useEffect, useImperativeHandle, useMemo } from 'react';
|
|
8
8
|
|
|
9
|
+
import { useCapabilities } from '@dxos/app-framework/ui';
|
|
9
10
|
import { type ThemedClassName, useThemeContext, useTranslation } from '@dxos/react-ui';
|
|
10
11
|
import {
|
|
11
12
|
type EditorMenuGroup,
|
|
@@ -16,30 +17,32 @@ import {
|
|
|
16
17
|
import {
|
|
17
18
|
type EditorSelectionState,
|
|
18
19
|
type EditorStateStore,
|
|
19
|
-
type EditorViewMode,
|
|
20
20
|
type ThemeExtensionsOptions,
|
|
21
|
+
mobileSlots,
|
|
21
22
|
createBasicExtensions,
|
|
22
23
|
createMarkdownExtensions,
|
|
23
24
|
createThemeExtensions,
|
|
24
25
|
dropFile,
|
|
25
|
-
|
|
26
|
+
documentSlots,
|
|
26
27
|
formattingListener,
|
|
27
28
|
processEditorPayload,
|
|
28
|
-
|
|
29
|
+
editorClassNames,
|
|
29
30
|
} from '@dxos/ui-editor';
|
|
31
|
+
import { type EditorViewMode } from '@dxos/ui-editor/types';
|
|
30
32
|
import { mx } from '@dxos/ui-theme';
|
|
31
33
|
import { isTruthy } from '@dxos/util';
|
|
32
34
|
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
+
import { meta } from '#meta';
|
|
36
|
+
import { MarkdownCapabilities } from '#types';
|
|
35
37
|
|
|
36
38
|
import { type MarkdownEditorToolbarProps } from './MarkdownEditorToolbar';
|
|
37
39
|
|
|
38
40
|
export type MarkdownEditorContentProps = ThemedClassName<{
|
|
39
41
|
id: string;
|
|
42
|
+
attendableId?: string;
|
|
40
43
|
role?: string;
|
|
44
|
+
compact?: boolean;
|
|
41
45
|
viewMode?: EditorViewMode;
|
|
42
|
-
scrollPastEnd?: boolean;
|
|
43
46
|
slashCommandGroups?: EditorMenuGroup[];
|
|
44
47
|
editorStateStore?: EditorStateStore;
|
|
45
48
|
toolbarState?: Atom.Writable<EditorToolbarState>;
|
|
@@ -49,19 +52,21 @@ export type MarkdownEditorContentProps = ThemedClassName<{
|
|
|
49
52
|
Pick<MarkdownEditorToolbarProps, 'onFileUpload'> &
|
|
50
53
|
Pick<ThemeExtensionsOptions, 'slots'>;
|
|
51
54
|
|
|
55
|
+
// TODO(burdon): Move controller to Root.
|
|
52
56
|
export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEditorContentProps>(
|
|
53
57
|
(
|
|
54
58
|
{
|
|
55
59
|
classNames,
|
|
56
60
|
id,
|
|
61
|
+
attendableId,
|
|
57
62
|
role,
|
|
63
|
+
compact,
|
|
58
64
|
viewMode,
|
|
59
65
|
initialValue,
|
|
60
66
|
editorStateStore,
|
|
61
67
|
toolbarState,
|
|
62
68
|
extensions,
|
|
63
|
-
|
|
64
|
-
slots = editorSlots,
|
|
69
|
+
slots,
|
|
65
70
|
onFileUpload,
|
|
66
71
|
},
|
|
67
72
|
forwardedRef,
|
|
@@ -93,21 +98,19 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
93
98
|
id,
|
|
94
99
|
scrollTo,
|
|
95
100
|
selection,
|
|
96
|
-
// TODO(wittjosiah): Autofocus based on layout is racy.
|
|
97
|
-
// autoFocus: layoutPlugin?.provides.layout ? layoutPlugin?.provides.layout.scrollIntoView === id : true,
|
|
98
101
|
selectionEnd: true,
|
|
99
102
|
}),
|
|
100
103
|
initialValue,
|
|
101
104
|
extensions: [
|
|
102
105
|
createBasicExtensions({
|
|
103
106
|
readOnly: viewMode === 'readonly',
|
|
104
|
-
placeholder: t('editor
|
|
105
|
-
scrollPastEnd:
|
|
107
|
+
placeholder: t('editor.placeholder'),
|
|
108
|
+
scrollPastEnd: !compact,
|
|
106
109
|
search: true,
|
|
107
110
|
}),
|
|
108
111
|
createThemeExtensions({
|
|
109
112
|
themeMode,
|
|
110
|
-
slots,
|
|
113
|
+
slots: slots ?? (compact ? mobileSlots : documentSlots),
|
|
111
114
|
syntaxHighlighting: true,
|
|
112
115
|
}),
|
|
113
116
|
createMarkdownExtensions(),
|
|
@@ -127,22 +130,27 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
127
130
|
extensions,
|
|
128
131
|
].filter(isTruthy),
|
|
129
132
|
}),
|
|
130
|
-
[id, viewMode, themeMode, extensions],
|
|
133
|
+
[id, viewMode, themeMode, extensions, compact],
|
|
131
134
|
);
|
|
132
135
|
|
|
133
136
|
useImperativeHandle<EditorView | null, EditorView | null>(forwardedRef, () => editorView, [editorView]);
|
|
134
137
|
|
|
135
|
-
|
|
138
|
+
const [editorViewRegistry] = useCapabilities(MarkdownCapabilities.EditorViews);
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
if (editorView && editorViewRegistry) {
|
|
141
|
+
editorViewRegistry.register(attendableId ?? id, editorView, id);
|
|
142
|
+
return () => editorViewRegistry.unregister(attendableId ?? id);
|
|
143
|
+
}
|
|
144
|
+
}, [editorView, editorViewRegistry, attendableId, id]);
|
|
136
145
|
|
|
137
146
|
useTest(editorView);
|
|
138
147
|
|
|
139
148
|
return (
|
|
140
149
|
<div
|
|
141
150
|
{...focusAttributes}
|
|
142
|
-
role
|
|
151
|
+
className={mx(editorClassNames(role), classNames)}
|
|
143
152
|
data-testid='composer.markdownRoot'
|
|
144
153
|
data-popover-collision-boundary={true}
|
|
145
|
-
className={mx(stackItemContentEditorClassNames(role), classNames)}
|
|
146
154
|
ref={parentRef}
|
|
147
155
|
/>
|
|
148
156
|
);
|
|
@@ -3,65 +3,45 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
|
-
import React, {
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type FileInfo } from '@dxos/app-toolkit';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { EditorToolbar, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
12
|
-
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
9
|
+
import { Editor, type EditorToolbarProps } from '@dxos/react-ui-editor';
|
|
10
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
13
11
|
|
|
14
12
|
import { FileUpload, type FileUploadAction } from './FileUpload';
|
|
15
13
|
|
|
16
|
-
export type MarkdownEditorToolbarProps =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
50
|
-
return (
|
|
51
|
-
<div role='none' {...props}>
|
|
52
|
-
<EditorToolbar
|
|
53
|
-
classNames={classNames}
|
|
54
|
-
attendableId={id}
|
|
55
|
-
role={role}
|
|
56
|
-
state={state}
|
|
57
|
-
customActions={customActions}
|
|
58
|
-
getView={getView}
|
|
59
|
-
onAction={onAction}
|
|
60
|
-
onImageUpload={upload ?? undefined}
|
|
61
|
-
onViewModeChange={handleViewModeChange}
|
|
62
|
-
/>
|
|
63
|
-
|
|
64
|
-
{onFileUpload && <FileUpload ref={uploadRef} editorView={editorView} onFileUpload={onFileUpload} />}
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
};
|
|
14
|
+
export type MarkdownEditorToolbarProps = {
|
|
15
|
+
id: string;
|
|
16
|
+
editorView?: EditorView;
|
|
17
|
+
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
18
|
+
} & Pick<EditorToolbarProps, 'role' | 'customActions' | 'onAction' | 'onViewModeChange'>;
|
|
19
|
+
|
|
20
|
+
export const MarkdownEditorToolbar = composable<HTMLDivElement, MarkdownEditorToolbarProps>(
|
|
21
|
+
({ id, role, editorView, customActions, onAction, onFileUpload, onViewModeChange, ...props }, forwardedRef) => {
|
|
22
|
+
const { className, ...rest } = composableProps(props);
|
|
23
|
+
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
24
|
+
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
25
|
+
|
|
26
|
+
if (!editorView) {
|
|
27
|
+
return <div className={className} {...rest} ref={forwardedRef} />;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<div className='contents' ref={forwardedRef}>
|
|
32
|
+
<Editor.Toolbar
|
|
33
|
+
{...rest}
|
|
34
|
+
classNames={className}
|
|
35
|
+
attendableId={id}
|
|
36
|
+
role={role}
|
|
37
|
+
customActions={customActions}
|
|
38
|
+
onAction={onAction}
|
|
39
|
+
onImageUpload={upload ?? undefined}
|
|
40
|
+
onViewModeChange={onViewModeChange}
|
|
41
|
+
/>
|
|
42
|
+
|
|
43
|
+
{onFileUpload && <FileUpload ref={uploadRef} editorView={editorView} onFileUpload={onFileUpload} />}
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
);
|
|
@@ -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 MarkdownContainer
|
|
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
|
+
};
|
|
@@ -8,25 +8,25 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
import { OperationPlugin, RuntimePlugin } 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/plugin';
|
|
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
|
);
|
|
@@ -5,53 +5,59 @@
|
|
|
5
5
|
import React, { useMemo } from 'react';
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
|
-
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import {
|
|
8
|
+
import { Card, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Editor } from '@dxos/react-ui-editor';
|
|
10
10
|
import { Text } from '@dxos/schema';
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
12
|
+
|
|
13
|
+
import { MarkdownEditor, MarkdownEditorProvider } from '#components';
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
import { Markdown } from '#types';
|
|
11
16
|
|
|
12
|
-
import { MarkdownEditor } from '../../components';
|
|
13
|
-
import { meta } from '../../meta';
|
|
14
|
-
import { Markdown } from '../../types';
|
|
15
17
|
import { getContentSnippet } from '../../util';
|
|
18
|
+
import { snippet as snippetExtension } from './snippet';
|
|
16
19
|
|
|
17
20
|
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
18
21
|
|
|
19
22
|
export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
20
23
|
const { t } = useTranslation(meta.id);
|
|
21
24
|
const snippet = useMemo(() => getSnippet(subject), [subject]);
|
|
25
|
+
const extensions = useMemo(() => [snippetExtension({ height: 300, scale: 0.8 })], []);
|
|
22
26
|
const info = getInfo(subject);
|
|
23
27
|
|
|
24
28
|
return (
|
|
25
29
|
<Card.Content>
|
|
26
30
|
{snippet && (
|
|
27
|
-
<Card.Section>
|
|
28
|
-
<
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
+
/>
|
|
37
45
|
</Card.Section>
|
|
38
46
|
)}
|
|
39
47
|
<Card.Section>
|
|
40
|
-
<Card.Text classNames='text-xs text-description'>
|
|
41
|
-
{info.words} {t('words
|
|
48
|
+
<Card.Text classNames='px-1.5 text-xs text-description'>
|
|
49
|
+
{info.words} {t('words.label', { count: info.words })}
|
|
42
50
|
</Card.Text>
|
|
43
51
|
</Card.Section>
|
|
44
52
|
</Card.Content>
|
|
45
53
|
);
|
|
46
54
|
};
|
|
47
55
|
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
56
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string, maxLines = 16) => {
|
|
51
57
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
52
|
-
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback,
|
|
58
|
+
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, maxLines);
|
|
53
59
|
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
54
|
-
return getContentSnippet(subject.content ?? fallback,
|
|
60
|
+
return getContentSnippet(subject.content ?? fallback, maxLines);
|
|
55
61
|
}
|
|
56
62
|
};
|
|
57
63
|
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { EditorState } from '@codemirror/state';
|
|
6
|
+
import { EditorView } from '@codemirror/view';
|
|
7
|
+
|
|
8
|
+
export type SnippetOptions = {
|
|
9
|
+
/** Maximum height of the editor in pixels. Overflowing content is hidden. */
|
|
10
|
+
height: number;
|
|
11
|
+
/** Zoom factor applied to the editor (e.g. 0.5 renders at 50%). @default 1 */
|
|
12
|
+
scale?: number;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* CodeMirror extension for rendering a non-scrollable snippet of editor content.
|
|
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.
|
|
23
|
+
*/
|
|
24
|
+
export const snippet = ({ height, scale = 1 }: SnippetOptions) => {
|
|
25
|
+
return [
|
|
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
|
+
}),
|
|
34
|
+
EditorView.theme({
|
|
35
|
+
// Outer editor element: clip to the caller-specified height.
|
|
36
|
+
'&': {
|
|
37
|
+
maxHeight: `${height}px`,
|
|
38
|
+
overflow: 'hidden',
|
|
39
|
+
},
|
|
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',
|
|
44
|
+
padding: '0',
|
|
45
|
+
},
|
|
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',
|
|
50
|
+
padding: '0',
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
];
|
|
54
|
+
};
|
|
@@ -10,26 +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 {
|
|
15
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
16
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
17
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
16
18
|
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
17
|
-
import {
|
|
18
|
-
import { useQuery,
|
|
19
|
+
import { random } from '@dxos/random';
|
|
20
|
+
import { useQuery, useSpaces } from '@dxos/react-client/echo';
|
|
19
21
|
import { useAsyncEffect } from '@dxos/react-ui';
|
|
20
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
21
22
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
23
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
22
24
|
import { Text } from '@dxos/schema';
|
|
23
25
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
24
26
|
import { Organization, Person } from '@dxos/types';
|
|
25
27
|
|
|
28
|
+
import { translations } from '#translations';
|
|
29
|
+
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '#types';
|
|
30
|
+
|
|
26
31
|
import { MarkdownPlugin } from '../../MarkdownPlugin';
|
|
27
|
-
import { translations } from '../../translations';
|
|
28
|
-
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '../../types';
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
random.seed(1);
|
|
31
34
|
|
|
32
|
-
const generator: ValueGenerator =
|
|
35
|
+
const generator: ValueGenerator = random as any;
|
|
33
36
|
|
|
34
37
|
/** Minimal plugin that contributes an empty Extensions capability for stories. */
|
|
35
38
|
const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions', name: 'Story Extensions' }).pipe(
|
|
@@ -43,10 +46,10 @@ const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions'
|
|
|
43
46
|
|
|
44
47
|
const DefaultStory = () => {
|
|
45
48
|
const { invokePromise } = useOperationInvoker();
|
|
46
|
-
const space =
|
|
49
|
+
const [space] = useSpaces();
|
|
47
50
|
const [doc] = useQuery(space?.db, Query.type(Markdown.Document));
|
|
48
|
-
const data = useMemo(() => ({ subject: doc }), [doc]);
|
|
49
51
|
const id = doc && Obj.getDXN(doc).toString();
|
|
52
|
+
const data = useMemo(() => ({ subject: doc, attendableId: id ?? 'story' }), [doc, id]);
|
|
50
53
|
const attentionAttrs = useAttentionAttributes(id);
|
|
51
54
|
|
|
52
55
|
useAsyncEffect(async () => {
|
|
@@ -57,7 +60,7 @@ const DefaultStory = () => {
|
|
|
57
60
|
|
|
58
61
|
return (
|
|
59
62
|
<div className='contents' {...attentionAttrs}>
|
|
60
|
-
<Surface.Surface
|
|
63
|
+
<Surface.Surface type={AppSurface.Article} data={data} limit={1} />
|
|
61
64
|
</div>
|
|
62
65
|
);
|
|
63
66
|
};
|
|
@@ -66,7 +69,6 @@ const meta = {
|
|
|
66
69
|
title: 'plugins/plugin-markdown/containers/MarkdownContainer',
|
|
67
70
|
render: DefaultStory,
|
|
68
71
|
decorators: [
|
|
69
|
-
withTheme(),
|
|
70
72
|
withLayout({ layout: 'column' }),
|
|
71
73
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
72
74
|
setupEvents: [AppActivationEvents.SetupSettings, MarkdownEvents.SetupExtensions],
|
|
@@ -78,20 +80,17 @@ const meta = {
|
|
|
78
80
|
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
79
81
|
onClientInitialized: ({ client }) =>
|
|
80
82
|
Effect.gen(function* () {
|
|
81
|
-
yield*
|
|
82
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
83
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
83
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
84
84
|
|
|
85
|
-
const
|
|
86
|
-
const createObjects = createObjectFactory(space.db, generator);
|
|
85
|
+
const createObjects = createObjectFactory(personalSpace.db, generator);
|
|
87
86
|
yield* Effect.promise(() => createObjects([{ type: Organization.Organization, count: 10 }]));
|
|
88
87
|
|
|
89
|
-
const queue =
|
|
88
|
+
const queue = personalSpace.queues.create();
|
|
90
89
|
const kai = Obj.make(Person.Person, { fullName: 'Kai' });
|
|
91
90
|
const dxos = Obj.make(Organization.Organization, { name: 'DXOS' });
|
|
92
91
|
yield* Effect.promise(() => queue.append([kai, dxos]));
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
personalSpace.db.add(
|
|
95
94
|
Markdown.make({
|
|
96
95
|
name: context.args.title ?? 'Testing',
|
|
97
96
|
content: [
|
|
@@ -108,7 +107,7 @@ const meta = {
|
|
|
108
107
|
}),
|
|
109
108
|
);
|
|
110
109
|
|
|
111
|
-
yield* Effect.promise(() =>
|
|
110
|
+
yield* Effect.promise(() => personalSpace.db.flush({ indexes: true }));
|
|
112
111
|
}),
|
|
113
112
|
}),
|
|
114
113
|
|