@agilehub/agile-editor 1.8.3 → 1.8.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agile-editor.css +1 -1
- package/dist/agile-editor.js +25442 -17377
- package/dist/{i18n-E7gk29NK.js → i18n-BZGLJU1q.js} +511 -620
- package/dist/types/components/editor/callout-dialog.vue.d.ts +48 -0
- package/dist/types/components/editor/callout-gradient-editor.vue.d.ts +12 -0
- package/dist/types/components/editor/figure-caption-numbering-dialog.vue.d.ts +11 -0
- package/dist/types/components/editor/index.vue.d.ts +2 -2
- package/dist/types/components/editor/table-background-control.vue.d.ts +11 -0
- package/dist/types/components/editor/table-cell-properties.vue.d.ts +8 -0
- package/dist/types/components/editor/table-property-section.vue.d.ts +22 -0
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.vue.d.ts +945 -21
- package/dist/types/components/menus/bubble/image/replace.vue.d.ts +3 -0
- package/dist/types/components/menus/bubble/image/size.vue.d.ts +3 -0
- package/dist/types/components/menus/bubble/link/edit.vue.d.ts +3 -0
- package/dist/types/components/menus/bubble/menus.vue.d.ts +2 -2
- package/dist/types/components/menus/toolbar/tools/bubble-note-editor.vue.d.ts +52 -0
- package/dist/types/components/menus/toolbar/tools/bubble-note-image.d.ts +3 -0
- package/dist/types/components/menus/toolbar/tools/bubble-note.vue.d.ts +9 -0
- package/dist/types/components/menus/toolbar/tools/figure-caption-numbering.vue.d.ts +15 -1
- package/dist/types/components/picker/color-panel.vue.d.ts +37 -0
- package/dist/types/components/picker/color.vue.d.ts +9 -0
- package/dist/types/components/statusbar/countdown.vue.d.ts +2 -2
- package/dist/types/components/toolbar/classic.vue.d.ts +10 -10
- package/dist/types/components/toolbar/ribbon.vue.d.ts +10 -10
- package/dist/types/composables/i18n.d.ts +942 -18
- package/dist/types/extensions/bubble-note-content.d.ts +48 -0
- package/dist/types/extensions/bubble-note-extensions.d.ts +12 -0
- package/dist/types/extensions/bubble-note-render.d.ts +1 -0
- package/dist/types/extensions/bubble-note.d.ts +5 -0
- package/dist/types/extensions/callout/index.d.ts +3 -3
- package/dist/types/extensions/callout/title-view.vue.d.ts +93 -0
- package/dist/types/extensions/callout/title.d.ts +7 -0
- package/dist/types/extensions/code-block/index.d.ts +8 -0
- package/dist/types/extensions/columns/schema.d.ts +6 -1
- package/dist/types/extensions/courseware/reader-visibility.d.ts +6 -0
- package/dist/types/extensions/file/index.d.ts +4 -0
- package/dist/types/extensions/image/automatic-attributes.d.ts +6 -0
- package/dist/types/extensions/image/paste.d.ts +3 -0
- package/dist/types/extensions/indent.d.ts +1 -0
- package/dist/types/extensions/insert-newline.d.ts +2 -3
- package/dist/types/extensions/math/index.d.ts +2 -1
- package/dist/types/extensions/smart-sheet/model.d.ts +5 -0
- package/dist/types/extensions/table-column-resize.d.ts +15 -0
- package/dist/types/extensions/table.d.ts +29 -0
- package/dist/types/extensions/timeline/content.vue.d.ts +1 -0
- package/dist/types/extensions/timeline/index.d.ts +3 -6
- package/dist/types/extensions/timeline/model.d.ts +18 -15
- package/dist/types/extensions/trailing-node.d.ts +14 -0
- package/dist/types/i18n.d.ts +942 -18
- package/dist/types/options/config/callout-assets.d.ts +3 -0
- package/dist/types/options/config/callout-color-picker.d.ts +13 -0
- package/dist/types/options/config/callout-templates.d.ts +66 -0
- package/dist/types/options/config/index.d.ts +12 -0
- package/dist/types/options/config/table-color-picker.d.ts +6 -0
- package/dist/types/utils/base64url.d.ts +2 -0
- package/dist/types/utils/block-menu.d.ts +1 -0
- package/dist/types/utils/bookmark-attributes.d.ts +2 -0
- package/dist/types/utils/bubble-note-selection.d.ts +7 -0
- package/dist/types/utils/callout.d.ts +204 -0
- package/dist/types/utils/caption-numbering.d.ts +62 -0
- package/dist/types/utils/code-block-indent.d.ts +15 -0
- package/dist/types/utils/column-width.d.ts +9 -0
- package/dist/types/utils/document-attributes.d.ts +3 -0
- package/dist/types/utils/document-import.d.ts +4 -0
- package/dist/types/utils/document-loading.d.ts +14 -0
- package/dist/types/utils/document-save.d.ts +5 -0
- package/dist/types/utils/editor-scroll.d.ts +1 -0
- package/dist/types/utils/editor-view.d.ts +12 -0
- package/dist/types/utils/figure-caption-numbering.d.ts +11 -55
- package/dist/types/utils/figure-caption-visibility.d.ts +8 -0
- package/dist/types/utils/file.d.ts +5 -2
- package/dist/types/utils/font-size.d.ts +2 -0
- package/dist/types/utils/formula-size.d.ts +23 -0
- package/dist/types/utils/iframe.d.ts +5 -0
- package/dist/types/utils/image-display-size.d.ts +13 -0
- package/dist/types/utils/image-file-caption.d.ts +11 -0
- package/dist/types/utils/image-replacement.d.ts +31 -0
- package/dist/types/utils/image-source.d.ts +2 -0
- package/dist/types/utils/inline-style.d.ts +9 -0
- package/dist/types/utils/insert-newline-position.d.ts +23 -0
- package/dist/types/utils/link.d.ts +5 -0
- package/dist/types/utils/player.d.ts +12 -4
- package/dist/types/utils/pointer-hover-scheduler.d.ts +9 -0
- package/dist/types/utils/selection.d.ts +2 -1
- package/dist/types/utils/source-attributes.d.ts +7 -0
- package/dist/types/utils/style-target.d.ts +4 -0
- package/dist/types/utils/table-appearance.d.ts +33 -0
- package/dist/types/utils/table-attributes.d.ts +14 -0
- package/dist/types/utils/table-border.d.ts +38 -0
- package/dist/types/utils/table-caption-numbering.d.ts +19 -0
- package/dist/types/utils/table-caption-visibility.d.ts +32 -0
- package/dist/types/utils/table-column-resize.d.ts +10 -0
- package/dist/types/utils/table-layout.d.ts +10 -0
- package/dist/types/utils/table-properties.d.ts +39 -0
- package/dist/types/utils/table-reset.d.ts +23 -0
- package/dist/types/utils/table-row-resize.d.ts +8 -0
- package/dist/types/utils/table-selection.d.ts +18 -0
- package/dist/types/utils/thousands-separator.d.ts +1 -0
- package/dist/types/utils/tracking-attributes.d.ts +8 -0
- package/dist/types/utils/video-frame.d.ts +1 -0
- package/dist/types/utils/video-skin.d.ts +1 -0
- package/dist/{viewer-DmoW4doo.js → viewer-Bg-htPGM.js} +2 -2
- package/docs/FORMATTING_TEMPLATES.md +253 -253
- package/docs/FORMATTING_TEMPLATE_BUSINESS_GUIDE.md +536 -536
- package/docs/SECONDARY_DEVELOPMENT.md +13 -9
- package/docs/features.md +1 -1
- package/docs/superpowers/plans/2026-11-27-table-reset-controls.md +185 -0
- package/docs/superpowers/plans/2026-11-28-bubble-note-rich-content.md +101 -0
- package/docs/superpowers/plans/2026-11-28-image-replace.md +190 -0
- package/docs/superpowers/plans/2026-11-28-table-image-resize-preview.md +121 -0
- package/docs/superpowers/plans/2026-11-28-table-property-category-actions.md +192 -0
- package/docs/superpowers/specs/2026-11-27-table-reset-controls-design.md +66 -0
- package/docs/superpowers/specs/2026-11-28-bubble-note-rich-content-design.md +64 -0
- package/docs/superpowers/specs/2026-11-28-image-replace-design.md +40 -0
- package/docs/superpowers/specs/2026-11-28-table-image-resize-preview-design.md +30 -0
- package/docs/superpowers/specs/2026-11-28-table-property-category-actions-design.md +63 -0
- package/package.json +5 -5
- package/dist/types/components/menus/bubble/callout/background.vue.d.ts +0 -7
- package/dist/types/components/menus/bubble/callout/emoji-remove.vue.d.ts +0 -7
- /package/dist/types/components/{menus/bubble/callout/builtin.vue.d.ts → editor/table-cell-context-menu.vue.d.ts} +0 -0
- /package/dist/types/components/{menus/bubble/image/open.vue.d.ts → editor/table-quick-toolbar.vue.d.ts} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 高亮块表单统一使用的系统预设颜色。
|
|
3
|
+
* 该配置与气泡注释标题颜色保持一致,确保不同表单中的颜色选择体验统一。
|
|
4
|
+
*/
|
|
5
|
+
export declare const CALLOUT_COLOR_SWATCHES: string[];
|
|
6
|
+
/**
|
|
7
|
+
* 高亮块颜色弹层配置。
|
|
8
|
+
* 通用颜色弹层默认隐藏 TDesign 预设色区域,这里通过专属类名恢复展示,
|
|
9
|
+
* 同时避免扩大全局样式影响范围。
|
|
10
|
+
*/
|
|
11
|
+
export declare const CALLOUT_COLOR_PICKER_POPUP_PROPS: {
|
|
12
|
+
overlayClassName: string[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { type CalloutAssetLabel, type CalloutStyle } from '../../utils/callout.ts';
|
|
2
|
+
export type CalloutTemplatePalette = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: CalloutAssetLabel;
|
|
5
|
+
swatch: string;
|
|
6
|
+
tokens: Record<string, string>;
|
|
7
|
+
};
|
|
8
|
+
export type CalloutTemplatePreset = {
|
|
9
|
+
id: string;
|
|
10
|
+
label: CalloutAssetLabel;
|
|
11
|
+
description?: CalloutAssetLabel;
|
|
12
|
+
previewTitle?: CalloutAssetLabel;
|
|
13
|
+
icon?: string;
|
|
14
|
+
badgeText?: string;
|
|
15
|
+
badgeBackground?: string;
|
|
16
|
+
badgeColor?: string;
|
|
17
|
+
style: Record<string, unknown>;
|
|
18
|
+
imageStyle?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
export declare const defaultCalloutTemplatePalettes: CalloutTemplatePalette[];
|
|
21
|
+
export declare const defaultCalloutTemplates: CalloutTemplatePreset[];
|
|
22
|
+
export declare const defaultCalloutTemplateDesignPhilosophy: CalloutAssetLabel;
|
|
23
|
+
/**
|
|
24
|
+
* 递归解析模板中的主题 token。
|
|
25
|
+
* 业务模板可使用 @accent、@surface、@border 等引用色板值,
|
|
26
|
+
* 切换色系时仅替换 token,无需复制整套模板 JSON。
|
|
27
|
+
*/
|
|
28
|
+
export declare const resolveCalloutTemplateValue: (value: unknown, palette: CalloutTemplatePalette) => unknown;
|
|
29
|
+
/**
|
|
30
|
+
* 将模板 JSON 与默认样式合并并规范化。
|
|
31
|
+
* 业务模板只声明有差异的属性即可,缺省值由编辑器统一补齐。
|
|
32
|
+
*/
|
|
33
|
+
export declare const resolveCalloutTemplateStyle: (template: CalloutTemplatePreset, palette: CalloutTemplatePalette, preferImage?: boolean) => CalloutStyle;
|
|
34
|
+
export declare const resolveCalloutTemplateColor: (value: string | undefined, palette: CalloutTemplatePalette, fallback: string) => string;
|
|
35
|
+
/**
|
|
36
|
+
* 生成模板选择卡片的小尺寸预览。
|
|
37
|
+
* 仅缩放内边距,不改变边框、圆角、渐变和阴影,确保预览与最终表单参数一致。
|
|
38
|
+
*/
|
|
39
|
+
export declare const getCalloutStylePreviewStyle: (style: CalloutStyle) => {
|
|
40
|
+
padding: string;
|
|
41
|
+
backgroundColor: string;
|
|
42
|
+
backgroundImage: string;
|
|
43
|
+
backgroundSize: string;
|
|
44
|
+
backgroundRepeat: string;
|
|
45
|
+
backgroundPosition: string;
|
|
46
|
+
borderStyle: string;
|
|
47
|
+
borderWidth: string;
|
|
48
|
+
borderColor: string;
|
|
49
|
+
borderRadius: string;
|
|
50
|
+
boxShadow: string;
|
|
51
|
+
overflow: string;
|
|
52
|
+
};
|
|
53
|
+
export declare const getCalloutTemplatePreviewStyle: (template: CalloutTemplatePreset, palette: CalloutTemplatePalette, preferImage?: boolean) => {
|
|
54
|
+
padding: string;
|
|
55
|
+
backgroundColor: string;
|
|
56
|
+
backgroundImage: string;
|
|
57
|
+
backgroundSize: string;
|
|
58
|
+
backgroundRepeat: string;
|
|
59
|
+
backgroundPosition: string;
|
|
60
|
+
borderStyle: string;
|
|
61
|
+
borderWidth: string;
|
|
62
|
+
borderColor: string;
|
|
63
|
+
borderRadius: string;
|
|
64
|
+
boxShadow: string;
|
|
65
|
+
overflow: string;
|
|
66
|
+
};
|
|
@@ -75,6 +75,18 @@ declare const _default: {
|
|
|
75
75
|
value: string;
|
|
76
76
|
svg: string;
|
|
77
77
|
}[];
|
|
78
|
+
content: {
|
|
79
|
+
maxCharacters: 2000;
|
|
80
|
+
maxImages: 5;
|
|
81
|
+
maxFormulas: 20;
|
|
82
|
+
maxBytes: number;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
callout: {
|
|
86
|
+
backgrounds: import("../../utils/callout").CalloutBackgroundAsset[];
|
|
87
|
+
borderImages: import("../../utils/callout").CalloutBorderImageAsset[];
|
|
88
|
+
palettes: import("./callout-templates").CalloutTemplatePalette[];
|
|
89
|
+
templates: import("./callout-templates").CalloutTemplatePreset[];
|
|
78
90
|
};
|
|
79
91
|
toolbar: {
|
|
80
92
|
showSaveLabel: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Shared TDesign color picker preset colors for table property panels. */
|
|
2
|
+
export declare const TABLE_COLOR_SWATCHES: string[];
|
|
3
|
+
export declare const TABLE_COLOR_PICKER_POPUP_CLASS = "agile-table-color-picker-popup";
|
|
4
|
+
export declare const TABLE_COLOR_PICKER_POPUP_PROPS: {
|
|
5
|
+
overlayClassName: string[];
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const normalizeBlockMenuNodePosition: (position: unknown) => number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Selection } from '@tiptap/pm/state';
|
|
2
|
+
/**
|
|
3
|
+
* Text selections may live inside tables and figure captions, but only the
|
|
4
|
+
* selected content in the current text block matters. Parent containers such
|
|
5
|
+
* as image, tableFigure and table must not make the text look non-textual.
|
|
6
|
+
*/
|
|
7
|
+
export declare const selectionContainsNonTextContent: (selection: Selection) => boolean;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
export declare const CALLOUT_GRADIENT_MAX_STOPS = 3;
|
|
3
|
+
export declare const CALLOUT_GRADIENT_MASK_MAX_STOPS = 5;
|
|
4
|
+
export declare const CALLOUT_BADGE_MAX_LENGTH = 12;
|
|
5
|
+
export declare const CALLOUT_PADDING_MAX = 96;
|
|
6
|
+
/**
|
|
7
|
+
* 按 Unicode 字符截断高亮块文本。
|
|
8
|
+
* 不能直接使用 slice,否则包含 Emoji 或生僻字时可能从代理对中间截断。
|
|
9
|
+
*/
|
|
10
|
+
export declare const truncateCalloutText: (value: unknown, maxLength: number) => string;
|
|
11
|
+
export type CalloutBorderMode = 'none' | 'solid' | 'dashed' | 'dotted' | 'image';
|
|
12
|
+
export type CalloutImageFit = 'cover' | 'contain';
|
|
13
|
+
export type CalloutImageRepeat = 'no-repeat' | 'repeat';
|
|
14
|
+
export type CalloutGradientStop = {
|
|
15
|
+
color: string;
|
|
16
|
+
position: number;
|
|
17
|
+
};
|
|
18
|
+
export type CalloutGradient = {
|
|
19
|
+
angle: number;
|
|
20
|
+
stops: CalloutGradientStop[];
|
|
21
|
+
};
|
|
22
|
+
export type CalloutImageMask = {
|
|
23
|
+
type: 'none' | 'color' | 'gradient';
|
|
24
|
+
color: string;
|
|
25
|
+
opacity: number;
|
|
26
|
+
gradient: CalloutGradient | null;
|
|
27
|
+
};
|
|
28
|
+
export type CalloutBackgroundImage = {
|
|
29
|
+
sourceType: 'builtin' | 'upload' | 'url';
|
|
30
|
+
id: string | null;
|
|
31
|
+
url: string;
|
|
32
|
+
fit: CalloutImageFit;
|
|
33
|
+
repeat: CalloutImageRepeat;
|
|
34
|
+
position: string;
|
|
35
|
+
mask: CalloutImageMask;
|
|
36
|
+
};
|
|
37
|
+
export type CalloutBorderImage = {
|
|
38
|
+
sourceType: 'builtin' | 'upload' | 'url';
|
|
39
|
+
id: string | null;
|
|
40
|
+
url: string;
|
|
41
|
+
slice: number;
|
|
42
|
+
repeat: 'stretch' | 'repeat' | 'round' | 'space';
|
|
43
|
+
};
|
|
44
|
+
export type CalloutStyle = {
|
|
45
|
+
version: 1;
|
|
46
|
+
border: {
|
|
47
|
+
mode: CalloutBorderMode;
|
|
48
|
+
width: number;
|
|
49
|
+
color: string;
|
|
50
|
+
image: CalloutBorderImage | null;
|
|
51
|
+
};
|
|
52
|
+
radius: {
|
|
53
|
+
linked: boolean;
|
|
54
|
+
topLeft: number;
|
|
55
|
+
topRight: number;
|
|
56
|
+
bottomRight: number;
|
|
57
|
+
bottomLeft: number;
|
|
58
|
+
};
|
|
59
|
+
shadow: {
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
x: number;
|
|
62
|
+
y: number;
|
|
63
|
+
blur: number;
|
|
64
|
+
spread: number;
|
|
65
|
+
color: string;
|
|
66
|
+
};
|
|
67
|
+
padding: {
|
|
68
|
+
top: number;
|
|
69
|
+
right: number;
|
|
70
|
+
bottom: number;
|
|
71
|
+
left: number;
|
|
72
|
+
};
|
|
73
|
+
background: {
|
|
74
|
+
mode: 'color' | 'image' | 'gradient';
|
|
75
|
+
color: string;
|
|
76
|
+
image: CalloutBackgroundImage | null;
|
|
77
|
+
gradient: CalloutGradient | null;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export type CalloutAssetLabel = string | {
|
|
81
|
+
zh_CN?: string;
|
|
82
|
+
en_US?: string;
|
|
83
|
+
};
|
|
84
|
+
export type CalloutBackgroundAsset = {
|
|
85
|
+
id: string;
|
|
86
|
+
label: CalloutAssetLabel;
|
|
87
|
+
url: string;
|
|
88
|
+
thumbnail?: string;
|
|
89
|
+
};
|
|
90
|
+
export type CalloutBorderImageAsset = {
|
|
91
|
+
id: string;
|
|
92
|
+
label: CalloutAssetLabel;
|
|
93
|
+
url: string;
|
|
94
|
+
thumbnail?: string;
|
|
95
|
+
slice: number;
|
|
96
|
+
repeat?: CalloutBorderImage['repeat'];
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* 创建新版高亮块的默认样式。
|
|
100
|
+
* 每次调用都返回独立对象,避免多个节点共享嵌套对象后被意外联动修改。
|
|
101
|
+
*/
|
|
102
|
+
export declare const createDefaultCalloutStyle: () => CalloutStyle;
|
|
103
|
+
/**
|
|
104
|
+
* 校验可写入内联样式的颜色值。
|
|
105
|
+
* 颜色配置最终会进入 style 属性,因此必须拒绝分号、花括号和换行等可拼接额外声明的字符。
|
|
106
|
+
*/
|
|
107
|
+
export declare const normalizeCalloutColor: (value: unknown, fallback: string) => string;
|
|
108
|
+
/**
|
|
109
|
+
* 深拷贝渐变配置,防止表单草稿与节点属性引用同一数组。
|
|
110
|
+
*/
|
|
111
|
+
export declare const cloneGradient: (gradient: CalloutGradient | null | undefined) => CalloutGradient | null;
|
|
112
|
+
/**
|
|
113
|
+
* 规范化渐变数据,保证:
|
|
114
|
+
* 1. 至少保留两个色标;
|
|
115
|
+
* 2. 色标上限由使用场景决定,普通渐变默认三个、图片遮罩最多五个;
|
|
116
|
+
* 3. 色标按位置从小到大自动排序。
|
|
117
|
+
*/
|
|
118
|
+
export declare const normalizeCalloutGradient: (value: Partial<CalloutGradient> | null | undefined, maxStops?: number) => CalloutGradient;
|
|
119
|
+
/**
|
|
120
|
+
* 按色标行的拖拽顺序重新生成渐变。
|
|
121
|
+
* 拖拽时颜色和配置随行移动,原有升序位置槽仍固定在列表位置,
|
|
122
|
+
* 因此无需修改用户输入的位置值格式,也能让下方渐变预览实时变化。
|
|
123
|
+
*/
|
|
124
|
+
export declare const reorderCalloutGradientStops: (value: CalloutGradient, fromIndex: number, toIndex: number, maxStops?: number) => CalloutGradient;
|
|
125
|
+
/**
|
|
126
|
+
* 将业务端图片输入统一转换为可安全写入 CSS 的来源。
|
|
127
|
+
* 支持 HTTP(S)、Data URL、Base64、原始 SVG 字符串和普通相对地址;
|
|
128
|
+
* 原始 SVG 会被编码为 Data URL,避免直接破坏 CSS url() 语法。
|
|
129
|
+
*/
|
|
130
|
+
export declare const normalizeCalloutImageSource: (value: unknown) => string;
|
|
131
|
+
/**
|
|
132
|
+
* 将外部传入的高亮块样式收敛为稳定结构。
|
|
133
|
+
* 该方法同时承担默认值补齐、范围限制和旧数据容错职责。
|
|
134
|
+
*/
|
|
135
|
+
export declare const normalizeCalloutStyle: (value: Partial<CalloutStyle> | null | undefined) => CalloutStyle;
|
|
136
|
+
/**
|
|
137
|
+
* 将颜色转换为带透明度的 rgba。
|
|
138
|
+
* 支持 #rgb、#rrggbb、rgb() 和 rgba(),无法解析时回退到透明的 color-mix。
|
|
139
|
+
*/
|
|
140
|
+
export declare const applyColorOpacity: (color: string, opacity: number) => string;
|
|
141
|
+
export declare const createCalloutGradientCss: (gradient: CalloutGradient, maxStops?: number) => string;
|
|
142
|
+
/**
|
|
143
|
+
* 生成高亮块外层样式。
|
|
144
|
+
* NodeView 编辑态与 renderHTML 导出态必须共用该方法,确保视觉配置一致。
|
|
145
|
+
*/
|
|
146
|
+
export declare const getCalloutContainerStyle: (input: Partial<CalloutStyle> | null | undefined) => {
|
|
147
|
+
backgroundColor: string;
|
|
148
|
+
backgroundImage: string;
|
|
149
|
+
backgroundSize: string;
|
|
150
|
+
backgroundRepeat: string;
|
|
151
|
+
backgroundPosition: string;
|
|
152
|
+
padding: string;
|
|
153
|
+
borderStyle: string;
|
|
154
|
+
borderWidth: string;
|
|
155
|
+
borderColor: string;
|
|
156
|
+
borderRadius: string;
|
|
157
|
+
boxShadow: string;
|
|
158
|
+
overflow: string;
|
|
159
|
+
};
|
|
160
|
+
/**
|
|
161
|
+
* 生成图片边框遮罩层样式。
|
|
162
|
+
* 该层铺在内容下方,并由外层圆角负责裁切,从而同时支持图片边框和四角圆角。
|
|
163
|
+
*/
|
|
164
|
+
export declare const getCalloutBorderImageStyle: (input: Partial<CalloutStyle> | null | undefined) => {
|
|
165
|
+
borderStyle: string;
|
|
166
|
+
borderWidth: string;
|
|
167
|
+
borderColor: string;
|
|
168
|
+
borderImageSource: string;
|
|
169
|
+
borderImageSlice: string;
|
|
170
|
+
borderImageWidth: string;
|
|
171
|
+
borderImageRepeat: "space" | "repeat" | "stretch" | "round";
|
|
172
|
+
borderRadius: string;
|
|
173
|
+
};
|
|
174
|
+
/**
|
|
175
|
+
* 将样式对象序列化为 HTML style 字符串。
|
|
176
|
+
* 仅处理已知的 camelCase 样式字段,避免外部数据注入任意样式声明。
|
|
177
|
+
*/
|
|
178
|
+
export declare const styleObjectToCssText: (style: Record<string, string | number> | null) => string;
|
|
179
|
+
/**
|
|
180
|
+
* 判断高亮块是否包含可折叠的非空标题。
|
|
181
|
+
* 标题节点必须是 callout 的第一个子节点,空标题或缺少标题都视为不可折叠。
|
|
182
|
+
*/
|
|
183
|
+
export declare const getCalloutTitleState: (node: ProseMirrorNode) => {
|
|
184
|
+
node: ProseMirrorNode;
|
|
185
|
+
hasTitle: boolean;
|
|
186
|
+
hasText: boolean;
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* 从选区深度链中查找 callout 节点位置。
|
|
190
|
+
* 返回 null 表示当前光标或选区不在高亮块内部。
|
|
191
|
+
*/
|
|
192
|
+
export declare const findCalloutPosition: (selection: any) => any;
|
|
193
|
+
/**
|
|
194
|
+
* 构造高亮块更新事务。
|
|
195
|
+
* 该方法集中处理样式规范化、角标长度限制以及标题节点增删,
|
|
196
|
+
* 保证命令、弹框和测试使用同一套结构变更逻辑。
|
|
197
|
+
*/
|
|
198
|
+
export declare const createCalloutUpdateTransaction: (state: any, position: number, attrs: Record<string, any>, titleEnabled?: boolean) => any;
|
|
199
|
+
/**
|
|
200
|
+
* 构造高亮块删除事务。
|
|
201
|
+
* 标题节点被丢弃,标题后的所有正文块按原顺序恢复到文档;
|
|
202
|
+
* 正文字块为空时补入一个空段落,避免父级结构失效。
|
|
203
|
+
*/
|
|
204
|
+
export declare const createCalloutRemovalTransaction: (state: any, position: number) => any;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
+
export type CaptionPreviewStatus = 'keep' | 'replace' | 'append' | 'empty' | 'warning';
|
|
3
|
+
export interface CaptionRule {
|
|
4
|
+
fixedPrefix: string;
|
|
5
|
+
startSequence: number;
|
|
6
|
+
sequenceWidth: number;
|
|
7
|
+
captionSeparator: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ParsedCaption {
|
|
10
|
+
label: string;
|
|
11
|
+
title: string;
|
|
12
|
+
fixedPrefix: string;
|
|
13
|
+
sequence: number;
|
|
14
|
+
sequenceWidth: number;
|
|
15
|
+
captionSeparator: string;
|
|
16
|
+
replaceLength: number;
|
|
17
|
+
}
|
|
18
|
+
export interface CaptionCandidate {
|
|
19
|
+
order: number;
|
|
20
|
+
pos: number;
|
|
21
|
+
node: ProseMirrorNode;
|
|
22
|
+
rawCaption: string;
|
|
23
|
+
normalizedCaption: string;
|
|
24
|
+
}
|
|
25
|
+
export interface CaptionAnalysis {
|
|
26
|
+
candidates: CaptionCandidate[];
|
|
27
|
+
seed: CaptionCandidate | null;
|
|
28
|
+
autoRule: CaptionRule | null;
|
|
29
|
+
error: 'no-caption' | 'unrecognized' | null;
|
|
30
|
+
}
|
|
31
|
+
export interface CaptionPreviewItem {
|
|
32
|
+
order: number;
|
|
33
|
+
pos: number;
|
|
34
|
+
nodeId: string | null;
|
|
35
|
+
name: string;
|
|
36
|
+
oldCaption: string;
|
|
37
|
+
newCaption: string;
|
|
38
|
+
replacementText: string;
|
|
39
|
+
replaceLength: number;
|
|
40
|
+
replaceWholeCaption?: boolean;
|
|
41
|
+
status: CaptionPreviewStatus;
|
|
42
|
+
apply: boolean;
|
|
43
|
+
warning: string;
|
|
44
|
+
}
|
|
45
|
+
export interface CaptionPreview {
|
|
46
|
+
items: CaptionPreviewItem[];
|
|
47
|
+
candidateCount: number;
|
|
48
|
+
emptyCount: number;
|
|
49
|
+
replaceCount: number;
|
|
50
|
+
appendCount: number;
|
|
51
|
+
warningCount: number;
|
|
52
|
+
changeCount: number;
|
|
53
|
+
}
|
|
54
|
+
export declare const normalizeCaptionText: (value: unknown) => string;
|
|
55
|
+
export declare const normalizeCaptionRule: (rule: Partial<CaptionRule>) => CaptionRule;
|
|
56
|
+
export declare const isValidCaptionRule: (rule: CaptionRule) => boolean;
|
|
57
|
+
export declare const formatCaptionLabel: (rule: CaptionRule, sequence: number) => string;
|
|
58
|
+
export declare const parseCaption: (value: unknown, prefixRegex: RegExp) => ParsedCaption | null;
|
|
59
|
+
export declare const createCaptionRuleFromCaption: (value: unknown, prefixRegex: RegExp) => CaptionRule | null;
|
|
60
|
+
export declare const createCaptionAnalysis: (candidates: CaptionCandidate[], createRule: (value: unknown) => CaptionRule | null) => CaptionAnalysis;
|
|
61
|
+
export declare const createCaptionPreview: (candidates: CaptionCandidate[], rule: CaptionRule, prefixRegex: RegExp, possibleLabelRegex: RegExp) => CaptionPreview;
|
|
62
|
+
export declare const applyCaptionPreview: (editor: any, items: CaptionPreviewItem[], nodeTypeName: string) => boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 为代码文本的每一行增加指定缩进。
|
|
3
|
+
* 空行也会保留缩进字符,确保多行选中后的代码结构一致。
|
|
4
|
+
*/
|
|
5
|
+
export declare const indentCodeText: (text: string, tabSize?: number) => string;
|
|
6
|
+
/**
|
|
7
|
+
* 计算一行代码应移除的缩进字符数。
|
|
8
|
+
* 行首为 Tab 时一次移除一个 Tab,否则最多移除一个 tabSize 长度的空格。
|
|
9
|
+
*/
|
|
10
|
+
export declare const getCodeIndentRemovalCount: (line: string, tabSize?: number) => number;
|
|
11
|
+
/**
|
|
12
|
+
* 减少代码文本每一行的缩进。
|
|
13
|
+
* 该方法用于有文本选区时的批量反缩进,不会移除行中的普通空格。
|
|
14
|
+
*/
|
|
15
|
+
export declare const outdentCodeText: (text: string, tabSize?: number) => string;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ColumnWidthUnit = 'px' | '%' | 'rem' | 'em';
|
|
2
|
+
export declare const parseColumnWidth: (value: unknown) => {
|
|
3
|
+
value: number;
|
|
4
|
+
unit: ColumnWidthUnit;
|
|
5
|
+
};
|
|
6
|
+
export declare const getColumnWidthStyle: ({ value, unit, }: {
|
|
7
|
+
value: number;
|
|
8
|
+
unit?: ColumnWidthUnit;
|
|
9
|
+
}) => string;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
/** 标记外部 HTML 的初始化导入事务,避免业务编辑过滤器误拦截。 */
|
|
2
2
|
export declare const DOCUMENT_IMPORT_META = "documentImport";
|
|
3
|
+
/** 标记菜单导入事务,保留 DOCX 映射后的原始样式。 */
|
|
4
|
+
export declare const DOCX_IMPORT_META = "docxImport";
|
|
5
|
+
/** 分块导入期间持续挂起/恢复尾部段落补全。 */
|
|
6
|
+
export declare const TRAILING_NODE_IMPORT_META = "trailingNodeImport";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface DocumentChunkRange {
|
|
2
|
+
start: number;
|
|
3
|
+
end: number;
|
|
4
|
+
size: number;
|
|
5
|
+
nodeCount: number;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Group top-level document blocks into parse-sized ranges without splitting a
|
|
9
|
+
* block. The ranges keep the caller free to map HTML or JSON nodes into the
|
|
10
|
+
* same progressive-loading flow.
|
|
11
|
+
*/
|
|
12
|
+
export declare const createDocumentChunkRanges: (sourceLength: number, nodeSizes: number[]) => DocumentChunkRange[];
|
|
13
|
+
export declare const getDocumentLoadingProgress: (loadedSize: number, totalSize: number) => number;
|
|
14
|
+
export declare const shouldHideEmptyDocumentLoading: (hasInitialContent: boolean, loadingVisible: boolean) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const resetEditorScrollToTop: (scrollContainer: HTMLElement | null | undefined, zoomableContent?: HTMLElement | null) => void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type EditorViewSource<TDom> = {
|
|
2
|
+
view?: {
|
|
3
|
+
dom?: TDom | null;
|
|
4
|
+
} | null;
|
|
5
|
+
};
|
|
6
|
+
type EditorFormTransaction = {
|
|
7
|
+
docChanged?: boolean;
|
|
8
|
+
selectionSet?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare const getEditorViewDom: <TDom = HTMLElement>(editor: EditorViewSource<TDom> | null | undefined) => TDom | null;
|
|
11
|
+
export declare const shouldRefreshEditorForm: (transaction: EditorFormTransaction | null | undefined) => boolean;
|
|
12
|
+
export {};
|
|
@@ -1,60 +1,16 @@
|
|
|
1
1
|
import type { Node as ProseMirrorNode } from '@tiptap/pm/model';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
10
|
-
label: string;
|
|
11
|
-
title: string;
|
|
12
|
-
fixedPrefix: string;
|
|
13
|
-
sequence: number;
|
|
14
|
-
sequenceWidth: number;
|
|
15
|
-
captionSeparator: string;
|
|
16
|
-
replaceLength: number;
|
|
17
|
-
}
|
|
18
|
-
export interface FigureCaptionCandidate {
|
|
19
|
-
order: number;
|
|
20
|
-
pos: number;
|
|
21
|
-
node: ProseMirrorNode;
|
|
22
|
-
rawCaption: string;
|
|
23
|
-
normalizedCaption: string;
|
|
24
|
-
}
|
|
25
|
-
export interface FigureCaptionAnalysis {
|
|
26
|
-
candidates: FigureCaptionCandidate[];
|
|
27
|
-
seed: FigureCaptionCandidate | null;
|
|
28
|
-
autoRule: FigureCaptionRule | null;
|
|
29
|
-
error: 'no-caption' | 'unrecognized' | null;
|
|
30
|
-
}
|
|
31
|
-
export interface FigureCaptionPreviewItem {
|
|
32
|
-
order: number;
|
|
33
|
-
pos: number;
|
|
34
|
-
nodeId: string | null;
|
|
35
|
-
name: string;
|
|
36
|
-
oldCaption: string;
|
|
37
|
-
newCaption: string;
|
|
38
|
-
replacementText: string;
|
|
39
|
-
replaceLength: number;
|
|
40
|
-
replaceWholeCaption?: boolean;
|
|
41
|
-
status: FigureCaptionPreviewStatus;
|
|
42
|
-
apply: boolean;
|
|
43
|
-
warning: string;
|
|
44
|
-
}
|
|
45
|
-
export interface FigureCaptionPreview {
|
|
46
|
-
items: FigureCaptionPreviewItem[];
|
|
47
|
-
candidateCount: number;
|
|
48
|
-
emptyCount: number;
|
|
49
|
-
replaceCount: number;
|
|
50
|
-
appendCount: number;
|
|
51
|
-
warningCount: number;
|
|
52
|
-
changeCount: number;
|
|
53
|
-
}
|
|
2
|
+
import { type CaptionAnalysis, type CaptionCandidate, type CaptionPreview, type CaptionPreviewItem, type CaptionPreviewStatus, type CaptionRule, type ParsedCaption } from './caption-numbering.ts';
|
|
3
|
+
export type FigureCaptionPreviewStatus = CaptionPreviewStatus;
|
|
4
|
+
export type FigureCaptionRule = CaptionRule;
|
|
5
|
+
export type ParsedFigureCaption = ParsedCaption;
|
|
6
|
+
export type FigureCaptionCandidate = CaptionCandidate;
|
|
7
|
+
export type FigureCaptionAnalysis = CaptionAnalysis;
|
|
8
|
+
export type FigureCaptionPreviewItem = CaptionPreviewItem;
|
|
9
|
+
export type FigureCaptionPreview = CaptionPreview;
|
|
54
10
|
export declare const normalizeFigureCaptionText: (value: unknown) => string;
|
|
55
|
-
export declare const normalizeFigureCaptionRule: (rule: Partial<
|
|
56
|
-
export declare const isValidFigureCaptionRule: (rule:
|
|
57
|
-
export declare const formatFigureCaptionLabel: (rule:
|
|
11
|
+
export declare const normalizeFigureCaptionRule: (rule: Partial<CaptionRule>) => CaptionRule;
|
|
12
|
+
export declare const isValidFigureCaptionRule: (rule: CaptionRule) => boolean;
|
|
13
|
+
export declare const formatFigureCaptionLabel: (rule: CaptionRule, sequence: number) => string;
|
|
58
14
|
export declare const parseFigureCaption: (value: unknown) => ParsedFigureCaption | null;
|
|
59
15
|
export declare const createFigureCaptionRuleFromCaption: (value: unknown) => FigureCaptionRule | null;
|
|
60
16
|
export declare const collectFigureCaptionCandidates: (doc: ProseMirrorNode) => FigureCaptionCandidate[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type CaptionElement = Pick<HTMLElement, 'hidden' | 'textContent'>;
|
|
2
|
+
type CaptionStyle = Pick<CSSStyleDeclaration, 'display' | 'visibility'>;
|
|
3
|
+
/**
|
|
4
|
+
* 返回图片查看器可展示的图注文本。
|
|
5
|
+
* NodeView 通过 v-show 隐藏图注时只会写入 display,因此不能只看 hidden 属性。
|
|
6
|
+
*/
|
|
7
|
+
export declare const getVisibleFigureCaptionText: (caption: CaptionElement | null | undefined, style?: CaptionStyle | null) => string;
|
|
8
|
+
export {};
|
|
@@ -3,9 +3,12 @@ export declare const getFileIcon: (filename: any) => string;
|
|
|
3
3
|
/**
|
|
4
4
|
* 通过浏览器图片对象读取本地图片原始尺寸。
|
|
5
5
|
* @param file - 待读取的图片文件。
|
|
6
|
-
* @returns 宽高对象;非图片或加载失败时宽高为 0
|
|
6
|
+
* @returns 宽高对象;非图片或加载失败时宽高为 0。
|
|
7
7
|
*/
|
|
8
|
-
export declare const getImageDimensions: (file:
|
|
8
|
+
export declare const getImageDimensions: (file: File) => Promise<{
|
|
9
|
+
width: number;
|
|
10
|
+
height: number;
|
|
11
|
+
}>;
|
|
9
12
|
/**
|
|
10
13
|
* 从图片地址异步读取原始尺寸,超时或加载失败时返回 null。
|
|
11
14
|
* @param src - 图片地址。
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export declare const FONT_SIZE_STEPS: readonly ["12px", "14px", "16px", "18px", "20px", "22px", "24px", "26px", "28px", "30px", "32px", "34px", "36px"];
|
|
2
|
+
export declare const DEFAULT_FONT_SIZE = "18px";
|
|
3
|
+
export declare const DEFAULT_FONT_SIZE_PX = 18;
|
|
2
4
|
/**
|
|
3
5
|
* 将 pt 字号按 1pt = 96/72px 换算为最接近的偶数像素。
|
|
4
6
|
* 非 pt 单位和不合法值保持原样。
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type FormulaDisplay = 'inline' | 'block';
|
|
2
|
+
/**
|
|
3
|
+
* 旧 HTML 常只保留公式图片的单边尺寸。编辑器拖拽框需要完整宽高,
|
|
4
|
+
* 缺失的一边不能退化为 14px,否则公式会被缩到无法阅读。
|
|
5
|
+
*/
|
|
6
|
+
export declare const resolveFormulaDimensions: ({ display, width, height, }: {
|
|
7
|
+
display: FormulaDisplay;
|
|
8
|
+
width?: number | null;
|
|
9
|
+
height?: number | null;
|
|
10
|
+
}) => {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
export declare const fitFormulaImageSize: ({ display, width, height, naturalWidth, naturalHeight, }: {
|
|
15
|
+
display: FormulaDisplay;
|
|
16
|
+
width?: number | null;
|
|
17
|
+
height?: number | null;
|
|
18
|
+
naturalWidth?: number | null;
|
|
19
|
+
naturalHeight?: number | null;
|
|
20
|
+
}) => {
|
|
21
|
+
width: number;
|
|
22
|
+
height: number;
|
|
23
|
+
};
|
|
@@ -3,3 +3,8 @@ export declare const normalizeIframeDimensions: (width: unknown, maxWidth: numbe
|
|
|
3
3
|
width: number;
|
|
4
4
|
height: number;
|
|
5
5
|
};
|
|
6
|
+
export declare const createIframeResizeAttributes: (attrs: Record<string, any>, width: unknown, maxWidth: number, height?: unknown) => {
|
|
7
|
+
equalProportion: boolean;
|
|
8
|
+
height: number;
|
|
9
|
+
width: number;
|
|
10
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
type ImageSize = {
|
|
2
|
+
width: unknown;
|
|
3
|
+
height: unknown;
|
|
4
|
+
};
|
|
5
|
+
export declare const fitImageDisplaySize: (size: ImageSize, maxWidth: unknown) => {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const normalizeImageDimensions: (size: ImageSize) => {
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { JSONContent } from '@tiptap/core';
|
|
2
|
+
import { type Node, type Schema } from '@tiptap/pm/model';
|
|
3
|
+
type ImageFileCaption = {
|
|
4
|
+
content: JSONContent[];
|
|
5
|
+
style: string | null;
|
|
6
|
+
visible: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const captureImageFileCaption: (node: Node) => ImageFileCaption;
|
|
9
|
+
export declare const parseImageFileCaption: (value: string | null) => ImageFileCaption;
|
|
10
|
+
export declare const restoreFileImage: (schema: Schema, { imageCaption, ...attrs }: Record<string, any>) => JSONContent | null;
|
|
11
|
+
export {};
|