@dou-ui/editor 0.1.0-alpha.2 → 0.1.0-alpha.21
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/code/code-editor-block.js.map +1 -1
- package/dist/code/code-editor-block.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/code/code-editor-block.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/collaboration/binding.js +371 -57
- package/dist/collaboration/binding.js.map +1 -1
- package/dist/collaboration/cursors.js +42 -10
- package/dist/collaboration/cursors.js.map +1 -1
- package/dist/collaboration/index.js +61 -11
- package/dist/collaboration/index.js.map +1 -1
- package/dist/collaboration/inline-diff.js +138 -0
- package/dist/collaboration/inline-diff.js.map +1 -0
- package/dist/collaboration/merged-props.js +152 -0
- package/dist/collaboration/merged-props.js.map +1 -0
- package/dist/collaboration/order.js +41 -1
- package/dist/collaboration/order.js.map +1 -1
- package/dist/collaboration/table.js +64 -25
- package/dist/collaboration/table.js.map +1 -1
- package/dist/collaboration/text.js +213 -1
- package/dist/collaboration/text.js.map +1 -1
- package/dist/components/block-handle.js.map +1 -1
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js +125 -17
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/bubble-toolbar.js.map +1 -1
- package/dist/components/bubble-toolbar.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/bubble-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/comment-card.js.map +1 -1
- package/dist/components/comment-card.vue_vue_type_script_setup_true_lang.js +2 -1
- package/dist/components/comment-card.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/components/slash-choices.js +6 -0
- package/dist/components/slash-choices.js.map +1 -0
- package/dist/components/slash-choices.vue_vue_type_script_setup_true_lang.js +56 -0
- package/dist/components/slash-choices.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/slash-menu.js.map +1 -1
- package/dist/components/slash-menu.vue_vue_type_script_setup_true_lang.js +185 -20
- package/dist/components/slash-menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/core/block-selection.js +32 -4
- package/dist/core/block-selection.js.map +1 -1
- package/dist/core/blocks.js +21 -3
- package/dist/core/blocks.js.map +1 -1
- package/dist/core/commands.js +125 -13
- package/dist/core/commands.js.map +1 -1
- package/dist/core/comments.js +85 -3
- package/dist/core/comments.js.map +1 -1
- package/dist/core/convert.js +3 -3
- package/dist/core/convert.js.map +1 -1
- package/dist/core/editor.js +2 -1
- package/dist/core/editor.js.map +1 -1
- package/dist/core/extension.js +6 -2
- package/dist/core/extension.js.map +1 -1
- package/dist/core/model.js +10 -3
- package/dist/core/model.js.map +1 -1
- package/dist/core/plugins.js +108 -5
- package/dist/core/plugins.js.map +1 -1
- package/dist/core/prepare.js +12 -5
- package/dist/core/prepare.js.map +1 -1
- package/dist/core/schema.js.map +1 -1
- package/dist/core/transaction.js +19 -4
- package/dist/core/transaction.js.map +1 -1
- package/dist/define-block.js +8 -4
- package/dist/define-block.js.map +1 -1
- package/dist/document.js +59 -4
- package/dist/document.js.map +1 -1
- package/dist/dom.js +112 -13
- package/dist/dom.js.map +1 -1
- package/dist/editor.js.map +1 -1
- package/dist/editor.vue_vue_type_script_setup_true_lang.js +3 -3
- package/dist/editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/editor2.js.map +1 -1
- package/dist/extensions/align/align-menu.js.map +1 -1
- package/dist/extensions/align/align-menu.vue_vue_type_script_setup_true_lang.js +4 -6
- package/dist/extensions/align/align-menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/extensions/callout/html.js +5 -4
- package/dist/extensions/callout/html.js.map +1 -1
- package/dist/extensions/colors/color-menu.js.map +1 -1
- package/dist/extensions/colors/color-menu.vue_vue_type_script_setup_true_lang.js +6 -8
- package/dist/extensions/colors/color-menu.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/extensions/columns/column-picker.js +6 -0
- package/dist/extensions/columns/column-picker.js.map +1 -0
- package/dist/extensions/columns/column-picker.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/extensions/columns/column-picker.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/columns/columns-controls.js +6 -0
- package/dist/extensions/columns/columns-controls.js.map +1 -0
- package/dist/extensions/columns/columns-controls.vue_vue_type_script_setup_true_lang.js +341 -0
- package/dist/extensions/columns/columns-controls.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/columns/html.js +34 -0
- package/dist/extensions/columns/html.js.map +1 -0
- package/dist/extensions/columns/index.js +57 -0
- package/dist/extensions/columns/index.js.map +1 -0
- package/dist/extensions/columns/keys.js +53 -0
- package/dist/extensions/columns/keys.js.map +1 -0
- package/dist/extensions/columns/plugin.js +213 -0
- package/dist/extensions/columns/plugin.js.map +1 -0
- package/dist/extensions/columns/schema.js +58 -0
- package/dist/extensions/columns/schema.js.map +1 -0
- package/dist/extensions/columns/select-columns.js +6 -0
- package/dist/extensions/columns/select-columns.js.map +1 -0
- package/dist/extensions/columns/select-columns.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/extensions/columns/select-columns.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/editor-kit.js +3 -1
- package/dist/extensions/editor-kit.js.map +1 -1
- package/dist/extensions/list-html.js +1 -1
- package/dist/extensions/list-html.js.map +1 -1
- package/dist/extensions/table/plugin.js +33 -1
- package/dist/extensions/table/plugin.js.map +1 -1
- package/dist/extensions/table/table-controls.js.map +1 -1
- package/dist/extensions/table/table-controls.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/extensions/table/table-controls.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/extensions/table/view.js +25 -1
- package/dist/extensions/table/view.js.map +1 -1
- package/dist/flow/board-block.js +6 -0
- package/dist/flow/board-block.js.map +1 -0
- package/dist/flow/board-block.vue_vue_type_script_setup_true_lang.js +659 -0
- package/dist/flow/board-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/flow/board.js +221 -0
- package/dist/flow/board.js.map +1 -0
- package/dist/flow/index.js +173 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/locale.js +78 -6
- package/dist/locale.js.map +1 -1
- package/dist/markdown/index.js +2 -2
- package/dist/markdown/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/style.js +2 -1
- package/dist/types/collaboration/binding.d.ts +12 -0
- package/dist/types/collaboration/cursors.d.ts +29 -1
- package/dist/types/collaboration/index.d.ts +53 -6
- package/dist/types/collaboration/inline-diff.d.ts +9 -0
- package/dist/types/collaboration/merged-props.d.ts +20 -0
- package/dist/types/collaboration/order.d.ts +5 -0
- package/dist/types/collaboration/table.d.ts +5 -1
- package/dist/types/collaboration/text.d.ts +20 -0
- package/dist/types/components/slash-choices.vue.d.ts +18 -0
- package/dist/types/core/blocks.d.ts +10 -0
- package/dist/types/core/commands.d.ts +17 -2
- package/dist/types/core/comments.d.ts +39 -3
- package/dist/types/core/convert.d.ts +10 -2
- package/dist/types/core/extension.d.ts +58 -4
- package/dist/types/core/model.d.ts +6 -1
- package/dist/types/core/plugins.d.ts +9 -0
- package/dist/types/core/prepare.d.ts +16 -2
- package/dist/types/core/schema.d.ts +1 -1
- package/dist/types/core/transaction.d.ts +6 -0
- package/dist/types/define-block.d.ts +16 -4
- package/dist/types/document.d.ts +5 -2
- package/dist/types/dom.d.ts +43 -4
- package/dist/types/editor.d.ts +9 -1
- package/dist/types/editor.vue.d.ts +24 -0
- package/dist/types/extensions/columns/column-picker.vue.d.ts +10 -0
- package/dist/types/extensions/columns/columns-controls.vue.d.ts +3 -0
- package/dist/types/extensions/columns/html.d.ts +10 -0
- package/dist/types/extensions/columns/index.d.ts +9 -0
- package/dist/types/extensions/columns/keys.d.ts +6 -0
- package/dist/types/extensions/columns/plugin.d.ts +28 -0
- package/dist/types/extensions/columns/schema.d.ts +17 -0
- package/dist/types/extensions/columns/select-columns.vue.d.ts +13 -0
- package/dist/types/extensions/editor-kit.d.ts +4 -1
- package/dist/types/extensions/table/view.d.ts +8 -1
- package/dist/types/flow/board-block.vue.d.ts +16 -0
- package/dist/types/flow/board.d.ts +53 -0
- package/dist/types/flow/index.d.ts +65 -0
- package/dist/types/index.d.ts +29 -4
- package/dist/types/locale.d.ts +34 -0
- package/dist/types/markdown/index.d.ts +8 -1
- package/dist/use-comments.js +2 -2
- package/dist/use-comments.js.map +1 -1
- package/package.json +14 -5
|
@@ -5,9 +5,16 @@ import type { NodeView, ViewMutationRecord } from 'prosemirror-view';
|
|
|
5
5
|
export declare const CELL_MIN_WIDTH = 96;
|
|
6
6
|
/**
|
|
7
7
|
* A table in the editor: a scrolling frame (the block's content element)
|
|
8
|
-
* around the table, with a `<colgroup>` that holds the column widths.
|
|
8
|
+
* around the table, with a `<colgroup>` that holds the column widths. When
|
|
9
|
+
* columns are cut off at either side of the frame, that side has a shadow:
|
|
10
|
+
* `is-cut-start` / `is-cut-end` on the frame.
|
|
9
11
|
*/
|
|
10
12
|
export declare class TableBlockView extends TableView implements NodeView {
|
|
13
|
+
private readonly observer;
|
|
14
|
+
private readonly onScroll;
|
|
11
15
|
constructor(node: PMNode);
|
|
16
|
+
/** Which sides cut columns off: the table's edges against the frame's, padding left out. */
|
|
17
|
+
private edges;
|
|
12
18
|
ignoreMutation(record: ViewMutationRecord): boolean;
|
|
19
|
+
destroy(): void;
|
|
13
20
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockProps } from '../core/model';
|
|
2
|
+
import { type BoardBlockSettings } from './board';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
block: {
|
|
5
|
+
id: string;
|
|
6
|
+
type: string;
|
|
7
|
+
props: BlockProps;
|
|
8
|
+
};
|
|
9
|
+
updateProps: (props: BlockProps) => void;
|
|
10
|
+
selected: boolean;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
settings: BoardBlockSettings;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
15
|
+
declare const _default: typeof __VLS_export;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FlowCommentAnchor, FlowDocument, FlowExtension } from '@dou-ui/flow';
|
|
2
|
+
import type { Node as PMNode } from 'prosemirror-model';
|
|
3
|
+
import type { BlockCommentsSpec } from '../core/comments';
|
|
4
|
+
import type { Label } from '../core/extension';
|
|
5
|
+
import type { FlowBlockEditorProps } from './index';
|
|
6
|
+
/** Sent to a block's element to open its fullscreen editor (`Enter` on the selected block). */
|
|
7
|
+
export declare const BOARD_OPEN_EVENT = "dou-editor-board-open";
|
|
8
|
+
/** Heights a block may have in the document, in px. */
|
|
9
|
+
export declare const BOARD_HEIGHT: {
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
step: number;
|
|
13
|
+
};
|
|
14
|
+
export interface BoardBlockSettings {
|
|
15
|
+
label: Label;
|
|
16
|
+
extensions: (FlowExtension | FlowExtension[])[];
|
|
17
|
+
editorProps: FlowBlockEditorProps;
|
|
18
|
+
height: number;
|
|
19
|
+
/** When the extensions offer no node to add, offer one with ports (not on a whiteboard, which has its tools). */
|
|
20
|
+
fallbackNode: boolean;
|
|
21
|
+
/** Threads can be started and shown on the nodes and edges, with the document's comments. */
|
|
22
|
+
commentable: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A block's `board` prop as a flow document; one that is missing or not
|
|
26
|
+
* shaped like one is read as an empty flow (nodes and edges that aren't
|
|
27
|
+
* objects, and edges without valid endpoints, are left out).
|
|
28
|
+
*/
|
|
29
|
+
export declare function boardOf(value: unknown): FlowDocument;
|
|
30
|
+
export declare const clampHeight: (height: number) => number;
|
|
31
|
+
/** A block's `height` prop in px: the default when it isn't a positive number. */
|
|
32
|
+
export declare const heightOf: (value: unknown, fallback: number) => number;
|
|
33
|
+
/** What `checkDocument` reports of a block's props: a board or height it would read differently. */
|
|
34
|
+
export declare function checkBoardProps(props: Record<string, unknown>): {
|
|
35
|
+
prop: string;
|
|
36
|
+
message: string;
|
|
37
|
+
}[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether `a` and `b` differ only in the `board` prop of the block `id`:
|
|
40
|
+
* an undo taken from the fullscreen editor must not change anything the
|
|
41
|
+
* person can't see there.
|
|
42
|
+
*/
|
|
43
|
+
export declare function onlyBoardChanged(a: PMNode, b: PMNode, id: string): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Where a thread is on a board, as the flow editor's `getCommentAnchors`
|
|
46
|
+
* gives it: a node, maybe a point on it with its number there, or an edge.
|
|
47
|
+
*/
|
|
48
|
+
export type BoardCommentTarget = FlowCommentAnchor;
|
|
49
|
+
/**
|
|
50
|
+
* How a board block keeps comment threads: on its nodes and edges, in their
|
|
51
|
+
* `comments` (and `commentPins`), as a `DouFlowEditor` does.
|
|
52
|
+
*/
|
|
53
|
+
export declare const boardComments: BlockCommentsSpec<BoardCommentTarget>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type FlowDocument, type FlowEditorProps, type FlowExtension } from '@dou-ui/flow';
|
|
2
|
+
import { type WhiteboardKitOptions } from '@dou-ui/flow/whiteboard';
|
|
3
|
+
import { type BlockOption, type EditorExtension, type Label } from '../core/extension';
|
|
4
|
+
export { boardOf, type BoardCommentTarget } from './board';
|
|
5
|
+
/** The props of the fullscreen editor that a flow block may set. */
|
|
6
|
+
export type FlowBlockEditorProps = Omit<FlowEditorProps, 'extensions' | 'readonly' | 'fitView' | 'comments' | 'author' | 'activeComment' | 'commentable'>;
|
|
7
|
+
export interface FlowBlockOptions {
|
|
8
|
+
/** The block type, e.g. `approvalFlow`; unique among the editor's blocks. */
|
|
9
|
+
type: string;
|
|
10
|
+
/** What the flow is made of, as the editor's `extensions`. `[flowKit()]` by default. */
|
|
11
|
+
extensions?: (FlowExtension | FlowExtension[])[];
|
|
12
|
+
/** More props for the flow editors, e.g. `nodeTypes`, `portTypes` or `direction`. */
|
|
13
|
+
editorProps?: FlowBlockEditorProps;
|
|
14
|
+
/** The block's name: the title of the fullscreen editor, and of its slash menu entry. */
|
|
15
|
+
label: Label;
|
|
16
|
+
/** The slash menu entry, or `false` to leave it out (blocks then come from code or pasting). */
|
|
17
|
+
menu?: (Omit<BlockOption, 'key' | 'type' | 'label'> & {
|
|
18
|
+
key?: string;
|
|
19
|
+
label?: Label;
|
|
20
|
+
}) | false;
|
|
21
|
+
/** The height of a new block in the document, in px. Defaults to `360`. */
|
|
22
|
+
height?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Comment threads on the nodes and edges, with the document's
|
|
25
|
+
* `v-model:comments`, `author` and `commentable`. Defaults to `true`;
|
|
26
|
+
* `false` leaves them out of this block type.
|
|
27
|
+
*/
|
|
28
|
+
commentable?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* How a block is written in `blocksToHTML`, e.g. an `<img>` of a picture
|
|
31
|
+
* of it the app keeps. By default a `<figure>` with its name, which
|
|
32
|
+
* pasting reads back as the block.
|
|
33
|
+
*/
|
|
34
|
+
html?: (board: FlowDocument, block: {
|
|
35
|
+
id: string;
|
|
36
|
+
props: Record<string, unknown>;
|
|
37
|
+
}) => string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* A block that holds a flow, drawn with `@dou-ui/flow`: the document shows
|
|
41
|
+
* it whole, and it is edited in a fullscreen editor (double-click, the
|
|
42
|
+
* “Edit” button, or `Enter` while the block is selected). The flow is the
|
|
43
|
+
* block's `board` prop; collaboration merges it node by node.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* extensions: [editorKit(), flowBlock({ type: 'approvalFlow', label: '审批流程', extensions: [flowKit(), approval()] })]
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* Needs `@dou-ui/flow` and its styles. For a whiteboard, `whiteboardBlock()`.
|
|
50
|
+
*/
|
|
51
|
+
export declare function flowBlock(options: FlowBlockOptions): EditorExtension;
|
|
52
|
+
export interface WhiteboardBlockOptions extends Pick<WhiteboardKitOptions, 'upload' | 'onUploadError'>, Pick<FlowBlockOptions, 'height' | 'html' | 'editorProps' | 'commentable'> {
|
|
53
|
+
/** The slash menu entry, or `false` to leave it out. */
|
|
54
|
+
menu?: FlowBlockOptions['menu'];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* A whiteboard block: shapes, sticky notes, text, pen strokes, images and
|
|
58
|
+
* connectors, drawn in a fullscreen editor. Pass the `upload` of `image()`
|
|
59
|
+
* so pictures on the board are uploaded too, not kept in the document.
|
|
60
|
+
*
|
|
61
|
+
* ```ts
|
|
62
|
+
* extensions: [editorKit(), whiteboardBlock({ upload })]
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
export declare function whiteboardBlock(options?: WhiteboardBlockOptions): EditorExtension;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,8 +48,10 @@ export declare const DouEditor: import("dou-ui").WithInstall<import("vue").Defin
|
|
|
48
48
|
toggle?: string | undefined;
|
|
49
49
|
callout?: string | undefined;
|
|
50
50
|
table?: string | undefined;
|
|
51
|
+
columns?: string | undefined;
|
|
51
52
|
attachment?: string | undefined;
|
|
52
53
|
embed?: string | undefined;
|
|
54
|
+
whiteboard?: string | undefined;
|
|
53
55
|
} | undefined;
|
|
54
56
|
hints?: {
|
|
55
57
|
paragraph?: string | undefined;
|
|
@@ -66,8 +68,10 @@ export declare const DouEditor: import("dou-ui").WithInstall<import("vue").Defin
|
|
|
66
68
|
toggle?: string | undefined;
|
|
67
69
|
callout?: string | undefined;
|
|
68
70
|
table?: string | undefined;
|
|
71
|
+
columns?: string | undefined;
|
|
69
72
|
attachment?: string | undefined;
|
|
70
73
|
embed?: string | undefined;
|
|
74
|
+
whiteboard?: string | undefined;
|
|
71
75
|
} | undefined;
|
|
72
76
|
image?: {
|
|
73
77
|
empty?: string | undefined;
|
|
@@ -126,6 +130,14 @@ export declare const DouEditor: import("dou-ui").WithInstall<import("vue").Defin
|
|
|
126
130
|
addRow?: string | undefined;
|
|
127
131
|
addColumn?: string | undefined;
|
|
128
132
|
} | undefined;
|
|
133
|
+
columns?: {
|
|
134
|
+
pick?: string | undefined;
|
|
135
|
+
count?: string | undefined;
|
|
136
|
+
select?: string | undefined;
|
|
137
|
+
resize?: string | undefined;
|
|
138
|
+
even?: string | undefined;
|
|
139
|
+
column?: string | undefined;
|
|
140
|
+
} | undefined;
|
|
129
141
|
colors?: {
|
|
130
142
|
label?: string | undefined;
|
|
131
143
|
text?: string | undefined;
|
|
@@ -166,6 +178,18 @@ export declare const DouEditor: import("dou-ui").WithInstall<import("vue").Defin
|
|
|
166
178
|
edit?: string | undefined;
|
|
167
179
|
cancel?: string | undefined;
|
|
168
180
|
} | undefined;
|
|
181
|
+
board?: {
|
|
182
|
+
empty?: string | undefined;
|
|
183
|
+
start?: string | undefined;
|
|
184
|
+
edit?: string | undefined;
|
|
185
|
+
view?: string | undefined;
|
|
186
|
+
resize?: string | undefined;
|
|
187
|
+
addNode?: string | undefined;
|
|
188
|
+
searchNodes?: string | undefined;
|
|
189
|
+
noNodes?: string | undefined;
|
|
190
|
+
node?: string | undefined;
|
|
191
|
+
emptyFlow?: string | undefined;
|
|
192
|
+
} | undefined;
|
|
169
193
|
noResults?: string | undefined;
|
|
170
194
|
addBlock?: string | undefined;
|
|
171
195
|
dragHandle?: string | undefined;
|
|
@@ -210,13 +234,13 @@ export type { EditorComments, EditorContext, EditorEmits, EditorExpose, EditorLi
|
|
|
210
234
|
export { EditorTransaction } from './core/transaction';
|
|
211
235
|
export type { BlockEdge, BlockPatch, BlockPlacement, EditorTransactionMeta, } from './core/transaction';
|
|
212
236
|
export type { BlockChanges } from './core/changes';
|
|
213
|
-
export type { CommentAnchor, CommentRange } from './core/comments';
|
|
237
|
+
export type { BlockCommentAnchor, BlockCommentsSpec, CommentAnchor, CommentRange, } from './core/comments';
|
|
214
238
|
export { editorLocales, useEditorMessages } from './locale';
|
|
215
239
|
export type { EditorMessages, EditorMessagesOverride } from './locale';
|
|
216
240
|
export { filterOptions } from './catalog';
|
|
217
241
|
export { defineEditorExtension, labelOf } from './core/extension';
|
|
218
|
-
export type { BlockOption, CommentsProvider, EditorExtension, EditorExtensionContext, FormatOption, HistoryProvider, Label, MountComponent, ResolvedEditorExtensions, } from './core/extension';
|
|
219
|
-
export { align, callout, codeBlock, colors, divider, formatting, heading, link, lists, paragraph, quote, editorKit, table, toggle, } from './extensions/editor-kit';
|
|
242
|
+
export type { BlockOption, BlockOptionChoice, BlockOptionChoices, BlockOptionChoicesEmits, BlockOptionChoicesProps, CommentsProvider, EditorExtension, EditorExtensionContext, FormatOption, HistoryProvider, Label, MountComponent, ResolvedEditorExtensions, } from './core/extension';
|
|
243
|
+
export { align, callout, codeBlock, colors, columns, divider, formatting, heading, link, lists, paragraph, quote, editorKit, table, toggle, } from './extensions/editor-kit';
|
|
220
244
|
export type { CalloutTone } from './extensions/callout';
|
|
221
245
|
export { setHighlight, setTextColor, textColors } from './extensions/colors';
|
|
222
246
|
export type { TextColor } from './extensions/colors';
|
|
@@ -253,7 +277,8 @@ export { contentDOM, createSchema, isSafeHref, textBlock } from './core/schema';
|
|
|
253
277
|
export { duplicateBlocks, insertBlockAfter, liftBlocks, swapBlocks, moveRangeTo, setBlockType, sinkBlocks, } from './core/commands';
|
|
254
278
|
export { clearBlockSelection, getBlockSelection, selectBlocks } from './core/block-selection';
|
|
255
279
|
export { isRemote } from './core/plugins';
|
|
256
|
-
export { blocksToHTML, htmlToBlocks } from './core/convert';
|
|
280
|
+
export { blocksToHTML, htmlToBlocks, type HTMLToBlocksOptions } from './core/convert';
|
|
281
|
+
export type { DOMParserLike } from './core/prepare';
|
|
257
282
|
export type { EditorExtensionList } from './core/convert';
|
|
258
283
|
export { escapeHTML, escapeMarkdown, indentLines } from './core/output';
|
|
259
284
|
export type { BlockOutput, BlockOutputContext, EditorExtensionOutput, InlineOutput, MarkdownBlockContext, MarkOutput, } from './core/output';
|
package/dist/types/locale.d.ts
CHANGED
|
@@ -19,8 +19,10 @@ export interface EditorMessages {
|
|
|
19
19
|
toggle: string;
|
|
20
20
|
callout: string;
|
|
21
21
|
table: string;
|
|
22
|
+
columns: string;
|
|
22
23
|
attachment: string;
|
|
23
24
|
embed: string;
|
|
25
|
+
whiteboard: string;
|
|
24
26
|
};
|
|
25
27
|
/** Short descriptions in the slash menu. */
|
|
26
28
|
hints: {
|
|
@@ -38,8 +40,10 @@ export interface EditorMessages {
|
|
|
38
40
|
toggle: string;
|
|
39
41
|
callout: string;
|
|
40
42
|
table: string;
|
|
43
|
+
columns: string;
|
|
41
44
|
attachment: string;
|
|
42
45
|
embed: string;
|
|
46
|
+
whiteboard: string;
|
|
43
47
|
};
|
|
44
48
|
/** The image block. */
|
|
45
49
|
image: {
|
|
@@ -103,6 +107,21 @@ export interface EditorMessages {
|
|
|
103
107
|
addRow: string;
|
|
104
108
|
addColumn: string;
|
|
105
109
|
};
|
|
110
|
+
/** Columns: the picker in the slash menu, the block menu entry, the resize bar. */
|
|
111
|
+
columns: {
|
|
112
|
+
/** The title of the picker for the number of columns. */
|
|
113
|
+
pick: string;
|
|
114
|
+
/** A number of columns; `{count}` is replaced with it. */
|
|
115
|
+
count: string;
|
|
116
|
+
/** Selects the whole set of columns a block is in. */
|
|
117
|
+
select: string;
|
|
118
|
+
/** The bar between two columns. */
|
|
119
|
+
resize: string;
|
|
120
|
+
/** Makes every column of the set as wide as the others. */
|
|
121
|
+
even: string;
|
|
122
|
+
/** A column, for screen readers; `{index}` and `{count}` are replaced. */
|
|
123
|
+
column: string;
|
|
124
|
+
};
|
|
106
125
|
/** The color menu of the formatting toolbar. */
|
|
107
126
|
colors: {
|
|
108
127
|
label: string;
|
|
@@ -148,6 +167,21 @@ export interface EditorMessages {
|
|
|
148
167
|
edit: string;
|
|
149
168
|
cancel: string;
|
|
150
169
|
};
|
|
170
|
+
/** Blocks holding a whiteboard or a flow (`@dou-ui/editor/flow`). */
|
|
171
|
+
board: {
|
|
172
|
+
empty: string;
|
|
173
|
+
start: string;
|
|
174
|
+
edit: string;
|
|
175
|
+
view: string;
|
|
176
|
+
resize: string;
|
|
177
|
+
/** The button that adds a node to a flow, and the name of the node a flow block offers. */
|
|
178
|
+
addNode: string;
|
|
179
|
+
searchNodes: string;
|
|
180
|
+
noNodes: string;
|
|
181
|
+
node: string;
|
|
182
|
+
/** On an empty flow in the fullscreen editor. */
|
|
183
|
+
emptyFlow: string;
|
|
184
|
+
};
|
|
151
185
|
noResults: string;
|
|
152
186
|
addBlock: string;
|
|
153
187
|
dragHandle: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type EditorExtensionList } from '../core/convert';
|
|
2
2
|
import type { Block, PartialBlock } from '../core/model';
|
|
3
|
+
import { type DOMParserLike } from '../core/prepare';
|
|
4
|
+
export type { DOMParserLike };
|
|
3
5
|
export interface MarkdownToBlocksOptions {
|
|
4
6
|
/**
|
|
5
7
|
* Turns Markdown into HTML. Defaults to markdown-it with HTML allowed
|
|
@@ -7,8 +9,13 @@ export interface MarkdownToBlocksOptions {
|
|
|
7
9
|
* is kept); pass your own to add syntax.
|
|
8
10
|
*/
|
|
9
11
|
render?: (markdown: string) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the HTML. Defaults to the global `DOMParser`; where there is none
|
|
14
|
+
* (Node, Bun), pass one from a DOM library such as happy-dom or linkedom.
|
|
15
|
+
*/
|
|
16
|
+
domParser?: DOMParserLike;
|
|
10
17
|
}
|
|
11
18
|
/** Write blocks as Markdown (CommonMark with GitHub's extensions). Works without a browser. */
|
|
12
19
|
export declare function blocksToMarkdown(blocks: PartialBlock[], extensions: EditorExtensionList): string;
|
|
13
|
-
/** Read Markdown as blocks. Needs `DOMParser
|
|
20
|
+
/** Read Markdown as blocks. Needs a `DOMParser`: the browser's, or `options.domParser`. */
|
|
14
21
|
export declare function markdownToBlocks(markdown: string, extensions: EditorExtensionList, options?: MarkdownToBlocksOptions): Block[];
|
package/dist/use-comments.js
CHANGED
|
@@ -83,9 +83,9 @@ function useEditorComments(options) {
|
|
|
83
83
|
if (current && pending.value) setPendingComment(current, null);
|
|
84
84
|
open(null);
|
|
85
85
|
}
|
|
86
|
-
function apply(action) {
|
|
86
|
+
function apply(action, how = {}) {
|
|
87
87
|
const current = view.value;
|
|
88
|
-
if (action.type === "create") {
|
|
88
|
+
if (action.type === "create" && !how.anchored) {
|
|
89
89
|
const range = pending.value;
|
|
90
90
|
if (!current || !range) return;
|
|
91
91
|
anchorComment(current, range, action.thread.id);
|
package/dist/use-comments.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-comments.js","names":[],"sources":["../src/use-comments.ts"],"sourcesContent":["import { applyCommentAction, type CommentAction, type CommentThread } from 'dou-ui'\nimport { TextSelection, type EditorState } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport { computed, shallowRef, watch, type ShallowRef } from 'vue'\nimport {\n anchorComment,\n commentAnchors,\n commentsAt,\n commentPlugin,\n setPendingComment,\n unanchorComment,\n type CommentAnchor,\n type CommentRange,\n} from './core/comments'\nimport type { CommentsProvider } from './core/extension'\nimport type { EditorComments, EditorEmits, EditorProps } from './editor'\n\ntype Emit = <K extends keyof EditorEmits>(event: K, ...args: EditorEmits[K]) => void\n\n/** The selected text in a read-only editor, which keeps no selection of its own. */\nfunction domSelection(view: EditorView): CommentRange | null {\n const selection = view.dom.ownerDocument.getSelection()\n if (!selection || selection.isCollapsed || !selection.rangeCount) return null\n const range = selection.getRangeAt(0)\n if (!view.dom.contains(range.startContainer) || !view.dom.contains(range.endContainer))\n return null\n try {\n const from = view.posAtDOM(range.startContainer, range.startOffset)\n const to = view.posAtDOM(range.endContainer, range.endOffset)\n return to > from ? { from, to } : null\n } catch {\n return null\n }\n}\n\n/** Whether a range holds text a thread can be about: not only a divider, not in code. */\nfunction hasText(state: EditorState, range: CommentRange) {\n let text = false\n state.doc.nodesBetween(range.from, range.to, (node) => {\n if (text) return false\n if (!node.isTextblock) return true\n text = !node.type.spec.code && node.content.size > 0\n return false\n })\n return text\n}\n\nexport function useEditorComments(options: {\n props: EditorProps\n emit: Emit\n view: ShallowRef<EditorView | null>\n provider: CommentsProvider | null\n}) {\n const { props, emit, view, provider } = options\n\n const threads = computed<readonly CommentThread[]>(\n () => provider?.threads.value ?? props.comments ?? [],\n )\n const enabled = computed(() => !!provider || props.comments !== undefined)\n const writable = computed(() => enabled.value && !!props.author && props.commentable !== false)\n const known = computed(() => new Set(threads.value.map((thread) => thread.id)))\n\n // the shared document's threads, mirrored to `v-model:comments`\n if (provider)\n watch(provider.threads, (value) => emit('update:comments', [...value]), { immediate: true })\n\n const innerActive = shallowRef<string | null>(null)\n const active = computed(() =>\n props.activeComment === undefined ? innerActive.value : props.activeComment,\n )\n function open(id: string | null) {\n if (id === active.value) return\n innerActive.value = id\n emit('update:activeComment', id)\n }\n\n const pending = shallowRef<CommentRange | null>(null)\n\n function selection(): CommentRange | null {\n const current = view.value\n if (!current) return null\n const range = current.editable\n ? current.state.selection instanceof TextSelection && !current.state.selection.empty\n ? { from: current.state.selection.from, to: current.state.selection.to }\n : null\n : domSelection(current)\n return range && hasText(current.state, range) ? range : null\n }\n\n const focusRequest = shallowRef(0)\n\n /** The open thread the cursor is in, innermost first. */\n function threadAtCursor(): string | null {\n const current = view.value\n if (!current) return null\n const ids = commentsAt(current.state, current.state.selection.from)\n return ids.find((id) => isOpen(id)) ?? null\n }\n\n function start(): boolean {\n const current = view.value\n if (!current || !enabled.value) return false\n const range = selection()\n if (!range) {\n // on commented text: open its thread, ready to reply\n const id = threadAtCursor()\n if (!id) return false\n open(id)\n focusRequest.value++\n return true\n }\n if (!writable.value) return false\n open(null)\n setPendingComment(current, range)\n return true\n }\n\n function close() {\n const current = view.value\n if (current && pending.value) setPendingComment(current, null)\n open(null)\n }\n\n function apply(action: CommentAction) {\n const current = view.value\n if (action.type === 'create') {\n const range = pending.value\n if (!current || !range) return\n anchorComment(current, range, action.thread.id)\n } else if (current && action.type === 'remove') unanchorComment(current, action.threadId)\n if (provider) provider.apply(action)\n else emit('update:comments', applyCommentAction(threads.value, action))\n emit('commentAction', action)\n if (action.type === 'create') {\n open(action.thread.id)\n focusRequest.value++\n } else if (action.type === 'remove' || action.type === 'resolve') open(null)\n }\n\n const isOpen = (id: string) => {\n const thread = threads.value.find((item) => item.id === id)\n return !!thread && !thread.resolved\n }\n\n const plugin = commentPlugin({\n known: () => (enabled.value ? known.value : null),\n onClick: (ids) => {\n if (pending.value && view.value) setPendingComment(view.value, null)\n open(ids.find(isOpen) ?? null)\n },\n // selecting other text (the formatting toolbar shows) closes an open thread\n onSelect: () => {\n if (!pending.value) open(null)\n },\n onPending: (range) => (pending.value = range),\n })\n\n function anchors(): Record<string, CommentAnchor | null> {\n const found = view.value ? commentAnchors(view.value.state.doc) : new Map()\n return Object.fromEntries(\n threads.value.map((thread) => [thread.id, found.get(thread.id) ?? null]),\n )\n }\n\n const comments: EditorComments = {\n enabled,\n writable,\n threads,\n author: computed(() => props.author),\n active,\n pending,\n focusRequest,\n selection,\n start,\n apply,\n open,\n close,\n }\n\n return { comments, plugin, anchors }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,aAAa,MAAuC;CAC3D,MAAM,YAAY,KAAK,IAAI,cAAc,aAAa;CACtD,IAAI,CAAC,aAAa,UAAU,eAAe,CAAC,UAAU,YAAY,OAAO;CACzE,MAAM,QAAQ,UAAU,WAAW,CAAC;CACpC,IAAI,CAAC,KAAK,IAAI,SAAS,MAAM,cAAc,KAAK,CAAC,KAAK,IAAI,SAAS,MAAM,YAAY,GACnF,OAAO;CACT,IAAI;EACF,MAAM,OA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AAC,SAAS,OAAO;EACrB,MAAM,QAAQ,QAAQ,WAClB,QAAQ,MAAM,qBAAqB,iBAAiB,CAAC,QAAQ,MAAM,UAAU,QAC3E;GAAE,MAAM,QAAQ,MAAM,UAAU;GAAM,IAAI,QAAQ,MAAM,UAAU;EAAG,IACrE,OACF,aAAa,OAAO;EACxB,OAAO,SAAS,QAAQ,QAAQ,OAAO,KAAK,IAAI,QAAQ;CAC1D;CAEA,MAAM,eAAe,WAAW,CAAC;;CAGjC,SAAS,iBAAgC;EACvC,MAAM,UAAU,KAAK;EACrB,IAAI,CAAC,SAAS,OAAO;EAErB,OADY,WAAW,QAAQ,OAAO,QAAQ,MAAM,UAAU,IACvD,CAAA,CAAI,MAAM,OAAO,OAAO,EAAE,CAAC,KAAK;CACzC;CAEA,SAAS,QAAiB;EACxB,MAAM,UAAU,KAAK;EACrB,IAAI,CAAC,WAAW,CAAC,QAAQ,OAAO,OAAO;EACvC,MAAM,QAAQ,UAAU;EACxB,IAAI,CAAC,OAAO;GAEV,MAAM,KAAK,eAAe;GAC1B,IAAI,CAAC,IAAI,OAAO;GAChB,KAAK,EAAE;GACP,aAAa;GACb,OAAO;EACT;EACA,IAAI,CAAC,SAAS,OAAO,OAAO;EAC5B,KAAK,IAAI;EACT,kBAAkB,SAAS,KAAK;EAChC,OAAO;CACT;CAEA,SAAS,QAAQ;EACf,MAAM,UAAU,KAAK;EACrB,IAAI,WAAW,QAAQ,OAAO,kBAAkB,SAAS,IAAI;EAC7D,KAAK,IAAI;CACX;CAEA,SAAS,MAAM,QAAuB;
|
|
1
|
+
{"version":3,"file":"use-comments.js","names":[],"sources":["../src/use-comments.ts"],"sourcesContent":["import { applyCommentAction, type CommentAction, type CommentThread } from 'dou-ui'\nimport { TextSelection, type EditorState } from 'prosemirror-state'\nimport type { EditorView } from 'prosemirror-view'\nimport { computed, shallowRef, watch, type ShallowRef } from 'vue'\nimport {\n anchorComment,\n commentAnchors,\n commentsAt,\n commentPlugin,\n setPendingComment,\n unanchorComment,\n type CommentAnchor,\n type CommentRange,\n} from './core/comments'\nimport type { CommentsProvider } from './core/extension'\nimport type { EditorComments, EditorEmits, EditorProps } from './editor'\n\ntype Emit = <K extends keyof EditorEmits>(event: K, ...args: EditorEmits[K]) => void\n\n/** The selected text in a read-only editor, which keeps no selection of its own. */\nfunction domSelection(view: EditorView): CommentRange | null {\n const selection = view.dom.ownerDocument.getSelection()\n if (!selection || selection.isCollapsed || !selection.rangeCount) return null\n const range = selection.getRangeAt(0)\n if (!view.dom.contains(range.startContainer) || !view.dom.contains(range.endContainer))\n return null\n try {\n const from = view.posAtDOM(range.startContainer, range.startOffset)\n const to = view.posAtDOM(range.endContainer, range.endOffset)\n return to > from ? { from, to } : null\n } catch {\n return null\n }\n}\n\n/** Whether a range holds text a thread can be about: not only a divider, not in code. */\nfunction hasText(state: EditorState, range: CommentRange) {\n let text = false\n state.doc.nodesBetween(range.from, range.to, (node) => {\n if (text) return false\n if (!node.isTextblock) return true\n text = !node.type.spec.code && node.content.size > 0\n return false\n })\n return text\n}\n\nexport function useEditorComments(options: {\n props: EditorProps\n emit: Emit\n view: ShallowRef<EditorView | null>\n provider: CommentsProvider | null\n}) {\n const { props, emit, view, provider } = options\n\n const threads = computed<readonly CommentThread[]>(\n () => provider?.threads.value ?? props.comments ?? [],\n )\n const enabled = computed(() => !!provider || props.comments !== undefined)\n const writable = computed(() => enabled.value && !!props.author && props.commentable !== false)\n const known = computed(() => new Set(threads.value.map((thread) => thread.id)))\n\n // the shared document's threads, mirrored to `v-model:comments`\n if (provider)\n watch(provider.threads, (value) => emit('update:comments', [...value]), { immediate: true })\n\n const innerActive = shallowRef<string | null>(null)\n const active = computed(() =>\n props.activeComment === undefined ? innerActive.value : props.activeComment,\n )\n function open(id: string | null) {\n if (id === active.value) return\n innerActive.value = id\n emit('update:activeComment', id)\n }\n\n const pending = shallowRef<CommentRange | null>(null)\n\n function selection(): CommentRange | null {\n const current = view.value\n if (!current) return null\n const range = current.editable\n ? current.state.selection instanceof TextSelection && !current.state.selection.empty\n ? { from: current.state.selection.from, to: current.state.selection.to }\n : null\n : domSelection(current)\n return range && hasText(current.state, range) ? range : null\n }\n\n const focusRequest = shallowRef(0)\n\n /** The open thread the cursor is in, innermost first. */\n function threadAtCursor(): string | null {\n const current = view.value\n if (!current) return null\n const ids = commentsAt(current.state, current.state.selection.from)\n return ids.find((id) => isOpen(id)) ?? null\n }\n\n function start(): boolean {\n const current = view.value\n if (!current || !enabled.value) return false\n const range = selection()\n if (!range) {\n // on commented text: open its thread, ready to reply\n const id = threadAtCursor()\n if (!id) return false\n open(id)\n focusRequest.value++\n return true\n }\n if (!writable.value) return false\n open(null)\n setPendingComment(current, range)\n return true\n }\n\n function close() {\n const current = view.value\n if (current && pending.value) setPendingComment(current, null)\n open(null)\n }\n\n function apply(action: CommentAction, how: { anchored?: boolean } = {}) {\n const current = view.value\n if (action.type === 'create' && !how.anchored) {\n const range = pending.value\n if (!current || !range) return\n anchorComment(current, range, action.thread.id)\n } else if (current && action.type === 'remove') unanchorComment(current, action.threadId)\n if (provider) provider.apply(action)\n else emit('update:comments', applyCommentAction(threads.value, action))\n emit('commentAction', action)\n if (action.type === 'create') {\n open(action.thread.id)\n focusRequest.value++\n } else if (action.type === 'remove' || action.type === 'resolve') open(null)\n }\n\n const isOpen = (id: string) => {\n const thread = threads.value.find((item) => item.id === id)\n return !!thread && !thread.resolved\n }\n\n const plugin = commentPlugin({\n known: () => (enabled.value ? known.value : null),\n onClick: (ids) => {\n if (pending.value && view.value) setPendingComment(view.value, null)\n open(ids.find(isOpen) ?? null)\n },\n // selecting other text (the formatting toolbar shows) closes an open thread\n onSelect: () => {\n if (!pending.value) open(null)\n },\n onPending: (range) => (pending.value = range),\n })\n\n function anchors(): Record<string, CommentAnchor | null> {\n const found = view.value ? commentAnchors(view.value.state.doc) : new Map()\n return Object.fromEntries(\n threads.value.map((thread) => [thread.id, found.get(thread.id) ?? null]),\n )\n }\n\n const comments: EditorComments = {\n enabled,\n writable,\n threads,\n author: computed(() => props.author),\n active,\n pending,\n focusRequest,\n selection,\n start,\n apply,\n open,\n close,\n }\n\n return { comments, plugin, anchors }\n}\n"],"mappings":";;;;;;AAoBA,SAAS,aAAa,MAAuC;CAC3D,MAAM,YAAY,KAAK,IAAI,cAAc,aAAa;CACtD,IAAI,CAAC,aAAa,UAAU,eAAe,CAAC,UAAU,YAAY,OAAO;CACzE,MAAM,QAAQ,UAAU,WAAW,CAAC;CACpC,IAAI,CAAC,KAAK,IAAI,SAAS,MAAM,cAAc,KAAK,CAAC,KAAK,IAAI,SAAS,MAAM,YAAY,GACnF,OAAO;CACT,IAAI;EACF,MAAM,OAAO,KAAK,SAAS,MAAM,gBAAgB,MAAM,WAAW;EAClE,MAAM,KAAK,KAAK,SAAS,MAAM,cAAc,MAAM,SAAS;EAC5D,OAAO,KAAK,OAAO;GAAE;GAAM;EAAG,IAAI;CACpC,QAAQ;EACN,OAAO;CACT;AACF;;AAGA,SAAS,QAAQ,OAAoB,OAAqB;CACxD,IAAI,OAAO;CACX,MAAM,IAAI,aAAa,MAAM,MAAM,MAAM,KAAK,SAAS;EACrD,IAAI,MAAM,OAAO;EACjB,IAAI,CAAC,KAAK,aAAa,OAAO;EAC9B,OAAO,CAAC,KAAK,KAAK,KAAK,QAAQ,KAAK,QAAQ,OAAO;EACnD,OAAO;CACT,CAAC;CACD,OAAO;AACT;AAEA,SAAgB,kBAAkB,SAK/B;CACD,MAAM,EAAE,OAAO,MAAM,MAAM,aAAa;CAExC,MAAM,UAAU,eACR,UAAU,QAAQ,SAAS,MAAM,YAAY,CAAC,CACtD;CACA,MAAM,UAAU,eAAe,CAAC,CAAC,YAAY,MAAM,aAAa,KAAA,CAAS;CACzE,MAAM,WAAW,eAAe,QAAQ,SAAS,CAAC,CAAC,MAAM,UAAU,MAAM,gBAAgB,KAAK;CAC9F,MAAM,QAAQ,eAAe,IAAI,IAAI,QAAQ,MAAM,KAAK,WAAW,OAAO,EAAE,CAAC,CAAC;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AO,OAAO,YACZ,QAAQ,MAAM,KAAK,WAAW,CAAC,OAAO,IAAI,MAAM,IAAI,OAAO,EAAE,KAAK,IAAI,CAAC,CACzE;CACF;CAiBA,OAAO;EAAE,UAAA;GAdP;GACA;GACA;GACA,QAAQ,eAAe,MAAM,MAAM;GACnC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EAGO;EAAU;EAAQ;CAAQ;AACrC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dou-ui/editor",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.21",
|
|
4
4
|
"description": "DouUI 的块编辑器:基于 ProseMirror,文档由可拖动、可转换的块组成",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vue",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"types": "./dist/types/code/index.d.ts",
|
|
41
41
|
"import": "./dist/code/index.js"
|
|
42
42
|
},
|
|
43
|
+
"./flow": {
|
|
44
|
+
"types": "./dist/types/flow/index.d.ts",
|
|
45
|
+
"import": "./dist/flow/index.js"
|
|
46
|
+
},
|
|
43
47
|
"./markdown": {
|
|
44
48
|
"types": "./dist/types/markdown/index.d.ts",
|
|
45
49
|
"import": "./dist/markdown/index.js"
|
|
@@ -58,8 +62,9 @@
|
|
|
58
62
|
"build": "vite build && vue-tsc -p tsconfig.build.json && bun scripts/build-style.ts"
|
|
59
63
|
},
|
|
60
64
|
"peerDependencies": {
|
|
61
|
-
"@dou-ui/code": "0.1.0-alpha.
|
|
62
|
-
"dou-ui": "0.1.0-alpha.
|
|
65
|
+
"@dou-ui/code": "0.1.0-alpha.21",
|
|
66
|
+
"@dou-ui/flow": "0.1.0-alpha.21",
|
|
67
|
+
"dou-ui": "0.1.0-alpha.21",
|
|
63
68
|
"vue": "^3.5.0",
|
|
64
69
|
"yjs": "^13.6.0",
|
|
65
70
|
"markdown-it": "^14.0.0"
|
|
@@ -68,6 +73,9 @@
|
|
|
68
73
|
"@dou-ui/code": {
|
|
69
74
|
"optional": true
|
|
70
75
|
},
|
|
76
|
+
"@dou-ui/flow": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
71
79
|
"yjs": {
|
|
72
80
|
"optional": true
|
|
73
81
|
},
|
|
@@ -76,7 +84,7 @@
|
|
|
76
84
|
}
|
|
77
85
|
},
|
|
78
86
|
"dependencies": {
|
|
79
|
-
"@dou-ui/icons": "0.1.0-alpha.
|
|
87
|
+
"@dou-ui/icons": "0.1.0-alpha.21",
|
|
80
88
|
"prosemirror-commands": "^1.7.2",
|
|
81
89
|
"prosemirror-history": "^1.5.1",
|
|
82
90
|
"prosemirror-inputrules": "^1.5.1",
|
|
@@ -91,7 +99,8 @@
|
|
|
91
99
|
"access": "public"
|
|
92
100
|
},
|
|
93
101
|
"devDependencies": {
|
|
94
|
-
"@dou-ui/code": "0.1.0-alpha.
|
|
102
|
+
"@dou-ui/code": "0.1.0-alpha.21",
|
|
103
|
+
"@dou-ui/flow": "0.1.0-alpha.21",
|
|
95
104
|
"@types/markdown-it": "^14.1.2",
|
|
96
105
|
"markdown-it": "^14.1.0",
|
|
97
106
|
"y-protocols": "^1.0.7",
|