@dxos/plugin-markdown 0.7.4 → 0.7.5-labs.071a3e2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/browser/{MarkdownContainer-6OPC5MKP.mjs → MarkdownContainer-ZVCWASOD.mjs} +187 -124
- package/dist/lib/browser/MarkdownContainer-ZVCWASOD.mjs.map +7 -0
- package/dist/lib/browser/app-graph-serializer-BG3MHYI4.mjs +51 -0
- package/dist/lib/browser/app-graph-serializer-BG3MHYI4.mjs.map +7 -0
- package/dist/lib/browser/chunk-EZ65DY2X.mjs +16 -0
- package/dist/lib/browser/chunk-EZ65DY2X.mjs.map +7 -0
- package/dist/lib/browser/{chunk-TZN5FGB2.mjs → chunk-NPLFZ76Q.mjs} +24 -13
- package/dist/lib/browser/chunk-NPLFZ76Q.mjs.map +7 -0
- package/dist/lib/browser/chunk-P4K367ZX.mjs +66 -0
- package/dist/lib/browser/chunk-P4K367ZX.mjs.map +7 -0
- package/dist/lib/browser/chunk-ROJ4VUZB.mjs +47 -0
- package/dist/lib/browser/chunk-ROJ4VUZB.mjs.map +7 -0
- package/dist/lib/browser/chunk-YTHIPV5Q.mjs +22 -0
- package/dist/lib/browser/chunk-YTHIPV5Q.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +99 -452
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/intent-resolver-CCOPGHVY.mjs +43 -0
- package/dist/lib/browser/intent-resolver-CCOPGHVY.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/react-surface-FDSOMV5N.mjs +149 -0
- package/dist/lib/browser/react-surface-FDSOMV5N.mjs.map +7 -0
- package/dist/lib/browser/settings-U7E4DUWJ.mjs +28 -0
- package/dist/lib/browser/settings-U7E4DUWJ.mjs.map +7 -0
- package/dist/lib/browser/state-QMQXUPSI.mjs +37 -0
- package/dist/lib/browser/state-QMQXUPSI.mjs.map +7 -0
- package/dist/lib/browser/thread-Y4WMNFBC.mjs +36 -0
- package/dist/lib/browser/thread-Y4WMNFBC.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -4
- package/dist/lib/node/{MarkdownContainer-6OKJOHTZ.cjs → MarkdownContainer-HJR4TB7X.cjs} +179 -118
- package/dist/lib/node/MarkdownContainer-HJR4TB7X.cjs.map +7 -0
- package/dist/lib/node/app-graph-serializer-QZWERV4M.cjs +62 -0
- package/dist/lib/node/app-graph-serializer-QZWERV4M.cjs.map +7 -0
- package/dist/lib/node/{meta.cjs → chunk-23NQGZX3.cjs} +13 -8
- package/dist/lib/node/chunk-23NQGZX3.cjs.map +7 -0
- package/dist/lib/node/{chunk-KEPAM4JP.cjs → chunk-2WJ7TUBY.cjs} +39 -14
- package/dist/lib/node/chunk-2WJ7TUBY.cjs.map +7 -0
- package/dist/lib/node/chunk-CZXXBKMN.cjs +86 -0
- package/dist/lib/node/chunk-CZXXBKMN.cjs.map +7 -0
- package/dist/lib/node/{chunk-PHHIPRJC.cjs → chunk-QZ4XQYNC.cjs} +16 -9
- package/dist/lib/node/chunk-QZ4XQYNC.cjs.map +7 -0
- package/dist/lib/node/chunk-ZO5ABSHT.cjs +64 -0
- package/dist/lib/node/chunk-ZO5ABSHT.cjs.map +7 -0
- package/dist/lib/node/index.cjs +90 -450
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/intent-resolver-5LCIY27K.cjs +56 -0
- package/dist/lib/node/intent-resolver-5LCIY27K.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/react-surface-Y4IB5T27.cjs +162 -0
- package/dist/lib/node/react-surface-Y4IB5T27.cjs.map +7 -0
- package/dist/lib/node/settings-4OYDMRVY.cjs +42 -0
- package/dist/lib/node/settings-4OYDMRVY.cjs.map +7 -0
- package/dist/lib/node/state-QSA5AOLH.cjs +51 -0
- package/dist/lib/node/state-QSA5AOLH.cjs.map +7 -0
- package/dist/lib/node/thread-BZE6RKFE.cjs +52 -0
- package/dist/lib/node/thread-BZE6RKFE.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +7 -7
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{MarkdownContainer-GBNSGROQ.mjs → MarkdownContainer-ILR7OVRM.mjs} +187 -124
- package/dist/lib/node-esm/MarkdownContainer-ILR7OVRM.mjs.map +7 -0
- package/dist/lib/node-esm/app-graph-serializer-H7LI476D.mjs +52 -0
- package/dist/lib/node-esm/app-graph-serializer-H7LI476D.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BBVPC53M.mjs +24 -0
- package/dist/lib/node-esm/chunk-BBVPC53M.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-MMVIEZ43.mjs +67 -0
- package/dist/lib/node-esm/chunk-MMVIEZ43.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-OXPPXUUU.mjs +48 -0
- package/dist/lib/node-esm/chunk-OXPPXUUU.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-NUMUUCYF.mjs → chunk-T62F7XQE.mjs} +24 -13
- package/dist/lib/node-esm/chunk-T62F7XQE.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-Y5QKDC4V.mjs +17 -0
- package/dist/lib/node-esm/chunk-Y5QKDC4V.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +99 -452
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/intent-resolver-HFEI5NFC.mjs +44 -0
- package/dist/lib/node-esm/intent-resolver-HFEI5NFC.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/react-surface-N5F4I26E.mjs +150 -0
- package/dist/lib/node-esm/react-surface-N5F4I26E.mjs.map +7 -0
- package/dist/lib/node-esm/settings-MEN2YBLA.mjs +29 -0
- package/dist/lib/node-esm/settings-MEN2YBLA.mjs.map +7 -0
- package/dist/lib/node-esm/state-FF4NXLWU.mjs +38 -0
- package/dist/lib/node-esm/state-FF4NXLWU.mjs.map +7 -0
- package/dist/lib/node-esm/thread-O2YDKT77.mjs +37 -0
- package/dist/lib/node-esm/thread-O2YDKT77.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -4
- package/dist/types/src/MarkdownPlugin.d.ts +1 -3
- package/dist/types/src/MarkdownPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-serializer.d.ts +4 -0
- package/dist/types/src/capabilities/app-graph-serializer.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +12 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +16 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts +4 -0
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +4 -0
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/state.d.ts +11 -0
- package/dist/types/src/capabilities/state.d.ts.map +1 -0
- package/dist/types/src/capabilities/thread.d.ts +6 -0
- package/dist/types/src/capabilities/thread.d.ts.map +1 -0
- package/dist/types/src/components/MarkdownContainer.d.ts +1 -1
- package/dist/types/src/components/MarkdownContainer.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor.d.ts +15 -0
- package/dist/types/src/components/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/Toolbar.stories.d.ts +2 -2
- package/dist/types/src/components/Toolbar.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/extensions.d.ts +4 -4
- package/dist/types/src/extensions.d.ts.map +1 -1
- package/dist/types/src/hooks/useSelectCurrentThread.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 +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +75 -0
- package/dist/types/src/types/schema.d.ts.map +1 -0
- package/dist/types/src/types/types.d.ts +40 -35
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util.d.ts +1 -5
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +33 -37
- package/src/MarkdownPlugin.tsx +76 -283
- package/src/capabilities/app-graph-serializer.ts +50 -0
- package/src/capabilities/capabilities.ts +20 -0
- package/src/capabilities/index.ts +14 -0
- package/src/capabilities/intent-resolver.ts +33 -0
- package/src/capabilities/react-surface.tsx +71 -0
- package/src/capabilities/settings.ts +25 -0
- package/src/capabilities/state.ts +31 -0
- package/src/capabilities/thread.ts +34 -0
- package/src/components/MarkdownContainer.tsx +14 -10
- package/src/components/MarkdownEditor.stories.tsx +16 -5
- package/src/components/MarkdownEditor.tsx +91 -61
- package/src/components/MarkdownSettings.tsx +3 -3
- package/src/components/Toolbar.stories.tsx +16 -22
- package/src/extensions.tsx +25 -22
- package/src/hooks/useSelectCurrentThread.tsx +22 -14
- package/src/index.ts +2 -5
- package/src/meta.ts +7 -2
- package/src/translations.ts +1 -0
- package/src/types/index.ts +1 -1
- package/src/types/{document.ts → schema.ts} +4 -7
- package/src/types/types.ts +36 -58
- package/src/util.tsx +5 -11
- package/dist/lib/browser/MarkdownContainer-6OPC5MKP.mjs.map +0 -7
- package/dist/lib/browser/chunk-4X6YX3KU.mjs +0 -15
- package/dist/lib/browser/chunk-4X6YX3KU.mjs.map +0 -7
- package/dist/lib/browser/chunk-CMSUKMPM.mjs +0 -41
- package/dist/lib/browser/chunk-CMSUKMPM.mjs.map +0 -7
- package/dist/lib/browser/chunk-TZN5FGB2.mjs.map +0 -7
- package/dist/lib/browser/meta.mjs +0 -9
- package/dist/lib/browser/meta.mjs.map +0 -7
- package/dist/lib/node/MarkdownContainer-6OKJOHTZ.cjs.map +0 -7
- package/dist/lib/node/chunk-KEPAM4JP.cjs.map +0 -7
- package/dist/lib/node/chunk-PHHIPRJC.cjs.map +0 -7
- package/dist/lib/node/chunk-YGMWZIIJ.cjs +0 -61
- package/dist/lib/node/chunk-YGMWZIIJ.cjs.map +0 -7
- package/dist/lib/node/meta.cjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-GBNSGROQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-BABK7FMW.mjs +0 -17
- package/dist/lib/node-esm/chunk-BABK7FMW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-ERJ52KN2.mjs +0 -42
- package/dist/lib/node-esm/chunk-ERJ52KN2.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-NUMUUCYF.mjs.map +0 -7
- package/dist/lib/node-esm/meta.mjs +0 -10
- package/dist/lib/node-esm/meta.mjs.map +0 -7
- package/dist/types/src/types/document.d.ts +0 -106
- package/dist/types/src/types/document.d.ts.map +0 -1
package/dist/types/src/util.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import { type Plugin } from '@dxos/app-framework';
|
|
2
1
|
import { type TypedObjectSerializer } from '@dxos/plugin-space/types';
|
|
3
|
-
import { DocumentType, type MarkdownProperties
|
|
2
|
+
import { DocumentType, type MarkdownProperties } from './types';
|
|
4
3
|
export declare const isMarkdownProperties: (data: unknown) => data is MarkdownProperties;
|
|
5
|
-
type MarkdownExtensionPlugin = Plugin<MarkdownExtensionProvides>;
|
|
6
|
-
export declare const markdownExtensionPlugins: (plugins: Plugin[]) => MarkdownExtensionPlugin[];
|
|
7
4
|
export declare const getFallbackName: (content: string) => string;
|
|
8
5
|
export declare const setFallbackName: (...args: any[]) => void;
|
|
9
6
|
export declare const serializer: TypedObjectSerializer<DocumentType>;
|
|
10
|
-
export {};
|
|
11
7
|
//# sourceMappingURL=util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../../src/util.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAItE,OAAO,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAEhE,eAAO,MAAM,oBAAoB,SAAU,OAAO,KAAG,IAAI,IAAI,kBAKhD,CAAC;AAId,eAAO,MAAM,eAAe,YAAa,MAAM,WAE9C,CAAC;AAEF,eAAO,MAAM,eAAe,0BAKrB,CAAC;AAER,eAAO,MAAM,UAAU,EAAE,qBAAqB,CAAC,YAAY,CAY1D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":"5.7.3"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dxos/plugin-markdown",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.5-labs.071a3e2",
|
|
4
4
|
"description": "DXOS Surface plugin for interacting with Markdown",
|
|
5
5
|
"homepage": "https://dxos.org",
|
|
6
6
|
"bugs": "https://github.com/dxos/dxos/issues",
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
"browser": "./dist/lib/browser/index.mjs",
|
|
14
14
|
"node": "./dist/lib/node-esm/index.mjs"
|
|
15
15
|
},
|
|
16
|
-
"./meta": {
|
|
17
|
-
"types": "./dist/types/src/meta.d.ts",
|
|
18
|
-
"browser": "./dist/lib/browser/meta.mjs",
|
|
19
|
-
"node": "./dist/lib/node-esm/meta.mjs"
|
|
20
|
-
},
|
|
21
16
|
"./types": {
|
|
22
17
|
"types": "./dist/types/src/types/index.d.ts",
|
|
23
18
|
"browser": "./dist/lib/browser/types/index.mjs",
|
|
@@ -27,9 +22,6 @@
|
|
|
27
22
|
"types": "dist/types/src/index.d.ts",
|
|
28
23
|
"typesVersions": {
|
|
29
24
|
"*": {
|
|
30
|
-
"meta": [
|
|
31
|
-
"dist/types/src/meta.d.ts"
|
|
32
|
-
],
|
|
33
25
|
"types": [
|
|
34
26
|
"dist/types/src/types/index.d.ts"
|
|
35
27
|
]
|
|
@@ -44,28 +36,31 @@
|
|
|
44
36
|
"@codemirror/view": "^6.34.1",
|
|
45
37
|
"@effect/schema": "^0.75.5",
|
|
46
38
|
"@preact/signals-core": "^1.6.0",
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"@dxos/
|
|
50
|
-
"@dxos/
|
|
51
|
-
"@dxos/
|
|
52
|
-
"@dxos/
|
|
53
|
-
"@dxos/
|
|
54
|
-
"@dxos/
|
|
55
|
-
"@dxos/
|
|
56
|
-
"@dxos/
|
|
57
|
-
"@dxos/plugin-
|
|
58
|
-
"@dxos/plugin-
|
|
59
|
-
"@dxos/
|
|
60
|
-
"@dxos/
|
|
61
|
-
"@dxos/
|
|
62
|
-
"@dxos/
|
|
63
|
-
"@dxos/react-
|
|
64
|
-
"@dxos/react-ui-
|
|
65
|
-
"@dxos/react-ui-
|
|
66
|
-
"@dxos/react-ui-
|
|
67
|
-
"@dxos/
|
|
68
|
-
"@dxos/react-ui-
|
|
39
|
+
"effect": "^3.12.3",
|
|
40
|
+
"react-dropzone": "^14.2.3",
|
|
41
|
+
"@dxos/app-framework": "0.7.5-labs.071a3e2",
|
|
42
|
+
"@dxos/async": "0.7.5-labs.071a3e2",
|
|
43
|
+
"@dxos/echo-schema": "0.7.5-labs.071a3e2",
|
|
44
|
+
"@dxos/keys": "0.7.5-labs.071a3e2",
|
|
45
|
+
"@dxos/invariant": "0.7.5-labs.071a3e2",
|
|
46
|
+
"@dxos/live-object": "0.7.5-labs.071a3e2",
|
|
47
|
+
"@dxos/log": "0.7.5-labs.071a3e2",
|
|
48
|
+
"@dxos/local-storage": "0.7.5-labs.071a3e2",
|
|
49
|
+
"@dxos/plugin-client": "0.7.5-labs.071a3e2",
|
|
50
|
+
"@dxos/plugin-attention": "0.7.5-labs.071a3e2",
|
|
51
|
+
"@dxos/plugin-graph": "0.7.5-labs.071a3e2",
|
|
52
|
+
"@dxos/react-client": "0.7.5-labs.071a3e2",
|
|
53
|
+
"@dxos/plugin-space": "0.7.5-labs.071a3e2",
|
|
54
|
+
"@dxos/plugin-theme": "0.7.5-labs.071a3e2",
|
|
55
|
+
"@dxos/react-hooks": "0.7.5-labs.071a3e2",
|
|
56
|
+
"@dxos/react-ui-attention": "0.7.5-labs.071a3e2",
|
|
57
|
+
"@dxos/react-ui-card": "0.7.5-labs.071a3e2",
|
|
58
|
+
"@dxos/react-ui-editor": "0.7.5-labs.071a3e2",
|
|
59
|
+
"@dxos/react-ui-form": "0.7.5-labs.071a3e2",
|
|
60
|
+
"@dxos/react-ui-stack": "0.7.5-labs.071a3e2",
|
|
61
|
+
"@dxos/react-ui-mosaic": "0.7.5-labs.071a3e2",
|
|
62
|
+
"@dxos/schema": "0.7.5-labs.071a3e2",
|
|
63
|
+
"@dxos/util": "0.7.5-labs.071a3e2"
|
|
69
64
|
},
|
|
70
65
|
"devDependencies": {
|
|
71
66
|
"@phosphor-icons/react": "^2.1.5",
|
|
@@ -74,17 +69,18 @@
|
|
|
74
69
|
"react": "~18.2.0",
|
|
75
70
|
"react-dom": "~18.2.0",
|
|
76
71
|
"vite": "5.4.7",
|
|
77
|
-
"@dxos/
|
|
78
|
-
"@dxos/
|
|
79
|
-
"@dxos/
|
|
80
|
-
"@dxos/react-ui": "0.7.
|
|
72
|
+
"@dxos/debug": "0.7.5-labs.071a3e2",
|
|
73
|
+
"@dxos/random": "0.7.5-labs.071a3e2",
|
|
74
|
+
"@dxos/react-ui": "0.7.5-labs.071a3e2",
|
|
75
|
+
"@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
|
|
76
|
+
"@dxos/storybook-utils": "0.7.5-labs.071a3e2"
|
|
81
77
|
},
|
|
82
78
|
"peerDependencies": {
|
|
83
79
|
"@phosphor-icons/react": "^2.1.5",
|
|
84
80
|
"react": "~18.2.0",
|
|
85
81
|
"react-dom": "~18.2.0",
|
|
86
|
-
"@dxos/react-ui": "0.7.
|
|
87
|
-
"@dxos/react-ui
|
|
82
|
+
"@dxos/react-ui-theme": "0.7.5-labs.071a3e2",
|
|
83
|
+
"@dxos/react-ui": "0.7.5-labs.071a3e2"
|
|
88
84
|
},
|
|
89
85
|
"publishConfig": {
|
|
90
86
|
"access": "public"
|
package/src/MarkdownPlugin.tsx
CHANGED
|
@@ -1,89 +1,52 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
5
|
+
import { Capabilities, contributes, createIntent, defineModule, definePlugin, Events } from '@dxos/app-framework';
|
|
6
|
+
import { type BaseObject } from '@dxos/echo-schema';
|
|
7
|
+
import { RefArray } from '@dxos/live-object';
|
|
8
|
+
import { ClientCapabilities, ClientEvents } from '@dxos/plugin-client';
|
|
9
|
+
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
10
|
+
import { TextType } from '@dxos/schema';
|
|
7
11
|
|
|
8
|
-
import { parseIntentPlugin, resolvePlugin, NavigationAction, type PluginDefinition } from '@dxos/app-framework';
|
|
9
|
-
import { create } from '@dxos/live-object';
|
|
10
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
11
|
-
import { parseClientPlugin } from '@dxos/plugin-client';
|
|
12
|
-
import { type ActionGroup, createExtension, isActionGroup } from '@dxos/plugin-graph';
|
|
13
|
-
import { SpaceAction } from '@dxos/plugin-space';
|
|
14
|
-
import { CollectionType } from '@dxos/plugin-space/types';
|
|
15
12
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
type EditorViewMode,
|
|
25
|
-
EditorViewModes,
|
|
26
|
-
translations as editorTranslations,
|
|
27
|
-
createEditorStateStore,
|
|
28
|
-
} from '@dxos/react-ui-editor';
|
|
29
|
-
|
|
30
|
-
import { MarkdownContainer, MarkdownSettings } from './components';
|
|
31
|
-
import meta, { MARKDOWN_PLUGIN } from './meta';
|
|
13
|
+
MarkdownState,
|
|
14
|
+
MarkdownSettings,
|
|
15
|
+
ReactSurface,
|
|
16
|
+
IntentResolver,
|
|
17
|
+
AppGraphSerializer,
|
|
18
|
+
Thread,
|
|
19
|
+
} from './capabilities';
|
|
20
|
+
import { MARKDOWN_PLUGIN, meta } from './meta';
|
|
32
21
|
import translations from './translations';
|
|
33
|
-
import { DocumentType,
|
|
34
|
-
import {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
meta,
|
|
63
|
-
ready: async (plugins) => {
|
|
64
|
-
settings
|
|
65
|
-
.prop({ key: 'defaultViewMode', type: LocalStorageStore.enum<EditorViewMode>() })
|
|
66
|
-
.prop({ key: 'editorInputMode', type: LocalStorageStore.enum<EditorInputMode>({ allowUndefined: true }) })
|
|
67
|
-
.prop({ key: 'toolbar', type: LocalStorageStore.bool({ allowUndefined: true }) })
|
|
68
|
-
.prop({ key: 'experimental', type: LocalStorageStore.bool({ allowUndefined: true }) })
|
|
69
|
-
.prop({ key: 'debug', type: LocalStorageStore.bool({ allowUndefined: true }) })
|
|
70
|
-
.prop({ key: 'typewriter', type: LocalStorageStore.string({ allowUndefined: true }) })
|
|
71
|
-
.prop({ key: 'numberedHeadings', type: LocalStorageStore.bool({ allowUndefined: true }) })
|
|
72
|
-
.prop({ key: 'folding', type: LocalStorageStore.bool({ allowUndefined: true }) });
|
|
73
|
-
|
|
74
|
-
state.prop({ key: 'viewMode', type: LocalStorageStore.json<{ [key: string]: EditorViewMode }>() });
|
|
75
|
-
|
|
76
|
-
markdownExtensionPlugins(plugins).forEach((plugin) => {
|
|
77
|
-
const { extensions } = plugin.provides.markdown;
|
|
78
|
-
state.values.extensionProviders?.push(extensions);
|
|
79
|
-
});
|
|
80
|
-
},
|
|
81
|
-
provides: {
|
|
82
|
-
settings: settings.values,
|
|
83
|
-
metadata: {
|
|
84
|
-
records: {
|
|
85
|
-
[DocumentType.typename]: {
|
|
86
|
-
createObject: MarkdownAction.CREATE,
|
|
22
|
+
import { DocumentType, MarkdownAction } from './types';
|
|
23
|
+
import { serializer } from './util';
|
|
24
|
+
|
|
25
|
+
export const MarkdownPlugin = () =>
|
|
26
|
+
definePlugin(meta, [
|
|
27
|
+
defineModule({
|
|
28
|
+
id: `${meta.id}/module/settings`,
|
|
29
|
+
activatesOn: Events.SetupSettings,
|
|
30
|
+
activate: MarkdownSettings,
|
|
31
|
+
}),
|
|
32
|
+
defineModule({
|
|
33
|
+
id: `${meta.id}/module/state`,
|
|
34
|
+
activatesOn: Events.Startup,
|
|
35
|
+
activate: MarkdownState,
|
|
36
|
+
}),
|
|
37
|
+
defineModule({
|
|
38
|
+
id: `${meta.id}/module/translations`,
|
|
39
|
+
activatesOn: Events.SetupTranslations,
|
|
40
|
+
activate: () => contributes(Capabilities.Translations, [...translations, ...editorTranslations]),
|
|
41
|
+
}),
|
|
42
|
+
defineModule({
|
|
43
|
+
id: `${meta.id}/module/metadata`,
|
|
44
|
+
activatesOn: Events.SetupMetadata,
|
|
45
|
+
activate: () =>
|
|
46
|
+
contributes(Capabilities.Metadata, {
|
|
47
|
+
id: DocumentType.typename,
|
|
48
|
+
metadata: {
|
|
49
|
+
createObject: (props: { name?: string }) => createIntent(MarkdownAction.Create, props),
|
|
87
50
|
label: (object: any) => (object instanceof DocumentType ? object.name || object.fallbackName : undefined),
|
|
88
51
|
placeholder: ['document title placeholder', { ns: MARKDOWN_PLUGIN }],
|
|
89
52
|
icon: 'ph--text-aa--regular',
|
|
@@ -91,208 +54,38 @@ export const MarkdownPlugin = (): PluginDefinition<MarkdownPluginProvides> => {
|
|
|
91
54
|
managesAutofocus: true,
|
|
92
55
|
},
|
|
93
56
|
// TODO(wittjosiah): Move out of metadata.
|
|
94
|
-
loadReferences: (doc: DocumentType) =>
|
|
57
|
+
loadReferences: async (doc: DocumentType) =>
|
|
58
|
+
await RefArray.loadAll<BaseObject>([doc.content, ...doc.threads]),
|
|
95
59
|
serializer,
|
|
96
60
|
},
|
|
97
|
-
},
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
data: async () => {
|
|
129
|
-
await dispatch([
|
|
130
|
-
{ plugin: MARKDOWN_PLUGIN, action: MarkdownAction.CREATE },
|
|
131
|
-
{ action: SpaceAction.ADD_OBJECT, data: { target } },
|
|
132
|
-
{ action: NavigationAction.OPEN },
|
|
133
|
-
]);
|
|
134
|
-
},
|
|
135
|
-
properties: {
|
|
136
|
-
label: ['create document label', { ns: MARKDOWN_PLUGIN }],
|
|
137
|
-
icon: 'ph--text-aa--regular',
|
|
138
|
-
testId: 'markdownPlugin.createObject',
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
];
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
},
|
|
145
|
-
serializer: (plugins) => {
|
|
146
|
-
const dispatch = resolvePlugin(plugins, parseIntentPlugin)?.provides.intent.dispatch;
|
|
147
|
-
if (!dispatch) {
|
|
148
|
-
return [];
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
return [
|
|
152
|
-
{
|
|
153
|
-
inputType: DocumentType.typename,
|
|
154
|
-
outputType: 'text/markdown',
|
|
155
|
-
// Reconcile with metadata serializers.
|
|
156
|
-
serialize: async (node) => {
|
|
157
|
-
const doc = node.data;
|
|
158
|
-
const content = await loadObjectReferences(doc, (doc) => doc.content);
|
|
159
|
-
return {
|
|
160
|
-
name:
|
|
161
|
-
doc.name ||
|
|
162
|
-
doc.fallbackName ||
|
|
163
|
-
translations[0]['en-US'][MARKDOWN_PLUGIN]['document title placeholder'],
|
|
164
|
-
data: content.content,
|
|
165
|
-
type: 'text/markdown',
|
|
166
|
-
};
|
|
167
|
-
},
|
|
168
|
-
deserialize: async (data, ancestors) => {
|
|
169
|
-
const space = ancestors.find(isSpace);
|
|
170
|
-
const target =
|
|
171
|
-
ancestors.findLast((ancestor) => ancestor instanceof CollectionType) ??
|
|
172
|
-
space?.properties[CollectionType.typename];
|
|
173
|
-
if (!space || !target) {
|
|
174
|
-
return;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const result = await dispatch([
|
|
178
|
-
{
|
|
179
|
-
plugin: MARKDOWN_PLUGIN,
|
|
180
|
-
action: MarkdownAction.CREATE,
|
|
181
|
-
data: { name: data.name, content: data.data },
|
|
182
|
-
},
|
|
183
|
-
{
|
|
184
|
-
action: SpaceAction.ADD_OBJECT,
|
|
185
|
-
data: { target },
|
|
186
|
-
},
|
|
187
|
-
]);
|
|
188
|
-
|
|
189
|
-
return result?.data.object;
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
];
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
stack: {
|
|
196
|
-
creators: [
|
|
197
|
-
{
|
|
198
|
-
id: 'create-stack-section-doc',
|
|
199
|
-
testId: 'markdownPlugin.createSection',
|
|
200
|
-
type: ['plugin name', { ns: MARKDOWN_PLUGIN }],
|
|
201
|
-
label: ['create stack section label', { ns: MARKDOWN_PLUGIN }],
|
|
202
|
-
icon: (props: any) => <TextAa {...props} />,
|
|
203
|
-
intent: {
|
|
204
|
-
plugin: MARKDOWN_PLUGIN,
|
|
205
|
-
action: MarkdownAction.CREATE,
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
],
|
|
209
|
-
},
|
|
210
|
-
thread: {
|
|
211
|
-
predicate: (obj) => obj instanceof DocumentType,
|
|
212
|
-
createSort: (doc: DocumentType) => {
|
|
213
|
-
const accessor = doc.content ? createDocAccessor(doc.content, ['content']) : undefined;
|
|
214
|
-
if (!accessor) {
|
|
215
|
-
return (_) => 0;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
const getStartPosition = (cursor: string | undefined) => {
|
|
219
|
-
const range = cursor ? getRangeFromCursor(accessor, cursor) : undefined;
|
|
220
|
-
return range?.start ?? Number.MAX_SAFE_INTEGER;
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
return (anchorA: string | undefined, anchorB: string | undefined): number => {
|
|
224
|
-
if (anchorA === undefined || anchorB === undefined) {
|
|
225
|
-
return 0;
|
|
226
|
-
}
|
|
227
|
-
const posA = getStartPosition(anchorA);
|
|
228
|
-
const posB = getStartPosition(anchorB);
|
|
229
|
-
return posA - posB;
|
|
230
|
-
};
|
|
231
|
-
},
|
|
232
|
-
},
|
|
233
|
-
surface: {
|
|
234
|
-
component: ({ data, role }) => {
|
|
235
|
-
switch (role) {
|
|
236
|
-
case 'section':
|
|
237
|
-
case 'article': {
|
|
238
|
-
const doc = getDoc(data.object);
|
|
239
|
-
const { id, object } = isEditorModel(data.object)
|
|
240
|
-
? { id: data.object.id, object: data.object }
|
|
241
|
-
: doc
|
|
242
|
-
? { id: fullyQualifiedId(doc), object: doc }
|
|
243
|
-
: {};
|
|
244
|
-
|
|
245
|
-
if (!id || !object) {
|
|
246
|
-
return null;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
return (
|
|
250
|
-
<MarkdownContainer
|
|
251
|
-
id={id}
|
|
252
|
-
object={object}
|
|
253
|
-
role={role}
|
|
254
|
-
settings={settings.values}
|
|
255
|
-
extensionProviders={state.values.extensionProviders}
|
|
256
|
-
viewMode={getViewMode(id)}
|
|
257
|
-
editorStateStore={editorStateStore}
|
|
258
|
-
onViewModeChange={setViewMode}
|
|
259
|
-
/>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
case 'settings': {
|
|
264
|
-
return data.plugin === meta.id ? <MarkdownSettings settings={settings.values} /> : null;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return null;
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
|
-
intent: {
|
|
272
|
-
resolver: ({ action, data }) => {
|
|
273
|
-
switch (action) {
|
|
274
|
-
case MarkdownAction.CREATE: {
|
|
275
|
-
const doc = create(DocumentType, {
|
|
276
|
-
name: data?.name,
|
|
277
|
-
content: create(TextType, { content: data?.content ?? '' }),
|
|
278
|
-
threads: [],
|
|
279
|
-
});
|
|
280
|
-
|
|
281
|
-
return { data: doc };
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
case MarkdownAction.SET_VIEW_MODE: {
|
|
285
|
-
const { id, viewMode } = data ?? {};
|
|
286
|
-
if (typeof id === 'string' && EditorViewModes.includes(viewMode)) {
|
|
287
|
-
state.values.viewMode[id] = viewMode;
|
|
288
|
-
return { data: true };
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
break;
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
},
|
|
296
|
-
},
|
|
297
|
-
};
|
|
298
|
-
};
|
|
61
|
+
}),
|
|
62
|
+
}),
|
|
63
|
+
defineModule({
|
|
64
|
+
id: `${meta.id}/module/schema`,
|
|
65
|
+
activatesOn: ClientEvents.SetupSchema,
|
|
66
|
+
activate: () => [
|
|
67
|
+
contributes(ClientCapabilities.SystemSchema, [TextType]),
|
|
68
|
+
contributes(ClientCapabilities.Schema, [DocumentType]),
|
|
69
|
+
],
|
|
70
|
+
}),
|
|
71
|
+
defineModule({
|
|
72
|
+
id: `${meta.id}/module/react-surface`,
|
|
73
|
+
activatesOn: Events.SetupSurfaces,
|
|
74
|
+
activate: ReactSurface,
|
|
75
|
+
}),
|
|
76
|
+
defineModule({
|
|
77
|
+
id: `${meta.id}/module/intent-resolver`,
|
|
78
|
+
activatesOn: Events.SetupIntents,
|
|
79
|
+
activate: IntentResolver,
|
|
80
|
+
}),
|
|
81
|
+
defineModule({
|
|
82
|
+
id: `${meta.id}/module/app-graph-serializer`,
|
|
83
|
+
activatesOn: Events.Startup,
|
|
84
|
+
activate: AppGraphSerializer,
|
|
85
|
+
}),
|
|
86
|
+
defineModule({
|
|
87
|
+
id: `${meta.id}/module/thread`,
|
|
88
|
+
activatesOn: Events.Startup,
|
|
89
|
+
activate: Thread,
|
|
90
|
+
}),
|
|
91
|
+
]);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { pipe } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { contributes, Capabilities, type PluginsContext, chain, createIntent } from '@dxos/app-framework';
|
|
8
|
+
import { SpaceAction, CollectionType } from '@dxos/plugin-space/types';
|
|
9
|
+
import { isSpace } from '@dxos/react-client/echo';
|
|
10
|
+
|
|
11
|
+
import { MARKDOWN_PLUGIN } from '../meta';
|
|
12
|
+
import translations from '../translations';
|
|
13
|
+
import { MarkdownAction, DocumentType } from '../types';
|
|
14
|
+
|
|
15
|
+
export default (context: PluginsContext) =>
|
|
16
|
+
contributes(Capabilities.AppGraphSerializer, [
|
|
17
|
+
{
|
|
18
|
+
inputType: DocumentType.typename,
|
|
19
|
+
outputType: 'text/markdown',
|
|
20
|
+
// Reconcile with metadata serializers.
|
|
21
|
+
serialize: async (node) => {
|
|
22
|
+
const doc = node.data;
|
|
23
|
+
const content = await doc.content.load();
|
|
24
|
+
return {
|
|
25
|
+
name: doc.name || doc.fallbackName || translations[0]['en-US'][MARKDOWN_PLUGIN]['document title placeholder'],
|
|
26
|
+
data: content.content,
|
|
27
|
+
type: 'text/markdown',
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
deserialize: async (data, ancestors) => {
|
|
31
|
+
const space = ancestors.find(isSpace);
|
|
32
|
+
const target =
|
|
33
|
+
ancestors.findLast((ancestor) => ancestor instanceof CollectionType) ??
|
|
34
|
+
space?.properties[CollectionType.typename]?.target;
|
|
35
|
+
if (!space || !target) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
40
|
+
const result = await dispatch(
|
|
41
|
+
pipe(
|
|
42
|
+
createIntent(MarkdownAction.Create, { name: data.name, content: data.data }),
|
|
43
|
+
chain(SpaceAction.AddObject, { target }),
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return result.data?.object;
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
]);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { defineCapability } from '@dxos/app-framework';
|
|
6
|
+
import { type EditorViewMode, type EditorStateStore } from '@dxos/react-ui-editor';
|
|
7
|
+
|
|
8
|
+
import { MARKDOWN_PLUGIN } from '../meta';
|
|
9
|
+
import { type MarkdownExtensionProvider, type MarkdownPluginState } from '../types';
|
|
10
|
+
|
|
11
|
+
export namespace MarkdownCapabilities {
|
|
12
|
+
export const State = defineCapability<{
|
|
13
|
+
state: MarkdownPluginState;
|
|
14
|
+
editorState: EditorStateStore;
|
|
15
|
+
getViewMode: (id: string) => EditorViewMode;
|
|
16
|
+
setViewMode: (id: string, viewMode: EditorViewMode) => void;
|
|
17
|
+
}>(`${MARKDOWN_PLUGIN}/capability/state`);
|
|
18
|
+
|
|
19
|
+
export const Extensions = defineCapability<MarkdownExtensionProvider[]>(`${MARKDOWN_PLUGIN}/capability/extensions`);
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { lazy } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
export const AppGraphSerializer = lazy(() => import('./app-graph-serializer'));
|
|
8
|
+
export const IntentResolver = lazy(() => import('./intent-resolver'));
|
|
9
|
+
export const ReactSurface = lazy(() => import('./react-surface'));
|
|
10
|
+
export const MarkdownSettings = lazy(() => import('./settings'));
|
|
11
|
+
export const MarkdownState = lazy(() => import('./state'));
|
|
12
|
+
export const Thread = lazy(() => import('./thread'));
|
|
13
|
+
|
|
14
|
+
export * from './capabilities';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Capabilities, contributes, createResolver, type PluginsContext } from '@dxos/app-framework';
|
|
6
|
+
import { makeRef, create } from '@dxos/live-object';
|
|
7
|
+
import { TextType } from '@dxos/schema';
|
|
8
|
+
|
|
9
|
+
import { MarkdownCapabilities } from './capabilities';
|
|
10
|
+
import { DocumentType, MarkdownAction } from '../types';
|
|
11
|
+
|
|
12
|
+
export default (context: PluginsContext) =>
|
|
13
|
+
contributes(Capabilities.IntentResolver, [
|
|
14
|
+
createResolver({
|
|
15
|
+
intent: MarkdownAction.Create,
|
|
16
|
+
resolve: ({ name, content }) => {
|
|
17
|
+
const doc = create(DocumentType, {
|
|
18
|
+
name,
|
|
19
|
+
content: makeRef(create(TextType, { content: content ?? '' })),
|
|
20
|
+
threads: [],
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
return { data: { object: doc } };
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
createResolver({
|
|
27
|
+
intent: MarkdownAction.SetViewMode,
|
|
28
|
+
resolve: ({ id, viewMode }) => {
|
|
29
|
+
const { state } = context.requestCapability(MarkdownCapabilities.State);
|
|
30
|
+
state.viewMode[id] = viewMode;
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
33
|
+
]);
|