@dou-ui/editor 0.0.0-stage → 0.1.0-alpha.1
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/LICENSE +21 -0
- package/README.md +10 -2
- package/dist/catalog.js +18 -0
- package/dist/catalog.js.map +1 -0
- package/dist/code/code-editor-block.js +6 -0
- package/dist/code/code-editor-block.js.map +1 -0
- package/dist/code/code-editor-block.vue_vue_type_script_setup_true_lang.js +116 -0
- package/dist/code/code-editor-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/code/index.js +69 -0
- package/dist/code/index.js.map +1 -0
- package/dist/code/languages.js +51 -0
- package/dist/code/languages.js.map +1 -0
- package/dist/code/view.js +255 -0
- package/dist/code/view.js.map +1 -0
- package/dist/collaboration/binding.js +381 -0
- package/dist/collaboration/binding.js.map +1 -0
- package/dist/collaboration/cursors.js +150 -0
- package/dist/collaboration/cursors.js.map +1 -0
- package/dist/collaboration/index.js +108 -0
- package/dist/collaboration/index.js.map +1 -0
- package/dist/collaboration/order.js +88 -0
- package/dist/collaboration/order.js.map +1 -0
- package/dist/collaboration/table.js +234 -0
- package/dist/collaboration/table.js.map +1 -0
- package/dist/collaboration/text.js +91 -0
- package/dist/collaboration/text.js.map +1 -0
- package/dist/components/block-handle.js +6 -0
- package/dist/components/block-handle.js.map +1 -0
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js +474 -0
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/bubble-toolbar.js +6 -0
- package/dist/components/bubble-toolbar.js.map +1 -0
- package/dist/components/bubble-toolbar.vue_vue_type_script_setup_true_lang.js +381 -0
- package/dist/components/bubble-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/comment-button.js +6 -0
- package/dist/components/comment-button.js.map +1 -0
- package/dist/components/comment-button.vue_vue_type_script_setup_true_lang.js +83 -0
- package/dist/components/comment-button.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/comment-card.js +6 -0
- package/dist/components/comment-card.js.map +1 -0
- package/dist/components/comment-card.vue_vue_type_script_setup_true_lang.js +104 -0
- package/dist/components/comment-card.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/menu-escape.js +25 -0
- package/dist/components/menu-escape.js.map +1 -0
- package/dist/components/search-bar.js +6 -0
- package/dist/components/search-bar.js.map +1 -0
- package/dist/components/search-bar.vue_vue_type_script_setup_true_lang.js +192 -0
- package/dist/components/search-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/components/slash-menu.js +6 -0
- package/dist/components/slash-menu.js.map +1 -0
- package/dist/components/slash-menu.vue_vue_type_script_setup_true_lang.js +164 -0
- package/dist/components/slash-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/core/align.js +94 -0
- package/dist/core/align.js.map +1 -0
- package/dist/core/block-selection.js +155 -0
- package/dist/core/block-selection.js.map +1 -0
- package/dist/core/blocks.js +132 -0
- package/dist/core/blocks.js.map +1 -0
- package/dist/core/changes.js +85 -0
- package/dist/core/changes.js.map +1 -0
- package/dist/core/colors.js +16 -0
- package/dist/core/colors.js.map +1 -0
- package/dist/core/commands.js +379 -0
- package/dist/core/commands.js.map +1 -0
- package/dist/core/comments.js +186 -0
- package/dist/core/comments.js.map +1 -0
- package/dist/core/compare.js +106 -0
- package/dist/core/compare.js.map +1 -0
- package/dist/core/convert.js +28 -0
- package/dist/core/convert.js.map +1 -0
- package/dist/core/diff.js +141 -0
- package/dist/core/diff.js.map +1 -0
- package/dist/core/editor.js +138 -0
- package/dist/core/editor.js.map +1 -0
- package/dist/core/extension.js +99 -0
- package/dist/core/extension.js.map +1 -0
- package/dist/core/file-drop.js +56 -0
- package/dist/core/file-drop.js.map +1 -0
- package/dist/core/highlight.js +120 -0
- package/dist/core/highlight.js.map +1 -0
- package/dist/core/input-rules.js +61 -0
- package/dist/core/input-rules.js.map +1 -0
- package/dist/core/keymap.js +38 -0
- package/dist/core/keymap.js.map +1 -0
- package/dist/core/model.js +196 -0
- package/dist/core/model.js.map +1 -0
- package/dist/core/output.js +263 -0
- package/dist/core/output.js.map +1 -0
- package/dist/core/plugins.js +102 -0
- package/dist/core/plugins.js.map +1 -0
- package/dist/core/prepare.js +102 -0
- package/dist/core/prepare.js.map +1 -0
- package/dist/core/schema.js +158 -0
- package/dist/core/schema.js.map +1 -0
- package/dist/core/search.js +197 -0
- package/dist/core/search.js.map +1 -0
- package/dist/core/selection.js +16 -0
- package/dist/core/selection.js.map +1 -0
- package/dist/core/slash.js +83 -0
- package/dist/core/slash.js.map +1 -0
- package/dist/core/transaction.js +311 -0
- package/dist/core/transaction.js.map +1 -0
- package/dist/define-block.js +177 -0
- package/dist/define-block.js.map +1 -0
- package/dist/document.js +157 -0
- package/dist/document.js.map +1 -0
- package/dist/dom.js +48 -0
- package/dist/dom.js.map +1 -0
- package/dist/editor.js +33 -0
- package/dist/editor.js.map +1 -0
- package/dist/editor.vue_vue_type_script_setup_true_lang.js +564 -0
- package/dist/editor.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/editor2.js +6 -0
- package/dist/editor2.js.map +1 -0
- package/dist/extensions/align/align-menu.js +6 -0
- package/dist/extensions/align/align-menu.js.map +1 -0
- package/dist/extensions/align/align-menu.vue_vue_type_script_setup_true_lang.js +82 -0
- package/dist/extensions/align/align-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/align/align-sub.js +6 -0
- package/dist/extensions/align/align-sub.js.map +1 -0
- package/dist/extensions/align/align-sub.vue_vue_type_script_setup_true_lang.js +57 -0
- package/dist/extensions/align/align-sub.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/align/commands.js +40 -0
- package/dist/extensions/align/commands.js.map +1 -0
- package/dist/extensions/align/index.js +27 -0
- package/dist/extensions/align/index.js.map +1 -0
- package/dist/extensions/attachment/attachment-block.js +6 -0
- package/dist/extensions/attachment/attachment-block.js.map +1 -0
- package/dist/extensions/attachment/attachment-block.vue_vue_type_script_setup_true_lang.js +119 -0
- package/dist/extensions/attachment/attachment-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/attachment/files.js +66 -0
- package/dist/extensions/attachment/files.js.map +1 -0
- package/dist/extensions/attachment/index.js +132 -0
- package/dist/extensions/attachment/index.js.map +1 -0
- package/dist/extensions/blocks.js +170 -0
- package/dist/extensions/blocks.js.map +1 -0
- package/dist/extensions/callout/callout-block.js +6 -0
- package/dist/extensions/callout/callout-block.js.map +1 -0
- package/dist/extensions/callout/callout-block.vue_vue_type_script_setup_true_lang.js +71 -0
- package/dist/extensions/callout/callout-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/callout/html.js +61 -0
- package/dist/extensions/callout/html.js.map +1 -0
- package/dist/extensions/callout/index.js +52 -0
- package/dist/extensions/callout/index.js.map +1 -0
- package/dist/extensions/callout/tones.js +12 -0
- package/dist/extensions/callout/tones.js.map +1 -0
- package/dist/extensions/code-block/code-block-view.js +6 -0
- package/dist/extensions/code-block/code-block-view.js.map +1 -0
- package/dist/extensions/code-block/code-block-view.vue_vue_type_script_setup_true_lang.js +87 -0
- package/dist/extensions/code-block/code-block-view.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/code-block/index.js +98 -0
- package/dist/extensions/code-block/index.js.map +1 -0
- package/dist/extensions/code-block/languages.js +116 -0
- package/dist/extensions/code-block/languages.js.map +1 -0
- package/dist/extensions/colors/color-menu.js +6 -0
- package/dist/extensions/colors/color-menu.js.map +1 -0
- package/dist/extensions/colors/color-menu.vue_vue_type_script_setup_true_lang.js +113 -0
- package/dist/extensions/colors/color-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/colors/index.js +49 -0
- package/dist/extensions/colors/index.js.map +1 -0
- package/dist/extensions/colors/palette.js +26 -0
- package/dist/extensions/colors/palette.js.map +1 -0
- package/dist/extensions/editor-kit.js +35 -0
- package/dist/extensions/editor-kit.js.map +1 -0
- package/dist/extensions/embed/embed-block.js +6 -0
- package/dist/extensions/embed/embed-block.js.map +1 -0
- package/dist/extensions/embed/embed-block.vue_vue_type_script_setup_true_lang.js +210 -0
- package/dist/extensions/embed/embed-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/embed/index.js +118 -0
- package/dist/extensions/embed/index.js.map +1 -0
- package/dist/extensions/embed/targets.js +79 -0
- package/dist/extensions/embed/targets.js.map +1 -0
- package/dist/extensions/formatting.js +153 -0
- package/dist/extensions/formatting.js.map +1 -0
- package/dist/extensions/image/image-block.js +6 -0
- package/dist/extensions/image/image-block.js.map +1 -0
- package/dist/extensions/image/image-block.vue_vue_type_script_setup_true_lang.js +206 -0
- package/dist/extensions/image/image-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/image/index.js +125 -0
- package/dist/extensions/image/index.js.map +1 -0
- package/dist/extensions/image/uploads.js +96 -0
- package/dist/extensions/image/uploads.js.map +1 -0
- package/dist/extensions/list-html.js +58 -0
- package/dist/extensions/list-html.js.map +1 -0
- package/dist/extensions/lists.js +182 -0
- package/dist/extensions/lists.js.map +1 -0
- package/dist/extensions/mention/index.js +56 -0
- package/dist/extensions/mention/index.js.map +1 -0
- package/dist/extensions/mention/mention-menu.js +6 -0
- package/dist/extensions/mention/mention-menu.js.map +1 -0
- package/dist/extensions/mention/mention-menu.vue_vue_type_script_setup_true_lang.js +132 -0
- package/dist/extensions/mention/mention-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/mention/state.js +113 -0
- package/dist/extensions/mention/state.js.map +1 -0
- package/dist/extensions/table/commands.js +356 -0
- package/dist/extensions/table/commands.js.map +1 -0
- package/dist/extensions/table/html.js +134 -0
- package/dist/extensions/table/html.js.map +1 -0
- package/dist/extensions/table/index.js +56 -0
- package/dist/extensions/table/index.js.map +1 -0
- package/dist/extensions/table/plugin.js +81 -0
- package/dist/extensions/table/plugin.js.map +1 -0
- package/dist/extensions/table/schema.js +258 -0
- package/dist/extensions/table/schema.js.map +1 -0
- package/dist/extensions/table/table-controls.js +6 -0
- package/dist/extensions/table/table-controls.js.map +1 -0
- package/dist/extensions/table/table-controls.vue_vue_type_script_setup_true_lang.js +698 -0
- package/dist/extensions/table/table-controls.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/extensions/table/view.js +19 -0
- package/dist/extensions/table/view.js.map +1 -0
- package/dist/extensions/toggle/index.js +87 -0
- package/dist/extensions/toggle/index.js.map +1 -0
- package/dist/extensions/toggle/state.js +120 -0
- package/dist/extensions/toggle/state.js.map +1 -0
- package/dist/extensions/toggle/toggle-block.js +6 -0
- package/dist/extensions/toggle/toggle-block.js.map +1 -0
- package/dist/extensions/toggle/toggle-block.vue_vue_type_script_setup_true_lang.js +42 -0
- package/dist/extensions/toggle/toggle-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/locale.js +522 -0
- package/dist/locale.js.map +1 -0
- package/dist/markdown/index.js +24 -0
- package/dist/markdown/index.js.map +1 -0
- package/dist/style.css +1 -0
- package/dist/style.d.ts +1 -0
- package/dist/style.js +8 -0
- package/dist/types/catalog.d.ts +8 -0
- package/dist/types/code/code-editor-block.vue.d.ts +17 -0
- package/dist/types/code/index.d.ts +18 -0
- package/dist/types/code/languages.d.ts +7 -0
- package/dist/types/code/types.d.ts +37 -0
- package/dist/types/code/view.d.ts +12 -0
- package/dist/types/collaboration/binding.d.ts +32 -0
- package/dist/types/collaboration/cursors.d.ts +26 -0
- package/dist/types/collaboration/index.d.ts +47 -0
- package/dist/types/collaboration/order.d.ts +20 -0
- package/dist/types/collaboration/table.d.ts +25 -0
- package/dist/types/collaboration/text.d.ts +9 -0
- package/dist/types/components/block-handle.vue.d.ts +3 -0
- package/dist/types/components/bubble-toolbar.vue.d.ts +7 -0
- package/dist/types/components/comment-button.vue.d.ts +3 -0
- package/dist/types/components/comment-card.vue.d.ts +3 -0
- package/dist/types/components/menu-escape.d.ts +7 -0
- package/dist/types/components/search-bar.vue.d.ts +22 -0
- package/dist/types/components/slash-menu.vue.d.ts +11 -0
- package/dist/types/core/align.d.ts +16 -0
- package/dist/types/core/block-selection.d.ts +22 -0
- package/dist/types/core/blocks.d.ts +52 -0
- package/dist/types/core/changes.d.ts +14 -0
- package/dist/types/core/colors.d.ts +4 -0
- package/dist/types/core/commands.d.ts +61 -0
- package/dist/types/core/comments.d.ts +44 -0
- package/dist/types/core/compare.d.ts +10 -0
- package/dist/types/core/convert.d.ts +12 -0
- package/dist/types/core/diff.d.ts +49 -0
- package/dist/types/core/editor.d.ts +64 -0
- package/dist/types/core/extension.d.ts +167 -0
- package/dist/types/core/file-drop.d.ts +19 -0
- package/dist/types/core/highlight.d.ts +32 -0
- package/dist/types/core/input-rules.d.ts +21 -0
- package/dist/types/core/keymap.d.ts +8 -0
- package/dist/types/core/model.d.ts +158 -0
- package/dist/types/core/output.d.ts +64 -0
- package/dist/types/core/plugins.d.ts +24 -0
- package/dist/types/core/prepare.d.ts +23 -0
- package/dist/types/core/schema.d.ts +38 -0
- package/dist/types/core/search.d.ts +83 -0
- package/dist/types/core/selection.d.ts +8 -0
- package/dist/types/core/slash.d.ts +21 -0
- package/dist/types/core/transaction.d.ts +97 -0
- package/dist/types/define-block.d.ts +66 -0
- package/dist/types/document.d.ts +46 -0
- package/dist/types/dom.d.ts +17 -0
- package/dist/types/editor.d.ts +252 -0
- package/dist/types/editor.vue.d.ts +210 -0
- package/dist/types/extensions/align/align-menu.vue.d.ts +3 -0
- package/dist/types/extensions/align/align-sub.vue.d.ts +7 -0
- package/dist/types/extensions/align/commands.d.ts +13 -0
- package/dist/types/extensions/align/index.d.ts +7 -0
- package/dist/types/extensions/attachment/attachment-block.vue.d.ts +17 -0
- package/dist/types/extensions/attachment/files.d.ts +6 -0
- package/dist/types/extensions/attachment/index.d.ts +20 -0
- package/dist/types/extensions/blocks.d.ts +8 -0
- package/dist/types/extensions/callout/callout-block.vue.d.ts +14 -0
- package/dist/types/extensions/callout/html.d.ts +4 -0
- package/dist/types/extensions/callout/index.d.ts +3 -0
- package/dist/types/extensions/callout/tones.d.ts +8 -0
- package/dist/types/extensions/code-block/code-block-view.vue.d.ts +16 -0
- package/dist/types/extensions/code-block/index.d.ts +19 -0
- package/dist/types/extensions/code-block/languages.d.ts +9 -0
- package/dist/types/extensions/colors/color-menu.vue.d.ts +3 -0
- package/dist/types/extensions/colors/index.d.ts +7 -0
- package/dist/types/extensions/colors/palette.d.ts +7 -0
- package/dist/types/extensions/editor-kit.d.ts +37 -0
- package/dist/types/extensions/embed/embed-block.vue.d.ts +16 -0
- package/dist/types/extensions/embed/index.d.ts +18 -0
- package/dist/types/extensions/embed/targets.d.ts +32 -0
- package/dist/types/extensions/formatting.d.ts +8 -0
- package/dist/types/extensions/image/image-block.vue.d.ts +16 -0
- package/dist/types/extensions/image/index.d.ts +16 -0
- package/dist/types/extensions/image/uploads.d.ts +35 -0
- package/dist/types/extensions/list-html.d.ts +11 -0
- package/dist/types/extensions/lists.d.ts +6 -0
- package/dist/types/extensions/mention/index.d.ts +11 -0
- package/dist/types/extensions/mention/mention-menu.vue.d.ts +7 -0
- package/dist/types/extensions/mention/state.d.ts +28 -0
- package/dist/types/extensions/table/commands.d.ts +69 -0
- package/dist/types/extensions/table/html.d.ts +4 -0
- package/dist/types/extensions/table/index.d.ts +8 -0
- package/dist/types/extensions/table/plugin.d.ts +4 -0
- package/dist/types/extensions/table/schema.d.ts +23 -0
- package/dist/types/extensions/table/table-controls.vue.d.ts +3 -0
- package/dist/types/extensions/table/view.d.ts +13 -0
- package/dist/types/extensions/toggle/index.d.ts +7 -0
- package/dist/types/extensions/toggle/state.d.ts +17 -0
- package/dist/types/extensions/toggle/toggle-block.vue.d.ts +14 -0
- package/dist/types/index.d.ts +266 -0
- package/dist/types/locale.d.ts +195 -0
- package/dist/types/markdown/index.d.ts +14 -0
- package/dist/types/use-comments.d.ts +17 -0
- package/dist/use-comments.js +141 -0
- package/dist/use-comments.js.map +1 -0
- package/package.json +98 -4
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import type { EditorState, Command, Plugin } from 'prosemirror-state';
|
|
2
|
+
import type { EditorView } from 'prosemirror-view';
|
|
3
|
+
import type { CommentAction, CommentAuthor, CommentThread } from 'dou-ui';
|
|
4
|
+
import { type ComputedRef, type InjectionKey, type ShallowRef } from 'vue';
|
|
5
|
+
import type { CommentAnchor, CommentRange } from './core/comments';
|
|
6
|
+
import type { EditorExtension, ResolvedEditorExtensions } from './core/extension';
|
|
7
|
+
import type { BlockChanges } from './core/changes';
|
|
8
|
+
import type { Block, EditorDocument, PartialBlock } from './core/model';
|
|
9
|
+
import type { EditorSearchQuery } from './core/search';
|
|
10
|
+
import type { BlockEdge, BlockPatch, BlockPlacement, EditorTransaction, EditorTransactionMeta } from './core/transaction';
|
|
11
|
+
import type { EditorMessages, EditorMessagesOverride } from './locale';
|
|
12
|
+
export interface EditorProps {
|
|
13
|
+
/**
|
|
14
|
+
* The document, bound with `v-model`. With collaboration the shared
|
|
15
|
+
* document is the source of truth: leave `v-model` out and read changes
|
|
16
|
+
* from the `change` event.
|
|
17
|
+
*/
|
|
18
|
+
modelValue?: EditorDocument<PartialBlock>;
|
|
19
|
+
/**
|
|
20
|
+
* Blocks, marks, shortcuts and menu entries. Defaults to `[editorKit()]`;
|
|
21
|
+
* read once, when the editor mounts.
|
|
22
|
+
*/
|
|
23
|
+
extensions?: (EditorExtension | EditorExtension[])[];
|
|
24
|
+
/** Show the document without editing it. Links stay clickable. */
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
/** The built-in find panel (`Ctrl/⌘+F`). Off, the keys are left to the browser. On by default. */
|
|
27
|
+
searchable?: boolean;
|
|
28
|
+
/** The hint in the empty block under the cursor. */
|
|
29
|
+
placeholder?: string;
|
|
30
|
+
/** Replace any of the built-in texts. */
|
|
31
|
+
messages?: EditorMessagesOverride;
|
|
32
|
+
/** The accessible name of the editing area. */
|
|
33
|
+
ariaLabel?: string;
|
|
34
|
+
/** Focus the editor once it is mounted. */
|
|
35
|
+
autofocus?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Extra ProseMirror plugins, e.g. for collaboration. They run before
|
|
38
|
+
* the built-in ones, so their keys win.
|
|
39
|
+
*/
|
|
40
|
+
plugins?: Plugin[];
|
|
41
|
+
/** Leave out the built-in undo history (collaboration brings its own). */
|
|
42
|
+
history?: boolean;
|
|
43
|
+
/** Undo and redo commands to replace the built-in ones. */
|
|
44
|
+
undo?: Command;
|
|
45
|
+
redo?: Command;
|
|
46
|
+
/**
|
|
47
|
+
* The comment threads, bound with `v-model:comments`. The text a thread
|
|
48
|
+
* is about carries its id in the document; leave this out to turn
|
|
49
|
+
* comments off.
|
|
50
|
+
*/
|
|
51
|
+
comments?: CommentThread[];
|
|
52
|
+
/** Who is commenting. Without it comments can be read but not written. */
|
|
53
|
+
author?: CommentAuthor;
|
|
54
|
+
/** The id of the thread shown beside its text, bound with `v-model:activeComment`. */
|
|
55
|
+
activeComment?: string | null;
|
|
56
|
+
/** Whether threads can be started and answered; also while `readonly`. Defaults to `true`. */
|
|
57
|
+
commentable?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* An older version of the document, e.g. one the app saved. The editor
|
|
60
|
+
* then shows the document read-only, with what changed since marked:
|
|
61
|
+
* blocks added and removed, and in each changed block the text added
|
|
62
|
+
* and removed. Blocks are matched by `id`; a block without one shows as
|
|
63
|
+
* removed.
|
|
64
|
+
*/
|
|
65
|
+
compare?: EditorDocument<PartialBlock> | null;
|
|
66
|
+
/**
|
|
67
|
+
* The block with the cursor and the selected blocks, bound with
|
|
68
|
+
* `v-model:selection`. Setting it puts the cursor at the end of `block`,
|
|
69
|
+
* or selects `blocks` when there are several siblings, without focusing.
|
|
70
|
+
*/
|
|
71
|
+
selection?: EditorSelection;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Who made a change: `'external'` for a new `v-model` value or
|
|
75
|
+
* `setBlocks`, `'remote'` for a collaborator's, `'restore'` for `restore`,
|
|
76
|
+
* `'undo'` and `'redo'`, or
|
|
77
|
+
* the `origin` given to `transact`. Typing and the editor's own commands
|
|
78
|
+
* leave it out.
|
|
79
|
+
*/
|
|
80
|
+
export type EditorOrigin = 'external' | 'remote' | 'restore' | 'undo' | 'redo' | (string & {});
|
|
81
|
+
/** What a change to the document did, as the `transaction` event hands it over. */
|
|
82
|
+
export interface EditorTransactionResult {
|
|
83
|
+
/** The document after the change, as `update:modelValue` gets it next. */
|
|
84
|
+
blocks: Block[];
|
|
85
|
+
/** The blocks the change touched, by id. */
|
|
86
|
+
changes: BlockChanges;
|
|
87
|
+
meta: {
|
|
88
|
+
origin?: EditorOrigin;
|
|
89
|
+
/** Whether undo can take the change back: not for others' changes, nor for undo and redo themselves. */
|
|
90
|
+
history: boolean;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/** Where the selection is, by block. */
|
|
94
|
+
export interface EditorSelection {
|
|
95
|
+
/** The innermost block at the cursor (the moving end of a selection); `null` while none is. */
|
|
96
|
+
block: string | null;
|
|
97
|
+
/**
|
|
98
|
+
* The blocks the selection covers: the selected blocks, or the blocks a
|
|
99
|
+
* text selection runs across, at the level they share.
|
|
100
|
+
*/
|
|
101
|
+
blocks: string[];
|
|
102
|
+
}
|
|
103
|
+
export interface EditorEmits {
|
|
104
|
+
'update:modelValue': [document: EditorDocument];
|
|
105
|
+
/** The document changed: typing, formatting, moving blocks. */
|
|
106
|
+
change: [document: EditorDocument];
|
|
107
|
+
/** Every change to the document, with what it touched; `update:modelValue` follows. */
|
|
108
|
+
transaction: [result: EditorTransactionResult];
|
|
109
|
+
/** The cursor moved to another block, or other blocks were selected. */
|
|
110
|
+
'update:selection': [selection: EditorSelection];
|
|
111
|
+
/** Before a link opens (Ctrl / ⌘ + click, or a click while read-only); `preventDefault()` keeps it from opening in a new tab. */
|
|
112
|
+
linkOpen: [event: EditorLinkOpenEvent];
|
|
113
|
+
focus: [event: FocusEvent];
|
|
114
|
+
blur: [event: FocusEvent];
|
|
115
|
+
'update:comments': [threads: CommentThread[]];
|
|
116
|
+
'update:activeComment': [id: string | null];
|
|
117
|
+
/** A change to the comments made here: to send to a server, notify people, keep a log. */
|
|
118
|
+
commentAction: [action: CommentAction];
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Before a link is followed. `preventDefault()` stops the editor from
|
|
122
|
+
* opening it in a new tab, e.g. to use the app's router or ask first.
|
|
123
|
+
*/
|
|
124
|
+
export interface EditorLinkOpenEvent {
|
|
125
|
+
/** The address as the text's `link` holds it. */
|
|
126
|
+
link: string;
|
|
127
|
+
/** The id of the block the link is in. */
|
|
128
|
+
block: string;
|
|
129
|
+
defaultPrevented: boolean;
|
|
130
|
+
preventDefault: () => void;
|
|
131
|
+
}
|
|
132
|
+
export interface EditorExpose {
|
|
133
|
+
/** The ProseMirror view, once mounted. */
|
|
134
|
+
readonly view: EditorView | null;
|
|
135
|
+
focus: () => void;
|
|
136
|
+
blur: () => void;
|
|
137
|
+
/** The current document. */
|
|
138
|
+
getBlocks: () => Block[];
|
|
139
|
+
/** Replace the document. The change does not go into the undo history. */
|
|
140
|
+
setBlocks: (blocks: PartialBlock[]) => void;
|
|
141
|
+
/** The current document as HTML, written by the extensions (see `blocksToHTML`). */
|
|
142
|
+
getHTML: () => string;
|
|
143
|
+
/** Replace the document with HTML, read like pasted HTML. */
|
|
144
|
+
setHTML: (html: string) => void;
|
|
145
|
+
/** Run a ProseMirror command, e.g. one of the exported ones. */
|
|
146
|
+
run: (command: Command) => boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Opens the find panel (`Ctrl/⌘+F`), with a query put in; with `replace`
|
|
149
|
+
* in it, the replace box opens too. `false` when `searchable` is off or
|
|
150
|
+
* the editor is not mounted.
|
|
151
|
+
*/
|
|
152
|
+
openSearch: (query?: Partial<EditorSearchQuery>) => boolean;
|
|
153
|
+
/** Closes the find panel; `false` when it was not open. */
|
|
154
|
+
closeSearch: () => boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Make changes by blocks and ids, applied together as one undo step.
|
|
157
|
+
* Returns what happened, or `null` when nothing changed. Works while
|
|
158
|
+
* read-only too.
|
|
159
|
+
*/
|
|
160
|
+
transact: (fn: (tr: EditorTransaction) => void, meta?: EditorTransactionMeta) => EditorTransactionResult | null;
|
|
161
|
+
/** One block, or `null` when there is none with that id. */
|
|
162
|
+
getBlock: (id: string) => Block | null;
|
|
163
|
+
/**
|
|
164
|
+
* Insert blocks, by default after the block with the cursor. Returns the
|
|
165
|
+
* new blocks' ids (an id already in use is replaced). One undo step.
|
|
166
|
+
*/
|
|
167
|
+
insertBlocks: (blocks: PartialBlock[], placement?: BlockPlacement) => string[];
|
|
168
|
+
/** Change a block's type, props (merged), content or children. One undo step. */
|
|
169
|
+
updateBlock: (id: string, patch: BlockPatch) => boolean;
|
|
170
|
+
/** Remove blocks with their children. One undo step. */
|
|
171
|
+
removeBlocks: (ids: string[]) => boolean;
|
|
172
|
+
/** Move blocks, in the order given, before, after or into another block. One undo step. */
|
|
173
|
+
moveBlocks: (ids: string[], placement: BlockPlacement) => boolean;
|
|
174
|
+
/** Focus the editor with the cursor at the start or end (the default) of a block, scrolled into view. */
|
|
175
|
+
focusBlock: (id: string, edge?: BlockEdge) => boolean;
|
|
176
|
+
/** The selection by block, as `v-model:selection` has it. */
|
|
177
|
+
getSelection: () => EditorSelection;
|
|
178
|
+
undo: () => boolean;
|
|
179
|
+
redo: () => boolean;
|
|
180
|
+
readonly canUndo: boolean;
|
|
181
|
+
readonly canRedo: boolean;
|
|
182
|
+
/**
|
|
183
|
+
* Start a thread on the selected text and open the box for its first
|
|
184
|
+
* comment; with the cursor on commented text, open that thread to reply.
|
|
185
|
+
*/
|
|
186
|
+
comment: () => boolean;
|
|
187
|
+
/** Where each thread is anchored; `null` for a thread whose text was deleted. */
|
|
188
|
+
getCommentAnchors: () => Record<string, CommentAnchor | null>;
|
|
189
|
+
/**
|
|
190
|
+
* Replace the document with `doc`, e.g. an older version, as one
|
|
191
|
+
* change undo takes back. With collaboration only the blocks that differ
|
|
192
|
+
* are written, and everyone sees it. The `transaction` event has origin
|
|
193
|
+
* `'restore'`. Like the other methods it works while `readonly`; it is
|
|
194
|
+
* the one change allowed while comparing. Returns `false` when nothing
|
|
195
|
+
* differs.
|
|
196
|
+
*/
|
|
197
|
+
restore: (doc: EditorDocument<PartialBlock>) => boolean;
|
|
198
|
+
/** With `compare`: scroll to the next change after the one last shown; `false` when there is none. */
|
|
199
|
+
nextChange: () => boolean;
|
|
200
|
+
/** With `compare`: scroll to the change before the one last shown. */
|
|
201
|
+
previousChange: () => boolean;
|
|
202
|
+
}
|
|
203
|
+
/** The comments, as the parts around the editing area see them. */
|
|
204
|
+
export interface EditorComments {
|
|
205
|
+
/** Comments are on: there are threads to show. */
|
|
206
|
+
enabled: ComputedRef<boolean>;
|
|
207
|
+
/** Threads can be started and answered. */
|
|
208
|
+
writable: ComputedRef<boolean>;
|
|
209
|
+
threads: ComputedRef<readonly CommentThread[]>;
|
|
210
|
+
author: ComputedRef<CommentAuthor | undefined>;
|
|
211
|
+
/** The thread shown beside its text. */
|
|
212
|
+
active: ComputedRef<string | null>;
|
|
213
|
+
/** The text a new thread is being started on. */
|
|
214
|
+
pending: ShallowRef<CommentRange | null>;
|
|
215
|
+
/** Goes up when the open thread's reply box should take focus. */
|
|
216
|
+
focusRequest: ShallowRef<number>;
|
|
217
|
+
/** The selected text, also in a read-only editor; `null` when there is none. */
|
|
218
|
+
selection: () => CommentRange | null;
|
|
219
|
+
/** Start a thread on the selected text, or open the one the cursor is in. */
|
|
220
|
+
start: () => boolean;
|
|
221
|
+
apply: (action: CommentAction) => void;
|
|
222
|
+
open: (id: string | null) => void;
|
|
223
|
+
/** Close the card, dropping a thread not yet started. */
|
|
224
|
+
close: () => void;
|
|
225
|
+
}
|
|
226
|
+
/** What the parts around the editing area (menus, handle, toolbar) share. */
|
|
227
|
+
export interface EditorContext {
|
|
228
|
+
view: ShallowRef<EditorView | null>;
|
|
229
|
+
/** Updated on every transaction, so computeds follow the selection too. */
|
|
230
|
+
state: ShallowRef<EditorState | null>;
|
|
231
|
+
focused: ShallowRef<boolean>;
|
|
232
|
+
/** Blocks are being dragged by the handle. */
|
|
233
|
+
dragging: ShallowRef<boolean>;
|
|
234
|
+
editable: ComputedRef<boolean>;
|
|
235
|
+
messages: ComputedRef<EditorMessages>;
|
|
236
|
+
/** What the extensions contribute: schema, menu entries, toolbar toggles. */
|
|
237
|
+
kit: ResolvedEditorExtensions;
|
|
238
|
+
/** The element the overlays are positioned against. */
|
|
239
|
+
root: ShallowRef<HTMLElement | null>;
|
|
240
|
+
comments: EditorComments;
|
|
241
|
+
}
|
|
242
|
+
export declare const editorKey: InjectionKey<EditorContext>;
|
|
243
|
+
/** For the formatting toolbar: the open state of the menus in it. */
|
|
244
|
+
export declare function provideToolbarMenus(): Set<ShallowRef<boolean>>;
|
|
245
|
+
/**
|
|
246
|
+
* The open state for a menu in the formatting toolbar (an extension's
|
|
247
|
+
* `toolbar` component), to bind with `v-model:open`: the toolbar stays
|
|
248
|
+
* while the menu is open, though the focus has left the editor.
|
|
249
|
+
*/
|
|
250
|
+
export declare function useToolbarMenu(): ShallowRef<boolean>;
|
|
251
|
+
/** The editor around a block component, for its messages, state and view. */
|
|
252
|
+
export declare function useEditor(): EditorContext;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { Plugin } from 'prosemirror-state';
|
|
2
|
+
import { type Block, type EditorDocument, type PartialBlock } from './core/model';
|
|
3
|
+
import { type EditorExpose, type EditorProps, type EditorLinkOpenEvent, type EditorSelection, type EditorTransactionResult } from './editor';
|
|
4
|
+
declare const __VLS_export: import("vue").DefineComponent<EditorProps, EditorExpose, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
|
+
blur: (event: FocusEvent) => any;
|
|
6
|
+
change: (document: EditorDocument<Block>) => any;
|
|
7
|
+
focus: (event: FocusEvent) => any;
|
|
8
|
+
"update:modelValue": (document: EditorDocument<Block>) => any;
|
|
9
|
+
transaction: (result: EditorTransactionResult) => any;
|
|
10
|
+
"update:selection": (selection: EditorSelection) => any;
|
|
11
|
+
linkOpen: (event: EditorLinkOpenEvent) => any;
|
|
12
|
+
"update:comments": (threads: import("dou-ui").CommentThread[]) => any;
|
|
13
|
+
"update:activeComment": (id: string | null) => any;
|
|
14
|
+
commentAction: (action: import("dou-ui").CommentAction) => any;
|
|
15
|
+
}, string, import("vue").PublicProps, Readonly<EditorProps> & Readonly<{
|
|
16
|
+
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
17
|
+
onChange?: ((document: EditorDocument<Block>) => any) | undefined;
|
|
18
|
+
onFocus?: ((event: FocusEvent) => any) | undefined;
|
|
19
|
+
"onUpdate:modelValue"?: ((document: EditorDocument<Block>) => any) | undefined;
|
|
20
|
+
onTransaction?: ((result: EditorTransactionResult) => any) | undefined;
|
|
21
|
+
"onUpdate:selection"?: ((selection: EditorSelection) => any) | undefined;
|
|
22
|
+
onLinkOpen?: ((event: EditorLinkOpenEvent) => any) | undefined;
|
|
23
|
+
"onUpdate:comments"?: ((threads: import("dou-ui").CommentThread[]) => any) | undefined;
|
|
24
|
+
"onUpdate:activeComment"?: ((id: string | null) => any) | undefined;
|
|
25
|
+
onCommentAction?: ((action: import("dou-ui").CommentAction) => any) | undefined;
|
|
26
|
+
}>, {
|
|
27
|
+
placeholder: string;
|
|
28
|
+
comments: import("dou-ui").CommentThread[];
|
|
29
|
+
selection: EditorSelection;
|
|
30
|
+
undo: import("prosemirror-state").Command;
|
|
31
|
+
redo: import("prosemirror-state").Command;
|
|
32
|
+
plugins: Plugin<any>[];
|
|
33
|
+
history: boolean;
|
|
34
|
+
messages: {
|
|
35
|
+
placeholder?: string | undefined;
|
|
36
|
+
emptyPlaceholder?: string | undefined;
|
|
37
|
+
headingPlaceholder?: string | undefined;
|
|
38
|
+
types?: {
|
|
39
|
+
paragraph?: string | undefined;
|
|
40
|
+
heading1?: string | undefined;
|
|
41
|
+
heading2?: string | undefined;
|
|
42
|
+
heading3?: string | undefined;
|
|
43
|
+
bulletItem?: string | undefined;
|
|
44
|
+
numberedItem?: string | undefined;
|
|
45
|
+
checkItem?: string | undefined;
|
|
46
|
+
quote?: string | undefined;
|
|
47
|
+
codeBlock?: string | undefined;
|
|
48
|
+
divider?: string | undefined;
|
|
49
|
+
image?: string | undefined;
|
|
50
|
+
toggle?: string | undefined;
|
|
51
|
+
callout?: string | undefined;
|
|
52
|
+
table?: string | undefined;
|
|
53
|
+
attachment?: string | undefined;
|
|
54
|
+
embed?: string | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
hints?: {
|
|
57
|
+
paragraph?: string | undefined;
|
|
58
|
+
heading1?: string | undefined;
|
|
59
|
+
heading2?: string | undefined;
|
|
60
|
+
heading3?: string | undefined;
|
|
61
|
+
bulletItem?: string | undefined;
|
|
62
|
+
numberedItem?: string | undefined;
|
|
63
|
+
checkItem?: string | undefined;
|
|
64
|
+
quote?: string | undefined;
|
|
65
|
+
codeBlock?: string | undefined;
|
|
66
|
+
divider?: string | undefined;
|
|
67
|
+
image?: string | undefined;
|
|
68
|
+
toggle?: string | undefined;
|
|
69
|
+
callout?: string | undefined;
|
|
70
|
+
table?: string | undefined;
|
|
71
|
+
attachment?: string | undefined;
|
|
72
|
+
embed?: string | undefined;
|
|
73
|
+
} | undefined;
|
|
74
|
+
image?: {
|
|
75
|
+
empty?: string | undefined;
|
|
76
|
+
upload?: string | undefined;
|
|
77
|
+
embed?: string | undefined;
|
|
78
|
+
urlPlaceholder?: string | undefined;
|
|
79
|
+
apply?: string | undefined;
|
|
80
|
+
uploading?: string | undefined;
|
|
81
|
+
failed?: string | undefined;
|
|
82
|
+
caption?: string | undefined;
|
|
83
|
+
resize?: string | undefined;
|
|
84
|
+
} | undefined;
|
|
85
|
+
codeBlock?: {
|
|
86
|
+
language?: string | undefined;
|
|
87
|
+
plainText?: string | undefined;
|
|
88
|
+
} | undefined;
|
|
89
|
+
toggle?: {
|
|
90
|
+
expand?: string | undefined;
|
|
91
|
+
collapse?: string | undefined;
|
|
92
|
+
} | undefined;
|
|
93
|
+
callout?: {
|
|
94
|
+
change?: string | undefined;
|
|
95
|
+
tones?: {
|
|
96
|
+
info?: string | undefined;
|
|
97
|
+
tip?: string | undefined;
|
|
98
|
+
warning?: string | undefined;
|
|
99
|
+
danger?: string | undefined;
|
|
100
|
+
} | undefined;
|
|
101
|
+
} | undefined;
|
|
102
|
+
mention?: {
|
|
103
|
+
label?: string | undefined;
|
|
104
|
+
searching?: string | undefined;
|
|
105
|
+
noResults?: string | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
table?: {
|
|
108
|
+
row?: string | undefined;
|
|
109
|
+
column?: string | undefined;
|
|
110
|
+
insertAbove?: string | undefined;
|
|
111
|
+
insertBelow?: string | undefined;
|
|
112
|
+
insertLeft?: string | undefined;
|
|
113
|
+
insertRight?: string | undefined;
|
|
114
|
+
moveUp?: string | undefined;
|
|
115
|
+
moveDown?: string | undefined;
|
|
116
|
+
moveLeft?: string | undefined;
|
|
117
|
+
moveRight?: string | undefined;
|
|
118
|
+
deleteRow?: string | undefined;
|
|
119
|
+
deleteColumn?: string | undefined;
|
|
120
|
+
merge?: string | undefined;
|
|
121
|
+
split?: string | undefined;
|
|
122
|
+
clear?: string | undefined;
|
|
123
|
+
headerRow?: string | undefined;
|
|
124
|
+
headerColumn?: string | undefined;
|
|
125
|
+
alignLeft?: string | undefined;
|
|
126
|
+
alignCenter?: string | undefined;
|
|
127
|
+
alignRight?: string | undefined;
|
|
128
|
+
addRow?: string | undefined;
|
|
129
|
+
addColumn?: string | undefined;
|
|
130
|
+
} | undefined;
|
|
131
|
+
colors?: {
|
|
132
|
+
label?: string | undefined;
|
|
133
|
+
text?: string | undefined;
|
|
134
|
+
background?: string | undefined;
|
|
135
|
+
none?: string | undefined;
|
|
136
|
+
names?: {
|
|
137
|
+
gray?: string | undefined;
|
|
138
|
+
red?: string | undefined;
|
|
139
|
+
orange?: string | undefined;
|
|
140
|
+
yellow?: string | undefined;
|
|
141
|
+
green?: string | undefined;
|
|
142
|
+
blue?: string | undefined;
|
|
143
|
+
purple?: string | undefined;
|
|
144
|
+
pink?: string | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
} | undefined;
|
|
147
|
+
align?: {
|
|
148
|
+
label?: string | undefined;
|
|
149
|
+
left?: string | undefined;
|
|
150
|
+
center?: string | undefined;
|
|
151
|
+
right?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
attachment?: {
|
|
154
|
+
empty?: string | undefined;
|
|
155
|
+
upload?: string | undefined;
|
|
156
|
+
uploading?: string | undefined;
|
|
157
|
+
failed?: string | undefined;
|
|
158
|
+
retry?: string | undefined;
|
|
159
|
+
download?: string | undefined;
|
|
160
|
+
} | undefined;
|
|
161
|
+
embed?: {
|
|
162
|
+
empty?: string | undefined;
|
|
163
|
+
urlPlaceholder?: string | undefined;
|
|
164
|
+
apply?: string | undefined;
|
|
165
|
+
invalid?: string | undefined;
|
|
166
|
+
insecure?: string | undefined;
|
|
167
|
+
caption?: string | undefined;
|
|
168
|
+
edit?: string | undefined;
|
|
169
|
+
cancel?: string | undefined;
|
|
170
|
+
} | undefined;
|
|
171
|
+
noResults?: string | undefined;
|
|
172
|
+
addBlock?: string | undefined;
|
|
173
|
+
dragHandle?: string | undefined;
|
|
174
|
+
turnInto?: string | undefined;
|
|
175
|
+
duplicate?: string | undefined;
|
|
176
|
+
delete?: string | undefined;
|
|
177
|
+
moveUp?: string | undefined;
|
|
178
|
+
moveDown?: string | undefined;
|
|
179
|
+
bold?: string | undefined;
|
|
180
|
+
italic?: string | undefined;
|
|
181
|
+
underline?: string | undefined;
|
|
182
|
+
strike?: string | undefined;
|
|
183
|
+
code?: string | undefined;
|
|
184
|
+
link?: string | undefined;
|
|
185
|
+
linkPlaceholder?: string | undefined;
|
|
186
|
+
applyLink?: string | undefined;
|
|
187
|
+
removeLink?: string | undefined;
|
|
188
|
+
comment?: string | undefined;
|
|
189
|
+
commentThread?: string | undefined;
|
|
190
|
+
removedBlock?: string | undefined;
|
|
191
|
+
restored?: string | undefined;
|
|
192
|
+
changeAdded?: string | undefined;
|
|
193
|
+
changeRemoved?: string | undefined;
|
|
194
|
+
changeChanged?: string | undefined;
|
|
195
|
+
formatting?: string | undefined;
|
|
196
|
+
blockTypes?: string | undefined;
|
|
197
|
+
};
|
|
198
|
+
autofocus: boolean;
|
|
199
|
+
modelValue: EditorDocument<PartialBlock>;
|
|
200
|
+
readonly: boolean;
|
|
201
|
+
author: import("dou-ui").CommentAuthor;
|
|
202
|
+
compare: EditorDocument<PartialBlock> | null;
|
|
203
|
+
extensions: (import("./index.js").EditorExtension | import("./index.js").EditorExtension[])[];
|
|
204
|
+
searchable: boolean;
|
|
205
|
+
ariaLabel: string;
|
|
206
|
+
activeComment: string | null;
|
|
207
|
+
commentable: boolean;
|
|
208
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
209
|
+
declare const _default: typeof __VLS_export;
|
|
210
|
+
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,7 @@
|
|
|
1
|
+
import type { Block } from '../../core/model';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: Block;
|
|
4
|
+
};
|
|
5
|
+
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>;
|
|
6
|
+
declare const _default: typeof __VLS_export;
|
|
7
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Command, EditorState } from 'prosemirror-state';
|
|
2
|
+
import type { BlockAlign } from '../../core/align';
|
|
3
|
+
/**
|
|
4
|
+
* Align the selected blocks (or the block with `id`). `'left'` and `null`
|
|
5
|
+
* both go back to the reading direction, stored as no `align` at all.
|
|
6
|
+
* Blocks that can't be aligned are left alone.
|
|
7
|
+
*/
|
|
8
|
+
export declare function setAlign(align: BlockAlign | null, id?: string): Command;
|
|
9
|
+
/**
|
|
10
|
+
* The alignment the selected blocks share: `null` for none set, `'mixed'`
|
|
11
|
+
* when they differ, `undefined` when none can be aligned.
|
|
12
|
+
*/
|
|
13
|
+
export declare function currentAlign(state: EditorState): BlockAlign | 'mixed' | null | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { currentAlign, setAlign } from './commands';
|
|
2
|
+
/**
|
|
3
|
+
* Aligning paragraphs, headings and quotes left, centered or right: a menu
|
|
4
|
+
* in the formatting toolbar and in the block menu, and `Mod+Shift+L/E/R`.
|
|
5
|
+
* The blocks keep it as `props.align`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const align: import("../..").EditorExtension;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BlockProps } from '../../core/model';
|
|
2
|
+
import type { Uploads } from '../image/uploads';
|
|
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
|
+
uploads: Uploads;
|
|
13
|
+
accept?: string;
|
|
14
|
+
};
|
|
15
|
+
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>;
|
|
16
|
+
declare const _default: typeof __VLS_export;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Addresses an attachment may link to: web, relative, and files held in the page. */
|
|
2
|
+
export declare function isSafeFileSrc(src: string): boolean;
|
|
3
|
+
/** `1.2 MB`, `340 KB`, `12 B`. */
|
|
4
|
+
export declare function formatFileSize(size: unknown): string;
|
|
5
|
+
/** The kind of file, for its icon. */
|
|
6
|
+
export declare function fileKind(mime: string, name: string): 'image' | 'video' | 'audio' | 'archive' | 'text' | 'spreadsheet' | 'other';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EditorExtension } from '../../core/extension';
|
|
2
|
+
import { type FileUploader } from '../image/uploads';
|
|
3
|
+
import { formatFileSize, isSafeFileSrc } from './files';
|
|
4
|
+
export interface AttachmentOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Store the file and resolve with its address. Without it, files are
|
|
7
|
+
* kept in the document as data URLs, which suits trying things out but
|
|
8
|
+
* makes documents large.
|
|
9
|
+
*/
|
|
10
|
+
upload?: FileUploader;
|
|
11
|
+
/** The file types the picker offers, as the `accept` of a file input. */
|
|
12
|
+
accept?: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Attachment blocks: a file with its name and size and a download button.
|
|
16
|
+
* Files dropped or pasted into the editor become attachments (images stay
|
|
17
|
+
* images when the image block is there).
|
|
18
|
+
*/
|
|
19
|
+
export declare function attachment(options?: AttachmentOptions): EditorExtension;
|
|
20
|
+
export { formatFileSize, isSafeFileSrc, type FileUploader };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The paragraph itself is part of the frame; this adds its menu entry and shortcut. */
|
|
2
|
+
export declare const paragraph: import("..").EditorExtension;
|
|
3
|
+
/** Headings, levels 1 to 3. `# ` to `### ` turn a paragraph into one. */
|
|
4
|
+
export declare const heading: import("..").EditorExtension;
|
|
5
|
+
/** A quotation. `> ` turns a paragraph into one. */
|
|
6
|
+
export declare const quote: import("..").EditorExtension;
|
|
7
|
+
/** A horizontal line. `---` in an empty paragraph. */
|
|
8
|
+
export declare const divider: import("..").EditorExtension;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BlockProps } from '../../core/model';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
block: {
|
|
4
|
+
id: string;
|
|
5
|
+
type: string;
|
|
6
|
+
props: BlockProps;
|
|
7
|
+
};
|
|
8
|
+
updateProps: (props: BlockProps) => void;
|
|
9
|
+
selected: boolean;
|
|
10
|
+
editable: boolean;
|
|
11
|
+
};
|
|
12
|
+
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>;
|
|
13
|
+
declare const _default: typeof __VLS_export;
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type BlockOutput } from '../../core/output';
|
|
2
|
+
export declare const calloutOutput: BlockOutput;
|
|
3
|
+
/** `<aside data-callout>` from `blocksToHTML`, and quotes that start with `[!TIP]` as Markdown writes them. */
|
|
4
|
+
export declare function prepareCallouts(root: HTMLElement): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** The callout's tones and their icons. */
|
|
2
|
+
export declare const calloutTones: {
|
|
3
|
+
info: import("@dou-ui/icons").IconComponent;
|
|
4
|
+
tip: import("@dou-ui/icons").IconComponent;
|
|
5
|
+
warning: import("@dou-ui/icons").IconComponent;
|
|
6
|
+
danger: import("@dou-ui/icons").IconComponent;
|
|
7
|
+
};
|
|
8
|
+
export type CalloutTone = keyof typeof calloutTones;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockProps } from '../../core/model';
|
|
2
|
+
import type { CodeLanguage } from './languages';
|
|
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
|
+
languages: CodeLanguage[];
|
|
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,19 @@
|
|
|
1
|
+
import { type EditorExtension } from '../../core/extension';
|
|
2
|
+
import { type CodeHighlighter } from '../../core/highlight';
|
|
3
|
+
import { defaultLanguages, type CodeLanguage } from './languages';
|
|
4
|
+
export interface CodeBlockOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Highlights the code, the same function `DouCodeBlock` takes. Defaults
|
|
7
|
+
* to `DouCodeBlock.highlight` in the ConfigProvider's `defaults`; without
|
|
8
|
+
* either the code stays plain.
|
|
9
|
+
*/
|
|
10
|
+
highlight?: CodeHighlighter;
|
|
11
|
+
/** The languages offered in the picker. Strings serve as both value and name. */
|
|
12
|
+
languages?: (CodeLanguage | string)[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Code in a monospace font, without formatting, with a language picker and
|
|
16
|
+
* a copy button. ` ``` ` at the start of a block.
|
|
17
|
+
*/
|
|
18
|
+
export declare function codeBlock(options?: CodeBlockOptions): EditorExtension;
|
|
19
|
+
export { defaultLanguages, type CodeHighlighter, type CodeLanguage };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** A language in the code block's picker. `value` goes to the highlighter. */
|
|
2
|
+
export interface CodeLanguage {
|
|
3
|
+
value: string;
|
|
4
|
+
label: string;
|
|
5
|
+
}
|
|
6
|
+
/** Common languages, named as shiki names them. */
|
|
7
|
+
export declare const defaultLanguages: CodeLanguage[];
|
|
8
|
+
/** Strings name themselves. */
|
|
9
|
+
export declare const toLanguage: (item: CodeLanguage | string) => CodeLanguage;
|
|
@@ -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,7 @@
|
|
|
1
|
+
export { setHighlight, setTextColor, textColors, type TextColor } from './palette';
|
|
2
|
+
/**
|
|
3
|
+
* Text and background colors from a palette that follows the theme. The
|
|
4
|
+
* formatting toolbar gets a color menu; the text runs keep the names as
|
|
5
|
+
* `color` and `highlight`.
|
|
6
|
+
*/
|
|
7
|
+
export declare const colors: import("../..").EditorExtension;
|