@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
|
@@ -7,7 +7,10 @@ import type { ContentType } from './schema';
|
|
|
7
7
|
* Turn every block the selection touches into `type`. Text formatting is
|
|
8
8
|
* dropped when it can't be kept (in a code block); a type without text
|
|
9
9
|
* (a divider, an embed) replaces the content and adds an empty paragraph
|
|
10
|
-
* after it to keep typing in.
|
|
10
|
+
* after it to keep typing in. A type that starts with children of its own
|
|
11
|
+
* (`template` in its spec, e.g. columns) is added after the blocks instead,
|
|
12
|
+
* or takes the place of an empty paragraph; blocks that lay out others
|
|
13
|
+
* (columns) are left as they are.
|
|
11
14
|
*/
|
|
12
15
|
export declare function setBlockType(type: ContentType, props?: BlockProps): Command;
|
|
13
16
|
/** Set attributes on the content of the block at `pos`, e.g. tick a to-do. */
|
|
@@ -41,7 +44,11 @@ export declare const sinkBlocks: Command;
|
|
|
41
44
|
* so nothing changes order.
|
|
42
45
|
*/
|
|
43
46
|
export declare const liftBlocks: Command;
|
|
44
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* `Mod+Shift+↑/↓`: swap the selected blocks with their neighbour. At the
|
|
49
|
+
* top or bottom of a column, the blocks move out of the set of columns,
|
|
50
|
+
* above or below it.
|
|
51
|
+
*/
|
|
45
52
|
export declare function swapBlocks(direction: -1 | 1): Command;
|
|
46
53
|
/**
|
|
47
54
|
* Drag and drop: move the blocks of `range` to `target`, a position right
|
|
@@ -49,6 +56,14 @@ export declare function swapBlocks(direction: -1 | 1): Command;
|
|
|
49
56
|
* target is inside the moved blocks. The cursor goes to the first one.
|
|
50
57
|
*/
|
|
51
58
|
export declare function moveRangeTo(range: SiblingRange, target: number): Command;
|
|
59
|
+
/**
|
|
60
|
+
* Drag and drop beside a column: move the blocks of `range` into a new
|
|
61
|
+
* column of the row at `rowPos`, before its column `index` (or after the
|
|
62
|
+
* last). The new column is as wide as the others on average. A column the
|
|
63
|
+
* blocks leave empty goes away. Fails when the row is among the moved
|
|
64
|
+
* blocks or already has as many columns as it may (`maxColumns`).
|
|
65
|
+
*/
|
|
66
|
+
export declare function moveRangeToNewColumn(range: SiblingRange, rowPos: number, index: number): Command;
|
|
52
67
|
/** Remove blocks, keeping at least one empty paragraph in the document. */
|
|
53
68
|
export declare function deleteBlocks(tr: Transaction, blocks: BlockInfo[]): Transaction;
|
|
54
69
|
/** Copies of blocks with fresh ids (the id plugin assigns them). */
|
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
import { type Node as PMNode } from 'prosemirror-model';
|
|
2
2
|
import { Plugin, PluginKey, type EditorState } from 'prosemirror-state';
|
|
3
3
|
import { DecorationSet, type EditorView } from 'prosemirror-view';
|
|
4
|
+
import type { BlockProps } from './model';
|
|
5
|
+
/** Where a thread is inside a block: what to show for it, and the block's own description of the spot. */
|
|
6
|
+
export interface BlockCommentAnchor<Target = unknown> {
|
|
7
|
+
/** The text of what the thread is about, e.g. a node's label; `''` when it has none. */
|
|
8
|
+
text: string;
|
|
9
|
+
/** Where in the block, as the block describes it, e.g. `{ node: 'n1' }`. */
|
|
10
|
+
target: Target;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* How a block type keeps comment threads on what is inside it, in its
|
|
14
|
+
* props: the `comments` field of its spec. The block's component starts
|
|
15
|
+
* and shows those threads itself (see `useEditor().comments`); the editor
|
|
16
|
+
* lists them in `getCommentAnchors()`, leaves them out of pasted copies,
|
|
17
|
+
* and puts them back after undo and redo, which restore older props.
|
|
18
|
+
*/
|
|
19
|
+
export interface BlockCommentsSpec<Target = unknown> {
|
|
20
|
+
/** The threads in the block, by id. */
|
|
21
|
+
anchors: (props: BlockProps) => Record<string, BlockCommentAnchor<Target>>;
|
|
22
|
+
/** The props with thread `id` on `target`; `null` when that isn't in the block any more. */
|
|
23
|
+
place: (props: BlockProps, id: string, target: Target) => BlockProps | null;
|
|
24
|
+
/** The props with only the threads `keep` says yes to. */
|
|
25
|
+
strip: (props: BlockProps, keep: (id: string) => boolean) => BlockProps;
|
|
26
|
+
}
|
|
27
|
+
declare module 'prosemirror-model' {
|
|
28
|
+
interface NodeSpec {
|
|
29
|
+
/** Comment threads kept inside the block's props, see `BlockCommentsSpec`. */
|
|
30
|
+
comments?: BlockCommentsSpec<any>;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** The `comments` of a node's spec: a block type that keeps threads inside. */
|
|
34
|
+
export declare const blockCommentsOf: (node: PMNode) => BlockCommentsSpec | undefined;
|
|
4
35
|
/** A range of the document, as positions. */
|
|
5
36
|
export interface CommentRange {
|
|
6
37
|
from: number;
|
|
@@ -8,12 +39,17 @@ export interface CommentRange {
|
|
|
8
39
|
}
|
|
9
40
|
/** Where a thread is anchored: the block and the text it is about. */
|
|
10
41
|
export interface CommentAnchor {
|
|
11
|
-
/** The id of the (first) block holding the text. */
|
|
42
|
+
/** The id of the (first) block holding the text, or of the block the thread is inside. */
|
|
12
43
|
block: string;
|
|
13
|
-
/** The text the thread is about. */
|
|
44
|
+
/** The text the thread is about; inside a block, what the block shows for it (e.g. a node's label). */
|
|
14
45
|
text: string;
|
|
46
|
+
/** The text's first and last positions; inside a block, the block's. */
|
|
15
47
|
from: number;
|
|
16
48
|
to: number;
|
|
49
|
+
/** Inside a block: the block's type. */
|
|
50
|
+
type?: string;
|
|
51
|
+
/** Inside a block: where, as the block describes it (e.g. `{ node: 'n1' }` on a whiteboard). */
|
|
52
|
+
target?: unknown;
|
|
17
53
|
}
|
|
18
54
|
export interface CommentPluginState {
|
|
19
55
|
/** The text a thread is being started on, until its first comment is sent. */
|
|
@@ -38,7 +74,7 @@ export declare function commentAnchors(doc: PMNode): Map<string, CommentAnchor>;
|
|
|
38
74
|
export declare function commentRange(doc: PMNode, id: string): CommentRange | null;
|
|
39
75
|
/** Marks `range` as the text of a new thread. Not undone with the edits around it. */
|
|
40
76
|
export declare function anchorComment(view: EditorView, range: CommentRange, id: string): void;
|
|
41
|
-
/** Takes a removed thread's anchor off the text. */
|
|
77
|
+
/** Takes a removed thread's anchor off the text, or out of the block it is inside. */
|
|
42
78
|
export declare function unanchorComment(view: EditorView, id: string): void;
|
|
43
79
|
export declare function setPendingComment(view: EditorView, range: CommentRange | null): void;
|
|
44
80
|
export declare function commentPlugin(options: CommentPluginOptions): Plugin<CommentPluginState>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type EditorExtension, type ResolvedEditorExtensions } from './extension';
|
|
2
2
|
import type { Block, PartialBlock } from './model';
|
|
3
|
+
import { type DOMParserLike } from './prepare';
|
|
3
4
|
export type EditorExtensionList = readonly (EditorExtension | EditorExtension[])[];
|
|
4
5
|
/** Resolve a list of extensions once; the same array gives the same result. */
|
|
5
6
|
export declare function kitOf(extensions: EditorExtensionList): ResolvedEditorExtensions;
|
|
@@ -8,5 +9,12 @@ export declare function kitOf(extensions: EditorExtensionList): ResolvedEditorEx
|
|
|
8
9
|
* outside the editor. Works without a browser.
|
|
9
10
|
*/
|
|
10
11
|
export declare function blocksToHTML(blocks: PartialBlock[], extensions: EditorExtensionList): string;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
export interface HTMLToBlocksOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Reads the HTML. Defaults to the global `DOMParser`; where there is none
|
|
15
|
+
* (Node, Bun), pass one from a DOM library such as happy-dom or linkedom.
|
|
16
|
+
*/
|
|
17
|
+
domParser?: DOMParserLike;
|
|
18
|
+
}
|
|
19
|
+
/** Read HTML as blocks with the given extensions. Needs a `DOMParser`: the browser's, or `options.domParser`. */
|
|
20
|
+
export declare function htmlToBlocks(html: string, extensions: EditorExtensionList, options?: HTMLToBlocksOptions): Block[];
|
|
@@ -4,7 +4,7 @@ import type { Command, Plugin } from 'prosemirror-state';
|
|
|
4
4
|
import type { NodeViewConstructor } from 'prosemirror-view';
|
|
5
5
|
import { type CommentAction, type CommentThread } from 'dou-ui';
|
|
6
6
|
import type { Component, Ref } from 'vue';
|
|
7
|
-
import type
|
|
7
|
+
import { type EditorMessages } from '../locale';
|
|
8
8
|
import type { BlockProps } from './model';
|
|
9
9
|
import type { EditorExtensionOutput } from './output';
|
|
10
10
|
/** Text shown in a menu: fixed, or read from the editor's messages so it follows the locale. */
|
|
@@ -25,6 +25,51 @@ export interface BlockOption {
|
|
|
25
25
|
keywords?: string[];
|
|
26
26
|
/** The Markdown shortcut, shown as a hint. */
|
|
27
27
|
shortcut?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Variants to pick from in a panel beside the option in the slash menu,
|
|
30
|
+
* e.g. how many columns. Choosing the option itself inserts the first.
|
|
31
|
+
*/
|
|
32
|
+
choices?: BlockOptionChoices;
|
|
33
|
+
}
|
|
34
|
+
/** One variant of a slash menu option. */
|
|
35
|
+
export interface BlockOptionChoice {
|
|
36
|
+
/** The props it inserts with, over the option's own. */
|
|
37
|
+
props: BlockProps;
|
|
38
|
+
/** Its name, also read out by screen readers. */
|
|
39
|
+
label: Label;
|
|
40
|
+
}
|
|
41
|
+
/** The variants of a slash menu option, picked in a panel beside it. */
|
|
42
|
+
export interface BlockOptionChoices {
|
|
43
|
+
/** The panel's title, e.g. “Number of columns”; also the name screen readers give the panel. */
|
|
44
|
+
title: Label;
|
|
45
|
+
items: BlockOptionChoice[];
|
|
46
|
+
/**
|
|
47
|
+
* Draws the variants (the panel around them and its title are drawn by
|
|
48
|
+
* the menu). It gets the props in `BlockOptionChoicesProps` and emits
|
|
49
|
+
* `hover` and `choose` with an index, as in `BlockOptionChoicesEmits`.
|
|
50
|
+
* Without it, the panel lists their names.
|
|
51
|
+
*/
|
|
52
|
+
component?: Component<BlockOptionChoicesProps>;
|
|
53
|
+
}
|
|
54
|
+
/** What the `component` of `BlockOptionChoices` gets. */
|
|
55
|
+
export interface BlockOptionChoicesProps {
|
|
56
|
+
items: BlockOptionChoice[];
|
|
57
|
+
/** The index of the highlighted variant; -1 while the option itself is highlighted. */
|
|
58
|
+
active: number;
|
|
59
|
+
messages: EditorMessages;
|
|
60
|
+
/**
|
|
61
|
+
* For screen readers: give the element of variant `index` the id
|
|
62
|
+
* `${idPrefix}-${index}` and `role="option"` (with `aria-selected`), so
|
|
63
|
+
* the editor can point at the highlighted one.
|
|
64
|
+
*/
|
|
65
|
+
idPrefix: string;
|
|
66
|
+
}
|
|
67
|
+
/** What the `component` of `BlockOptionChoices` emits. */
|
|
68
|
+
export interface BlockOptionChoicesEmits {
|
|
69
|
+
/** The pointer is on variant `index`. */
|
|
70
|
+
hover: [index: number];
|
|
71
|
+
/** Variant `index` is picked: the menu inserts it. */
|
|
72
|
+
choose: [index: number];
|
|
28
73
|
}
|
|
29
74
|
/** A toggle in the formatting toolbar for a mark. */
|
|
30
75
|
export interface FormatOption {
|
|
@@ -43,6 +88,12 @@ export interface CommentsProvider {
|
|
|
43
88
|
}
|
|
44
89
|
export interface EditorExtensionContext {
|
|
45
90
|
schema: Schema;
|
|
91
|
+
/**
|
|
92
|
+
* The editor's messages, in its current locale, for text a plugin puts
|
|
93
|
+
* in the document's markup (e.g. a name for screen readers). Outside an
|
|
94
|
+
* editor (converting documents) the Chinese ones.
|
|
95
|
+
*/
|
|
96
|
+
messages: () => EditorMessages;
|
|
46
97
|
}
|
|
47
98
|
/** What the extension replacing the undo history provides (e.g. collaboration). */
|
|
48
99
|
export interface HistoryProvider {
|
|
@@ -61,8 +112,11 @@ export interface EditorExtension {
|
|
|
61
112
|
/**
|
|
62
113
|
* Content node specs for new block types, by type name. They join the
|
|
63
114
|
* `blockContent` group. Extra spec fields the editor reads:
|
|
64
|
-
* `continues` (Enter continues the same type, like a list)
|
|
65
|
-
* `component` (a Vue component that renders the block)
|
|
115
|
+
* `continues` (Enter continues the same type, like a list),
|
|
116
|
+
* `component` (a Vue component that renders the block) and
|
|
117
|
+
* `mergeProps` (props holding lists of `{ id }` items that collaboration
|
|
118
|
+
* merges item by item, by prop name: the fields that are such lists,
|
|
119
|
+
* e.g. `{ board: ['nodes', 'edges'] }`).
|
|
66
120
|
*/
|
|
67
121
|
blocks?: Record<string, NodeSpec>;
|
|
68
122
|
/**
|
|
@@ -164,4 +218,4 @@ export interface ResolvedEditorExtensions {
|
|
|
164
218
|
/** `mod+shift+h` → `Mod-Shift-h`, the way the ProseMirror keymap names keys. */
|
|
165
219
|
export declare function toEditorKey(hotkey: string): string;
|
|
166
220
|
/** Sort the extensions by priority, build the schema and collect what they add. */
|
|
167
|
-
export declare function resolveEditorExtensions(list: readonly (EditorExtension | EditorExtension[])[]): ResolvedEditorExtensions;
|
|
221
|
+
export declare function resolveEditorExtensions(list: readonly (EditorExtension | EditorExtension[])[], messages?: () => EditorMessages): ResolvedEditorExtensions;
|
|
@@ -152,7 +152,12 @@ export declare function inlineNodes(schema: Schema, content: PartialBlock['conte
|
|
|
152
152
|
*/
|
|
153
153
|
export declare function contentAttrs(type: NodeType, props?: BlockProps): Record<string, unknown>;
|
|
154
154
|
export declare function createContentNode(schema: Schema, type: ContentType, props?: BlockProps, content?: PartialBlock['content'], rows?: PartialTableRow[]): PMNode;
|
|
155
|
-
|
|
155
|
+
/**
|
|
156
|
+
* The block node for `block`. With `fill`, a block that starts with
|
|
157
|
+
* children of its own (`template` in its spec, e.g. columns) and is given
|
|
158
|
+
* none gets them, as when it is picked from the slash menu.
|
|
159
|
+
*/
|
|
160
|
+
export declare function nodeFromBlock(schema: Schema, block: PartialBlock, fill?: boolean): PMNode;
|
|
156
161
|
export declare function blocksToDoc(schema: Schema, blocks: PartialBlock[]): PMNode;
|
|
157
162
|
/** A development warning, once per message. */
|
|
158
163
|
export declare function warnOnce(message: string): void;
|
|
@@ -11,6 +11,15 @@ export declare function isRemote(tr: Transaction): boolean;
|
|
|
11
11
|
* over an id.
|
|
12
12
|
*/
|
|
13
13
|
export declare function idPlugin(): Plugin;
|
|
14
|
+
/**
|
|
15
|
+
* Whether a transaction may have changed which blocks there are, their
|
|
16
|
+
* types or their nesting. Typing and deleting inside one text block, marks
|
|
17
|
+
* and attributes don't; decorations that only follow the block structure
|
|
18
|
+
* then just map through the change instead of being rebuilt.
|
|
19
|
+
*/
|
|
20
|
+
export declare function changesBlockStructure(tr: Transaction): boolean;
|
|
21
|
+
/** Marks list-like blocks and the ends of their runs, for spacing. */
|
|
22
|
+
export declare function listPlugin(): Plugin;
|
|
14
23
|
export declare function numberingPlugin(): Plugin;
|
|
15
24
|
export interface PlaceholderOptions {
|
|
16
25
|
/** The hint in the empty block the cursor is in. */
|
|
@@ -17,7 +17,21 @@ export declare function splitContainer(element: Element): {
|
|
|
17
17
|
};
|
|
18
18
|
/** Run every extension's `prepareHTML` over the markup. */
|
|
19
19
|
export declare function prepareElement(root: HTMLElement, kit: ResolvedEditorExtensions): void;
|
|
20
|
-
/**
|
|
21
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Something that reads HTML like the browser's `DOMParser`, e.g. one from a
|
|
22
|
+
* DOM library such as happy-dom or linkedom. Only `parseFromString` is used,
|
|
23
|
+
* and only the `body` of what it returns.
|
|
24
|
+
*/
|
|
25
|
+
export interface DOMParserLike {
|
|
26
|
+
parseFromString(html: string, type: 'text/html'): {
|
|
27
|
+
body: unknown;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Read HTML as blocks, with the block types, inline nodes and marks of `kit`.
|
|
32
|
+
* Uses the global `DOMParser` unless given `domParser`; `name` is the
|
|
33
|
+
* function the error message tells to pass one to.
|
|
34
|
+
*/
|
|
35
|
+
export declare function parseHTML(html: string, kit: ResolvedEditorExtensions, domParser?: DOMParserLike, name?: string): Block[];
|
|
22
36
|
/** Pasted HTML goes through the extensions' `prepareHTML` too. */
|
|
23
37
|
export declare function preparePastePlugin(kit: ResolvedEditorExtensions): Plugin;
|
|
@@ -32,7 +32,7 @@ export declare function createSchema({ blocks, nodes: inner, inlines, marks }: S
|
|
|
32
32
|
/** Links may only point to web pages, mail, phone numbers or relative paths. */
|
|
33
33
|
export declare function isSafeHref(href: string): boolean;
|
|
34
34
|
/** The content types that come with `editorKit`; extensions add more. */
|
|
35
|
-
export type BuiltinContentType = 'paragraph' | 'heading' | 'bulletItem' | 'numberedItem' | 'checkItem' | 'quote' | 'codeBlock' | 'divider' | 'toggle' | 'callout' | 'table';
|
|
35
|
+
export type BuiltinContentType = 'paragraph' | 'heading' | 'bulletItem' | 'numberedItem' | 'checkItem' | 'quote' | 'codeBlock' | 'divider' | 'toggle' | 'callout' | 'table' | 'columns' | 'column';
|
|
36
36
|
export type ContentType = BuiltinContentType | (string & {});
|
|
37
37
|
export type BuiltinMarkType = 'bold' | 'italic' | 'underline' | 'strike' | 'code';
|
|
38
38
|
export type MarkType = BuiltinMarkType | (string & {});
|
|
@@ -39,6 +39,12 @@ export type BlockEdge = 'start' | 'end';
|
|
|
39
39
|
* providers other than the built-in one (collaboration reads it).
|
|
40
40
|
*/
|
|
41
41
|
export declare const ownStepKey = "douOwnStep";
|
|
42
|
+
/**
|
|
43
|
+
* Set on a transaction that joins the undo step before it however long
|
|
44
|
+
* after it comes, e.g. the frames of a drag on a whiteboard (with
|
|
45
|
+
* `appendedTransaction` for the built-in history).
|
|
46
|
+
*/
|
|
47
|
+
export declare const joinStepKey = "douJoinStep";
|
|
42
48
|
/**
|
|
43
49
|
* Changes made by blocks and ids, applied together as one undo step. Ids
|
|
44
50
|
* are looked up in the document as it is after the earlier calls.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { NodeSpec } from 'prosemirror-model';
|
|
2
2
|
import type { NodeViewConstructor } from 'prosemirror-view';
|
|
3
3
|
import { type AppContext, type Component, type InjectionKey, type PropType } from 'vue';
|
|
4
|
+
import type { BlockCommentsSpec } from './core/comments';
|
|
4
5
|
import type { BlockOption, EditorExtension, Label, MountComponent } from './core/extension';
|
|
5
6
|
import type { BlockProps } from './core/model';
|
|
6
7
|
/** What a block's Vue component receives. */
|
|
@@ -11,13 +12,19 @@ export interface BlockViewProps {
|
|
|
11
12
|
type: string;
|
|
12
13
|
props: BlockProps;
|
|
13
14
|
};
|
|
14
|
-
/**
|
|
15
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Change props; the change goes into the document, the undo history and
|
|
17
|
+
* collaboration. `history: false` keeps it out of the undo history, e.g.
|
|
18
|
+
* for the id of a comment thread put inside the block.
|
|
19
|
+
*/
|
|
20
|
+
updateProps: (props: BlockProps, options?: {
|
|
21
|
+
history?: boolean;
|
|
22
|
+
}) => void;
|
|
16
23
|
/** The block is selected as a whole (a block without text was clicked). */
|
|
17
24
|
selected: boolean;
|
|
18
25
|
editable: boolean;
|
|
19
26
|
}
|
|
20
|
-
export interface DefineBlockOptions {
|
|
27
|
+
export interface DefineBlockOptions<Target = unknown> {
|
|
21
28
|
type: string;
|
|
22
29
|
/** The props and their defaults. They are stored in the document, as `Block.props`. */
|
|
23
30
|
props?: Record<string, unknown>;
|
|
@@ -27,6 +34,11 @@ export interface DefineBlockOptions {
|
|
|
27
34
|
component?: Component;
|
|
28
35
|
/** `Enter` at the end continues with the same type, like a list. */
|
|
29
36
|
continues?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Comment threads on what is inside the block, kept in its props: how
|
|
39
|
+
* to find, put back and strip them. See `BlockCommentsSpec`.
|
|
40
|
+
*/
|
|
41
|
+
comments?: BlockCommentsSpec<Target>;
|
|
30
42
|
/** Entries for the slash menu and the “turn into” menus; one is made from `menu` when given. */
|
|
31
43
|
menu?: Omit<BlockOption, 'key' | 'type'> & {
|
|
32
44
|
key?: string;
|
|
@@ -62,5 +74,5 @@ export declare function vueNodeView(component: Component, appContext: AppContext
|
|
|
62
74
|
* Declare a block type rendered by a Vue component (or by plain DOM), with
|
|
63
75
|
* its props stored in the document. Returns an extension for `extensions`.
|
|
64
76
|
*/
|
|
65
|
-
export declare function defineBlock(options: DefineBlockOptions): EditorExtension;
|
|
77
|
+
export declare function defineBlock<Target = unknown>(options: DefineBlockOptions<Target>): EditorExtension;
|
|
66
78
|
export type { Label };
|
package/dist/types/document.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { Block, EditorDocument, PartialBlock } from './core/model';
|
|
|
3
3
|
/** A document with no blocks, to start from when nothing is saved yet. */
|
|
4
4
|
export declare const emptyDocument: () => EditorDocument<Block>;
|
|
5
5
|
export interface DocumentProblem {
|
|
6
|
-
code: 'version' | 'shape' | 'duplicate-id' | 'unknown-type' | 'unknown-mark' | 'unknown-inline';
|
|
6
|
+
code: 'version' | 'shape' | 'duplicate-id' | 'unknown-type' | 'unknown-mark' | 'unknown-inline' | 'invalid-columns' | 'invalid-props';
|
|
7
7
|
/** The block at fault, when it has an id. */
|
|
8
8
|
blockId?: string;
|
|
9
9
|
/**
|
|
@@ -24,7 +24,10 @@ export interface CheckDocumentOptions {
|
|
|
24
24
|
* The problems of an editor document, before it is saved or shown: an
|
|
25
25
|
* unknown version, blocks or table rows sharing an id, and block types,
|
|
26
26
|
* marks and inline nodes the extensions don't define, which the editor
|
|
27
|
-
* would show as a paragraph or leave out
|
|
27
|
+
* would show as a paragraph or leave out, and columns the editor would
|
|
28
|
+
* change on the next edit (a column outside a set of columns, a set with
|
|
29
|
+
* fewer than two, columns in a column…), and props a block type says it can't use
|
|
30
|
+
* (its spec's `checkProps`, e.g. a whiteboard's board that isn't a flow).
|
|
28
31
|
*/
|
|
29
32
|
export declare function checkDocument(document: EditorDocument<PartialBlock>, options?: CheckDocumentOptions): DocumentProblem[];
|
|
30
33
|
/**
|
package/dist/types/dom.d.ts
CHANGED
|
@@ -1,11 +1,26 @@
|
|
|
1
1
|
import type { EditorView } from 'prosemirror-view';
|
|
2
|
+
/** The blocks right inside a container element: the editing area or a group. */
|
|
3
|
+
export declare const childBlocks: (container: Element) => HTMLElement[];
|
|
4
|
+
/** The group of a set of columns, around an element in one of them. */
|
|
5
|
+
export declare const COLUMNS_GROUP = ".dou-editor__content--columns + .dou-editor__group";
|
|
6
|
+
/** The group of one column (its blocks). */
|
|
7
|
+
export declare const COLUMN_GROUP = ".dou-editor__content--column + .dou-editor__group";
|
|
8
|
+
/** Whether columns sit side by side; a narrow editor stacks them. */
|
|
9
|
+
export declare function sideBySide(columns: HTMLElement[]): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The column at `x` among side-by-side ones: the gap before a column
|
|
12
|
+
* belongs to it (its handle sits there), what is left of the first to the
|
|
13
|
+
* first and right of the last to the last.
|
|
14
|
+
*/
|
|
15
|
+
export declare function columnAtX(columns: HTMLElement[], x: number): number;
|
|
2
16
|
/**
|
|
3
17
|
* The content element (paragraph, heading, …) at height `y` in viewport
|
|
4
|
-
* coordinates: the last one whose top is above it
|
|
5
|
-
* other from top to bottom
|
|
6
|
-
*
|
|
18
|
+
* coordinates: the last one whose top is above it, nested ones included.
|
|
19
|
+
* Blocks follow each other from top to bottom, so a binary search finds
|
|
20
|
+
* the block, then the same again among its children. In a set of
|
|
21
|
+
* columns, `x` picks the column (stacked columns go by `y` too).
|
|
7
22
|
*/
|
|
8
|
-
export declare function contentAt(view: EditorView, y: number): HTMLElement | null;
|
|
23
|
+
export declare function contentAt(view: EditorView, y: number, x?: number): HTMLElement | null;
|
|
9
24
|
/** The block element around a content element. */
|
|
10
25
|
export declare function blockElementOf(content: HTMLElement): HTMLElement | null;
|
|
11
26
|
/** The nearest ancestor that scrolls vertically, or `null` for the page. */
|
|
@@ -15,3 +30,27 @@ export declare function firstLine(content: HTMLElement): {
|
|
|
15
30
|
top: number;
|
|
16
31
|
height: number;
|
|
17
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* Where a block's content goes across: its box, less what a top-level
|
|
35
|
+
* table's frame reaches into the margins (its start padding and end margin),
|
|
36
|
+
* which keeps the table in line with the text. The editor lays out left to
|
|
37
|
+
* right, so the logical start and end are the left and right.
|
|
38
|
+
*/
|
|
39
|
+
export declare function contentSpan(content: HTMLElement): {
|
|
40
|
+
left: number;
|
|
41
|
+
right: number;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Where the block handle goes: before the content, or before what shows of
|
|
45
|
+
* a table, whose left edge moves out into the margin as it scrolls.
|
|
46
|
+
*/
|
|
47
|
+
export declare function handleLeft(content: HTMLElement): number;
|
|
48
|
+
/**
|
|
49
|
+
* How far the block handle's bubble moves in over the text: by as much as
|
|
50
|
+
* its `start` (its left edge, "+" included when it can come out) lacks of
|
|
51
|
+
* `clip` plus 2px. Next to a table, a bubble that has to move in goes on
|
|
52
|
+
* past `clear`, right of the table's row handles, rather than onto them.
|
|
53
|
+
*/
|
|
54
|
+
export declare function bubbleShift(start: number, clip: number, clear?: number): number;
|
|
55
|
+
/** The right edge of the editor's text column: the surface less its padding (a reading width). */
|
|
56
|
+
export declare function columnRight(surface: HTMLElement): number;
|
package/dist/types/editor.d.ts
CHANGED
|
@@ -218,7 +218,15 @@ export interface EditorComments {
|
|
|
218
218
|
selection: () => CommentRange | null;
|
|
219
219
|
/** Start a thread on the selected text, or open the one the cursor is in. */
|
|
220
220
|
start: () => boolean;
|
|
221
|
-
|
|
221
|
+
/**
|
|
222
|
+
* Make a change to the threads. A new thread goes on the text being
|
|
223
|
+
* commented on; with `anchored`, its block already put it inside (see
|
|
224
|
+
* `BlockCommentsSpec`). A removed thread is taken off its text or block.
|
|
225
|
+
*/
|
|
226
|
+
apply: (action: CommentAction, options?: {
|
|
227
|
+
anchored?: boolean;
|
|
228
|
+
}) => void;
|
|
229
|
+
/** Open a thread: beside its text, or inside its block, which watches `active`. */
|
|
222
230
|
open: (id: string | null) => void;
|
|
223
231
|
/** Close the card, dropping a thread not yet started. */
|
|
224
232
|
close: () => void;
|
|
@@ -50,8 +50,10 @@ declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExp
|
|
|
50
50
|
toggle?: string | undefined;
|
|
51
51
|
callout?: string | undefined;
|
|
52
52
|
table?: string | undefined;
|
|
53
|
+
columns?: string | undefined;
|
|
53
54
|
attachment?: string | undefined;
|
|
54
55
|
embed?: string | undefined;
|
|
56
|
+
whiteboard?: string | undefined;
|
|
55
57
|
} | undefined;
|
|
56
58
|
hints?: {
|
|
57
59
|
paragraph?: string | undefined;
|
|
@@ -68,8 +70,10 @@ declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExp
|
|
|
68
70
|
toggle?: string | undefined;
|
|
69
71
|
callout?: string | undefined;
|
|
70
72
|
table?: string | undefined;
|
|
73
|
+
columns?: string | undefined;
|
|
71
74
|
attachment?: string | undefined;
|
|
72
75
|
embed?: string | undefined;
|
|
76
|
+
whiteboard?: string | undefined;
|
|
73
77
|
} | undefined;
|
|
74
78
|
image?: {
|
|
75
79
|
empty?: string | undefined;
|
|
@@ -128,6 +132,14 @@ declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExp
|
|
|
128
132
|
addRow?: string | undefined;
|
|
129
133
|
addColumn?: string | undefined;
|
|
130
134
|
} | undefined;
|
|
135
|
+
columns?: {
|
|
136
|
+
pick?: string | undefined;
|
|
137
|
+
count?: string | undefined;
|
|
138
|
+
select?: string | undefined;
|
|
139
|
+
resize?: string | undefined;
|
|
140
|
+
even?: string | undefined;
|
|
141
|
+
column?: string | undefined;
|
|
142
|
+
} | undefined;
|
|
131
143
|
colors?: {
|
|
132
144
|
label?: string | undefined;
|
|
133
145
|
text?: string | undefined;
|
|
@@ -168,6 +180,18 @@ declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExp
|
|
|
168
180
|
edit?: string | undefined;
|
|
169
181
|
cancel?: string | undefined;
|
|
170
182
|
} | undefined;
|
|
183
|
+
board?: {
|
|
184
|
+
empty?: string | undefined;
|
|
185
|
+
start?: string | undefined;
|
|
186
|
+
edit?: string | undefined;
|
|
187
|
+
view?: string | undefined;
|
|
188
|
+
resize?: string | undefined;
|
|
189
|
+
addNode?: string | undefined;
|
|
190
|
+
searchNodes?: string | undefined;
|
|
191
|
+
noNodes?: string | undefined;
|
|
192
|
+
node?: string | undefined;
|
|
193
|
+
emptyFlow?: string | undefined;
|
|
194
|
+
} | undefined;
|
|
171
195
|
noResults?: string | undefined;
|
|
172
196
|
addBlock?: string | undefined;
|
|
173
197
|
dragHandle?: string | undefined;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type BlockOptionChoicesProps } from '../../core/extension';
|
|
2
|
+
declare const __VLS_export: import("vue").DefineComponent<BlockOptionChoicesProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
3
|
+
hover: (index: number) => any;
|
|
4
|
+
choose: (index: number) => any;
|
|
5
|
+
}, string, import("vue").PublicProps, Readonly<BlockOptionChoicesProps> & Readonly<{
|
|
6
|
+
onHover?: ((index: number) => any) | undefined;
|
|
7
|
+
onChoose?: ((index: number) => any) | undefined;
|
|
8
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
|
+
declare const _default: typeof __VLS_export;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
2
|
+
declare const _default: typeof __VLS_export;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { BlockOutput } from '../../core/output';
|
|
2
|
+
/**
|
|
3
|
+
* Columns in HTML: a flex row of `div`s, each with its share of the row,
|
|
4
|
+
* so the page shows them side by side without the editor's styles; on a
|
|
5
|
+
* narrow page they wrap, one under the other.
|
|
6
|
+
* Markdown has no columns: their blocks follow one another.
|
|
7
|
+
*/
|
|
8
|
+
export declare const columnsOutput: Record<string, BlockOutput>;
|
|
9
|
+
/** Back from that HTML: `div[data-columns]` and the `div[data-column]` in it. */
|
|
10
|
+
export declare function prepareColumns(root: HTMLElement): void;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Columns: blocks side by side, two to five of them. In the slash menu,
|
|
3
|
+
* “Columns” opens a picker for how many. Each column holds any blocks,
|
|
4
|
+
* which move between columns like anywhere else; dropping blocks between
|
|
5
|
+
* two columns makes a new one there, and dragging the bar between two
|
|
6
|
+
* columns resizes them. On a narrow screen the columns stack.
|
|
7
|
+
*/
|
|
8
|
+
export declare const columns: import("../..").EditorExtension;
|
|
9
|
+
export { MAX_COLUMNS } from './schema';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Plugin, PluginKey, type Transaction } from 'prosemirror-state';
|
|
2
|
+
import { DecorationSet } from 'prosemirror-view';
|
|
3
|
+
/** A column's width while its bar is dragged: shown, not yet in the document. */
|
|
4
|
+
export interface ColumnPreview {
|
|
5
|
+
/** The position before the column's block. */
|
|
6
|
+
pos: number;
|
|
7
|
+
width: number;
|
|
8
|
+
}
|
|
9
|
+
interface ColumnsState {
|
|
10
|
+
decorations: DecorationSet;
|
|
11
|
+
preview: ColumnPreview[] | null;
|
|
12
|
+
}
|
|
13
|
+
/** The name of a column: its place among the columns of its set. */
|
|
14
|
+
export type ColumnLabel = (index: number, count: number) => string;
|
|
15
|
+
export declare const columnsKey: PluginKey<ColumnsState>;
|
|
16
|
+
/** Show `preview` widths without changing the document, or stop showing them (`null`). */
|
|
17
|
+
export declare function previewColumns(tr: Transaction, preview: ColumnPreview[] | null): Transaction;
|
|
18
|
+
/** Lay the columns out again, e.g. after the locale changed their names. */
|
|
19
|
+
export declare const refreshColumns: (tr: Transaction) => Transaction;
|
|
20
|
+
/**
|
|
21
|
+
* Keeps columns well formed after every change, also one from another
|
|
22
|
+
* collaborator (the fix is the same everywhere): columns only in a set of
|
|
23
|
+
* columns, at least one block in each, at least two in a set, no set of
|
|
24
|
+
* columns in a column. Lays each column's width on it, and turns a text
|
|
25
|
+
* selection across columns into a selection of the whole blocks.
|
|
26
|
+
*/
|
|
27
|
+
export declare function columnsPlugin(label: ColumnLabel): Plugin<ColumnsState>;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { NodeSpec } from 'prosemirror-model';
|
|
2
|
+
/** The most columns a set can have, from the picker or by dropping blocks beside them. */
|
|
3
|
+
export declare const MAX_COLUMNS = 5;
|
|
4
|
+
export declare const MIN_COLUMNS = 2;
|
|
5
|
+
/** A column's width: a positive weight, rounded; anything else is the default (1). */
|
|
6
|
+
export declare function widthOf(value: unknown): number | null;
|
|
7
|
+
/**
|
|
8
|
+
* A set of columns. Its content node holds no text and isn't shown; its
|
|
9
|
+
* children are `column` blocks, laid out side by side.
|
|
10
|
+
*/
|
|
11
|
+
export declare const columnsSpec: NodeSpec;
|
|
12
|
+
/**
|
|
13
|
+
* One column: its children are the blocks shown in it. `props.width` is
|
|
14
|
+
* its share of the row, a weight against the other columns' (1 when left
|
|
15
|
+
* out), so two people resizing different columns at once both keep theirs.
|
|
16
|
+
*/
|
|
17
|
+
export declare const columnSpec: NodeSpec;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Block } from '../../core/model';
|
|
2
|
+
/**
|
|
3
|
+
* In the block menu of a block inside columns: select the whole set of
|
|
4
|
+
* columns, to move, copy or remove it with the handle or the keyboard;
|
|
5
|
+
* and, when the columns differ in width, make them even (where the bar
|
|
6
|
+
* between them can't be dragged, e.g. on a touch screen).
|
|
7
|
+
*/
|
|
8
|
+
type __VLS_Props = {
|
|
9
|
+
block: Block;
|
|
10
|
+
};
|
|
11
|
+
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>;
|
|
12
|
+
declare const _default: typeof __VLS_export;
|
|
13
|
+
export default _default;
|
|
@@ -4,6 +4,7 @@ import { align } from './align';
|
|
|
4
4
|
import { callout } from './callout';
|
|
5
5
|
import { colors } from './colors';
|
|
6
6
|
import { codeBlock, type CodeBlockOptions } from './code-block';
|
|
7
|
+
import { columns } from './columns';
|
|
7
8
|
import { formatting, link } from './formatting';
|
|
8
9
|
import { lists } from './lists';
|
|
9
10
|
import { table } from './table';
|
|
@@ -22,6 +23,8 @@ export interface EditorKitOptions {
|
|
|
22
23
|
toggle?: boolean;
|
|
23
24
|
callout?: boolean;
|
|
24
25
|
table?: boolean;
|
|
26
|
+
/** Blocks side by side in columns. */
|
|
27
|
+
columns?: boolean;
|
|
25
28
|
formatting?: boolean;
|
|
26
29
|
link?: boolean;
|
|
27
30
|
/** Text and background colors. */
|
|
@@ -34,4 +37,4 @@ export interface EditorKitOptions {
|
|
|
34
37
|
* it out, e.g. `editorKit({ codeBlock: false })`.
|
|
35
38
|
*/
|
|
36
39
|
export declare function editorKit(options?: EditorKitOptions): EditorExtension[];
|
|
37
|
-
export { align, callout, colors, codeBlock, divider, formatting, heading, link, lists, paragraph, quote, table, toggle, };
|
|
40
|
+
export { align, callout, colors, codeBlock, columns, divider, formatting, heading, link, lists, paragraph, quote, table, toggle, };
|