@dou-ui/editor 0.0.0-stage → 0.1.0-alpha.0
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,7 @@
|
|
|
1
|
+
import type { Command } from 'prosemirror-state';
|
|
2
|
+
import { isColor, textColors, type TextColor } from '../../core/colors';
|
|
3
|
+
export { isColor, textColors, type TextColor };
|
|
4
|
+
/** Set (or with `null` clear) the text color of the selection. */
|
|
5
|
+
export declare function setTextColor(color: TextColor | null): Command;
|
|
6
|
+
/** Set (or with `null` clear) the background color of the selection. */
|
|
7
|
+
export declare function setHighlight(color: TextColor | null): Command;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EditorExtension } from '../core/extension';
|
|
2
|
+
import { divider, heading, paragraph, quote } from './blocks';
|
|
3
|
+
import { align } from './align';
|
|
4
|
+
import { callout } from './callout';
|
|
5
|
+
import { colors } from './colors';
|
|
6
|
+
import { codeBlock, type CodeBlockOptions } from './code-block';
|
|
7
|
+
import { formatting, link } from './formatting';
|
|
8
|
+
import { lists } from './lists';
|
|
9
|
+
import { table } from './table';
|
|
10
|
+
import { toggle } from './toggle';
|
|
11
|
+
export interface EditorKitOptions {
|
|
12
|
+
heading?: boolean;
|
|
13
|
+
lists?: boolean;
|
|
14
|
+
quote?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Options for the code block, e.g. its highlighter, or `false` to leave
|
|
17
|
+
* it out. Another code block extension takes its place, e.g.
|
|
18
|
+
* `codeEditorBlock()` from `@dou-ui/editor/code`.
|
|
19
|
+
*/
|
|
20
|
+
codeBlock?: boolean | CodeBlockOptions | EditorExtension;
|
|
21
|
+
divider?: boolean;
|
|
22
|
+
toggle?: boolean;
|
|
23
|
+
callout?: boolean;
|
|
24
|
+
table?: boolean;
|
|
25
|
+
formatting?: boolean;
|
|
26
|
+
link?: boolean;
|
|
27
|
+
/** Text and background colors. */
|
|
28
|
+
colors?: boolean;
|
|
29
|
+
/** Aligning paragraphs, headings and quotes. */
|
|
30
|
+
align?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The built-in blocks and formatting. Pass `false` for any part to leave
|
|
34
|
+
* it out, e.g. `editorKit({ codeBlock: false })`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function editorKit(options?: EditorKitOptions): EditorExtension[];
|
|
37
|
+
export { align, callout, colors, codeBlock, divider, formatting, heading, link, lists, paragraph, quote, table, toggle, };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockProps } from '../../core/model';
|
|
2
|
+
import { type EmbedTarget } from './targets';
|
|
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
|
+
resolve: (url: string) => EmbedTarget | null;
|
|
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,18 @@
|
|
|
1
|
+
import type { EditorExtension } from '../../core/extension';
|
|
2
|
+
import { resolveEmbed, type EmbedResolver, type EmbedTarget } from './targets';
|
|
3
|
+
export interface EmbedOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Turn a link into what the block shows: a frame, a video or an audio
|
|
6
|
+
* player, or `null` to refuse it. The block keeps the link itself, so a
|
|
7
|
+
* changed resolver applies to documents already written. Only https
|
|
8
|
+
* addresses are ever loaded. By default media files play in the browser's
|
|
9
|
+
* player and other pages show in a frame.
|
|
10
|
+
*/
|
|
11
|
+
resolve?: EmbedResolver;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Embed blocks: a web page, a video or an audio file from a link, with a
|
|
15
|
+
* caption. Only https links are embedded.
|
|
16
|
+
*/
|
|
17
|
+
export declare function embed(options?: EmbedOptions): EditorExtension;
|
|
18
|
+
export { resolveEmbed, type EmbedResolver, type EmbedTarget };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** What an embed block shows for its link. */
|
|
2
|
+
export interface EmbedTarget {
|
|
3
|
+
/** A web page in a frame, or the browser's own video or audio player. */
|
|
4
|
+
kind: 'frame' | 'video' | 'audio';
|
|
5
|
+
/** The address the frame or player loads; it may differ from the link, as for a player page. */
|
|
6
|
+
src: string;
|
|
7
|
+
/** Width over height of a frame or video. Default `16 / 9`. */
|
|
8
|
+
aspectRatio?: number;
|
|
9
|
+
/** A frame's fixed height in px, instead of `aspectRatio`. */
|
|
10
|
+
height?: number;
|
|
11
|
+
}
|
|
12
|
+
/** Turns a link into what the block shows, or `null` to refuse the link. */
|
|
13
|
+
export type EmbedResolver = (url: string) => EmbedTarget | null;
|
|
14
|
+
/** The link as a URL, when it is an absolute https address. */
|
|
15
|
+
export declare function httpsUrl(value: string): URL | null;
|
|
16
|
+
/**
|
|
17
|
+
* The default: https links only. Media files play in the browser's player,
|
|
18
|
+
* any other page shows in a frame. Frames of the editor's own site are
|
|
19
|
+
* refused whatever the resolver (see `checkTarget`).
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveEmbed: EmbedResolver;
|
|
22
|
+
/** What frames may do: run scripts, open links in a new tab, go full screen. */
|
|
23
|
+
export declare const frameSandbox = "allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox allow-presentation allow-forms";
|
|
24
|
+
export declare const frameAllow = "fullscreen; picture-in-picture; encrypted-media; clipboard-write";
|
|
25
|
+
/**
|
|
26
|
+
* A resolver's answer, checked: only https addresses get through, and no
|
|
27
|
+
* frame of the page's own site, which the sandbox would not keep apart
|
|
28
|
+
* (it allows scripts and the site's own storage). Without a page (on a
|
|
29
|
+
* server) the site is unknown: see the docs.
|
|
30
|
+
*/
|
|
31
|
+
export declare function checkTarget(target: EmbedTarget | null | undefined): EmbedTarget | null;
|
|
32
|
+
export declare function ratioOf(target: EmbedTarget): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Bold, italic, underline, strikethrough and inline code, with shortcuts and toolbar toggles. */
|
|
2
|
+
export declare const formatting: import("..").EditorExtension;
|
|
3
|
+
/**
|
|
4
|
+
* Links. Only web pages, mail, phone numbers and relative paths are kept;
|
|
5
|
+
* the formatting toolbar edits them, and `Mod+K` opens the editor for the
|
|
6
|
+
* selected text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const link: import("..").EditorExtension;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BlockProps } from '../../core/model';
|
|
2
|
+
import { type Uploads } from './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
|
+
};
|
|
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,16 @@
|
|
|
1
|
+
import type { EditorExtension } from '../../core/extension';
|
|
2
|
+
import { isSafeImageSrc, readAsDataUrl, type FileUploader } from './uploads';
|
|
3
|
+
export interface ImageOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Store a picked, pasted or dropped file and resolve with its address.
|
|
6
|
+
* Without it, images are kept in the document as data URLs, which suits
|
|
7
|
+
* trying things out but makes documents large.
|
|
8
|
+
*/
|
|
9
|
+
upload?: FileUploader;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Image blocks: upload a file, paste or drop images, or embed a link. The
|
|
13
|
+
* image can be resized and given a caption.
|
|
14
|
+
*/
|
|
15
|
+
export declare function image(options?: ImageOptions): EditorExtension;
|
|
16
|
+
export { isSafeImageSrc, readAsDataUrl, type FileUploader };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { EditorView } from 'prosemirror-view';
|
|
2
|
+
/** Stores a picked, pasted or dropped file (an image or an attachment) and resolves with its address. */
|
|
3
|
+
export type FileUploader = (file: File) => Promise<string>;
|
|
4
|
+
/** Without an uploader the image is kept in the document as a data URL. */
|
|
5
|
+
export declare const readAsDataUrl: FileUploader;
|
|
6
|
+
/** Image addresses that are safe to show: web, relative, and images held in the page. */
|
|
7
|
+
export declare function isSafeImageSrc(src: string): boolean;
|
|
8
|
+
export interface Upload {
|
|
9
|
+
/** A local copy shown while uploading. */
|
|
10
|
+
preview: string;
|
|
11
|
+
failed: boolean;
|
|
12
|
+
}
|
|
13
|
+
/** What blocks hold uploaded files: an image or an attachment. */
|
|
14
|
+
export interface UploadTarget {
|
|
15
|
+
/** The block type. */
|
|
16
|
+
type: string;
|
|
17
|
+
/** Whether an uploader's address may be stored. */
|
|
18
|
+
isSafe: (src: string) => boolean;
|
|
19
|
+
/** Props taken from the file when it is picked, e.g. its name and size. */
|
|
20
|
+
propsOf?: (file: File) => Record<string, unknown>;
|
|
21
|
+
/** The addresses `isSafe` takes, for the warning when an uploader returns another. */
|
|
22
|
+
allowed: string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Uploads in progress, by block id. They live outside the document: only
|
|
26
|
+
* the finished address is written into it, so other collaborators never
|
|
27
|
+
* see a half-done image.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createUploads(upload: FileUploader, target?: UploadTarget): {
|
|
30
|
+
items: import("vue").Reactive<Map<string, Upload>>;
|
|
31
|
+
start: (view: EditorView, id: string, file: File, describe?: boolean) => void;
|
|
32
|
+
insert: (view: EditorView, files: File[], pos: number) => number;
|
|
33
|
+
setSrc: (view: EditorView, id: string, src: string) => void;
|
|
34
|
+
};
|
|
35
|
+
export type Uploads = ReturnType<typeof createUploads>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type BlockOutputContext } from '../core/output';
|
|
2
|
+
/**
|
|
3
|
+
* Lists from other apps nest a list inside an item (`<li>text<ul>…</ul></li>`),
|
|
4
|
+
* but a list item here is a block of text with child blocks. Rewrite them
|
|
5
|
+
* into blocks before parsing, so nesting survives. Task lists
|
|
6
|
+
* (`<li><input type="checkbox">`, or `[ ]` / `[x]` before the text as
|
|
7
|
+
* Markdown writes them) become to-do items.
|
|
8
|
+
*/
|
|
9
|
+
export declare function prepareLists(root: HTMLElement): void;
|
|
10
|
+
/** A list item in Markdown: the marker, the text, and the children indented under it. */
|
|
11
|
+
export declare function listItemMarkdown(marker: string, { content, children }: BlockOutputContext): string;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bulleted, numbered and to-do lists. Each item is a block of its own:
|
|
3
|
+
* `Enter` continues the list, `Tab` nests an item. Pasted HTML lists keep
|
|
4
|
+
* their nesting, and task lists become to-do items.
|
|
5
|
+
*/
|
|
6
|
+
export declare const lists: import("..").EditorExtension;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type EditorExtension } from '../../core/extension';
|
|
2
|
+
import { type MentionItem } from './state';
|
|
3
|
+
export interface MentionOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Finds who matches what was typed after the `@` (empty right after it).
|
|
6
|
+
* Can return a Promise; only the answer to the latest query is shown.
|
|
7
|
+
*/
|
|
8
|
+
search: (query: string) => MentionItem[] | Promise<MentionItem[]>;
|
|
9
|
+
}
|
|
10
|
+
export declare function mention(options: MentionOptions): EditorExtension;
|
|
11
|
+
export type { MentionItem };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type MentionItem } from './state';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
search: (query: string) => MentionItem[] | Promise<MentionItem[]>;
|
|
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,28 @@
|
|
|
1
|
+
import { Plugin, PluginKey, type EditorState } from 'prosemirror-state';
|
|
2
|
+
import type { EditorView } from 'prosemirror-view';
|
|
3
|
+
/** Someone (or something) that can be mentioned. */
|
|
4
|
+
export interface MentionItem {
|
|
5
|
+
/** Stored in the document. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Shown after the `@`, and stored too so the mention reads without a lookup. */
|
|
8
|
+
label: string;
|
|
9
|
+
/** A second line in the suggestions, e.g. a team or an email. */
|
|
10
|
+
description?: string;
|
|
11
|
+
/** An image shown in the suggestions. */
|
|
12
|
+
avatar?: string;
|
|
13
|
+
}
|
|
14
|
+
/** The suggestions: open from the `@` at `from` to the cursor, with what was typed as the query. */
|
|
15
|
+
export interface MentionState {
|
|
16
|
+
from: number;
|
|
17
|
+
query: string;
|
|
18
|
+
items: MentionItem[];
|
|
19
|
+
active: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const mentionKey: PluginKey<MentionState | null>;
|
|
22
|
+
export declare function getMention(state: EditorState | null): MentionState | null;
|
|
23
|
+
export declare const closeMention: (view: EditorView) => void;
|
|
24
|
+
export declare const setMentionItems: (view: EditorView, items: MentionItem[]) => void;
|
|
25
|
+
export declare const setMentionActive: (view: EditorView, active: number) => void;
|
|
26
|
+
/** Replace the `@query` with a mention and a space after it. */
|
|
27
|
+
export declare function chooseMention(view: EditorView, item: MentionItem): void;
|
|
28
|
+
export declare function mentionPlugin(): Plugin<MentionState | null>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Node as PMNode, ResolvedPos } from 'prosemirror-model';
|
|
2
|
+
import { type Command, type EditorState, type Transaction } from 'prosemirror-state';
|
|
3
|
+
import { TableMap } from 'prosemirror-tables';
|
|
4
|
+
import { type TableAlign } from './schema';
|
|
5
|
+
/** The table around the selection: its node, position and grid. */
|
|
6
|
+
export interface TableAt {
|
|
7
|
+
node: PMNode;
|
|
8
|
+
/** Position right before the table node. */
|
|
9
|
+
pos: number;
|
|
10
|
+
map: TableMap;
|
|
11
|
+
}
|
|
12
|
+
export declare function tableAt($pos: ResolvedPos): TableAt | null;
|
|
13
|
+
/** Add a column before or after the selected ones. */
|
|
14
|
+
export declare function insertColumn(side: 'before' | 'after'): Command;
|
|
15
|
+
/** Add a row above or below the selected ones. */
|
|
16
|
+
export declare function insertRow(side: 'before' | 'after'): Command;
|
|
17
|
+
/** Remove the selected columns; not all of them (that is deleting the table). */
|
|
18
|
+
export declare const deleteColumns: Command;
|
|
19
|
+
/** Remove the selected rows; not all of them. */
|
|
20
|
+
export declare const deleteRows: Command;
|
|
21
|
+
/**
|
|
22
|
+
* Where rows (or columns) can be cut: the boundaries no merged cell
|
|
23
|
+
* crosses. A run of rows between two of them moves as one.
|
|
24
|
+
*/
|
|
25
|
+
export declare function boundaries(map: TableMap, axis: 'row' | 'column'): number[];
|
|
26
|
+
/** The run of rows (or columns) that holds `[from, to)` and can move as one. */
|
|
27
|
+
export declare function band(map: TableMap, axis: 'row' | 'column', from: number, to: number): {
|
|
28
|
+
start: number;
|
|
29
|
+
end: number;
|
|
30
|
+
cuts: number[];
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Move the selected rows (or columns), with any merged cells they belong
|
|
34
|
+
* to, one step up or down (left or right). Ids, widths and alignment move
|
|
35
|
+
* along.
|
|
36
|
+
*/
|
|
37
|
+
export declare function moveLines(axis: 'row' | 'column', direction: -1 | 1): Command;
|
|
38
|
+
/**
|
|
39
|
+
* Move rows (or columns) `[start, end)` of the table at `tablePos` to the
|
|
40
|
+
* boundary `to`, given as the index of the line they go before. Both the
|
|
41
|
+
* run and `to` have to be on boundaries no merged cell crosses.
|
|
42
|
+
*/
|
|
43
|
+
export declare function moveLinesTo(tablePos: number, axis: 'row' | 'column', start: number, end: number, to: number): Command;
|
|
44
|
+
/** Select whole rows (or columns) `[from, to)` of the table at `tablePos`. */
|
|
45
|
+
export declare function selectLines(tr: Transaction, tablePos: number, axis: 'row' | 'column', from: number, to: number): Transaction;
|
|
46
|
+
/**
|
|
47
|
+
* Merge the selected cells into the top-left one. Their text joins it,
|
|
48
|
+
* each on a line of its own.
|
|
49
|
+
*/
|
|
50
|
+
export declare const mergeCells: Command;
|
|
51
|
+
/** Whether the selection is in (or on) a merged cell. */
|
|
52
|
+
export declare function inMergedCell(state: EditorState): boolean;
|
|
53
|
+
/** Split a merged cell back into single cells; its text stays in the first. */
|
|
54
|
+
export declare const splitMergedCell: Command;
|
|
55
|
+
/** Empty the selected cells. */
|
|
56
|
+
export declare const clearCells: Command;
|
|
57
|
+
/** Align the text of the selected columns. */
|
|
58
|
+
export declare function alignColumns(align: TableAlign | null): Command;
|
|
59
|
+
/** Turn the first row (or column) into a header, or back. */
|
|
60
|
+
export declare function toggleHeader(which: 'headerRow' | 'headerColumn'): Command;
|
|
61
|
+
/**
|
|
62
|
+
* `Tab` / `Shift+Tab`: the next or previous cell, its text selected.
|
|
63
|
+
* `Tab` in the last cell adds a row.
|
|
64
|
+
*/
|
|
65
|
+
export declare function goToCell(direction: 1 | -1): Command;
|
|
66
|
+
/** `Enter`: the cell below, adding a row at the bottom. */
|
|
67
|
+
export declare const goDown: Command;
|
|
68
|
+
/** `Backspace` at the start of a cell, `Delete` at its end: nothing, so cells never join. */
|
|
69
|
+
export declare function stopAtCellEdge(side: 'start' | 'end'): Command;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { BlockOutput } from '../../core/output';
|
|
2
|
+
export declare const tableOutput: BlockOutput;
|
|
3
|
+
/** Get pasted and imported tables ready: widths onto the cells, and each cell down to one line of text. */
|
|
4
|
+
export declare function prepareTables(root: HTMLElement): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tables: rows and columns of formatted text. Cells can be merged; rows
|
|
3
|
+
* and columns are added, moved and removed from the handles on their
|
|
4
|
+
* edges, and columns resized by dragging their borders.
|
|
5
|
+
*/
|
|
6
|
+
export declare const table: import("../..").EditorExtension;
|
|
7
|
+
export { alignColumns, clearCells, deleteColumns, deleteRows, insertColumn, insertRow, mergeCells, moveLines, moveLinesTo, splitMergedCell, toggleHeader, } from './commands';
|
|
8
|
+
export type { TableAlign, TableColumn } from './schema';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { NodeSpec } from 'prosemirror-model';
|
|
2
|
+
import { type RowsSpec } from '../../core/model';
|
|
3
|
+
/** A column of a table: a stable id, and how its cells align. */
|
|
4
|
+
export interface TableColumn {
|
|
5
|
+
id: string;
|
|
6
|
+
/** In pixels; without it the column takes its share of the width. */
|
|
7
|
+
width?: number;
|
|
8
|
+
align?: TableAlign;
|
|
9
|
+
}
|
|
10
|
+
export type TableAlign = 'left' | 'center' | 'right';
|
|
11
|
+
/** The columns as stored on the table node: id and alignment (widths live on the cells). */
|
|
12
|
+
interface StoredColumn {
|
|
13
|
+
id: string;
|
|
14
|
+
align?: TableAlign;
|
|
15
|
+
}
|
|
16
|
+
export declare const isAlign: (value: unknown) => value is TableAlign;
|
|
17
|
+
/** One column record per column of the grid, keeping ids and alignment that are there. */
|
|
18
|
+
export declare function fitColumns(columns: unknown, width: number): StoredColumn[];
|
|
19
|
+
export declare const isHeaderAt: (attrs: Record<string, unknown>, row: number, col: number) => boolean;
|
|
20
|
+
export declare const tableRows: RowsSpec;
|
|
21
|
+
export declare const tableSpec: NodeSpec;
|
|
22
|
+
export declare const tableNodes: Record<string, NodeSpec>;
|
|
23
|
+
export {};
|
|
@@ -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,13 @@
|
|
|
1
|
+
import type { Node as PMNode } from 'prosemirror-model';
|
|
2
|
+
import { TableView } from 'prosemirror-tables';
|
|
3
|
+
import type { NodeView, ViewMutationRecord } from 'prosemirror-view';
|
|
4
|
+
/** The narrowest a column gets, without a width of its own and when resized. */
|
|
5
|
+
export declare const CELL_MIN_WIDTH = 96;
|
|
6
|
+
/**
|
|
7
|
+
* A table in the editor: a scrolling frame (the block's content element)
|
|
8
|
+
* around the table, with a `<colgroup>` that holds the column widths.
|
|
9
|
+
*/
|
|
10
|
+
export declare class TableBlockView extends TableView implements NodeView {
|
|
11
|
+
constructor(node: PMNode);
|
|
12
|
+
ignoreMutation(record: ViewMutationRecord): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { isToggleOpen } from './state';
|
|
2
|
+
/**
|
|
3
|
+
* A toggle: a title with a button that shows or hides the blocks nested
|
|
4
|
+
* under it. Whether it is open belongs to the reader, not the document.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toggle: import("../..").EditorExtension;
|
|
7
|
+
export { isToggleOpen };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Plugin, PluginKey, type EditorState } from 'prosemirror-state';
|
|
2
|
+
import { DecorationSet, type EditorView } from 'prosemirror-view';
|
|
3
|
+
/**
|
|
4
|
+
* Which toggles are closed, by block id. This is how one reader sees the
|
|
5
|
+
* document, not part of it: opening a toggle does not change the document,
|
|
6
|
+
* works while read-only, and is not shared with collaborators.
|
|
7
|
+
*/
|
|
8
|
+
interface ToggleState {
|
|
9
|
+
closed: ReadonlySet<string>;
|
|
10
|
+
decorations: DecorationSet;
|
|
11
|
+
}
|
|
12
|
+
export declare const toggleKey: PluginKey<ToggleState>;
|
|
13
|
+
export declare function togglePlugin(): Plugin<ToggleState>;
|
|
14
|
+
export declare function isToggleOpen(state: EditorState | null, id: string): boolean;
|
|
15
|
+
/** Open or close the toggle with this block id. */
|
|
16
|
+
export declare function flipToggle(view: EditorView, id: string): void;
|
|
17
|
+
export {};
|
|
@@ -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;
|