@agilehub/agile-editor 1.6.0 → 1.8.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/README.md +1 -0
- package/dist/agile-editor.css +1 -1
- package/dist/agile-editor.js +18325 -18426
- package/dist/i18n-DCR9QpaV.js +2785 -0
- package/dist/types/components/editor/index.vue.d.ts +2 -2
- package/dist/types/components/editor/smart-sheet-dialog.vue.d.ts +3 -0
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/index.vue.d.ts +384 -22
- package/dist/types/components/menus/button.vue.d.ts +1 -1
- package/dist/types/components/menus/toolbar/insert/bookmark.vue.d.ts +24 -0
- package/dist/types/components/menus/toolbar/insert/courseware.vue.d.ts +3 -0
- package/dist/types/components/menus/toolbar/insert/smart-sheet.vue.d.ts +3 -0
- package/dist/types/components/preview-toolbar/index.vue.d.ts +2 -2
- package/dist/types/components/toolbar/classic.vue.d.ts +19 -11
- package/dist/types/components/toolbar/ribbon.vue.d.ts +19 -11
- package/dist/types/composables/i18n.d.ts +375 -18
- package/dist/types/extensions/bookmark-transaction.d.ts +4 -0
- package/dist/types/extensions/bookmark.d.ts +8 -5
- package/dist/types/extensions/bubble-note.d.ts +1 -0
- package/dist/types/extensions/courseware/annotation-session.d.ts +4 -0
- package/dist/types/extensions/courseware/index.d.ts +49 -0
- package/dist/types/extensions/courseware/model.d.ts +20 -0
- package/dist/types/extensions/courseware/node-view.vue.d.ts +93 -0
- package/dist/types/extensions/courseware/reader.vue.d.ts +22 -0
- package/dist/types/extensions/smart-sheet/index.d.ts +47 -0
- package/dist/types/extensions/smart-sheet/model.d.ts +18 -0
- package/dist/types/extensions/smart-sheet/node-view.vue.d.ts +93 -0
- package/dist/types/extensions/smart-sheet/viewer.vue.d.ts +36 -0
- package/dist/types/i18n.d.ts +375 -18
- package/dist/types/options/config/index.d.ts +2 -0
- package/dist/types/utils/bubble-note-icon.d.ts +1 -0
- package/dist/types/utils/document-formatting.d.ts +41 -37
- package/dist/types/utils/document-import.d.ts +2 -0
- package/dist/types/utils/html-element-id.d.ts +9 -2
- package/dist/types/utils/md5.d.ts +2 -0
- package/dist/viewer-CyuLA7YS.js +97 -0
- package/docs/FORMATTING_TEMPLATES.md +253 -250
- package/docs/FORMATTING_TEMPLATE_BUSINESS_GUIDE.md +536 -0
- package/docs/README.md +1 -0
- package/docs/SECONDARY_DEVELOPMENT.md +1 -1
- package/docs/api.md +43 -0
- package/docs/configuration.md +82 -0
- package/docs/custom-components.md +1 -1
- package/docs/development.md +6 -2
- package/docs/menu-extension.md +26 -1
- package/package.json +165 -153
- /package/dist/types/components/{menus/toolbar/view/preview.vue.d.ts → editor/courseware-dialog.vue.d.ts} +0 -0
|
@@ -1,58 +1,62 @@
|
|
|
1
1
|
import type { Editor } from '@tiptap/core';
|
|
2
|
-
import { type Node as PMNode } from '@tiptap/pm/model';
|
|
3
2
|
/** Only these presentation properties can be supplied by a JSON template. */
|
|
4
|
-
export declare const formattingProperties: readonly ["fontFamily", "fontSize", "fontWeight", "fontStyle", "color", "backgroundColor", "letterSpacing", "lineHeight", "textAlign", "textIndent", "textDecoration", "marginTop", "marginBottom", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "border", "borderColor", "borderWidth", "borderStyle", "borderRadius", "width", "maxWidth", "minHeight", "verticalAlign"];
|
|
3
|
+
export declare const formattingProperties: readonly ["fontFamily", "fontSize", "fontWeight", "fontStyle", "color", "backgroundColor", "letterSpacing", "lineHeight", "textAlign", "textIndent", "textDecoration", "marginTop", "marginBottom", "marginLeft", "marginRight", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "border", "borderColor", "borderWidth", "borderStyle", "borderRadius", "width", "maxWidth", "minHeight", "verticalAlign"];
|
|
5
4
|
export type FormattingStyle = Partial<Record<(typeof formattingProperties)[number], string | number | null>>;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
/**
|
|
6
|
+
* New-style element rules use the same JSON shape as the HTML-like document
|
|
7
|
+
* tree. For example `rules.table.td.p` styles only paragraphs inside table
|
|
8
|
+
* cells, while `rules.table.th.p` handles header cells.
|
|
9
|
+
*/
|
|
10
|
+
export interface FormattingElementRule extends FormattingStyle {
|
|
11
|
+
[selector: string]: unknown;
|
|
12
12
|
}
|
|
13
|
-
export interface
|
|
14
|
-
/** Partial existing schema attributes, not replacement content. */
|
|
15
|
-
attrs?: Record<string, unknown>;
|
|
16
|
-
/** Explicit styles for this node's direct text children (if marks are allowed). */
|
|
17
|
-
textStyle?: FormattingStyle;
|
|
18
|
-
}
|
|
19
|
-
export type FormattingNodeAdapter = (context: {
|
|
20
|
-
node: PMNode;
|
|
21
|
-
rule: Readonly<FormattingNodeRule>;
|
|
22
|
-
}) => FormattingAdapterResult;
|
|
23
|
-
export interface FormattingTableRule extends FormattingStyle {
|
|
13
|
+
export interface FormattingTableRule extends FormattingElementRule {
|
|
24
14
|
preset?: string;
|
|
25
15
|
themeColor?: string;
|
|
26
16
|
shading?: string[];
|
|
27
17
|
cellText?: FormattingStyle;
|
|
28
|
-
caption?:
|
|
18
|
+
caption?: FormattingElementRule;
|
|
19
|
+
th?: FormattingElementRule;
|
|
20
|
+
td?: FormattingElementRule;
|
|
21
|
+
}
|
|
22
|
+
export interface FormattingFigureRule extends FormattingElementRule {
|
|
23
|
+
img?: FormattingElementRule;
|
|
24
|
+
figcaption?: FormattingElementRule;
|
|
25
|
+
}
|
|
26
|
+
export interface FormattingListRule extends FormattingElementRule {
|
|
27
|
+
li?: FormattingElementRule;
|
|
29
28
|
}
|
|
30
|
-
export interface
|
|
31
|
-
|
|
29
|
+
export interface FormattingTemplateRules {
|
|
30
|
+
p?: FormattingElementRule;
|
|
31
|
+
h1?: FormattingElementRule;
|
|
32
|
+
h2?: FormattingElementRule;
|
|
33
|
+
h3?: FormattingElementRule;
|
|
34
|
+
h4?: FormattingElementRule;
|
|
35
|
+
h5?: FormattingElementRule;
|
|
36
|
+
h6?: FormattingElementRule;
|
|
37
|
+
table?: FormattingTableRule;
|
|
38
|
+
figure?: FormattingFigureRule;
|
|
39
|
+
img?: FormattingElementRule;
|
|
40
|
+
audio?: FormattingElementRule;
|
|
41
|
+
video?: FormattingElementRule;
|
|
42
|
+
ol?: FormattingListRule;
|
|
43
|
+
ul?: FormattingListRule;
|
|
44
|
+
li?: FormattingElementRule;
|
|
45
|
+
codeBlock?: FormattingElementRule;
|
|
46
|
+
blockquote?: FormattingElementRule;
|
|
47
|
+
taskItem?: FormattingElementRule;
|
|
48
|
+
footnote?: FormattingElementRule;
|
|
32
49
|
}
|
|
33
50
|
export interface FormattingTemplate {
|
|
34
51
|
id: string;
|
|
35
52
|
name: string;
|
|
36
53
|
description: string;
|
|
37
|
-
rules:
|
|
38
|
-
paragraph?: FormattingStyle;
|
|
39
|
-
heading?: Partial<Record<1 | 2 | 3 | 4 | 5 | 6, FormattingStyle>>;
|
|
40
|
-
table?: FormattingTableRule;
|
|
41
|
-
image?: FormattingImageRule;
|
|
42
|
-
audio?: FormattingStyle;
|
|
43
|
-
video?: FormattingStyle;
|
|
44
|
-
/** Presentation of a registered node; unknown/unadapted nodes are reported. */
|
|
45
|
-
nodes?: Record<string, FormattingNodeRule>;
|
|
46
|
-
/** Paragraph styles within these ancestor node types, nearest ancestor wins. */
|
|
47
|
-
contexts?: Record<string, FormattingStyle>;
|
|
48
|
-
};
|
|
54
|
+
rules: FormattingTemplateRules;
|
|
49
55
|
}
|
|
50
56
|
export interface FormattingOptions {
|
|
51
57
|
enabled?: boolean;
|
|
52
58
|
defaultTemplateId?: string;
|
|
53
59
|
templates?: FormattingTemplate[];
|
|
54
|
-
/** Component adapters override editor.storage[nodeType].formatting adapters. */
|
|
55
|
-
adapters?: Record<string, FormattingNodeAdapter>;
|
|
56
60
|
}
|
|
57
61
|
export declare class FormattingValidationError extends Error {
|
|
58
62
|
readonly path: string;
|
|
@@ -63,7 +67,7 @@ export declare function validateFormattingOptions(value: unknown): asserts value
|
|
|
63
67
|
export declare class FormattingCancelled extends Error {
|
|
64
68
|
}
|
|
65
69
|
/** Plan against a snapshot, yield periodically, then commit only changed attributes/marks. */
|
|
66
|
-
export declare function applyFormattingTemplate(editor: Editor, template: FormattingTemplate, signal?: AbortSignal
|
|
70
|
+
export declare function applyFormattingTemplate(editor: Editor, template: FormattingTemplate, signal?: AbortSignal): Promise<{
|
|
67
71
|
changed: number;
|
|
68
72
|
skipped: string[];
|
|
69
73
|
}>;
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import type { EditorState } from '@tiptap/pm/state';
|
|
2
|
+
import { Slice } from '@tiptap/pm/model';
|
|
2
3
|
export declare const nodeTypesWithOwnId: Set<string>;
|
|
3
4
|
export declare const nodeTypesWithoutHtmlId: Set<string>;
|
|
5
|
+
/** HTML 标签与菜单节点的并集,Set 保证重复定义的节点只生成一次 ID。 */
|
|
4
6
|
export declare const htmlIdNodeTypes: string[];
|
|
7
|
+
export declare const globalHtmlIdNodeTypes: string[];
|
|
5
8
|
export declare const htmlIdMarkTypes: string[];
|
|
6
|
-
export declare const
|
|
9
|
+
export declare const globalHtmlIdMarkTypes: string[];
|
|
10
|
+
export declare const stripPastedHtmlElementIds: (slice: Slice) => Slice;
|
|
11
|
+
type HtmlIdRange = {
|
|
7
12
|
from: number;
|
|
8
13
|
to: number;
|
|
9
|
-
}
|
|
14
|
+
};
|
|
15
|
+
export declare const ensureHtmlElementIds: (state: EditorState, ranges?: HtmlIdRange | HtmlIdRange[]) => import("@tiptap/pm/state").Transaction;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agilehub/agile-editor 1.8.0
|
|
3
|
+
* @license Apache-2.0
|
|
4
|
+
* @author undefined undefined
|
|
5
|
+
* @see undefined
|
|
6
|
+
**/
|
|
7
|
+
import "./agile-editor.css";
|
|
8
|
+
import { a as e, n as t } from "./i18n-DCR9QpaV.js";
|
|
9
|
+
import { createBlock as n, createElementBlock as r, createElementVNode as i, createVNode as a, defineComponent as o, guardReactiveProps as s, markRaw as c, normalizeProps as l, onMounted as u, openBlock as d, ref as f, renderSlot as p, resolveDynamicComponent as m, shallowRef as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
|
|
10
|
+
//#region src/extensions/smart-sheet/viewer.vue?vue&type=script&setup=true&lang.ts
|
|
11
|
+
var y = { class: "agile-smart-sheet-viewer" }, b = {
|
|
12
|
+
key: 0,
|
|
13
|
+
class: "agile-smart-sheet-viewer-state"
|
|
14
|
+
}, x = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "agile-smart-sheet-viewer-state is-error",
|
|
17
|
+
role: "alert"
|
|
18
|
+
}, S = {
|
|
19
|
+
key: 3,
|
|
20
|
+
class: "agile-smart-sheet-viewer-state is-error",
|
|
21
|
+
role: "alert"
|
|
22
|
+
}, C = /* @__PURE__ */ o({
|
|
23
|
+
__name: "viewer",
|
|
24
|
+
props: {
|
|
25
|
+
src: {},
|
|
26
|
+
fileName: { default: "" },
|
|
27
|
+
editable: {
|
|
28
|
+
type: Boolean,
|
|
29
|
+
default: !0
|
|
30
|
+
},
|
|
31
|
+
recalc: {
|
|
32
|
+
type: Boolean,
|
|
33
|
+
default: !0
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
emits: [
|
|
37
|
+
"ready",
|
|
38
|
+
"error",
|
|
39
|
+
"cell-change",
|
|
40
|
+
"dirty-change"
|
|
41
|
+
],
|
|
42
|
+
setup(o, { expose: C, emit: w }) {
|
|
43
|
+
let T = w, E = h(null), D = f(null), O = f(!0), k = f(""), A = async () => {
|
|
44
|
+
O.value = !0, k.value = "";
|
|
45
|
+
try {
|
|
46
|
+
let [e] = await Promise.all([import("ooxml-excel-editor"), Promise.resolve({ })]);
|
|
47
|
+
E.value = c(e.ExcelViewer);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
k.value = e instanceof Error ? e.message : t("insert.smartSheet.loadFailed"), T("error", k.value);
|
|
50
|
+
} finally {
|
|
51
|
+
O.value = !1;
|
|
52
|
+
}
|
|
53
|
+
}, j = (e) => {
|
|
54
|
+
T("ready", e);
|
|
55
|
+
}, M = (e) => {
|
|
56
|
+
let n = e instanceof Error ? e.message : String(e || t("insert.smartSheet.loadFailed"));
|
|
57
|
+
T("error", n);
|
|
58
|
+
};
|
|
59
|
+
return u(A), C({
|
|
60
|
+
getViewer: () => D.value,
|
|
61
|
+
isDirty: () => {
|
|
62
|
+
var e, t;
|
|
63
|
+
return !!((e = D.value) != null && (t = e.isDirty) != null && t.call(e));
|
|
64
|
+
}
|
|
65
|
+
}), (c, u) => {
|
|
66
|
+
let f = e;
|
|
67
|
+
return d(), r("div", y, [_(O) ? (d(), r("div", b, [a(f, {
|
|
68
|
+
name: "loading",
|
|
69
|
+
class: "loading-icon"
|
|
70
|
+
}), i("span", null, g(_(t)("insert.smartSheet.loading")), 1)])) : _(k) ? (d(), r("div", x, [a(f, { name: "image-failed" }), i("span", null, g(_(k)), 1)])) : E.value ? (d(), n(m(E.value), {
|
|
71
|
+
key: 2,
|
|
72
|
+
ref_key: "viewerRef",
|
|
73
|
+
ref: D,
|
|
74
|
+
src: o.src,
|
|
75
|
+
"file-name": o.fileName,
|
|
76
|
+
editable: o.editable,
|
|
77
|
+
recalc: o.recalc,
|
|
78
|
+
"export-progress": !0,
|
|
79
|
+
style: { height: "100%" },
|
|
80
|
+
onRendered: j,
|
|
81
|
+
onError: M,
|
|
82
|
+
onCellChange: u[0] || (u[0] = (e) => T("cell-change", e)),
|
|
83
|
+
onDirtyChange: u[1] || (u[1] = (e) => T("dirty-change", !!(e != null && e.dirty)))
|
|
84
|
+
}, {
|
|
85
|
+
header: v((e) => [p(c.$slots, "header", l(s(e)))]),
|
|
86
|
+
_: 3
|
|
87
|
+
}, 40, [
|
|
88
|
+
"src",
|
|
89
|
+
"file-name",
|
|
90
|
+
"editable",
|
|
91
|
+
"recalc"
|
|
92
|
+
])) : (d(), r("div", S, [a(f, { name: "image-failed" }), i("span", null, g(_(t)("insert.smartSheet.loadFailed")), 1)]))]);
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
//#endregion
|
|
97
|
+
export { C as default };
|