@dxos/plugin-markdown 0.8.4-main.3eb6e50203 → 0.8.4-main.4a85c3132b
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/{chunk-EZZFREFN.mjs → MarkdownCard-5NPSEJ2M.mjs} +26 -23
- package/dist/lib/browser/MarkdownCard-5NPSEJ2M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7AQTX6D5.mjs → MarkdownContainer-KER2N5M2.mjs} +19 -16
- package/dist/lib/browser/MarkdownContainer-KER2N5M2.mjs.map +7 -0
- package/dist/lib/browser/{react-surface-7Z6AB26V.mjs → MarkdownSettings-2N4TT2FG.mjs} +6 -113
- package/dist/lib/browser/MarkdownSettings-2N4TT2FG.mjs.map +7 -0
- package/dist/lib/browser/{anchor-sort-JBAZRPE7.mjs → anchor-sort-EHJGOCYW.mjs} +3 -2
- package/dist/lib/browser/{app-graph-serializer-6Q5YBUPW.mjs → app-graph-serializer-QBZDVASK.mjs} +5 -4
- package/dist/lib/browser/app-graph-serializer-QBZDVASK.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-6HOAW2E6.mjs → blueprint-definition-ASGDSKKE.mjs} +7 -9
- package/dist/lib/browser/blueprint-definition-ASGDSKKE.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +5 -4
- package/dist/lib/browser/{chunk-HHRUUWGH.mjs → chunk-7JEOX3X6.mjs} +169 -182
- package/dist/lib/browser/chunk-7JEOX3X6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-6SM75KL3.mjs → chunk-HK6EGNP5.mjs} +2 -2
- package/dist/lib/browser/{chunk-4GT3QWMK.mjs → chunk-P3TN2W6M.mjs} +20 -33
- package/dist/lib/browser/chunk-P3TN2W6M.mjs.map +7 -0
- package/dist/lib/browser/{chunk-2AAD3W6X.mjs → chunk-RJO5W5YX.mjs} +5 -3
- package/dist/lib/{node-esm/chunk-MLZQCT2N.mjs.map → browser/chunk-RJO5W5YX.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-HQTBT5IY.mjs → chunk-W24NJ6WB.mjs} +26 -24
- package/dist/lib/browser/chunk-W24NJ6WB.mjs.map +7 -0
- package/dist/lib/browser/chunk-YBMRREXE.mjs +28 -0
- package/dist/lib/browser/chunk-YBMRREXE.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +5 -3
- package/dist/lib/browser/cli/index.mjs.map +1 -1
- package/dist/lib/browser/index.mjs +16 -14
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{operation-resolver-UBQUPSXC.mjs → operation-resolver-3KOXJM7P.mjs} +5 -4
- package/dist/lib/browser/operation-resolver-3KOXJM7P.mjs.map +7 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs +115 -0
- package/dist/lib/browser/react-surface-WU4VTE43.mjs.map +7 -0
- package/dist/lib/browser/{settings-V2XOFSD5.mjs → settings-7FMWKB7N.mjs} +5 -3
- package/dist/lib/{node-esm/settings-EXSH2KF4.mjs.map → browser/settings-7FMWKB7N.mjs.map} +1 -1
- package/dist/lib/browser/{state-6Y3JB64H.mjs → state-7UJKJDGE.mjs} +5 -3
- package/dist/lib/{node-esm/state-TVF2XT2T.mjs.map → browser/state-7UJKJDGE.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +2 -1
- package/dist/lib/node-esm/{chunk-DCKB3AVD.mjs → MarkdownCard-4MXS7AQR.mjs} +26 -23
- package/dist/lib/node-esm/MarkdownCard-4MXS7AQR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K2IIYNCG.mjs → MarkdownContainer-BZ637MS3.mjs} +19 -16
- package/dist/lib/node-esm/MarkdownContainer-BZ637MS3.mjs.map +7 -0
- package/dist/lib/node-esm/{react-surface-VIXAH5CF.mjs → MarkdownSettings-FQTYCTD7.mjs} +6 -113
- package/dist/lib/node-esm/MarkdownSettings-FQTYCTD7.mjs.map +7 -0
- package/dist/lib/node-esm/{anchor-sort-IQMDZRA3.mjs → anchor-sort-QWZO6B2R.mjs} +3 -2
- package/dist/lib/{browser/anchor-sort-JBAZRPE7.mjs.map → node-esm/anchor-sort-QWZO6B2R.mjs.map} +1 -1
- package/dist/lib/node-esm/{app-graph-serializer-STEPJH57.mjs → app-graph-serializer-3UVXEHJG.mjs} +5 -4
- package/dist/lib/node-esm/app-graph-serializer-3UVXEHJG.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-UGDFF5OZ.mjs → blueprint-definition-TG7OZIWW.mjs} +7 -9
- package/dist/lib/node-esm/blueprint-definition-TG7OZIWW.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +5 -4
- package/dist/lib/node-esm/{chunk-MLZQCT2N.mjs → chunk-ANIFP6M2.mjs} +5 -3
- package/dist/lib/{browser/chunk-2AAD3W6X.mjs.map → node-esm/chunk-ANIFP6M2.mjs.map} +1 -1
- package/dist/lib/node-esm/{chunk-AGZOFIK2.mjs → chunk-KCH3EL53.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-D46D75SK.mjs → chunk-N73JZ4CD.mjs} +169 -182
- package/dist/lib/node-esm/chunk-N73JZ4CD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-LOZVC2WA.mjs → chunk-NBGAJPVH.mjs} +26 -24
- package/dist/lib/node-esm/chunk-NBGAJPVH.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs +29 -0
- package/dist/lib/node-esm/chunk-W7AM4HCG.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-USKAPINH.mjs → chunk-WBZQ246U.mjs} +20 -33
- package/dist/lib/node-esm/chunk-WBZQ246U.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +5 -3
- package/dist/lib/node-esm/cli/index.mjs.map +1 -1
- package/dist/lib/node-esm/index.mjs +16 -14
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{operation-resolver-QAGXDA5E.mjs → operation-resolver-2MEWKRFP.mjs} +5 -4
- package/dist/lib/node-esm/operation-resolver-2MEWKRFP.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs +116 -0
- package/dist/lib/node-esm/react-surface-LC5CI6VP.mjs.map +7 -0
- package/dist/lib/node-esm/{settings-EXSH2KF4.mjs → settings-DBK2SPWT.mjs} +5 -3
- package/dist/lib/{browser/settings-V2XOFSD5.mjs.map → node-esm/settings-DBK2SPWT.mjs.map} +1 -1
- package/dist/lib/node-esm/{state-TVF2XT2T.mjs → state-EEPLRAOT.mjs} +5 -3
- package/dist/lib/{browser/state-6Y3JB64H.mjs.map → node-esm/state-EEPLRAOT.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +2 -1
- package/dist/types/src/blueprints/functions/index.d.ts +41 -3
- package/dist/types/src/blueprints/functions/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +1 -1
- package/dist/types/src/blueprints/index.d.ts.map +1 -1
- package/dist/types/src/blueprints/markdown-blueprint.d.ts +3 -20
- package/dist/types/src/blueprints/markdown-blueprint.d.ts.map +1 -1
- package/dist/types/src/capabilities/anchor-sort/anchor-sort.d.ts +1 -1
- package/dist/types/src/capabilities/app-graph-serializer/app-graph-serializer.d.ts +1 -1
- package/dist/types/src/capabilities/artifact-definition/artifact-definition.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +1 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +1 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/settings/settings.d.ts +1 -1
- package/dist/types/src/capabilities/state/state.d.ts +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditor.stories.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorContent.d.ts.map +1 -1
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts +3 -3
- package/dist/types/src/components/MarkdownEditor/MarkdownEditorToolbar.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -8
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownCard/MarkdownCard.stories.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/MarkdownCard/index.d.ts +0 -1
- package/dist/types/src/containers/MarkdownCard/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers/MarkdownContainer}/MarkdownContainer.d.ts +2 -3
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.d.ts.map +1 -0
- package/dist/types/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.d.ts +1 -1
- package/dist/types/src/containers/MarkdownContainer/MarkdownContainer.stories.d.ts.map +1 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownContainer/index.d.ts.map +1 -0
- package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.d.ts.map +1 -1
- package/dist/types/src/containers/MarkdownSettings/index.d.ts +3 -0
- package/dist/types/src/containers/MarkdownSettings/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +6 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useExtensions.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/types/Markdown.d.ts +1 -1
- package/dist/types/src/types/Markdown.d.ts.map +1 -1
- package/dist/types/src/types/MarkdownAction.d.ts +1 -1
- package/dist/types/src/util.d.ts +1 -1
- package/dist/types/src/util.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +48 -48
- package/src/MarkdownPlugin.tsx +1 -1
- package/src/blueprints/functions/create.conversations.json +1 -1
- package/src/blueprints/functions/create.test.ts +2 -2
- package/src/blueprints/functions/create.ts +2 -2
- package/src/blueprints/functions/index.ts +11 -3
- package/src/blueprints/functions/open.ts +2 -2
- package/src/blueprints/functions/update.conversations.json +1 -1
- package/src/blueprints/functions/update.test.ts +2 -2
- package/src/blueprints/functions/update.ts +2 -2
- package/src/blueprints/index.ts +1 -1
- package/src/blueprints/markdown-blueprint.ts +14 -6
- package/src/capabilities/app-graph-serializer/app-graph-serializer.ts +1 -1
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +4 -13
- package/src/capabilities/operation-resolver/operation-resolver.ts +2 -2
- package/src/capabilities/react-surface/react-surface.tsx +1 -1
- package/src/components/MarkdownEditor/MarkdownEditor.stories.tsx +10 -8
- package/src/components/MarkdownEditor/MarkdownEditor.tsx +13 -3
- package/src/components/MarkdownEditor/MarkdownEditorContent.tsx +3 -4
- package/src/components/MarkdownEditor/MarkdownEditorToolbar.tsx +6 -5
- package/src/components/index.ts +2 -14
- package/src/{components → containers}/MarkdownCard/MarkdownCard.stories.tsx +16 -6
- package/src/{components → containers}/MarkdownCard/MarkdownCard.tsx +21 -24
- package/src/{components → containers}/MarkdownCard/index.ts +0 -2
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.stories.tsx +18 -5
- package/src/{components → containers/MarkdownContainer}/MarkdownContainer.tsx +25 -24
- package/src/containers/MarkdownContainer/index.ts +7 -0
- package/src/containers/MarkdownSettings/index.ts +7 -0
- package/src/containers/index.ts +11 -0
- package/src/hooks/useEditorMenuOptions.ts +1 -1
- package/src/hooks/useExtensions.tsx +51 -81
- package/src/index.ts +1 -1
- package/src/testing.ts +1 -1
- package/src/types/Markdown.ts +12 -4
- package/src/types/MarkdownAction.ts +1 -1
- package/src/util.tsx +2 -2
- package/dist/lib/browser/MarkdownCard-7VIO7R66.mjs +0 -11
- package/dist/lib/browser/MarkdownCard-7VIO7R66.mjs.map +0 -7
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs +0 -11
- package/dist/lib/browser/MarkdownContainer-6E43EDAU.mjs.map +0 -7
- package/dist/lib/browser/app-graph-serializer-6Q5YBUPW.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-6HOAW2E6.mjs.map +0 -7
- package/dist/lib/browser/chunk-4GT3QWMK.mjs.map +0 -7
- package/dist/lib/browser/chunk-7AQTX6D5.mjs.map +0 -7
- package/dist/lib/browser/chunk-EZZFREFN.mjs.map +0 -7
- package/dist/lib/browser/chunk-HHRUUWGH.mjs.map +0 -7
- package/dist/lib/browser/chunk-HQTBT5IY.mjs.map +0 -7
- package/dist/lib/browser/operation-resolver-UBQUPSXC.mjs.map +0 -7
- package/dist/lib/browser/react-surface-7Z6AB26V.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs +0 -12
- package/dist/lib/node-esm/MarkdownCard-YC3R2TQW.mjs.map +0 -7
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs +0 -12
- package/dist/lib/node-esm/MarkdownContainer-TTRUOXU6.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-serializer-STEPJH57.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-UGDFF5OZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-D46D75SK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DCKB3AVD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K2IIYNCG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-LOZVC2WA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-USKAPINH.mjs.map +0 -7
- package/dist/lib/node-esm/operation-resolver-QAGXDA5E.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-VIXAH5CF.mjs.map +0 -7
- package/dist/types/src/components/MarkdownCard/MarkdownCard.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/MarkdownCard.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownCard/index.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownContainer.stories.d.ts.map +0 -1
- package/dist/types/src/components/MarkdownSettings/index.d.ts +0 -2
- package/dist/types/src/components/MarkdownSettings/index.d.ts.map +0 -1
- package/dist/types/src/components/Suggestions.stories.d.ts +0 -11
- package/dist/types/src/components/Suggestions.stories.d.ts.map +0 -1
- package/src/components/MarkdownSettings/index.ts +0 -5
- package/src/components/Suggestions.stories.tsx +0 -215
- /package/dist/lib/{node-esm/anchor-sort-IQMDZRA3.mjs.map → browser/anchor-sort-EHJGOCYW.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-6SM75KL3.mjs.map → chunk-HK6EGNP5.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-AGZOFIK2.mjs.map → chunk-KCH3EL53.mjs.map} +0 -0
- /package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.d.ts +0 -0
- /package/dist/types/src/{components → containers}/MarkdownCard/MarkdownCard.stories.d.ts +0 -0
- /package/dist/types/src/{components → containers}/MarkdownSettings/MarkdownSettings.d.ts +0 -0
- /package/src/{components → containers}/MarkdownSettings/MarkdownSettings.tsx +0 -0
|
@@ -12,17 +12,17 @@ import { AssistantTestLayer } from '@dxos/assistant/testing';
|
|
|
12
12
|
import { Blueprint } from '@dxos/blueprints';
|
|
13
13
|
import { SpaceProperties } from '@dxos/client-protocol';
|
|
14
14
|
import { Database, Obj, Query, Ref } from '@dxos/echo';
|
|
15
|
+
import { Collection } from '@dxos/echo';
|
|
15
16
|
import { TestHelpers } from '@dxos/effect/testing';
|
|
16
17
|
import { FunctionInvocationService } from '@dxos/functions';
|
|
17
18
|
import { invariant } from '@dxos/invariant';
|
|
18
19
|
import { ObjectId } from '@dxos/keys';
|
|
19
20
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
20
|
-
import { Collection } from '@dxos/schema';
|
|
21
21
|
import { HasSubject } from '@dxos/types';
|
|
22
22
|
import { trim } from '@dxos/util';
|
|
23
23
|
|
|
24
24
|
import { WithProperties } from '../../testing';
|
|
25
|
-
import
|
|
25
|
+
import MarkdownBlueprint from '../markdown-blueprint';
|
|
26
26
|
|
|
27
27
|
import update from './update';
|
|
28
28
|
|
|
@@ -6,7 +6,7 @@ import { next as A, type Doc } from '@automerge/automerge';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import * as Schema from 'effect/Schema';
|
|
8
8
|
|
|
9
|
-
import { Database,
|
|
9
|
+
import { Database, Ref } from '@dxos/echo';
|
|
10
10
|
import { DocAccessor, createDocAccessor } from '@dxos/echo-db';
|
|
11
11
|
import { defineFunction } from '@dxos/functions';
|
|
12
12
|
import { trim } from '@dxos/util';
|
|
@@ -34,7 +34,7 @@ export default defineFunction({
|
|
|
34
34
|
Applies a set of edits to the markdown document.
|
|
35
35
|
`,
|
|
36
36
|
inputSchema: Schema.Struct({
|
|
37
|
-
doc:
|
|
37
|
+
doc: Ref.Ref(Markdown.Document).annotations({
|
|
38
38
|
description: 'The ID of the markdown document.',
|
|
39
39
|
}),
|
|
40
40
|
edits: Schema.Array(Edit).annotations({
|
package/src/blueprints/index.ts
CHANGED
|
@@ -2,19 +2,19 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type AppCapabilities } from '@dxos/app-toolkit';
|
|
5
6
|
import { Blueprint, Template } from '@dxos/blueprints';
|
|
6
|
-
import { type FunctionDefinition } from '@dxos/functions';
|
|
7
7
|
import { trim } from '@dxos/util';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { MarkdownFunctions } from './functions';
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const BLUEPRINT_KEY = 'dxos.org/blueprint/markdown';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const functions = Object.values(MarkdownFunctions);
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const make = () =>
|
|
16
16
|
Blueprint.make({
|
|
17
|
-
key:
|
|
17
|
+
key: BLUEPRINT_KEY,
|
|
18
18
|
name: 'Markdown',
|
|
19
19
|
tools: Blueprint.toolDefinitions({ functions }),
|
|
20
20
|
instructions: Template.make({
|
|
@@ -36,3 +36,11 @@ export const make = () =>
|
|
|
36
36
|
`,
|
|
37
37
|
}),
|
|
38
38
|
});
|
|
39
|
+
|
|
40
|
+
const blueprint: AppCapabilities.BlueprintDefinition = {
|
|
41
|
+
key: BLUEPRINT_KEY,
|
|
42
|
+
functions,
|
|
43
|
+
make,
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export default blueprint;
|
|
@@ -7,9 +7,9 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
8
|
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { Collection } from '@dxos/echo';
|
|
10
11
|
import { SpaceOperation } from '@dxos/plugin-space/types';
|
|
11
12
|
import { isSpace } from '@dxos/react-client/echo';
|
|
12
|
-
import { Collection } from '@dxos/schema';
|
|
13
13
|
|
|
14
14
|
import { translations } from '../../translations';
|
|
15
15
|
import { Markdown, MarkdownOperation } from '../../types';
|
|
@@ -9,18 +9,9 @@ import { AppCapabilities } from '@dxos/app-toolkit';
|
|
|
9
9
|
|
|
10
10
|
import { MarkdownBlueprint } from '../../blueprints';
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>,
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>
|
|
20
|
-
Effect.succeed([
|
|
21
|
-
Capability.contributes(AppCapabilities.Functions, functions),
|
|
22
|
-
Capability.contributes(AppCapabilities.BlueprintDefinition, MarkdownBlueprint.make()),
|
|
23
|
-
]),
|
|
24
|
-
);
|
|
12
|
+
const blueprintDefinition = Capability.makeModule<
|
|
13
|
+
[],
|
|
14
|
+
Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]
|
|
15
|
+
>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, MarkdownBlueprint)]));
|
|
25
16
|
|
|
26
17
|
export default blueprintDefinition;
|
|
@@ -7,7 +7,7 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
8
|
import { Obj, Ref, Type } from '@dxos/echo';
|
|
9
9
|
import { OperationResolver } from '@dxos/operation';
|
|
10
|
-
import {
|
|
10
|
+
import { ManagedCollection } from '@dxos/schema';
|
|
11
11
|
|
|
12
12
|
import { Markdown, MarkdownCapabilities, MarkdownOperation } from '../../types';
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ export default Capability.makeModule(
|
|
|
17
17
|
OperationResolver.make({
|
|
18
18
|
operation: MarkdownOperation.OnCreateSpace,
|
|
19
19
|
handler: Effect.fnUntraced(function* ({ rootCollection }) {
|
|
20
|
-
const collection =
|
|
20
|
+
const collection = ManagedCollection.makeManagedCollection({ key: Type.getTypename(Markdown.Document) });
|
|
21
21
|
Obj.change(rootCollection, (c) => {
|
|
22
22
|
c.objects.push(Ref.make(collection));
|
|
23
23
|
});
|
|
@@ -20,7 +20,7 @@ import { AttentionCapabilities } from '@dxos/plugin-attention';
|
|
|
20
20
|
import { Text } from '@dxos/schema';
|
|
21
21
|
import { type EditorViewMode } from '@dxos/ui-editor';
|
|
22
22
|
|
|
23
|
-
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../
|
|
23
|
+
import { MarkdownCard, MarkdownContainer, type MarkdownContainerProps, MarkdownSettings } from '../../containers';
|
|
24
24
|
import { meta } from '../../meta';
|
|
25
25
|
import { Markdown, MarkdownCapabilities } from '../../types';
|
|
26
26
|
|
|
@@ -11,7 +11,7 @@ import { Filter, Obj } from '@dxos/echo';
|
|
|
11
11
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
12
12
|
import { corePlugins } from '@dxos/plugin-testing';
|
|
13
13
|
import { useQuery, useSpace } from '@dxos/react-client/echo';
|
|
14
|
-
import {
|
|
14
|
+
import { Panel } from '@dxos/react-ui';
|
|
15
15
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
16
16
|
import { useAttentionAttributes } from '@dxos/react-ui-attention';
|
|
17
17
|
import { translations as editorTranslations } from '@dxos/react-ui-editor';
|
|
@@ -35,19 +35,21 @@ const DefaultStory = (props: StoryProps) => {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
return (
|
|
38
|
-
<
|
|
39
|
-
<
|
|
40
|
-
<
|
|
38
|
+
<MarkdownEditor.Root id={id} object={doc} {...props}>
|
|
39
|
+
<Panel.Root {...attentionAttrs}>
|
|
40
|
+
<Panel.Toolbar asChild>
|
|
41
41
|
<MarkdownEditor.Toolbar id={id} />
|
|
42
|
+
</Panel.Toolbar>
|
|
43
|
+
<Panel.Content asChild>
|
|
42
44
|
<MarkdownEditor.Content />
|
|
43
|
-
</
|
|
44
|
-
</
|
|
45
|
-
</
|
|
45
|
+
</Panel.Content>
|
|
46
|
+
</Panel.Root>
|
|
47
|
+
</MarkdownEditor.Root>
|
|
46
48
|
);
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
const meta: Meta<typeof DefaultStory> = {
|
|
50
|
-
title: 'plugins/plugin-markdown/MarkdownEditor',
|
|
52
|
+
title: 'plugins/plugin-markdown/components/MarkdownEditor',
|
|
51
53
|
component: DefaultStory,
|
|
52
54
|
render: DefaultStory as any,
|
|
53
55
|
decorators: [
|
|
@@ -191,9 +191,19 @@ type MarkdownEditorToolbarProps = Omit<
|
|
|
191
191
|
>;
|
|
192
192
|
|
|
193
193
|
const MarkdownEditorToolbar = (props: MarkdownEditorToolbarProps) => {
|
|
194
|
-
const { toolbarState,
|
|
194
|
+
const { editorView, toolbarState, onAction, onFileUpload, onViewModeChange } =
|
|
195
|
+
useMarkdownEditorContext(MARKDOWN_EDITOR_TOOLBAR_NAME);
|
|
195
196
|
|
|
196
|
-
return
|
|
197
|
+
return (
|
|
198
|
+
<NaturalMarkdownToolbar
|
|
199
|
+
{...props}
|
|
200
|
+
editorView={editorView}
|
|
201
|
+
state={toolbarState}
|
|
202
|
+
onAction={onAction}
|
|
203
|
+
onFileUpload={onFileUpload}
|
|
204
|
+
onViewModeChange={onViewModeChange}
|
|
205
|
+
/>
|
|
206
|
+
);
|
|
197
207
|
};
|
|
198
208
|
|
|
199
209
|
MarkdownEditorToolbar.displayName = MARKDOWN_EDITOR_TOOLBAR_NAME;
|
|
@@ -226,7 +236,7 @@ const PreviewBlock = ({ el, link }: PreviewBlock) => {
|
|
|
226
236
|
const subject = client.graph.makeRef(dxn).target;
|
|
227
237
|
const data = useMemo(() => ({ subject }), [subject]);
|
|
228
238
|
|
|
229
|
-
return createPortal(<Surface.Surface role='card--
|
|
239
|
+
return createPortal(<Surface.Surface role='card--content' data={data} limit={1} />, el);
|
|
230
240
|
};
|
|
231
241
|
|
|
232
242
|
//
|
|
@@ -45,7 +45,6 @@ export type MarkdownEditorContentProps = ThemedClassName<{
|
|
|
45
45
|
toolbarState?: Atom.Writable<EditorToolbarState>;
|
|
46
46
|
onLinkQuery?: (query?: string) => Promise<EditorMenuGroup[]>;
|
|
47
47
|
}> &
|
|
48
|
-
// prettier-ignore
|
|
49
48
|
Pick<UseTextEditorProps, 'initialValue' | 'extensions'> &
|
|
50
49
|
Pick<MarkdownEditorToolbarProps, 'onFileUpload'> &
|
|
51
50
|
Pick<ThemeExtensionsOptions, 'slots'>;
|
|
@@ -139,12 +138,12 @@ export const MarkdownEditorContent = forwardRef<EditorView | null, MarkdownEdito
|
|
|
139
138
|
|
|
140
139
|
return (
|
|
141
140
|
<div
|
|
141
|
+
{...focusAttributes}
|
|
142
142
|
role='none'
|
|
143
|
-
ref={parentRef}
|
|
144
143
|
data-testid='composer.markdownRoot'
|
|
145
|
-
className={mx(stackItemContentEditorClassNames(role), classNames)}
|
|
146
144
|
data-popover-collision-boundary={true}
|
|
147
|
-
{
|
|
145
|
+
className={mx(stackItemContentEditorClassNames(role), classNames)}
|
|
146
|
+
ref={parentRef}
|
|
148
147
|
/>
|
|
149
148
|
);
|
|
150
149
|
},
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type EditorView } from '@codemirror/view';
|
|
6
|
-
import React, { useCallback, useState } from 'react';
|
|
6
|
+
import React, { type ComponentPropsWithoutRef, useCallback, useState } from 'react';
|
|
7
7
|
|
|
8
8
|
import { type FileInfo } from '@dxos/app-toolkit';
|
|
9
9
|
import { invariant } from '@dxos/invariant';
|
|
@@ -14,7 +14,7 @@ import { type EditorViewMode } from '@dxos/ui-editor';
|
|
|
14
14
|
import { FileUpload, type FileUploadAction } from './FileUpload';
|
|
15
15
|
|
|
16
16
|
export type MarkdownEditorToolbarProps = ThemedClassName<
|
|
17
|
-
{
|
|
17
|
+
ComponentPropsWithoutRef<'div'> & {
|
|
18
18
|
id: string;
|
|
19
19
|
editorView?: EditorView;
|
|
20
20
|
onFileUpload?: (file: File) => Promise<FileInfo | undefined>;
|
|
@@ -31,6 +31,7 @@ export const MarkdownEditorToolbar = ({
|
|
|
31
31
|
onAction,
|
|
32
32
|
onFileUpload,
|
|
33
33
|
onViewModeChange,
|
|
34
|
+
...props
|
|
34
35
|
}: MarkdownEditorToolbarProps) => {
|
|
35
36
|
const [upload, setUpload] = useState<FileUploadAction | null>(null);
|
|
36
37
|
const uploadRef = useCallback((next: FileUploadAction) => setUpload(() => next), []);
|
|
@@ -43,11 +44,11 @@ export const MarkdownEditorToolbar = ({
|
|
|
43
44
|
}, [editorView]);
|
|
44
45
|
|
|
45
46
|
if (!editorView) {
|
|
46
|
-
return <div />;
|
|
47
|
+
return <div {...props} />;
|
|
47
48
|
}
|
|
48
49
|
|
|
49
50
|
return (
|
|
50
|
-
|
|
51
|
+
<div role='none' {...props}>
|
|
51
52
|
<EditorToolbar
|
|
52
53
|
classNames={classNames}
|
|
53
54
|
attendableId={id}
|
|
@@ -61,6 +62,6 @@ export const MarkdownEditorToolbar = ({
|
|
|
61
62
|
/>
|
|
62
63
|
|
|
63
64
|
{onFileUpload && <FileUpload ref={uploadRef} editorView={editorView} onFileUpload={onFileUpload} />}
|
|
64
|
-
|
|
65
|
+
</div>
|
|
65
66
|
);
|
|
66
67
|
};
|
package/src/components/index.ts
CHANGED
|
@@ -1,17 +1,5 @@
|
|
|
1
1
|
//
|
|
2
|
-
// Copyright
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { type MarkdownCard as MarkdownCardType } from './MarkdownCard';
|
|
8
|
-
import { type MarkdownContainer as MarkdownContainerType } from './MarkdownContainer';
|
|
9
|
-
|
|
10
|
-
export * from './MarkdownCard';
|
|
11
|
-
export * from './MarkdownContainer';
|
|
12
|
-
export * from './MarkdownSettings';
|
|
13
|
-
|
|
14
|
-
export const MarkdownCard: LazyExoticComponent<typeof MarkdownCardType> = lazy(() => import('./MarkdownCard'));
|
|
15
|
-
export const MarkdownContainer: LazyExoticComponent<typeof MarkdownContainerType> = lazy(
|
|
16
|
-
() => import('./MarkdownContainer'),
|
|
17
|
-
);
|
|
5
|
+
export * from './MarkdownEditor';
|
|
@@ -5,10 +5,13 @@
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
6
|
import React, { useMemo } from 'react';
|
|
7
7
|
|
|
8
|
-
import { OperationPlugin } from '@dxos/app-framework';
|
|
8
|
+
import { OperationPlugin, RuntimePlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { Obj } from '@dxos/echo';
|
|
11
|
+
import { ClientPlugin } from '@dxos/plugin-client';
|
|
10
12
|
import { Markdown } from '@dxos/plugin-markdown/types';
|
|
11
13
|
import { faker } from '@dxos/random';
|
|
14
|
+
import { Card } from '@dxos/react-ui';
|
|
12
15
|
import { withTheme } from '@dxos/react-ui/testing';
|
|
13
16
|
import { CardContainer } from '@dxos/react-ui-mosaic/testing';
|
|
14
17
|
|
|
@@ -18,30 +21,37 @@ import { MarkdownCard, type MarkdownCardProps } from './MarkdownCard';
|
|
|
18
21
|
|
|
19
22
|
faker.seed(1234);
|
|
20
23
|
|
|
21
|
-
// TODO(wittjosiah): ECHO objects don't work when passed via Storybook args.
|
|
22
24
|
const MarkdownCardStory = ({ ...args }: Omit<MarkdownCardProps, 'subject'>) => {
|
|
23
25
|
const subject = useMemo(
|
|
24
26
|
() =>
|
|
25
27
|
Markdown.make({
|
|
26
28
|
name: faker.lorem.words(3),
|
|
27
|
-
content: faker.lorem.paragraphs(
|
|
29
|
+
content: faker.lorem.paragraphs(5),
|
|
28
30
|
}),
|
|
29
31
|
[],
|
|
30
32
|
);
|
|
33
|
+
|
|
31
34
|
return (
|
|
32
35
|
<CardContainer icon='ph--text-aa--regular'>
|
|
33
|
-
<
|
|
36
|
+
<Card.Root border={false}>
|
|
37
|
+
<Card.Toolbar>
|
|
38
|
+
<Card.DragHandle />
|
|
39
|
+
<Card.Title>{Obj.getLabel(subject)}</Card.Title>
|
|
40
|
+
<Card.Menu />
|
|
41
|
+
</Card.Toolbar>
|
|
42
|
+
<MarkdownCard subject={subject} {...args} />
|
|
43
|
+
</Card.Root>
|
|
34
44
|
</CardContainer>
|
|
35
45
|
);
|
|
36
46
|
};
|
|
37
47
|
|
|
38
48
|
const meta: Meta<typeof MarkdownCardStory> = {
|
|
39
|
-
title: 'plugins/plugin-markdown/
|
|
49
|
+
title: 'plugins/plugin-markdown/containers/MarkdownCard',
|
|
40
50
|
component: MarkdownCardStory,
|
|
41
51
|
decorators: [
|
|
42
52
|
withTheme(),
|
|
43
53
|
withPluginManager({
|
|
44
|
-
plugins: [OperationPlugin()],
|
|
54
|
+
plugins: [OperationPlugin(), RuntimePlugin(), ClientPlugin({})],
|
|
45
55
|
}),
|
|
46
56
|
],
|
|
47
57
|
parameters: {
|
|
@@ -6,13 +6,13 @@ import React, { useMemo } from 'react';
|
|
|
6
6
|
|
|
7
7
|
import { Obj } from '@dxos/echo';
|
|
8
8
|
import { useTranslation } from '@dxos/react-ui';
|
|
9
|
-
import { Card } from '@dxos/react-ui
|
|
9
|
+
import { Card } from '@dxos/react-ui';
|
|
10
10
|
import { Text } from '@dxos/schema';
|
|
11
11
|
|
|
12
|
+
import { MarkdownEditor } from '../../components';
|
|
12
13
|
import { meta } from '../../meta';
|
|
13
14
|
import { Markdown } from '../../types';
|
|
14
|
-
import { getContentSnippet
|
|
15
|
-
import { MarkdownEditor } from '../MarkdownEditor';
|
|
15
|
+
import { getContentSnippet } from '../../util';
|
|
16
16
|
|
|
17
17
|
export type MarkdownCardProps = { subject: Markdown.Document | Text.Text };
|
|
18
18
|
|
|
@@ -24,41 +24,38 @@ export const MarkdownCard = ({ subject }: MarkdownCardProps) => {
|
|
|
24
24
|
return (
|
|
25
25
|
<Card.Content>
|
|
26
26
|
{snippet && (
|
|
27
|
-
<Card.
|
|
27
|
+
<Card.Section>
|
|
28
28
|
<MarkdownEditor.Root id={subject.id} viewMode='readonly'>
|
|
29
|
-
<MarkdownEditor.Content
|
|
29
|
+
<MarkdownEditor.Content
|
|
30
|
+
initialValue={snippet}
|
|
31
|
+
classNames='bg-transparent'
|
|
32
|
+
slots={{
|
|
33
|
+
editor: { className: 'max-h-[240px]' },
|
|
34
|
+
}}
|
|
35
|
+
/>
|
|
30
36
|
</MarkdownEditor.Root>
|
|
31
|
-
</Card.
|
|
37
|
+
</Card.Section>
|
|
32
38
|
)}
|
|
33
|
-
<Card.
|
|
39
|
+
<Card.Section>
|
|
34
40
|
<Card.Text classNames='text-xs text-description'>
|
|
35
41
|
{info.words} {t('words label', { count: info.words })}
|
|
36
42
|
</Card.Text>
|
|
37
|
-
</Card.
|
|
43
|
+
</Card.Section>
|
|
38
44
|
</Card.Content>
|
|
39
45
|
);
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
const
|
|
43
|
-
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
44
|
-
return { words: text.split(' ').length };
|
|
45
|
-
};
|
|
48
|
+
const MAX_LINES = 5;
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
const getTitle = (subject: Markdown.Document | Text.Text, fallback: string) => {
|
|
50
|
+
const getSnippet = (subject: Markdown.Document | Text.Text, fallback?: string) => {
|
|
49
51
|
if (Obj.instanceOf(Markdown.Document, subject)) {
|
|
50
|
-
|
|
51
|
-
return title ?? getFallbackName(subject.content?.target?.content ?? fallback);
|
|
52
|
+
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback, MAX_LINES);
|
|
52
53
|
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
53
|
-
return
|
|
54
|
+
return getContentSnippet(subject.content ?? fallback, MAX_LINES);
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
return Obj.getDescription(subject) || getContentSnippet(subject.content?.target?.content ?? fallback);
|
|
61
|
-
} else if (Obj.instanceOf(Text.Text, subject)) {
|
|
62
|
-
return getContentSnippet(subject.content ?? fallback);
|
|
63
|
-
}
|
|
58
|
+
const getInfo = (subject: Markdown.Document | Text.Text) => {
|
|
59
|
+
const text = (Obj.instanceOf(Markdown.Document, subject) ? subject.content?.target?.content : subject.content) ?? '';
|
|
60
|
+
return { words: text.split(' ').length };
|
|
64
61
|
};
|
|
@@ -6,9 +6,10 @@ import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
|
6
6
|
import * as Effect from 'effect/Effect';
|
|
7
7
|
import React, { useMemo } from 'react';
|
|
8
8
|
|
|
9
|
+
import { Capability, Plugin } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { Surface, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
11
|
-
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
12
|
+
import { AppActivationEvents, LayoutOperation } from '@dxos/app-toolkit';
|
|
12
13
|
import { Obj, Query } from '@dxos/echo';
|
|
13
14
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
15
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
@@ -22,14 +23,24 @@ import { Text } from '@dxos/schema';
|
|
|
22
23
|
import { type ValueGenerator, createObjectFactory } from '@dxos/schema/testing';
|
|
23
24
|
import { Organization, Person } from '@dxos/types';
|
|
24
25
|
|
|
25
|
-
import { MarkdownPlugin } from '
|
|
26
|
-
import { translations } from '
|
|
27
|
-
import { Markdown } from '
|
|
26
|
+
import { MarkdownPlugin } from '../../MarkdownPlugin';
|
|
27
|
+
import { translations } from '../../translations';
|
|
28
|
+
import { Markdown, MarkdownCapabilities, MarkdownEvents } from '../../types';
|
|
28
29
|
|
|
29
30
|
faker.seed(1);
|
|
30
31
|
|
|
31
32
|
const generator: ValueGenerator = faker as any;
|
|
32
33
|
|
|
34
|
+
/** Minimal plugin that contributes an empty Extensions capability for stories. */
|
|
35
|
+
const MarkdownExtensionsPlugin = Plugin.define({ id: 'story-markdown-extensions', name: 'Story Extensions' }).pipe(
|
|
36
|
+
Plugin.addModule({
|
|
37
|
+
id: 'extensions',
|
|
38
|
+
activatesOn: MarkdownEvents.SetupExtensions,
|
|
39
|
+
activate: () => Effect.succeed(Capability.contributes(MarkdownCapabilities.Extensions, [])),
|
|
40
|
+
}),
|
|
41
|
+
Plugin.make,
|
|
42
|
+
);
|
|
43
|
+
|
|
33
44
|
const DefaultStory = () => {
|
|
34
45
|
const { invokePromise } = useOperationInvoker();
|
|
35
46
|
const space = useSpace();
|
|
@@ -52,15 +63,17 @@ const DefaultStory = () => {
|
|
|
52
63
|
};
|
|
53
64
|
|
|
54
65
|
const meta = {
|
|
55
|
-
title: 'plugins/plugin-markdown/MarkdownContainer',
|
|
66
|
+
title: 'plugins/plugin-markdown/containers/MarkdownContainer',
|
|
56
67
|
render: DefaultStory,
|
|
57
68
|
decorators: [
|
|
58
69
|
withTheme(),
|
|
59
70
|
withLayout({ layout: 'column' }),
|
|
60
71
|
withPluginManager<{ title?: string; content?: string }>((context) => ({
|
|
72
|
+
setupEvents: [AppActivationEvents.SetupSettings, MarkdownEvents.SetupExtensions],
|
|
61
73
|
plugins: [
|
|
62
74
|
...corePlugins(),
|
|
63
75
|
StorybookPlugin({}),
|
|
76
|
+
MarkdownExtensionsPlugin(),
|
|
64
77
|
ClientPlugin({
|
|
65
78
|
types: [Markdown.Document, Text.Text, Person.Person, Organization.Organization],
|
|
66
79
|
onClientInitialized: ({ client }) =>
|
|
@@ -13,14 +13,13 @@ import { useAppGraph } from '@dxos/app-toolkit/ui';
|
|
|
13
13
|
import { Obj } from '@dxos/echo';
|
|
14
14
|
import { useActionRunner } from '@dxos/plugin-graph';
|
|
15
15
|
import { useObject } from '@dxos/react-client/echo';
|
|
16
|
-
import {
|
|
16
|
+
import { Panel } from '@dxos/react-ui';
|
|
17
17
|
import { type SelectionManager } from '@dxos/react-ui-attention';
|
|
18
18
|
import { Text } from '@dxos/schema';
|
|
19
19
|
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
import { MarkdownEditor, type MarkdownEditorContentProps, type MarkdownEditorRootProps } from './MarkdownEditor';
|
|
20
|
+
import { MarkdownEditor, type MarkdownEditorContentProps, type MarkdownEditorRootProps } from '../../components';
|
|
21
|
+
import { useLinkQuery } from '../../hooks';
|
|
22
|
+
import { Markdown, MarkdownCapabilities, type MarkdownPluginState } from '../../types';
|
|
24
23
|
|
|
25
24
|
export type MarkdownContainerProps = SurfaceComponentProps<
|
|
26
25
|
Markdown.Document | Text.Text,
|
|
@@ -69,7 +68,7 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
69
68
|
return Atom.make((get) => {
|
|
70
69
|
const actions = get(graph.actions(id));
|
|
71
70
|
const nodes = actions.filter((action) => action.properties.disposition === 'toolbar');
|
|
72
|
-
const edges = nodes.map((node) => ({ source: 'root', target: node.id }));
|
|
71
|
+
const edges = nodes.map((node) => ({ source: 'root', target: node.id, relation: 'child' }));
|
|
73
72
|
return { nodes, edges };
|
|
74
73
|
});
|
|
75
74
|
}, [graph]);
|
|
@@ -88,26 +87,28 @@ export const MarkdownContainer = forwardRef<HTMLDivElement, MarkdownContainerPro
|
|
|
88
87
|
const handleLinkQuery = useLinkQuery(db);
|
|
89
88
|
|
|
90
89
|
return (
|
|
91
|
-
<
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
>
|
|
90
|
+
<MarkdownEditor.Root
|
|
91
|
+
id={attendableId ?? id}
|
|
92
|
+
object={object}
|
|
93
|
+
extensions={extensions}
|
|
94
|
+
settings={settings}
|
|
95
|
+
onAction={runAction}
|
|
96
|
+
onFileUpload={handleFileUpload}
|
|
97
|
+
onLinkQuery={handleLinkQuery}
|
|
98
|
+
{...props}
|
|
99
|
+
>
|
|
100
|
+
<Panel.Root ref={forwardedRef}>
|
|
102
101
|
{settings.toolbar && (
|
|
103
|
-
<
|
|
102
|
+
<Panel.Toolbar asChild>
|
|
103
|
+
<MarkdownEditor.Toolbar id={attendableId ?? id} role={role} customActions={customActions} />
|
|
104
|
+
</Panel.Toolbar>
|
|
104
105
|
)}
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
<Panel.Content>
|
|
107
|
+
<MarkdownEditor.Content initialValue={initialValue} scrollPastEnd={role === 'article'} />
|
|
108
|
+
<MarkdownEditor.Blocks />
|
|
109
|
+
</Panel.Content>
|
|
110
|
+
</Panel.Root>
|
|
111
|
+
</MarkdownEditor.Root>
|
|
109
112
|
);
|
|
110
113
|
},
|
|
111
114
|
);
|
|
112
|
-
|
|
113
|
-
export default MarkdownContainer;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
7
|
+
export type { MarkdownContainerProps } from './MarkdownContainer/MarkdownContainer';
|
|
8
|
+
|
|
9
|
+
export const MarkdownCard: ComponentType<any> = lazy(() => import('./MarkdownCard'));
|
|
10
|
+
export const MarkdownContainer: ComponentType<any> = lazy(() => import('./MarkdownContainer'));
|
|
11
|
+
export const MarkdownSettings: ComponentType<any> = lazy(() => import('./MarkdownSettings'));
|
|
@@ -56,7 +56,7 @@ export const useEditorMenuOptions = ({
|
|
|
56
56
|
content: () => {
|
|
57
57
|
const pressEl = Domino.of('span').text('Press');
|
|
58
58
|
const triggerEls = trigger.map((text) =>
|
|
59
|
-
Domino.of('span').classNames('mx-1
|
|
59
|
+
Domino.of('span').classNames('mx-1 px-1.5 pt-[1px] pb-[2px] border border-separator rounded-xs').text(text),
|
|
60
60
|
);
|
|
61
61
|
const forCommandsEl = Domino.of('span').text('for commands.');
|
|
62
62
|
return Domino.of('div').children(pressEl, ...triggerEls, forCommandsEl).root;
|