xiaodao-editor 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.ZH.md +191 -68
- package/README.md +230 -78
- package/dist/block-editor.js +10444 -20908
- package/dist/block-editor.umd.cjs +30 -285
- package/dist/core/Editor.d.ts +32 -0
- package/dist/core/command/primitiveCommands.d.ts +1 -1
- package/dist/core/plugin/Plugin.d.ts +45 -5
- package/dist/core/state/EditorState.d.ts +5 -2
- package/dist/core/state/invert.d.ts +2 -2
- package/dist/core/types.d.ts +1 -1
- package/dist/extensions/Equation.d.ts +73 -8
- package/dist/extensions/Image.d.ts +54 -17
- package/dist/extensions/OrderedList.d.ts +1 -1
- package/dist/extensions/Paragraph.d.ts +1 -1
- package/dist/extensions/Table.d.ts +1 -1
- package/dist/extensions/math/ast.d.ts +140 -0
- package/dist/extensions/math/index.d.ts +18 -0
- package/dist/extensions/math/parser.d.ts +5 -0
- package/dist/extensions/math/renderHtml.d.ts +5 -0
- package/dist/extensions/math/renderTree.d.ts +16 -0
- package/dist/extensions/math/renderVNode.d.ts +4 -0
- package/dist/extensions/math/symbols.d.ts +37 -0
- package/dist/extensions/math/tokens.d.ts +22 -0
- package/dist/extensions/tableModel.d.ts +6 -6
- package/dist/i18n.d.ts +2 -2
- package/dist/index.d.ts +6 -3
- package/dist/style.css +1 -1
- package/dist/view/BlockEditor.vue.d.ts +0 -30
- package/dist/view/BlockList.vue.d.ts +2 -2
- package/dist/view/context.d.ts +11 -2
- package/dist/view/imageUpload.d.ts +20 -14
- package/dist/view/ui/icons.d.ts +22 -22
- package/dist/view/ui/inputRulesEngine.d.ts +2 -2
- package/dist/view/ui/popup.d.ts +1 -1
- package/dist/view/urlUtils.d.ts +2 -2
- package/package.json +2 -3
|
@@ -2,7 +2,6 @@ import { Extension } from '../core/extension/Extension';
|
|
|
2
2
|
import { DocumentData } from '../core/types';
|
|
3
3
|
import { Editor } from '../core/Editor';
|
|
4
4
|
import { Theme, Locale } from '../i18n';
|
|
5
|
-
import { UploadImageHandler } from './imageUpload';
|
|
6
5
|
declare const _default: import('vue').DefineComponent<{
|
|
7
6
|
extensions?: readonly Extension[];
|
|
8
7
|
modelValue?: DocumentData;
|
|
@@ -12,19 +11,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
12
11
|
theme?: Theme | string;
|
|
13
12
|
/** 'zh-CN' (default) or 'en-US'. Any non-empty non-'zh-CN' value ⇒ en-US. */
|
|
14
13
|
locale?: Locale | string;
|
|
15
|
-
/**
|
|
16
|
-
* Optional: image upload delegation function. When provided, the editor
|
|
17
|
-
* delegates image uploads to this function instead of using the built-in
|
|
18
|
-
* mock upload. The function receives the file name, File, an
|
|
19
|
-
* AbortController (aborted if the block is removed or the editor unmounts),
|
|
20
|
-
* and an onProgress callback (0–100). It must return a Promise that
|
|
21
|
-
* resolves with the final uploaded URL or rejects with an error.
|
|
22
|
-
*
|
|
23
|
-
* If omitted, the editor falls back to an internal mock upload that stores
|
|
24
|
-
* the file in memory as an object URL — fine for demos but NOT for
|
|
25
|
-
* persisted documents.
|
|
26
|
-
*/
|
|
27
|
-
uploadImage?: UploadImageHandler;
|
|
28
14
|
/** Optional: fixed width for the editor (e.g. '800px', '100%', 600). */
|
|
29
15
|
width?: string | number;
|
|
30
16
|
/** Optional: fixed height for the editor. When set, the editor scrolls
|
|
@@ -41,7 +27,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
41
27
|
editor: Editor;
|
|
42
28
|
}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
43
29
|
"update:modelValue": (args_0: DocumentData) => any;
|
|
44
|
-
"cleanup:image-file": (fileId: number) => any;
|
|
45
30
|
}, string, import('vue').PublicProps, Readonly<{
|
|
46
31
|
extensions?: readonly Extension[];
|
|
47
32
|
modelValue?: DocumentData;
|
|
@@ -51,19 +36,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
51
36
|
theme?: Theme | string;
|
|
52
37
|
/** 'zh-CN' (default) or 'en-US'. Any non-empty non-'zh-CN' value ⇒ en-US. */
|
|
53
38
|
locale?: Locale | string;
|
|
54
|
-
/**
|
|
55
|
-
* Optional: image upload delegation function. When provided, the editor
|
|
56
|
-
* delegates image uploads to this function instead of using the built-in
|
|
57
|
-
* mock upload. The function receives the file name, File, an
|
|
58
|
-
* AbortController (aborted if the block is removed or the editor unmounts),
|
|
59
|
-
* and an onProgress callback (0–100). It must return a Promise that
|
|
60
|
-
* resolves with the final uploaded URL or rejects with an error.
|
|
61
|
-
*
|
|
62
|
-
* If omitted, the editor falls back to an internal mock upload that stores
|
|
63
|
-
* the file in memory as an object URL — fine for demos but NOT for
|
|
64
|
-
* persisted documents.
|
|
65
|
-
*/
|
|
66
|
-
uploadImage?: UploadImageHandler;
|
|
67
39
|
/** Optional: fixed width for the editor (e.g. '800px', '100%', 600). */
|
|
68
40
|
width?: string | number;
|
|
69
41
|
/** Optional: fixed height for the editor. When set, the editor scrolls
|
|
@@ -78,7 +50,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
78
50
|
toolbarPosition?: "auto" | "top" | "bottom" | "float";
|
|
79
51
|
}> & Readonly<{
|
|
80
52
|
"onUpdate:modelValue"?: ((args_0: DocumentData) => any) | undefined;
|
|
81
|
-
"onCleanup:image-file"?: ((fileId: number) => any) | undefined;
|
|
82
53
|
}>, {
|
|
83
54
|
width: string | number;
|
|
84
55
|
height: string | number;
|
|
@@ -88,7 +59,6 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
88
59
|
modelValue: DocumentData;
|
|
89
60
|
theme: Theme | string;
|
|
90
61
|
locale: Locale | string;
|
|
91
|
-
uploadImage: UploadImageHandler;
|
|
92
62
|
toolbarPosition: "auto" | "top" | "bottom" | "float";
|
|
93
63
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
94
64
|
export default _default;
|
|
@@ -4,7 +4,7 @@ type DropPosition = 'before' | 'after' | 'first' | 'last' | 'into';
|
|
|
4
4
|
declare function setBlockHandleDragging(blockId: BlockId, active: boolean): void;
|
|
5
5
|
declare const _default: import('vue').DefineComponent<{
|
|
6
6
|
items: readonly BlockRenderItem[];
|
|
7
|
-
/** Readonly Map<BlockId, Block> view of DocState.blocks
|
|
7
|
+
/** Readonly Map<BlockId, Block> view of DocState.blocks: used by nested
|
|
8
8
|
* lists to resolve children block snapshots for the recursive items. */
|
|
9
9
|
blocksMap: ReadonlyMap<BlockId, Block>;
|
|
10
10
|
firstBlockPlaceholder?: string;
|
|
@@ -34,7 +34,7 @@ declare const _default: import('vue').DefineComponent<{
|
|
|
34
34
|
hoverChange: (blockId: BlockId | null) => any;
|
|
35
35
|
}, string, import('vue').PublicProps, Readonly<{
|
|
36
36
|
items: readonly BlockRenderItem[];
|
|
37
|
-
/** Readonly Map<BlockId, Block> view of DocState.blocks
|
|
37
|
+
/** Readonly Map<BlockId, Block> view of DocState.blocks: used by nested
|
|
38
38
|
* lists to resolve children block snapshots for the recursive items. */
|
|
39
39
|
blocksMap: ReadonlyMap<BlockId, Block>;
|
|
40
40
|
firstBlockPlaceholder?: string;
|
package/dist/view/context.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Block, BlockId } from '../core/types';
|
|
|
4
4
|
/**
|
|
5
5
|
* Injection key for the reactive `isMobile` flag. Provided by BlockEditor so
|
|
6
6
|
* child components (TableBlock, FixedToolbar, …) can adapt their rendering
|
|
7
|
-
* for touch devices. Uses `(pointer: coarse)` matchMedia
|
|
7
|
+
* for touch devices. Uses `(pointer: coarse)` matchMedia: matches iOS /
|
|
8
8
|
* iPadOS / Android browsers.
|
|
9
9
|
*/
|
|
10
10
|
export declare const mobileKey: InjectionKey<Ref<boolean>>;
|
|
@@ -56,7 +56,7 @@ export interface FixedToolbarDescriptor {
|
|
|
56
56
|
onTableCopy?: () => void;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
|
-
* Injection key for the fixed-toolbar bridge
|
|
59
|
+
* Injection key for the fixed-toolbar bridge: a reactive ref holding the
|
|
60
60
|
* **table-sourced** descriptor (or null). BlockEditor provides it; TableBlock
|
|
61
61
|
* injects it and publishes its toolbar state when running with a fixed
|
|
62
62
|
* toolbar. The text-block descriptor is computed directly inside
|
|
@@ -86,6 +86,15 @@ export declare const editableKey: InjectionKey<Ref<boolean>>;
|
|
|
86
86
|
* can initiate an image upload against the correct upload target block,
|
|
87
87
|
* with proper transient state management and document updating.
|
|
88
88
|
*
|
|
89
|
+
* The function itself is owned by `ImageExtension`, which registers it as
|
|
90
|
+
* an async `startImageUpload` extension method via
|
|
91
|
+
* `createImageExtension({ upload, onFileCleanup })`. BlockEditor simply
|
|
92
|
+
* looks it up with `editor.getExtensionMethod('startImageUpload')` and
|
|
93
|
+
* publishes it here when present: so `<BlockEditor>` has zero
|
|
94
|
+
* image-specific knowledge. If the consumer doesn't include an
|
|
95
|
+
* Image extension (or doesn't provide an upload handler), this injection
|
|
96
|
+
* is omitted and child components no-op gracefully.
|
|
97
|
+
*
|
|
89
98
|
* The callback returns the BlockId of the NEW (or existing) image block so
|
|
90
99
|
* the caller can set focus / selection if needed.
|
|
91
100
|
*/
|
|
@@ -20,8 +20,9 @@ export interface UploadState {
|
|
|
20
20
|
* removed or the editor is unmounted. */
|
|
21
21
|
readonly controller?: AbortController;
|
|
22
22
|
}
|
|
23
|
-
/** UploadResult: the final outcome handed back from the upload handler
|
|
24
|
-
*
|
|
23
|
+
/** UploadResult: the final outcome handed back from the upload handler
|
|
24
|
+
* (either an external `UploadImageHandler` injected via
|
|
25
|
+
* `createImageExtension({ upload })`, or the internal `mockUpload`). */
|
|
25
26
|
export interface UploadResult {
|
|
26
27
|
readonly url: string;
|
|
27
28
|
readonly width?: number;
|
|
@@ -29,14 +30,16 @@ export interface UploadResult {
|
|
|
29
30
|
readonly alt?: string;
|
|
30
31
|
readonly title?: string;
|
|
31
32
|
/** Optional server-managed file identifier (integer). When provided,
|
|
32
|
-
* the
|
|
33
|
-
*
|
|
33
|
+
* the `image-upload` plugin tracks references and invokes
|
|
34
|
+
* `createImageExtension({ onFileCleanup })` when the last block
|
|
35
|
+
* referencing this fileId is removed. */
|
|
34
36
|
readonly fileId?: number;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
|
-
* The public-facing result type returned by the `
|
|
38
|
-
*
|
|
39
|
-
*
|
|
39
|
+
* The public-facing result type returned by the `UploadImageHandler`
|
|
40
|
+
* passed to `createImageExtension({ upload })`. Identical to
|
|
41
|
+
* `UploadResult` but exported under a separate name so consumers have
|
|
42
|
+
* a clean public API type.
|
|
40
43
|
*/
|
|
41
44
|
export interface ImageUploadResult {
|
|
42
45
|
readonly url: string;
|
|
@@ -45,18 +48,20 @@ export interface ImageUploadResult {
|
|
|
45
48
|
readonly alt?: string;
|
|
46
49
|
readonly title?: string;
|
|
47
50
|
/** Optional server-managed file identifier (integer). When provided,
|
|
48
|
-
* the
|
|
49
|
-
*
|
|
51
|
+
* the `image-upload` plugin tracks references and invokes
|
|
52
|
+
* `createImageExtension({ onFileCleanup })` when the last block
|
|
53
|
+
* referencing this fileId is removed. */
|
|
50
54
|
readonly fileId?: number;
|
|
51
55
|
}
|
|
52
56
|
/**
|
|
53
|
-
* The `
|
|
54
|
-
*
|
|
57
|
+
* The `UploadImageHandler` signature. Consumers inject an upload
|
|
58
|
+
* function via `createImageExtension({ upload })`: the editor no
|
|
59
|
+
* longer carries an `uploadImage` prop.
|
|
55
60
|
*
|
|
56
61
|
* The function receives:
|
|
57
62
|
* - name: the original file name (file.name)
|
|
58
63
|
* - file: the File object to upload
|
|
59
|
-
* - controller: AbortController
|
|
64
|
+
* - controller: AbortController: the editor will call .abort() if the
|
|
60
65
|
* image block is removed or the editor is unmounted
|
|
61
66
|
* - onProgress: callback to report progress as 0–100
|
|
62
67
|
*
|
|
@@ -110,8 +115,9 @@ type Result<T, E> = {
|
|
|
110
115
|
* configured. Produces a blob: object URL in ~600 ms with fake progress.
|
|
111
116
|
*
|
|
112
117
|
* IMPORTANT: blob: object URLs are NOT serialisable across page reloads.
|
|
113
|
-
* Consumers that intend to persist and reload documents MUST
|
|
114
|
-
* `
|
|
118
|
+
* Consumers that intend to persist and reload documents MUST compose
|
|
119
|
+
* `createImageExtension({ upload: ... })` with a real handler. This mock
|
|
120
|
+
* exists purely so the editor still works
|
|
115
121
|
* out of the box in demos and tests.
|
|
116
122
|
*/
|
|
117
123
|
export declare function mockUpload(file: File, onProgress?: (progress01: number) => void): Promise<UploadResult>;
|
package/dist/view/ui/icons.d.ts
CHANGED
|
@@ -5,51 +5,51 @@
|
|
|
5
5
|
* All icons use a 1024×1024 viewBox with `currentColor` fill so they adapt
|
|
6
6
|
* to the surrounding text color.
|
|
7
7
|
*/
|
|
8
|
-
/** Paragraph
|
|
8
|
+
/** Paragraph: uppercase "T" glyph drawn as two merged rounded-rect strokes. */
|
|
9
9
|
export declare const ICON_PARAGRAPH = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M426.666667 939.050667a32 32 0 1 1 0-64h53.333333V160H235.093333V170.666667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667A32 32 0 0 1 171.093333 170.666667V128a32 32 0 0 1 32-32H820.693333a32 32 0 0 1 31.701334 27.648l0.298666 4.352v42.666667a32 32 0 1 1-64 0l-0.042666-10.666667H544v715.050667H597.333333a32 32 0 0 1 31.701334 27.648l0.298666 4.352a32 32 0 0 1-32 32h-170.666666z\" fill=\"currentColor\"/></svg>";
|
|
10
|
-
/** H1
|
|
10
|
+
/** H1: digit "1": simple vertical post with a short left serif (top). */
|
|
11
11
|
export declare const ICON_H1 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z M848.512 366.933333A32 32 0 0 1 896 394.965333v426.666667a32 32 0 1 1-64 0v-372.565333l-80.554667 44.416a32 32 0 0 1-41.130666-8.96l-2.346667-3.626667a32 32 0 0 1 12.586667-43.477333l128-70.485334z\" fill=\"currentColor\"/></svg>";
|
|
12
|
-
/** H2
|
|
12
|
+
/** H2: digit "2": mirrored-S arc flowing into a horizontal baseline bar. */
|
|
13
13
|
export declare const ICON_H2 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z M786.133333 362.666667a152.661333 152.661333 0 0 1 107.946667 260.693333l-166.058667 165.973333h178.773334a32 32 0 0 1 31.744 27.648l0.256 4.352a32 32 0 0 1-32 32h-256a32 32 0 0 1-22.613334-54.613333l220.672-220.672A88.661333 88.661333 0 0 0 786.133333 426.666667h-7.338666a96 96 0 0 0-96 96v20.565333a32 32 0 0 1-64 0v-20.565333a160 160 0 0 1 160-160h7.338666z\" fill=\"currentColor\"/></svg>";
|
|
14
|
-
/** H3
|
|
14
|
+
/** H3: digit "3": rounded double-stack form (upper + lower lobes). */
|
|
15
15
|
export declare const ICON_H3 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z m362.410667 192a32 32 0 0 1 22.613333 54.656L809.813333 536.746667l1.792 0.341333a160.085333 160.085333 0 0 1 126.506667 148.053333l0.256 8.490667a160 160 0 0 1-310.912 53.248 32 32 0 0 1 60.373333-21.333333 96 96 0 1 0 90.538667-127.914667h-42.666667a32 32 0 0 1-22.613333-54.613333l116.010667-116.053334h-178.773334a32 32 0 0 1-31.701333-27.648l-0.256-4.352a32 32 0 0 1 32-32h256z\" fill=\"currentColor\"/></svg>";
|
|
16
|
-
/** H4
|
|
16
|
+
/** H4: digit "4": vertical post + horizontal crossbar + diagonal connector. */
|
|
17
17
|
export declare const ICON_H4 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z m244.309333 193.493333a32 32 0 0 1 20.992 40.106667l-93.738666 299.776h116.48v-96a32 32 0 0 1 64 0v96h10.666666a32 32 0 0 1 31.744 27.648l0.298667 4.352a32 32 0 0 1-32 32H896v53.333333a32 32 0 1 1-64 0v-53.333333h-160a32 32 0 0 1-30.506667-41.557334l106.666667-341.333333a32 32 0 0 1 40.106667-20.992z\" fill=\"currentColor\"/></svg>";
|
|
18
|
-
/** H5
|
|
18
|
+
/** H5: digit "5": top bar + left stem + mid bar + sweeping lower arc. */
|
|
19
19
|
export declare const ICON_H5 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z m363.477333 192.426666a32 32 0 1 1 0 64h-145.706666l-28.245334 113.450667 5.12-1.493333a160.042667 160.042667 0 0 1 100.949334 6.4l9.472 4.266666a160 160 0 1 1-189.610667 249.856 32 32 0 0 1 48-42.325333 96 96 0 1 0 0-126.976c-22.186667 25.130667-63.146667 3.584-55.04-28.928l53.333333-214.016a32 32 0 0 1 31.061334-24.234667h170.666666z\" fill=\"currentColor\"/></svg>";
|
|
20
|
-
/** H6
|
|
20
|
+
/** H6: digit "6": descending loop with inner oval and opening stroke. */
|
|
21
21
|
export declare const ICON_H6 = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M544 170.922667a32 32 0 0 1 32 32v618.666666a32 32 0 1 1-64 0V544H192v277.674667a32 32 0 0 1-27.648 31.701333l-4.352 0.298667a32 32 0 0 1-32-32v-618.666667a32 32 0 0 1 64 0v276.992H512V202.922667a32 32 0 0 1 27.648-31.701334l4.352-0.298666z m292.522667 153.173333a32 32 0 0 1 12.586666 43.52l-93.141333 168.874667a159.957333 159.957333 0 0 1 102.4 19.712 158.848 158.848 0 0 1 58.581333 217.685333 160.426667 160.426667 0 0 1-218.453333 58.24 158.890667 158.890667 0 0 1-62.762667-209.962667l157.312-285.44a32 32 0 0 1 43.52-12.586666z m-141.226667 322.517333a94.890667 94.890667 0 0 0 35.072 130.048 96.426667 96.426667 0 0 0 131.242667-34.901333 94.848 94.848 0 0 0-35.114667-130.048 96.426667 96.426667 0 0 0-131.242667 34.901333z\" fill=\"currentColor\"/></svg>";
|
|
22
|
-
/** Unordered / bullet list
|
|
22
|
+
/** Unordered / bullet list: three filled dots with lines. */
|
|
23
23
|
export declare const ICON_BULLET_LIST = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"3\" cy=\"4\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3\" cy=\"8\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\"/><circle cx=\"3\" cy=\"12\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\"/><line x1=\"6.5\" y1=\"4\" x2=\"13.5\" y2=\"4\"/><line x1=\"6.5\" y1=\"8\" x2=\"13.5\" y2=\"8\"/><line x1=\"6.5\" y1=\"12\" x2=\"13.5\" y2=\"12\"/></svg>";
|
|
24
24
|
/**
|
|
25
|
-
* Ordered / numbered list
|
|
25
|
+
* Ordered / numbered list: three rows, each with a small numeral
|
|
26
26
|
* drawn as SVG strokes (1, 2, 3) followed by a text line.
|
|
27
|
-
* The numerals are drawn purely with paths
|
|
27
|
+
* The numerals are drawn purely with paths: no `<text>` elements.
|
|
28
28
|
*/
|
|
29
29
|
export declare const ICON_ORDERED_LIST = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M2.3 3.7L3.1 2.8L3.1 5.8\" stroke-width=\"1.1\"/><line x1=\"6.5\" y1=\"4\" x2=\"13.5\" y2=\"4\" stroke-width=\"1.3\"/><path d=\"M1.8 7.4C1.8 6.6 4.2 6.6 4.2 7.4C4.2 8.2 1.8 9.5 1.8 9.5L4.2 9.5\" stroke-width=\"1.1\"/><line x1=\"6.5\" y1=\"8\" x2=\"13.5\" y2=\"8\" stroke-width=\"1.3\"/><path d=\"M4.2 11.2C4.2 10.5 3 10.5 1.8 11.5C1.8 12 3 12 3 12C3 12 4.2 12 4.2 13C4.2 13.5 3 13.5 1.8 12.8\" stroke-width=\"1.1\"/><line x1=\"6.5\" y1=\"12\" x2=\"13.5\" y2=\"12\" stroke-width=\"1.3\"/></svg>";
|
|
30
|
-
/** To-do list
|
|
30
|
+
/** To-do list: checkbox with checkmark. */
|
|
31
31
|
export declare const ICON_TODO = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2.5\" y=\"2.5\" width=\"11\" height=\"11\" rx=\"2.5\"/><path d=\"M5.5 8L7 9.8L10.8 5.8\"/></svg>";
|
|
32
|
-
/** Quote / blockquote
|
|
32
|
+
/** Quote / blockquote: left bar with text lines. */
|
|
33
33
|
export declare const ICON_QUOTE = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2.5\" y=\"3\" width=\"2\" height=\"10\" rx=\"1\" fill=\"currentColor\" stroke=\"none\"/><line x1=\"6.5\" y1=\"5\" x2=\"13\" y2=\"5\"/><line x1=\"6.5\" y1=\"8\" x2=\"13\" y2=\"8\"/><line x1=\"6.5\" y1=\"11\" x2=\"10\" y2=\"11\"/></svg>";
|
|
34
|
-
/** Code block
|
|
34
|
+
/** Code block: angle brackets with slash. */
|
|
35
35
|
export declare const ICON_CODE = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M5 4L2 8L5 12\"/><path d=\"M11 4L14 8L11 12\"/><line x1=\"10\" y1=\"3\" x2=\"6\" y2=\"13\"/></svg>";
|
|
36
|
-
/** Divider / horizontal rule
|
|
36
|
+
/** Divider / horizontal rule: a single horizontal line. */
|
|
37
37
|
export declare const ICON_DIVIDER = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"2\" y1=\"8\" x2=\"14\" y2=\"8\"/></svg>";
|
|
38
|
-
/** Table of Contents
|
|
38
|
+
/** Table of Contents: indented list lines with leading dots. */
|
|
39
39
|
export declare const ICON_TOC = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M2 3.5h10M2 8h10M2 12.5h10\"/><path d=\"M14.5 3.5v.01M14.5 8v.01M14.5 12.5v.01\"/></svg>";
|
|
40
|
-
/** Image
|
|
40
|
+
/** Image: rectangle with mountain + sun. Drawn purely with SVG paths, no <text>. */
|
|
41
41
|
export declare const ICON_IMAGE = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2\" y=\"3\" width=\"12\" height=\"10\" rx=\"1.5\"/><circle cx=\"5.5\" cy=\"6.5\" r=\"1.1\" fill=\"currentColor\" stroke=\"none\"/><path d=\"M13 11.5L10 8.5L7 11.5L5 9.5L3 11.5\"/></svg>";
|
|
42
|
-
/** Upload progress spinner
|
|
42
|
+
/** Upload progress spinner: dashed arc, drawn purely with paths. */
|
|
43
43
|
export declare const ICON_SPINNER = "<svg viewBox=\"0 0 24 24\" width=\"20\" height=\"20\" aria-hidden=\"true\"><g fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.4\" stroke-linecap=\"round\"><path d=\"M12 3a9 9 0 0 1 9 9\" opacity=\"0.25\"/><path d=\"M12 3a9 9 0 0 0-9 9\" class=\"be-spinner-arc\"/></g></svg>";
|
|
44
|
-
/** Retry / refresh icon
|
|
44
|
+
/** Retry / refresh icon: circular arrow, pure paths. */
|
|
45
45
|
export declare const ICON_RETRY = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 8a5 5 0 0 1 8.5-3.5M13 3v3h-3\"/><path d=\"M13 8a5 5 0 0 1-8.5 3.5M3 13v-3h3\"/></svg>";
|
|
46
|
-
/** Close / delete icon
|
|
46
|
+
/** Close / delete icon: X, pure paths. */
|
|
47
47
|
export declare const ICON_CLOSE = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 4L12 12\"/><path d=\"M12 4L4 12\"/></svg>";
|
|
48
|
-
/** Replace / swap icon
|
|
48
|
+
/** Replace / swap icon: two horizontal arrows, pure paths. */
|
|
49
49
|
export declare const ICON_REPLACE = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M2 5H12M9 2L12 5L9 8\"/><path d=\"M14 11H4M7 8L4 11L7 14\"/></svg>";
|
|
50
50
|
/** Upload (cloud + arrow) icon, pure paths. */
|
|
51
51
|
export declare const ICON_UPLOAD = "<svg viewBox=\"0 0 1024 1024\" width=\"32\" height=\"32\" aria-hidden=\"true\"><path d=\"M768.35456 416a256 256 0 1 0-512 0 192 192 0 1 0 0 384v64a256 256 0 0 1-58.88-505.216 320.128 320.128 0 0 1 629.76 0A256.128 256.128 0 0 1 768.35456 864v-64a192 192 0 0 0 0-384z m-512 384h128v64H256.35456v-64z m384 0h128v64h-128v-64z\" fill=\"currentColor\"/><path d=\"M539.04256 589.184v333.056a32.448 32.448 0 0 1-32 32.192 32.448 32.448 0 0 1-32-32.192V589.184l-36.096 36.096a32.192 32.192 0 0 1-45.056-0.192 31.616 31.616 0 0 1-0.192-45.056l90.88-90.88a31.36 31.36 0 0 1 22.528-9.152 30.08 30.08 0 0 1 22.4 9.088l90.88 90.944a32.192 32.192 0 0 1-0.192 45.056 31.616 31.616 0 0 1-45.056 0.192l-36.096-36.096z\" fill=\"currentColor\"/></svg>";
|
|
52
|
-
/** Equation / math
|
|
52
|
+
/** Equation / math: Sigma (Σ) glyph, pure paths. */
|
|
53
53
|
export declare const ICON_EQUATION = "<svg viewBox=\"0 0 1024 1024\" width=\"16\" height=\"16\" aria-hidden=\"true\"><path d=\"M611.82976 512L300.4928 200.92928l545.2288-0.29696-0.04096-84.44928-667.36128 0.3584-0.04096 82.05312L492.34944 512 179.47648 824.60672l-1.19808 1.20832 0.04096 81.64352 667.36128 0.3584 0.04096-84.44928-545.2288-0.29696L611.82976 512z\" fill=\"currentColor\"/></svg>";
|
|
54
|
-
/** Equation
|
|
54
|
+
/** Equation: pencil (edit) glyph. */
|
|
55
55
|
export declare const ICON_EDIT = "<svg viewBox=\"0 0 16 16\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.3\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M10.5 2.5L13.5 5.5L6 13L3 13L3 10z\"/><path d=\"M9 4L12 7\"/></svg>";
|
|
@@ -7,7 +7,7 @@ export interface InputRuleRunContext {
|
|
|
7
7
|
readonly blockId: BlockId;
|
|
8
8
|
/** The full text currently in the block (after the just-typed character). */
|
|
9
9
|
readonly text: string;
|
|
10
|
-
/** True if we're in the middle of IME composition
|
|
10
|
+
/** True if we're in the middle of IME composition: we skip rules. */
|
|
11
11
|
readonly composing?: boolean;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
@@ -17,7 +17,7 @@ export interface InputRuleRunContext {
|
|
|
17
17
|
* For rule-matching we only examine the text currently in the block's leading
|
|
18
18
|
* prefix (i.e. no newline; rules always match a single-line prefix up to the
|
|
19
19
|
* caret). Because the editor's caret may be anywhere, `textBeforeCaret` is the
|
|
20
|
-
* full block text passed in
|
|
20
|
+
* full block text passed in: rules are responsible for anchoring patterns with
|
|
21
21
|
* `^…$`. This matches ProseMirror / Tiptap input-rule semantics.
|
|
22
22
|
*/
|
|
23
23
|
export declare function runInputRules(ctx: InputRuleRunContext): boolean;
|
package/dist/view/ui/popup.d.ts
CHANGED
|
@@ -55,7 +55,7 @@ export declare function placeBelowSelection(_root: HTMLElement, selectionRect: D
|
|
|
55
55
|
readonly width: number;
|
|
56
56
|
readonly height: number;
|
|
57
57
|
}, margin?: number): PopupPlacement;
|
|
58
|
-
/** Kept for backward compatibility
|
|
58
|
+
/** Kept for backward compatibility: delegates to placeBelowSelection. */
|
|
59
59
|
export declare function placeAboveSelection(root: HTMLElement, selectionRect: DOMRect, popupSize: {
|
|
60
60
|
readonly width: number;
|
|
61
61
|
readonly height: number;
|
package/dist/view/urlUtils.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { InlineSeq } from '../core/types';
|
|
|
6
6
|
* 1. It is non-empty.
|
|
7
7
|
* 2. It does not start with a dangerous scheme (case-insensitive).
|
|
8
8
|
* 3. If it has an explicit scheme, that scheme is in the allow-list.
|
|
9
|
-
* 4. If it has no scheme (relative URL or bare domain), it is safe
|
|
9
|
+
* 4. If it has no scheme (relative URL or bare domain), it is safe: the
|
|
10
10
|
* browser will resolve it relative to the current page, and it cannot
|
|
11
11
|
* execute script.
|
|
12
12
|
*
|
|
@@ -16,7 +16,7 @@ export declare function sanitizeUrl(raw: string): string | null;
|
|
|
16
16
|
/**
|
|
17
17
|
* Check if a string looks like a URL that should be auto-linked.
|
|
18
18
|
*
|
|
19
|
-
* This is intentionally conservative
|
|
19
|
+
* This is intentionally conservative: it only matches strings that start
|
|
20
20
|
* with a known scheme or look like a domain (e.g. "example.com/path").
|
|
21
21
|
*/
|
|
22
22
|
export declare function looksLikeUrl(text: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xiaodao-editor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.21",
|
|
4
4
|
"description": "Notion-style block editor for Vue 3 + TypeScript. Ships as a single zero-runtime-dependency package: a framework-agnostic core plus a Vue view layer. Keep developing!",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -58,8 +58,7 @@
|
|
|
58
58
|
"vue": "^3.4.0"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"highlight.js": "^11.11.0"
|
|
62
|
-
"katex": "^0.18.4"
|
|
61
|
+
"highlight.js": "^11.11.0"
|
|
63
62
|
},
|
|
64
63
|
"devDependencies": {
|
|
65
64
|
"@types/node": "^20.14.0",
|