@dou-ui/editor 0.1.0-alpha.14 → 0.1.0-alpha.16
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/collaboration/binding.js +32 -10
- package/dist/collaboration/binding.js.map +1 -1
- package/dist/collaboration/index.js +3 -0
- package/dist/collaboration/index.js.map +1 -1
- package/dist/collaboration/merged-props.js +152 -0
- package/dist/collaboration/merged-props.js.map +1 -0
- package/dist/components/block-handle.js.map +1 -1
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js +55 -5
- package/dist/components/block-handle.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/core/extension.js.map +1 -1
- package/dist/core/model.js +2 -1
- package/dist/core/model.js.map +1 -1
- package/dist/core/transaction.js +7 -1
- package/dist/core/transaction.js.map +1 -1
- package/dist/define-block.js +2 -1
- package/dist/define-block.js.map +1 -1
- package/dist/document.js +20 -1
- package/dist/document.js.map +1 -1
- package/dist/dom.js +12 -1
- package/dist/dom.js.map +1 -1
- package/dist/editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/editor2.js.map +1 -1
- package/dist/flow/board-block.js +6 -0
- package/dist/flow/board-block.js.map +1 -0
- package/dist/flow/board-block.vue_vue_type_script_setup_true_lang.js +598 -0
- package/dist/flow/board-block.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/flow/board.js +102 -0
- package/dist/flow/board.js.map +1 -0
- package/dist/flow/index.js +170 -0
- package/dist/flow/index.js.map +1 -0
- package/dist/locale.js +48 -6
- package/dist/locale.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/style.js +2 -0
- package/dist/types/collaboration/binding.d.ts +4 -0
- package/dist/types/collaboration/merged-props.d.ts +20 -0
- package/dist/types/core/extension.d.ts +5 -2
- package/dist/types/core/transaction.d.ts +6 -0
- package/dist/types/document.d.ts +3 -2
- package/dist/types/dom.d.ts +7 -0
- package/dist/types/editor.vue.d.ts +14 -0
- package/dist/types/flow/board-block.vue.d.ts +16 -0
- package/dist/types/flow/board.d.ts +40 -0
- package/dist/types/flow/index.d.ts +59 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/locale.d.ts +17 -0
- package/package.json +14 -5
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// src/flow/board.ts
|
|
2
|
+
/** Sent to a block's element to open its fullscreen editor (`Enter` on the selected block). */
|
|
3
|
+
var BOARD_OPEN_EVENT = "dou-editor-board-open";
|
|
4
|
+
/** Heights a block may have in the document, in px. */
|
|
5
|
+
var BOARD_HEIGHT = {
|
|
6
|
+
min: 160,
|
|
7
|
+
max: 1200,
|
|
8
|
+
step: 40
|
|
9
|
+
};
|
|
10
|
+
/** The items of a list that are objects. */
|
|
11
|
+
var objects = (list) => Array.isArray(list) ? list.filter((item) => item && typeof item === "object" && !Array.isArray(item)) : [];
|
|
12
|
+
/**
|
|
13
|
+
* A block's `board` prop as a flow document; one that is missing or not
|
|
14
|
+
* shaped like one is read as an empty flow (nodes and edges that aren't
|
|
15
|
+
* objects are left out).
|
|
16
|
+
*/
|
|
17
|
+
function boardOf(value) {
|
|
18
|
+
const source = value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
19
|
+
return {
|
|
20
|
+
...source,
|
|
21
|
+
version: 1,
|
|
22
|
+
nodes: objects(source.nodes),
|
|
23
|
+
edges: objects(source.edges)
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
var clampHeight = (height) => Math.round(Math.min(BOARD_HEIGHT.max, Math.max(BOARD_HEIGHT.min, height)));
|
|
27
|
+
/** A block's `height` prop in px: the default when it isn't a positive number. */
|
|
28
|
+
var heightOf = (value, fallback) => typeof value === "number" && value > 0 ? clampHeight(value) : fallback;
|
|
29
|
+
var isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
30
|
+
/** What `checkDocument` reports of a block's props: a board or height it would read differently. */
|
|
31
|
+
function checkBoardProps(props) {
|
|
32
|
+
const problems = [];
|
|
33
|
+
const { board, height } = props;
|
|
34
|
+
if (board != null) {
|
|
35
|
+
if (!isObject(board)) problems.push({
|
|
36
|
+
prop: "board",
|
|
37
|
+
message: "The board is not a flow document; it would be shown empty"
|
|
38
|
+
});
|
|
39
|
+
else for (const list of ["nodes", "edges"]) {
|
|
40
|
+
const items = board[list];
|
|
41
|
+
if (items === void 0) continue;
|
|
42
|
+
if (!Array.isArray(items)) problems.push({
|
|
43
|
+
prop: `board.${list}`,
|
|
44
|
+
message: `"${list}" is not a list; it would be read as empty`
|
|
45
|
+
});
|
|
46
|
+
else if (items.some((item) => !isObject(item))) problems.push({
|
|
47
|
+
prop: `board.${list}`,
|
|
48
|
+
message: `Some ${list} are not objects; they would be left out`
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (height != null && !(typeof height === "number" && height > 0)) problems.push({
|
|
53
|
+
prop: "height",
|
|
54
|
+
message: `The height ${JSON.stringify(height)} is not a positive number; the default would be used`
|
|
55
|
+
});
|
|
56
|
+
else if (typeof height === "number" && (height < BOARD_HEIGHT.min || height > BOARD_HEIGHT.max)) problems.push({
|
|
57
|
+
prop: "height",
|
|
58
|
+
message: `The height ${height} is outside ${BOARD_HEIGHT.min}–${BOARD_HEIGHT.max}; it would be clamped`
|
|
59
|
+
});
|
|
60
|
+
return problems;
|
|
61
|
+
}
|
|
62
|
+
var endOf = (at) => at.pos + at.node.nodeSize;
|
|
63
|
+
/** A content node's attributes besides the board. */
|
|
64
|
+
var restOf = (node) => JSON.stringify({
|
|
65
|
+
...node.attrs,
|
|
66
|
+
board: null
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Whether `a` and `b` differ only in the `board` prop of the block `id`:
|
|
70
|
+
* an undo taken from the fullscreen editor must not change anything the
|
|
71
|
+
* person can't see there.
|
|
72
|
+
*/
|
|
73
|
+
function onlyBoardChanged(a, b, id) {
|
|
74
|
+
const find = (doc) => {
|
|
75
|
+
let found = null;
|
|
76
|
+
doc.descendants((node, pos) => {
|
|
77
|
+
if (found) return false;
|
|
78
|
+
if (node.type.name === "block" && node.attrs.id === id) {
|
|
79
|
+
found = {
|
|
80
|
+
pos,
|
|
81
|
+
node
|
|
82
|
+
};
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
return true;
|
|
86
|
+
});
|
|
87
|
+
return found;
|
|
88
|
+
};
|
|
89
|
+
const before = find(a);
|
|
90
|
+
const after = find(b);
|
|
91
|
+
if (!before || !after) return false;
|
|
92
|
+
if (!a.slice(0, before.pos).eq(b.slice(0, after.pos))) return false;
|
|
93
|
+
if (!a.slice(endOf(before)).eq(b.slice(endOf(after)))) return false;
|
|
94
|
+
const [x, y] = [before.node.firstChild, after.node.firstChild];
|
|
95
|
+
if (x.type !== y.type) return false;
|
|
96
|
+
if (restOf(x) !== restOf(y)) return false;
|
|
97
|
+
if (before.node.childCount !== after.node.childCount) return false;
|
|
98
|
+
return before.node.childCount < 2 || before.node.child(1).eq(after.node.child(1));
|
|
99
|
+
}
|
|
100
|
+
export { BOARD_HEIGHT, BOARD_OPEN_EVENT, boardOf, checkBoardProps, clampHeight, heightOf, onlyBoardChanged };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=board.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"board.js","names":[],"sources":["../../src/flow/board.ts"],"sourcesContent":["import type { FlowDocument, FlowExtension } from '@dou-ui/flow'\nimport type { Node as PMNode } from 'prosemirror-model'\nimport type { Label } from '../core/extension'\nimport type { FlowBlockEditorProps } from './index'\n\n/** Sent to a block's element to open its fullscreen editor (`Enter` on the selected block). */\nexport const BOARD_OPEN_EVENT = 'dou-editor-board-open'\n\n/** Heights a block may have in the document, in px. */\nexport const BOARD_HEIGHT = { min: 160, max: 1200, step: 40 }\n\nexport interface BoardBlockSettings {\n label: Label\n extensions: (FlowExtension | FlowExtension[])[]\n editorProps: FlowBlockEditorProps\n height: number\n /** When the extensions offer no node to add, offer one with ports (not on a whiteboard, which has its tools). */\n fallbackNode: boolean\n}\n\n/** The items of a list that are objects. */\nconst objects = <T>(list: unknown) =>\n Array.isArray(list)\n ? (list.filter((item) => item && typeof item === 'object' && !Array.isArray(item)) as T[])\n : []\n\n/**\n * A block's `board` prop as a flow document; one that is missing or not\n * shaped like one is read as an empty flow (nodes and edges that aren't\n * objects are left out).\n */\nexport function boardOf(value: unknown): FlowDocument {\n const source =\n value && typeof value === 'object' && !Array.isArray(value)\n ? (value as Partial<FlowDocument>)\n : {}\n return {\n ...source,\n version: 1,\n nodes: objects(source.nodes),\n edges: objects(source.edges),\n } as FlowDocument\n}\n\nexport const clampHeight = (height: number) =>\n Math.round(Math.min(BOARD_HEIGHT.max, Math.max(BOARD_HEIGHT.min, height)))\n\n/** A block's `height` prop in px: the default when it isn't a positive number. */\nexport const heightOf = (value: unknown, fallback: number) =>\n typeof value === 'number' && value > 0 ? clampHeight(value) : fallback\n\nconst isObject = (value: unknown): value is Record<string, unknown> =>\n !!value && typeof value === 'object' && !Array.isArray(value)\n\n/** What `checkDocument` reports of a block's props: a board or height it would read differently. */\nexport function checkBoardProps(props: Record<string, unknown>) {\n const problems: { prop: string; message: string }[] = []\n const { board, height } = props\n if (board != null) {\n if (!isObject(board))\n problems.push({\n prop: 'board',\n message: 'The board is not a flow document; it would be shown empty',\n })\n else\n for (const list of ['nodes', 'edges'] as const) {\n const items = board[list]\n if (items === undefined) continue\n if (!Array.isArray(items))\n problems.push({\n prop: `board.${list}`,\n message: `\"${list}\" is not a list; it would be read as empty`,\n })\n else if (items.some((item) => !isObject(item)))\n problems.push({\n prop: `board.${list}`,\n message: `Some ${list} are not objects; they would be left out`,\n })\n }\n }\n if (height != null && !(typeof height === 'number' && height > 0))\n problems.push({\n prop: 'height',\n message: `The height ${JSON.stringify(height)} is not a positive number; the default would be used`,\n })\n else if (typeof height === 'number' && (height < BOARD_HEIGHT.min || height > BOARD_HEIGHT.max))\n problems.push({\n prop: 'height',\n message: `The height ${height} is outside ${BOARD_HEIGHT.min}–${BOARD_HEIGHT.max}; it would be clamped`,\n })\n return problems\n}\n\ninterface Found {\n pos: number\n node: PMNode\n}\n\nconst endOf = (at: Found) => at.pos + at.node.nodeSize\n/** A content node's attributes besides the board. */\nconst restOf = (node: PMNode) => JSON.stringify({ ...node.attrs, board: null })\n\n/**\n * Whether `a` and `b` differ only in the `board` prop of the block `id`:\n * an undo taken from the fullscreen editor must not change anything the\n * person can't see there.\n */\nexport function onlyBoardChanged(a: PMNode, b: PMNode, id: string): boolean {\n const find = (doc: PMNode) => {\n let found: Found | null = null\n doc.descendants((node, pos) => {\n if (found) return false\n if (node.type.name === 'block' && node.attrs.id === id) {\n found = { pos, node }\n return false\n }\n return true\n })\n return found as Found | null\n }\n const before = find(a)\n const after = find(b)\n if (!before || !after) return false\n if (!a.slice(0, before.pos).eq(b.slice(0, after.pos))) return false\n if (!a.slice(endOf(before)).eq(b.slice(endOf(after)))) return false\n const [x, y] = [before.node.firstChild!, after.node.firstChild!]\n if (x.type !== y.type) return false\n if (restOf(x) !== restOf(y)) return false\n // the children of the block, if any\n if (before.node.childCount !== after.node.childCount) return false\n return before.node.childCount < 2 || before.node.child(1).eq(after.node.child(1))\n}\n"],"mappings":";;AAMA,IAAa,mBAAmB;;AAGhC,IAAa,eAAe;CAAE,KAAK;CAAK,KAAK;CAAM,MAAM;AAAG;;AAY5D,IAAM,WAAc,SAClB,MAAM,QAAQ,IAAI,IACb,KAAK,QAAQ,SAAS,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,IAAI,CAAC,IAC/E,CAAC;;;;;;AAOP,SAAgB,QAAQ,OAA8B;CACpD,MAAM,SACJ,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,IACrD,QACD,CAAC;CACP,OAAO;EACL,GAAG;EACH,SAAS;EACT,OAAO,QAAQ,OAAO,KAAK;EAC3B,OAAO,QAAQ,OAAO,KAAK;CAC7B;AACF;AAEA,IAAa,eAAe,WAC1B,KAAK,M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;;;AAO9E,SAAgB,iBAAiB,GAAW,GAAW,IAAqB;CAC1E,MAAM,QAAQ,QAAgB;EAC5B,IAAI,QAAsB;EAC1B,IAAI,aAAa,MAAM,QAAQ;GAC7B,IAAI,OAAO,OAAO;GAClB,IAAI,KAAK,KAAK,SAAS,WAAW,KAAK,MAAM,OAAO,IAAI;IACtD,QAAQ;KAAE;KAAK;IAAK;IACpB,OAAO;GACT;GACA,OAAO;EACT,CAAC;EACD,OAAO;CACT;CACA,MAAM,SAAS,KAAK,CAAC;CACrB,MAAM,QAAQ,KAAK,CAAC;CACpB,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO;CAC9B,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,CAAC,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,OAAO;CAC9D,IAAI,CAAC,EAAE,MAAM,MAAM,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,MAAM,MAAM,KAAK,CAAC,CAAC,GAAG,OAAO;CAC9D,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,KAAK,YAAa,MAAM,KAAK,UAAW;CAC/D,IAAI,EAAE,SAAS,EAAE,MAAM,OAAO;CAC9B,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,OAAO;CAEpC,IAAI,OAAO,KAAK,eAAe,MAAM,KAAK,YAAY,OAAO;CAC7D,OAAO,OAAO,KAAK,aAAa,KAAK,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC;AAClF"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { editorLocales } from "../locale.js";
|
|
2
|
+
import { labelOf } from "../core/extension.js";
|
|
3
|
+
import { escapeHTML } from "../core/output.js";
|
|
4
|
+
import { defineBlock } from "../define-block.js";
|
|
5
|
+
import { BOARD_OPEN_EVENT, boardOf, checkBoardProps, clampHeight, heightOf } from "./board.js";
|
|
6
|
+
import board_block_default from "./board-block.js";
|
|
7
|
+
import { defineComponent, h } from "vue";
|
|
8
|
+
import { NodeSelection } from "prosemirror-state";
|
|
9
|
+
import { ShapesIcon, WorkflowIcon } from "@dou-ui/icons";
|
|
10
|
+
import { flowKit } from "@dou-ui/flow";
|
|
11
|
+
import { whiteboardKit } from "@dou-ui/flow/whiteboard";
|
|
12
|
+
// src/flow/index.ts
|
|
13
|
+
var fence = (type) => `dou-${type}`;
|
|
14
|
+
function attrsOf(dom, height) {
|
|
15
|
+
let board = null;
|
|
16
|
+
try {
|
|
17
|
+
board = JSON.parse(dom.getAttribute("data-prop-board") ?? "null");
|
|
18
|
+
} catch {}
|
|
19
|
+
const stored = Number.parseFloat(dom.getAttribute("data-prop-height") ?? "");
|
|
20
|
+
return {
|
|
21
|
+
board: board ? boardOf(board) : null,
|
|
22
|
+
height: stored > 0 ? clampHeight(stored) : height
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Turns ```dou-<type> fences from Markdown back into blocks. */
|
|
26
|
+
function readFences(root, type) {
|
|
27
|
+
for (const code of root.querySelectorAll(`pre > code.language-${fence(type)}`)) {
|
|
28
|
+
let written;
|
|
29
|
+
try {
|
|
30
|
+
written = JSON.parse(code.textContent ?? "");
|
|
31
|
+
} catch {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
const { board, height } = !!written && typeof written === "object" && "board" in written ? written : { board: written };
|
|
35
|
+
const element = root.ownerDocument.createElement("div");
|
|
36
|
+
element.dataset.contentType = type;
|
|
37
|
+
element.setAttribute("data-prop-board", JSON.stringify(boardOf(board)));
|
|
38
|
+
if (typeof height === "number") element.setAttribute("data-prop-height", String(height));
|
|
39
|
+
code.parentElement.replaceWith(element);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A block that holds a flow, drawn with `@dou-ui/flow`: the document shows
|
|
44
|
+
* it whole, and it is edited in a fullscreen editor (double-click, the
|
|
45
|
+
* “Edit” button, or `Enter` while the block is selected). The flow is the
|
|
46
|
+
* block's `board` prop; collaboration merges it node by node.
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
49
|
+
* extensions: [editorKit(), flowBlock({ type: 'approvalFlow', label: '审批流程', extensions: [flowKit(), approval()] })]
|
|
50
|
+
* ```
|
|
51
|
+
*
|
|
52
|
+
* Needs `@dou-ui/flow` and its styles. For a whiteboard, `whiteboardBlock()`.
|
|
53
|
+
*/
|
|
54
|
+
function flowBlock(options) {
|
|
55
|
+
return boardBlock(options, true);
|
|
56
|
+
}
|
|
57
|
+
function boardBlock(options, fallbackNode) {
|
|
58
|
+
const { type } = options;
|
|
59
|
+
const settings = {
|
|
60
|
+
label: options.label,
|
|
61
|
+
extensions: options.extensions ?? [flowKit()],
|
|
62
|
+
editorProps: options.editorProps ?? {},
|
|
63
|
+
height: options.height ?? 360,
|
|
64
|
+
fallbackNode
|
|
65
|
+
};
|
|
66
|
+
const View = defineComponent({
|
|
67
|
+
name: "DouEditorFlowBlockView",
|
|
68
|
+
inheritAttrs: false,
|
|
69
|
+
setup(_props, { attrs }) {
|
|
70
|
+
return () => h(board_block_default, {
|
|
71
|
+
...attrs,
|
|
72
|
+
settings
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const menu = options.menu === false ? void 0 : options.menu;
|
|
77
|
+
const block = defineBlock({
|
|
78
|
+
type,
|
|
79
|
+
props: {
|
|
80
|
+
board: null,
|
|
81
|
+
height: settings.height
|
|
82
|
+
},
|
|
83
|
+
content: "none",
|
|
84
|
+
component: View,
|
|
85
|
+
menu: options.menu === false ? void 0 : {
|
|
86
|
+
icon: WorkflowIcon,
|
|
87
|
+
...menu,
|
|
88
|
+
label: menu?.label ?? options.label
|
|
89
|
+
},
|
|
90
|
+
spec: {
|
|
91
|
+
mergeProps: { board: {
|
|
92
|
+
lists: ["nodes", "edges"],
|
|
93
|
+
objects: ["data"]
|
|
94
|
+
} },
|
|
95
|
+
checkProps: checkBoardProps,
|
|
96
|
+
parseDOM: [`div[data-content-type="${type}"]`, `figure[data-content-type="${type}"]`].map((tag) => ({
|
|
97
|
+
tag,
|
|
98
|
+
priority: 70,
|
|
99
|
+
getAttrs: (dom) => attrsOf(dom, settings.height)
|
|
100
|
+
}))
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
/** `Enter` on the selected block opens it. */
|
|
104
|
+
const open = (state, dispatch, view) => {
|
|
105
|
+
const { selection } = state;
|
|
106
|
+
if (!(selection instanceof NodeSelection) || selection.node.type.name !== type) return false;
|
|
107
|
+
if (dispatch && view) view.nodeDOM(selection.from)?.querySelector(".dou-editor-board")?.dispatchEvent(new CustomEvent(BOARD_OPEN_EVENT));
|
|
108
|
+
return true;
|
|
109
|
+
};
|
|
110
|
+
return {
|
|
111
|
+
...block,
|
|
112
|
+
name: `flow:${type}`,
|
|
113
|
+
keymap: () => ({ enter: open }),
|
|
114
|
+
prepareHTML: (root) => readFences(root, type),
|
|
115
|
+
output: { blocks: { [type]: {
|
|
116
|
+
html: (node, { children }) => {
|
|
117
|
+
const board = boardOf(node.props.board);
|
|
118
|
+
const inside = options.html ? options.html(board, node) : `<figcaption>${escapeHTML(labelOf(options.label, editorLocales["zh-CN"]))}</figcaption>`;
|
|
119
|
+
return `<figure data-content-type="${escapeHTML(type)}" data-prop-board="${escapeHTML(JSON.stringify(board))}" data-prop-height="${heightOf(node.props.height, settings.height)}">${inside}</figure>${children}`;
|
|
120
|
+
},
|
|
121
|
+
markdown: (node, { children }) => {
|
|
122
|
+
const value = {
|
|
123
|
+
height: heightOf(node.props.height, settings.height),
|
|
124
|
+
board: boardOf(node.props.board)
|
|
125
|
+
};
|
|
126
|
+
const written = `\`\`\`${fence(type)}\n${JSON.stringify(value)}\n\`\`\``;
|
|
127
|
+
return children ? `${written}\n\n${children}` : written;
|
|
128
|
+
}
|
|
129
|
+
} } }
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A whiteboard block: shapes, sticky notes, text, pen strokes, images and
|
|
134
|
+
* connectors, drawn in a fullscreen editor. Pass the `upload` of `image()`
|
|
135
|
+
* so pictures on the board are uploaded too, not kept in the document.
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* extensions: [editorKit(), whiteboardBlock({ upload })]
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
function whiteboardBlock(options = {}) {
|
|
142
|
+
return boardBlock({
|
|
143
|
+
type: "whiteboard",
|
|
144
|
+
label: (m) => m.types.whiteboard,
|
|
145
|
+
extensions: [flowKit(), whiteboardKit({
|
|
146
|
+
upload: options.upload,
|
|
147
|
+
onUploadError: options.onUploadError
|
|
148
|
+
})],
|
|
149
|
+
editorProps: options.editorProps,
|
|
150
|
+
height: options.height,
|
|
151
|
+
html: options.html,
|
|
152
|
+
menu: options.menu === false ? false : {
|
|
153
|
+
icon: ShapesIcon,
|
|
154
|
+
hint: (m) => m.hints.whiteboard,
|
|
155
|
+
keywords: [
|
|
156
|
+
"whiteboard",
|
|
157
|
+
"board",
|
|
158
|
+
"draw",
|
|
159
|
+
"flowchart",
|
|
160
|
+
"baiban",
|
|
161
|
+
"huatu",
|
|
162
|
+
"liuchengtu"
|
|
163
|
+
],
|
|
164
|
+
...options.menu
|
|
165
|
+
}
|
|
166
|
+
}, false);
|
|
167
|
+
}
|
|
168
|
+
export { boardOf, flowBlock, whiteboardBlock };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["BoardBlock"],"sources":["../../src/flow/index.ts"],"sourcesContent":["import { flowKit, type FlowDocument, type FlowEditorProps, type FlowExtension } from '@dou-ui/flow'\nimport { whiteboardKit, type WhiteboardKitOptions } from '@dou-ui/flow/whiteboard'\nimport { ShapesIcon, WorkflowIcon } from '@dou-ui/icons'\nimport { NodeSelection, type Command } from 'prosemirror-state'\nimport { defineComponent, h } from 'vue'\nimport { labelOf, type BlockOption, type EditorExtension, type Label } from '../core/extension'\nimport { escapeHTML } from '../core/output'\nimport { defineBlock } from '../define-block'\nimport { editorLocales } from '../locale'\nimport BoardBlock from './board-block.vue'\nimport {\n boardOf,\n BOARD_OPEN_EVENT,\n checkBoardProps,\n clampHeight,\n heightOf,\n type BoardBlockSettings,\n} from './board'\n\nexport { boardOf } from './board'\n\n/** The props of the fullscreen editor that a flow block may set. */\nexport type FlowBlockEditorProps = Omit<\n FlowEditorProps,\n 'extensions' | 'readonly' | 'fitView' | 'comments' | 'author' | 'activeComment' | 'commentable'\n>\n\nexport interface FlowBlockOptions {\n /** The block type, e.g. `approvalFlow`; unique among the editor's blocks. */\n type: string\n /** What the flow is made of, as the editor's `extensions`. `[flowKit()]` by default. */\n extensions?: (FlowExtension | FlowExtension[])[]\n /** More props for the flow editors, e.g. `nodeTypes`, `portTypes` or `direction`. */\n editorProps?: FlowBlockEditorProps\n /** The block's name: the title of the fullscreen editor, and of its slash menu entry. */\n label: Label\n /** The slash menu entry, or `false` to leave it out (blocks then come from code or pasting). */\n menu?: (Omit<BlockOption, 'key' | 'type' | 'label'> & { key?: string; label?: Label }) | false\n /** The height of a new block in the document, in px. Defaults to `360`. */\n height?: number\n /**\n * How a block is written in `blocksToHTML`, e.g. an `<img>` of a picture\n * of it the app keeps. By default a `<figure>` with its name, which\n * pasting reads back as the block.\n */\n html?: (board: FlowDocument, block: { id: string; props: Record<string, unknown> }) => string\n}\n\nconst fence = (type: string) => `dou-${type}`\n\nfunction attrsOf(dom: HTMLElement, height: number) {\n let board: unknown = null\n try {\n board = JSON.parse(dom.getAttribute('data-prop-board') ?? 'null')\n } catch {\n // a board that can't be read is an empty one\n }\n // `320`, or written by hand `320px`\n const stored = Number.parseFloat(dom.getAttribute('data-prop-height') ?? '')\n return { board: board ? boardOf(board) : null, height: stored > 0 ? clampHeight(stored) : height }\n}\n\n/** Turns ```dou-<type> fences from Markdown back into blocks. */\nfunction readFences(root: HTMLElement, type: string) {\n for (const code of root.querySelectorAll<HTMLElement>(`pre > code.language-${fence(type)}`)) {\n let written: unknown\n try {\n written = JSON.parse(code.textContent ?? '')\n } catch {\n continue\n }\n // `{ height, board }`, or the board alone\n const wrapped = !!written && typeof written === 'object' && 'board' in written\n const { board, height } = (wrapped ? written : { board: written }) as {\n board: unknown\n height?: unknown\n }\n const element = root.ownerDocument.createElement('div')\n element.dataset.contentType = type\n element.setAttribute('data-prop-board', JSON.stringify(boardOf(board)))\n if (typeof height === 'number') element.setAttribute('data-prop-height', String(height))\n code.parentElement!.replaceWith(element)\n }\n}\n\n/**\n * A block that holds a flow, drawn with `@dou-ui/flow`: the document shows\n * it whole, and it is edited in a fullscreen editor (double-click, the\n * “Edit” button, or `Enter` while the block is selected). The flow is the\n * block's `board` prop; collaboration merges it node by node.\n *\n * ```ts\n * extensions: [editorKit(), flowBlock({ type: 'approvalFlow', label: '审批流程', extensions: [flowKit(), approval()] })]\n * ```\n *\n * Needs `@dou-ui/flow` and its styles. For a whiteboard, `whiteboardBlock()`.\n */\nexport function flowBlock(options: FlowBlockOptions): EditorExtension {\n return boardBlock(options, true)\n}\n\nfunction boardBlock(options: FlowBlockOptions, fallbackNode: boolean): EditorExtension {\n const { type } = options\n const settings: BoardBlockSettings = {\n label: options.label,\n extensions: options.extensions ?? [flowKit()],\n editorProps: options.editorProps ?? {},\n height: options.height ?? 360,\n fallbackNode,\n }\n const View = defineComponent({\n name: 'DouEditorFlowBlockView',\n inheritAttrs: false,\n setup(_props, { attrs }) {\n return () => h(BoardBlock, { ...attrs, settings } as never)\n },\n })\n const menu = options.menu === false ? undefined : options.menu\n const block = defineBlock({\n type,\n props: { board: null, height: settings.height },\n content: 'none',\n component: View,\n menu:\n options.menu === false\n ? undefined\n : { icon: WorkflowIcon, ...menu, label: menu?.label ?? options.label },\n spec: {\n mergeProps: { board: { lists: ['nodes', 'edges'], objects: ['data'] } },\n // for `checkDocument`: what the block would read differently\n checkProps: checkBoardProps,\n // what is copied, and what `blocksToHTML` writes\n parseDOM: [`div[data-content-type=\"${type}\"]`, `figure[data-content-type=\"${type}\"]`].map(\n (tag) => ({\n tag,\n // before the figures of images, whatever the app's HTML puts inside\n priority: 70,\n getAttrs: (dom: HTMLElement) => attrsOf(dom, settings.height),\n }),\n ),\n },\n })\n /** `Enter` on the selected block opens it. */\n const open: Command = (state, dispatch, view) => {\n const { selection } = state\n if (!(selection instanceof NodeSelection) || selection.node.type.name !== type) return false\n if (dispatch && view) {\n const dom = view.nodeDOM(selection.from) as HTMLElement | null\n dom?.querySelector('.dou-editor-board')?.dispatchEvent(new CustomEvent(BOARD_OPEN_EVENT))\n }\n return true\n }\n return {\n ...block,\n name: `flow:${type}`,\n keymap: () => ({ enter: open }),\n prepareHTML: (root) => readFences(root, type),\n output: {\n blocks: {\n [type]: {\n html: (node, { children }) => {\n const board = boardOf(node.props.board)\n // written outside an editor: in Chinese, as the other output\n const inside = options.html\n ? options.html(board, node)\n : `<figcaption>${escapeHTML(labelOf(options.label, editorLocales['zh-CN']!))}</figcaption>`\n // the board stays on the figure, so pasting it reads back the block\n return `<figure data-content-type=\"${escapeHTML(type)}\" data-prop-board=\"${escapeHTML(JSON.stringify(board))}\" data-prop-height=\"${heightOf(node.props.height, settings.height)}\">${inside}</figure>${children}`\n },\n markdown: (node, { children }) => {\n const value = {\n height: heightOf(node.props.height, settings.height),\n board: boardOf(node.props.board),\n }\n const written = `\\`\\`\\`${fence(type)}\\n${JSON.stringify(value)}\\n\\`\\`\\``\n return children ? `${written}\\n\\n${children}` : written\n },\n },\n },\n },\n }\n}\n\nexport interface WhiteboardBlockOptions\n extends\n Pick<WhiteboardKitOptions, 'upload' | 'onUploadError'>,\n Pick<FlowBlockOptions, 'height' | 'html' | 'editorProps'> {\n /** The slash menu entry, or `false` to leave it out. */\n menu?: FlowBlockOptions['menu']\n}\n\n/**\n * A whiteboard block: shapes, sticky notes, text, pen strokes, images and\n * connectors, drawn in a fullscreen editor. Pass the `upload` of `image()`\n * so pictures on the board are uploaded too, not kept in the document.\n *\n * ```ts\n * extensions: [editorKit(), whiteboardBlock({ upload })]\n * ```\n */\nexport function whiteboardBlock(options: WhiteboardBlockOptions = {}): EditorExtension {\n return boardBlock(\n {\n type: 'whiteboard',\n label: (m) => m.types.whiteboard,\n extensions: [\n flowKit(),\n whiteboardKit({ upload: options.upload, onUploadError: options.onUploadError }),\n ],\n editorProps: options.editorProps,\n height: options.height,\n html: options.html,\n menu:\n options.menu === false\n ? false\n : {\n icon: ShapesIcon,\n hint: (m) => m.hints.whiteboard,\n keywords: [\n 'whiteboard',\n 'board',\n 'draw',\n 'flowchart',\n 'baiban',\n 'huatu',\n 'liuchengtu',\n ],\n ...options.menu,\n },\n },\n false,\n )\n}\n"],"mappings":";;;;;;;;;;;;AAgDA,IAAM,SAAS,SAAiB,OAAO;AAEvC,SAAS,QAAQ,KAAkB,QAAgB;CACjD,IAAI,QAAiB;CACrB,IAAI;EACF,QAAQ,KAAK,MAAM,IAAI,aAAa,iBAAiB,KAAK,MAAM;CAClE,QAAQ,CAER;CAEA,MAAM,SAAS,OAAO,WAAW,IAAI,aAAa,kBAAkB,KAAK,EAAE;CAC3E,OAAO;EAAE,OAAO,QAAQ,QAAQ,KAAK,IAAI;EAAM,QAAQ,SAAS,IAAI,YAAY,MAAM,IAAI;CAAO;AACnG;;AAGA,SAAS,WAAW,MAAmB,MAAc;CACnD,KAAK,MAAM,QAAQ,KAAK,iBAA8B,uBAAuB,MAAM,IAAI,GAAG,GAAG;EAC3F,IAAI;EACJ,IAAI;GACF,UAAU,KAAK,MAAM,KAAK,eAAe,EAAE;EAC7C,QAAQ;GACN;EACF;EAGA,MAAM,EAAE,OAAO,WADC,CAAC,CAAC,WAAW,OAAO,YAAY,YAAY,WAAW,UAClC,UAAU,EAAE,OAAO,QAAQ;EAIhE,MAAM,UAAU,KAAK,cAAc,cAAc,KAAK;EACtD,QAAQ,QAAQ,cAAc;EAC9B,QAAQ,aAAa,mBAAmB,KAAK,UAAU,QAAQ,KAAK,CAA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E,MAAM;GACN,OAAO,MAAM,EAAE,MAAM;GACrB,UAAU;IACR;IACA;IACA;IACA;IACA;IACA;IACA;GACF;GACA,GAAG,QAAQ;EACb;CACR,GACA,KACF;AACF"}
|
package/dist/locale.js
CHANGED
|
@@ -22,7 +22,8 @@ var zhCN = {
|
|
|
22
22
|
table: "表格",
|
|
23
23
|
columns: "分栏",
|
|
24
24
|
attachment: "附件",
|
|
25
|
-
embed: "嵌入"
|
|
25
|
+
embed: "嵌入",
|
|
26
|
+
whiteboard: "白板"
|
|
26
27
|
},
|
|
27
28
|
hints: {
|
|
28
29
|
paragraph: "普通的文字",
|
|
@@ -41,7 +42,8 @@ var zhCN = {
|
|
|
41
42
|
table: "插入一个表格",
|
|
42
43
|
columns: "把内容并排分成几栏",
|
|
43
44
|
attachment: "上传一个文件",
|
|
44
|
-
embed: "视频、音频或网页"
|
|
45
|
+
embed: "视频、音频或网页",
|
|
46
|
+
whiteboard: "图形、便签和连线"
|
|
45
47
|
},
|
|
46
48
|
image: {
|
|
47
49
|
empty: "添加一张图片",
|
|
@@ -148,6 +150,18 @@ var zhCN = {
|
|
|
148
150
|
cancel: "取消",
|
|
149
151
|
caption: "添加说明"
|
|
150
152
|
},
|
|
153
|
+
board: {
|
|
154
|
+
empty: "还没有内容",
|
|
155
|
+
start: "开始绘制",
|
|
156
|
+
edit: "编辑",
|
|
157
|
+
view: "查看",
|
|
158
|
+
resize: "拖动以调整高度",
|
|
159
|
+
addNode: "添加节点",
|
|
160
|
+
searchNodes: "搜索节点",
|
|
161
|
+
noNodes: "没有匹配的节点",
|
|
162
|
+
node: "节点",
|
|
163
|
+
emptyFlow: "使用左上角的“添加节点”添加第一个节点,也可以按住按钮拖到画布上"
|
|
164
|
+
},
|
|
151
165
|
noResults: "没有匹配的块",
|
|
152
166
|
addBlock: "在下方添加块",
|
|
153
167
|
dragHandle: "拖动以移动,点击打开菜单",
|
|
@@ -196,7 +210,8 @@ var zhTW = {
|
|
|
196
210
|
table: "表格",
|
|
197
211
|
columns: "分欄",
|
|
198
212
|
attachment: "附件",
|
|
199
|
-
embed: "嵌入"
|
|
213
|
+
embed: "嵌入",
|
|
214
|
+
whiteboard: "白板"
|
|
200
215
|
},
|
|
201
216
|
hints: {
|
|
202
217
|
paragraph: "一般的文字",
|
|
@@ -215,7 +230,8 @@ var zhTW = {
|
|
|
215
230
|
table: "插入一個表格",
|
|
216
231
|
columns: "把內容並排分成幾欄",
|
|
217
232
|
attachment: "上傳一個檔案",
|
|
218
|
-
embed: "影片、音訊或網頁"
|
|
233
|
+
embed: "影片、音訊或網頁",
|
|
234
|
+
whiteboard: "圖形、便籤和連線"
|
|
219
235
|
},
|
|
220
236
|
image: {
|
|
221
237
|
empty: "新增一張圖片",
|
|
@@ -322,6 +338,18 @@ var zhTW = {
|
|
|
322
338
|
cancel: "取消",
|
|
323
339
|
caption: "新增說明"
|
|
324
340
|
},
|
|
341
|
+
board: {
|
|
342
|
+
empty: "還沒有內容",
|
|
343
|
+
start: "開始繪製",
|
|
344
|
+
edit: "編輯",
|
|
345
|
+
view: "查看",
|
|
346
|
+
resize: "拖曳以調整高度",
|
|
347
|
+
addNode: "新增節點",
|
|
348
|
+
searchNodes: "搜尋節點",
|
|
349
|
+
noNodes: "沒有符合的節點",
|
|
350
|
+
node: "節點",
|
|
351
|
+
emptyFlow: "使用左上角的「新增節點」新增第一個節點,也可以按住按鈕拖曳到畫布上"
|
|
352
|
+
},
|
|
325
353
|
noResults: "沒有符合的區塊",
|
|
326
354
|
addBlock: "在下方新增區塊",
|
|
327
355
|
dragHandle: "拖曳以移動,點擊開啟選單",
|
|
@@ -370,7 +398,8 @@ var en = {
|
|
|
370
398
|
table: "Table",
|
|
371
399
|
columns: "Columns",
|
|
372
400
|
attachment: "File",
|
|
373
|
-
embed: "Embed"
|
|
401
|
+
embed: "Embed",
|
|
402
|
+
whiteboard: "Whiteboard"
|
|
374
403
|
},
|
|
375
404
|
hints: {
|
|
376
405
|
paragraph: "Plain text",
|
|
@@ -389,7 +418,8 @@ var en = {
|
|
|
389
418
|
table: "A grid of rows and columns",
|
|
390
419
|
columns: "Put content side by side",
|
|
391
420
|
attachment: "Upload a file",
|
|
392
|
-
embed: "Video, audio or a web page"
|
|
421
|
+
embed: "Video, audio or a web page",
|
|
422
|
+
whiteboard: "Shapes, sticky notes and connectors"
|
|
393
423
|
},
|
|
394
424
|
image: {
|
|
395
425
|
empty: "Add an image",
|
|
@@ -496,6 +526,18 @@ var en = {
|
|
|
496
526
|
cancel: "Cancel",
|
|
497
527
|
caption: "Add a caption"
|
|
498
528
|
},
|
|
529
|
+
board: {
|
|
530
|
+
empty: "Nothing drawn yet",
|
|
531
|
+
start: "Start drawing",
|
|
532
|
+
edit: "Edit",
|
|
533
|
+
view: "View",
|
|
534
|
+
resize: "Drag to change the height",
|
|
535
|
+
addNode: "Add node",
|
|
536
|
+
searchNodes: "Search nodes",
|
|
537
|
+
noNodes: "No matching nodes",
|
|
538
|
+
node: "Node",
|
|
539
|
+
emptyFlow: "Use “Add node” at the top left to add the first node, or hold the button and drag it onto the canvas"
|
|
540
|
+
},
|
|
499
541
|
noResults: "No matching blocks",
|
|
500
542
|
addBlock: "Add a block below",
|
|
501
543
|
dragHandle: "Drag to move, click for the menu",
|
package/dist/locale.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locale.js","names":[],"sources":["../src/locale.ts"],"sourcesContent":["import { useLocale } from 'dou-ui'\nimport { computed, toValue, type MaybeRefOrGetter } from 'vue'\n\nexport interface EditorMessages {\n placeholder: string\n emptyPlaceholder: string\n headingPlaceholder: string\n /** Names of the block types, also shown in menus. */\n types: {\n paragraph: string\n heading1: string\n heading2: string\n heading3: string\n bulletItem: string\n numberedItem: string\n checkItem: string\n quote: string\n codeBlock: string\n divider: string\n image: string\n toggle: string\n callout: string\n table: string\n columns: string\n attachment: string\n embed: string\n }\n /** Short descriptions in the slash menu. */\n hints: {\n paragraph: string\n heading1: string\n heading2: string\n heading3: string\n bulletItem: string\n numberedItem: string\n checkItem: string\n quote: string\n codeBlock: string\n divider: string\n image: string\n toggle: string\n callout: string\n table: string\n columns: string\n attachment: string\n embed: string\n }\n /** The image block. */\n image: {\n empty: string\n upload: string\n embed: string\n urlPlaceholder: string\n apply: string\n uploading: string\n failed: string\n caption: string\n resize: string\n }\n /** The code block. */\n codeBlock: {\n /** The language picker's name. */\n language: string\n plainText: string\n }\n toggle: { expand: string; collapse: string }\n callout: {\n /** Said after the tone on the icon button. */\n change: string\n tones: { info: string; tip: string; warning: string; danger: string }\n }\n mention: { label: string; searching: string; noResults: string }\n /** The table: its row and column menus. */\n table: {\n row: string\n column: string\n insertAbove: string\n insertBelow: string\n insertLeft: string\n insertRight: string\n moveUp: string\n moveDown: string\n moveLeft: string\n moveRight: string\n deleteRow: string\n deleteColumn: string\n merge: string\n split: string\n clear: string\n headerRow: string\n headerColumn: string\n alignLeft: string\n alignCenter: string\n alignRight: string\n addRow: string\n addColumn: string\n }\n /** Columns: the picker in the slash menu, the block menu entry, the resize bar. */\n columns: {\n /** The title of the picker for the number of columns. */\n pick: string\n /** A number of columns; `{count}` is replaced with it. */\n count: string\n /** Selects the whole set of columns a block is in. */\n select: string\n /** The bar between two columns. */\n resize: string\n /** Makes every column of the set as wide as the others. */\n even: string\n /** A column, for screen readers; `{index}` and `{count}` are replaced. */\n column: string\n }\n /** The color menu of the formatting toolbar. */\n colors: {\n label: string\n text: string\n background: string\n none: string\n names: {\n gray: string\n red: string\n orange: string\n yellow: string\n green: string\n blue: string\n purple: string\n pink: string\n }\n }\n /** Aligning paragraphs, headings and quotes. */\n align: { label: string; left: string; center: string; right: string }\n /** The attachment block. */\n attachment: {\n empty: string\n upload: string\n uploading: string\n failed: string\n retry: string\n download: string\n }\n /** The embed block. */\n embed: {\n empty: string\n urlPlaceholder: string\n apply: string\n invalid: string\n /** The link is not https. */\n insecure: string\n caption: string\n edit: string\n cancel: string\n }\n noResults: string\n addBlock: string\n dragHandle: string\n turnInto: string\n duplicate: string\n delete: string\n moveUp: string\n moveDown: string\n bold: string\n italic: string\n underline: string\n strike: string\n code: string\n link: string\n linkPlaceholder: string\n applyLink: string\n removeLink: string\n /** Starts a comment thread on the selected text. */\n comment: string\n /** The name of the card that shows a thread. */\n commentThread: string\n /** Shown for a removed block that has no text, such as a divider, when comparing versions. */\n removedBlock: string\n /** Read out once a version is restored. */\n restored: string\n /** Read out, before the text, when going to a change while comparing. */\n changeAdded: string\n changeRemoved: string\n changeChanged: string\n formatting: string\n /** The name of the slash menu's list. */\n blockTypes: string\n}\n\nconst zhCN: EditorMessages = {\n placeholder: '输入 / 插入内容',\n emptyPlaceholder: '开始写点什么,或输入 / 插入内容',\n headingPlaceholder: '标题',\n types: {\n paragraph: '正文',\n heading1: '一级标题',\n heading2: '二级标题',\n heading3: '三级标题',\n bulletItem: '无序列表',\n numberedItem: '有序列表',\n checkItem: '待办事项',\n quote: '引用',\n codeBlock: '代码',\n divider: '分隔线',\n image: '图片',\n toggle: '折叠块',\n callout: '提示块',\n table: '表格',\n columns: '分栏',\n attachment: '附件',\n embed: '嵌入',\n },\n hints: {\n paragraph: '普通的文字',\n heading1: '最大的标题',\n heading2: '中等的标题',\n heading3: '较小的标题',\n bulletItem: '用圆点列出几项',\n numberedItem: '按顺序编号',\n checkItem: '可以勾选的事项',\n quote: '引用一段话',\n codeBlock: '等宽显示代码',\n divider: '分隔上下内容',\n image: '上传或嵌入一张图片',\n toggle: '可以展开和收起的内容',\n callout: '带图标的醒目说明',\n table: '插入一个表格',\n columns: '把内容并排分成几栏',\n attachment: '上传一个文件',\n embed: '视频、音频或网页',\n },\n image: {\n empty: '添加一张图片',\n upload: '上传',\n embed: '嵌入链接',\n urlPlaceholder: '粘贴图片链接',\n apply: '确定',\n uploading: '正在上传',\n failed: '上传失败,请重试',\n caption: '添加说明',\n resize: '拖动调整宽度',\n },\n codeBlock: { language: '语言', plainText: '纯文本' },\n toggle: { expand: '展开', collapse: '收起' },\n mention: { label: '提及', searching: '正在搜索', noResults: '没有找到' },\n table: {\n row: '选择这一行',\n column: '选择这一列',\n insertAbove: '在上方插入行',\n insertBelow: '在下方插入行',\n insertLeft: '在左侧插入列',\n insertRight: '在右侧插入列',\n moveUp: '上移',\n moveDown: '下移',\n moveLeft: '左移',\n moveRight: '右移',\n deleteRow: '删除行',\n deleteColumn: '删除列',\n merge: '合并单元格',\n split: '取消合并',\n clear: '清空内容',\n headerRow: '标题行',\n headerColumn: '标题列',\n alignLeft: '左对齐',\n alignCenter: '居中',\n alignRight: '右对齐',\n addRow: '添加一行',\n addColumn: '添加一列',\n },\n callout: {\n change: '点击更换',\n tones: { info: '说明', tip: '提示', warning: '注意', danger: '警告' },\n },\n columns: {\n pick: '选择栏数',\n count: '{count} 栏',\n select: '选中整个分栏',\n resize: '调整栏宽',\n even: '平分栏宽',\n column: '第 {index} 栏,共 {count} 栏',\n },\n colors: {\n label: '颜色',\n text: '文字颜色',\n background: '背景色',\n none: '默认',\n names: {\n gray: '灰色',\n red: '红色',\n orange: '橙色',\n yellow: '黄色',\n green: '绿色',\n blue: '蓝色',\n purple: '紫色',\n pink: '粉色',\n },\n },\n align: { label: '对齐', left: '左对齐', center: '居中', right: '右对齐' },\n attachment: {\n empty: '添加附件',\n upload: '选择文件',\n uploading: '正在上传…',\n failed: '上传失败',\n retry: '重试',\n download: '下载',\n },\n embed: {\n empty: '嵌入视频、音频或网页',\n urlPlaceholder: '粘贴链接',\n apply: '嵌入',\n invalid: '无法嵌入这个链接',\n insecure: '只能嵌入 https 开头的链接',\n edit: '修改链接',\n cancel: '取消',\n caption: '添加说明',\n },\n noResults: '没有匹配的块',\n addBlock: '在下方添加块',\n dragHandle: '拖动以移动,点击打开菜单',\n turnInto: '转换为',\n duplicate: '复制',\n delete: '删除',\n moveUp: '上移',\n moveDown: '下移',\n bold: '粗体',\n italic: '斜体',\n underline: '下划线',\n strike: '删除线',\n code: '行内代码',\n link: '链接',\n linkPlaceholder: '粘贴或输入链接',\n applyLink: '确定',\n removeLink: '移除链接',\n comment: '评论',\n commentThread: '评论',\n removedBlock: '已删除的内容',\n restored: '已恢复到这个版本',\n changeAdded: '新增',\n changeRemoved: '删除',\n changeChanged: '修改',\n formatting: '文字格式',\n blockTypes: '块类型',\n}\n\nconst zhTW: EditorMessages = {\n placeholder: '輸入 / 插入內容',\n emptyPlaceholder: '開始寫點什麼,或輸入 / 插入內容',\n headingPlaceholder: '標題',\n types: {\n paragraph: '內文',\n heading1: '一級標題',\n heading2: '二級標題',\n heading3: '三級標題',\n bulletItem: '項目清單',\n numberedItem: '編號清單',\n checkItem: '待辦事項',\n quote: '引用',\n codeBlock: '程式碼',\n divider: '分隔線',\n image: '圖片',\n toggle: '摺疊區塊',\n callout: '提示區塊',\n table: '表格',\n columns: '分欄',\n attachment: '附件',\n embed: '嵌入',\n },\n hints: {\n paragraph: '一般的文字',\n heading1: '最大的標題',\n heading2: '中等的標題',\n heading3: '較小的標題',\n bulletItem: '用圓點列出幾項',\n numberedItem: '依序編號',\n checkItem: '可以勾選的事項',\n quote: '引用一段話',\n codeBlock: '等寬顯示程式碼',\n divider: '分隔上下內容',\n image: '上傳或嵌入一張圖片',\n toggle: '可以展開和收合的內容',\n callout: '帶圖示的醒目說明',\n table: '插入一個表格',\n columns: '把內容並排分成幾欄',\n attachment: '上傳一個檔案',\n embed: '影片、音訊或網頁',\n },\n image: {\n empty: '新增一張圖片',\n upload: '上傳',\n embed: '嵌入連結',\n urlPlaceholder: '貼上圖片連結',\n apply: '確定',\n uploading: '正在上傳',\n failed: '上傳失敗,請重試',\n caption: '新增說明',\n resize: '拖曳調整寬度',\n },\n codeBlock: { language: '語言', plainText: '純文字' },\n toggle: { expand: '展開', collapse: '收合' },\n mention: { label: '提及', searching: '正在搜尋', noResults: '沒有找到' },\n table: {\n row: '選擇這一列',\n column: '選擇這一欄',\n insertAbove: '在上方插入列',\n insertBelow: '在下方插入列',\n insertLeft: '在左側插入欄',\n insertRight: '在右側插入欄',\n moveUp: '上移',\n moveDown: '下移',\n moveLeft: '左移',\n moveRight: '右移',\n deleteRow: '刪除列',\n deleteColumn: '刪除欄',\n merge: '合併儲存格',\n split: '取消合併',\n clear: '清除內容',\n headerRow: '標題列',\n headerColumn: '標題欄',\n alignLeft: '靠左對齊',\n alignCenter: '置中',\n alignRight: '靠右對齊',\n addRow: '新增一列',\n addColumn: '新增一欄',\n },\n callout: {\n change: '點擊更換',\n tones: { info: '說明', tip: '提示', warning: '注意', danger: '警告' },\n },\n columns: {\n pick: '選擇欄數',\n count: '{count} 欄',\n select: '選取整個分欄',\n resize: '調整欄寬',\n even: '平分欄寬',\n column: '第 {index} 欄,共 {count} 欄',\n },\n colors: {\n label: '顏色',\n text: '文字顏色',\n background: '背景色',\n none: '預設',\n names: {\n gray: '灰色',\n red: '紅色',\n orange: '橙色',\n yellow: '黃色',\n green: '綠色',\n blue: '藍色',\n purple: '紫色',\n pink: '粉紅色',\n },\n },\n align: { label: '對齊', left: '靠左對齊', center: '置中', right: '靠右對齊' },\n attachment: {\n empty: '新增附件',\n upload: '選擇檔案',\n uploading: '正在上傳…',\n failed: '上傳失敗',\n retry: '重試',\n download: '下載',\n },\n embed: {\n empty: '嵌入影片、音訊或網頁',\n urlPlaceholder: '貼上連結',\n apply: '嵌入',\n invalid: '無法嵌入這個連結',\n insecure: '只能嵌入 https 開頭的連結',\n edit: '修改連結',\n cancel: '取消',\n caption: '新增說明',\n },\n noResults: '沒有符合的區塊',\n addBlock: '在下方新增區塊',\n dragHandle: '拖曳以移動,點擊開啟選單',\n turnInto: '轉換為',\n duplicate: '複製',\n delete: '刪除',\n moveUp: '上移',\n moveDown: '下移',\n bold: '粗體',\n italic: '斜體',\n underline: '底線',\n strike: '刪除線',\n code: '行內程式碼',\n link: '連結',\n linkPlaceholder: '貼上或輸入連結',\n applyLink: '確定',\n removeLink: '移除連結',\n comment: '評論',\n commentThread: '評論',\n removedBlock: '已刪除的內容',\n restored: '已還原到這個版本',\n changeAdded: '新增',\n changeRemoved: '刪除',\n changeChanged: '修改',\n formatting: '文字格式',\n blockTypes: '區塊類型',\n}\n\nconst en: EditorMessages = {\n placeholder: 'Type / for blocks',\n emptyPlaceholder: 'Start writing, or type / for blocks',\n headingPlaceholder: 'Heading',\n types: {\n paragraph: 'Text',\n heading1: 'Heading 1',\n heading2: 'Heading 2',\n heading3: 'Heading 3',\n bulletItem: 'Bulleted list',\n numberedItem: 'Numbered list',\n checkItem: 'To-do',\n quote: 'Quote',\n codeBlock: 'Code',\n divider: 'Divider',\n image: 'Image',\n toggle: 'Toggle',\n callout: 'Callout',\n table: 'Table',\n columns: 'Columns',\n attachment: 'File',\n embed: 'Embed',\n },\n hints: {\n paragraph: 'Plain text',\n heading1: 'Large section heading',\n heading2: 'Medium section heading',\n heading3: 'Small section heading',\n bulletItem: 'A simple list',\n numberedItem: 'A list with numbers',\n checkItem: 'Items to tick off',\n quote: 'Quote someone',\n codeBlock: 'Code in a monospace font',\n divider: 'Separate sections',\n image: 'Upload or embed an image',\n toggle: 'Content that can be shown or hidden',\n callout: 'A note that stands out, with an icon',\n table: 'A grid of rows and columns',\n columns: 'Put content side by side',\n attachment: 'Upload a file',\n embed: 'Video, audio or a web page',\n },\n image: {\n empty: 'Add an image',\n upload: 'Upload',\n embed: 'Embed link',\n urlPlaceholder: 'Paste the image link',\n apply: 'Apply',\n uploading: 'Uploading',\n failed: 'Upload failed, try again',\n caption: 'Add a caption',\n resize: 'Drag to resize',\n },\n codeBlock: { language: 'Language', plainText: 'Plain text' },\n toggle: { expand: 'Expand', collapse: 'Collapse' },\n mention: { label: 'Mention', searching: 'Searching', noResults: 'No one found' },\n table: {\n row: 'Select row',\n column: 'Select column',\n insertAbove: 'Insert row above',\n insertBelow: 'Insert row below',\n insertLeft: 'Insert column left',\n insertRight: 'Insert column right',\n moveUp: 'Move up',\n moveDown: 'Move down',\n moveLeft: 'Move left',\n moveRight: 'Move right',\n deleteRow: 'Delete row',\n deleteColumn: 'Delete column',\n merge: 'Merge cells',\n split: 'Unmerge',\n clear: 'Clear contents',\n headerRow: 'Header row',\n headerColumn: 'Header column',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n addRow: 'Add a row',\n addColumn: 'Add a column',\n },\n callout: {\n change: 'click to change',\n tones: { info: 'Info', tip: 'Tip', warning: 'Warning', danger: 'Danger' },\n },\n columns: {\n pick: 'Number of columns',\n count: '{count} columns',\n select: 'Select all columns',\n resize: 'Resize columns',\n even: 'Even out columns',\n column: 'Column {index} of {count}',\n },\n colors: {\n label: 'Color',\n text: 'Text color',\n background: 'Background',\n none: 'Default',\n names: {\n gray: 'Gray',\n red: 'Red',\n orange: 'Orange',\n yellow: 'Yellow',\n green: 'Green',\n blue: 'Blue',\n purple: 'Purple',\n pink: 'Pink',\n },\n },\n align: { label: 'Align', left: 'Align left', center: 'Center', right: 'Align right' },\n attachment: {\n empty: 'Add a file',\n upload: 'Choose a file',\n uploading: 'Uploading…',\n failed: 'Upload failed',\n retry: 'Retry',\n download: 'Download',\n },\n embed: {\n empty: 'Embed a video, audio or web page',\n urlPlaceholder: 'Paste a link',\n apply: 'Embed',\n invalid: \"This link can't be embedded\",\n insecure: 'Only https links can be embedded',\n edit: 'Change link',\n cancel: 'Cancel',\n caption: 'Add a caption',\n },\n noResults: 'No matching blocks',\n addBlock: 'Add a block below',\n dragHandle: 'Drag to move, click for the menu',\n turnInto: 'Turn into',\n duplicate: 'Duplicate',\n delete: 'Delete',\n moveUp: 'Move up',\n moveDown: 'Move down',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strike: 'Strikethrough',\n code: 'Inline code',\n link: 'Link',\n linkPlaceholder: 'Paste or type a link',\n applyLink: 'Apply',\n removeLink: 'Remove link',\n comment: 'Comment',\n commentThread: 'Comments',\n removedBlock: 'Removed content',\n restored: 'Restored this version',\n changeAdded: 'Added',\n changeRemoved: 'Removed',\n changeChanged: 'Changed',\n formatting: 'Text formatting',\n blockTypes: 'Block types',\n}\n\nexport const editorLocales: Record<string, EditorMessages> = {\n 'zh-CN': zhCN,\n 'zh-TW': zhTW,\n en,\n}\n\n/**\n * The editor's texts, picked by the name of DouUI's current locale.\n * Pass `messages` to override any of them.\n */\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K] }\n\n/** Any part of the messages: a nested group can be given in part too. */\nexport type EditorMessagesOverride = DeepPartial<EditorMessages>\n\nfunction merge<T>(base: T, extra: unknown): T {\n if (!extra || typeof extra !== 'object') return (extra ?? base) as T\n const result: Record<string, unknown> = { ...(base as Record<string, unknown>) }\n for (const [key, value] of Object.entries(extra)) {\n if (value === undefined) continue\n const current = result[key]\n result[key] =\n current && typeof current === 'object' && typeof value === 'object'\n ? merge(current, value)\n : value\n }\n return result as T\n}\n\nexport function useEditorMessages(override?: MaybeRefOrGetter<EditorMessagesOverride | undefined>) {\n const { locale } = useLocale()\n return computed<EditorMessages>(() => {\n const name = locale.value.name\n const base =\n editorLocales[name] ??\n editorLocales[name.split('-')[0]!] ??\n (name.startsWith('zh') ? zhCN : en)\n const extra = toValue(override)\n return extra ? merge(base, extra) : base\n })\n}\n"],"mappings":";;;AA0LA,IAAM,OAAuB;CAC3B,aAAa;CACb,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;EACL,WAAW;EACX,UAAU;EACV,UAAU;EACV,UAAU;EACV,YAAY;EACZ,cAAc;EACd,WAAW;EACX,OAAO;EACP,WAAW;EACX,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,YAAY;EACZ,OAAO;CACT;CACA,OAAO;EACL,WAAW;EACX,UAAU;EACV,UAAU;EACV,UAAU;EACV,YAAY;EACZ,cAAc;EACd,WAAW;EACX,OAAO;EACP,WAAW;EACX,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,YAAY;EACZ,OAAO;CACT;CACA,OAAO;EACL,OAAO;EACP,QAAQ;EACR,OAAO;EACP,gBAAg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ACX,QAAQ;CACR,QAAQ;CACR,UAAU;CACV,MAAM;CACN,QAAQ;CACR,WAAW;CACX,QAAQ;CACR,MAAM;CACN,MAAM;CACN,iBAAiB;CACjB,WAAW;CACX,YAAY;CACZ,SAAS;CACT,eAAe;CACf,cAAc;CACd,UAAU;CACV,aAAa;CACb,eAAe;CACf,eAAe;CACf,YAAY;CACZ,YAAY;AACd;AAEA,IAAa,gBAAgD;CAC3D,SAAS;CACT,SAAS;CACT;AACF;AAWA,SAAS,MAAS,MAAS,OAAmB;CAC5C,IAAI,CAAC,SAAS,OAAO,UAAU,UAAU,OAAQ,SAAS;CAC1D,MAAM,SAAkC,EAAE,GAAI,KAAiC;CAC/E,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,KAAK,GAAG;EAChD,IAAI,UAAU,KAAA,GAAW;EACzB,MAAM,UAAU,OAAO;EACvB,OAAO,OACL,WAAW,OAAO,YAAY,YAAY,OAAO,UAAU,WACvD,MAAM,SAAS,KAAK,IACpB;CACR;CACA,OAAO;AACT;AAEA,SAAgB,kBAAkB,UAAiE;CACjG,MAAM,EAAE,WAAW,UAAU;CAC7B,OAAO,eAA+B;EACpC,MAAM,OAAO,OAAO,MAAM;EAC1B,MAAM,OACJ,cAAc,SACd,cAAc,KAAK,MAAM,GAAG,CAAC,CAAC,QAC7B,KAAK,WAAW,IAAI,IAAI,OAAO;EAClC,MAAM,QAAQ,QAAQ,QAAQ;EAC9B,OAAO,QAAQ,MAAM,MAAM,KAAK,IAAI;CACtC,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"locale.js","names":[],"sources":["../src/locale.ts"],"sourcesContent":["import { useLocale } from 'dou-ui'\nimport { computed, toValue, type MaybeRefOrGetter } from 'vue'\n\nexport interface EditorMessages {\n placeholder: string\n emptyPlaceholder: string\n headingPlaceholder: string\n /** Names of the block types, also shown in menus. */\n types: {\n paragraph: string\n heading1: string\n heading2: string\n heading3: string\n bulletItem: string\n numberedItem: string\n checkItem: string\n quote: string\n codeBlock: string\n divider: string\n image: string\n toggle: string\n callout: string\n table: string\n columns: string\n attachment: string\n embed: string\n whiteboard: string\n }\n /** Short descriptions in the slash menu. */\n hints: {\n paragraph: string\n heading1: string\n heading2: string\n heading3: string\n bulletItem: string\n numberedItem: string\n checkItem: string\n quote: string\n codeBlock: string\n divider: string\n image: string\n toggle: string\n callout: string\n table: string\n columns: string\n attachment: string\n embed: string\n whiteboard: string\n }\n /** The image block. */\n image: {\n empty: string\n upload: string\n embed: string\n urlPlaceholder: string\n apply: string\n uploading: string\n failed: string\n caption: string\n resize: string\n }\n /** The code block. */\n codeBlock: {\n /** The language picker's name. */\n language: string\n plainText: string\n }\n toggle: { expand: string; collapse: string }\n callout: {\n /** Said after the tone on the icon button. */\n change: string\n tones: { info: string; tip: string; warning: string; danger: string }\n }\n mention: { label: string; searching: string; noResults: string }\n /** The table: its row and column menus. */\n table: {\n row: string\n column: string\n insertAbove: string\n insertBelow: string\n insertLeft: string\n insertRight: string\n moveUp: string\n moveDown: string\n moveLeft: string\n moveRight: string\n deleteRow: string\n deleteColumn: string\n merge: string\n split: string\n clear: string\n headerRow: string\n headerColumn: string\n alignLeft: string\n alignCenter: string\n alignRight: string\n addRow: string\n addColumn: string\n }\n /** Columns: the picker in the slash menu, the block menu entry, the resize bar. */\n columns: {\n /** The title of the picker for the number of columns. */\n pick: string\n /** A number of columns; `{count}` is replaced with it. */\n count: string\n /** Selects the whole set of columns a block is in. */\n select: string\n /** The bar between two columns. */\n resize: string\n /** Makes every column of the set as wide as the others. */\n even: string\n /** A column, for screen readers; `{index}` and `{count}` are replaced. */\n column: string\n }\n /** The color menu of the formatting toolbar. */\n colors: {\n label: string\n text: string\n background: string\n none: string\n names: {\n gray: string\n red: string\n orange: string\n yellow: string\n green: string\n blue: string\n purple: string\n pink: string\n }\n }\n /** Aligning paragraphs, headings and quotes. */\n align: { label: string; left: string; center: string; right: string }\n /** The attachment block. */\n attachment: {\n empty: string\n upload: string\n uploading: string\n failed: string\n retry: string\n download: string\n }\n /** The embed block. */\n embed: {\n empty: string\n urlPlaceholder: string\n apply: string\n invalid: string\n /** The link is not https. */\n insecure: string\n caption: string\n edit: string\n cancel: string\n }\n /** Blocks holding a whiteboard or a flow (`@dou-ui/editor/flow`). */\n board: {\n empty: string\n start: string\n edit: string\n view: string\n resize: string\n /** The button that adds a node to a flow, and the name of the node a flow block offers. */\n addNode: string\n searchNodes: string\n noNodes: string\n node: string\n /** On an empty flow in the fullscreen editor. */\n emptyFlow: string\n }\n noResults: string\n addBlock: string\n dragHandle: string\n turnInto: string\n duplicate: string\n delete: string\n moveUp: string\n moveDown: string\n bold: string\n italic: string\n underline: string\n strike: string\n code: string\n link: string\n linkPlaceholder: string\n applyLink: string\n removeLink: string\n /** Starts a comment thread on the selected text. */\n comment: string\n /** The name of the card that shows a thread. */\n commentThread: string\n /** Shown for a removed block that has no text, such as a divider, when comparing versions. */\n removedBlock: string\n /** Read out once a version is restored. */\n restored: string\n /** Read out, before the text, when going to a change while comparing. */\n changeAdded: string\n changeRemoved: string\n changeChanged: string\n formatting: string\n /** The name of the slash menu's list. */\n blockTypes: string\n}\n\nconst zhCN: EditorMessages = {\n placeholder: '输入 / 插入内容',\n emptyPlaceholder: '开始写点什么,或输入 / 插入内容',\n headingPlaceholder: '标题',\n types: {\n paragraph: '正文',\n heading1: '一级标题',\n heading2: '二级标题',\n heading3: '三级标题',\n bulletItem: '无序列表',\n numberedItem: '有序列表',\n checkItem: '待办事项',\n quote: '引用',\n codeBlock: '代码',\n divider: '分隔线',\n image: '图片',\n toggle: '折叠块',\n callout: '提示块',\n table: '表格',\n columns: '分栏',\n attachment: '附件',\n embed: '嵌入',\n whiteboard: '白板',\n },\n hints: {\n paragraph: '普通的文字',\n heading1: '最大的标题',\n heading2: '中等的标题',\n heading3: '较小的标题',\n bulletItem: '用圆点列出几项',\n numberedItem: '按顺序编号',\n checkItem: '可以勾选的事项',\n quote: '引用一段话',\n codeBlock: '等宽显示代码',\n divider: '分隔上下内容',\n image: '上传或嵌入一张图片',\n toggle: '可以展开和收起的内容',\n callout: '带图标的醒目说明',\n table: '插入一个表格',\n columns: '把内容并排分成几栏',\n attachment: '上传一个文件',\n embed: '视频、音频或网页',\n whiteboard: '图形、便签和连线',\n },\n image: {\n empty: '添加一张图片',\n upload: '上传',\n embed: '嵌入链接',\n urlPlaceholder: '粘贴图片链接',\n apply: '确定',\n uploading: '正在上传',\n failed: '上传失败,请重试',\n caption: '添加说明',\n resize: '拖动调整宽度',\n },\n codeBlock: { language: '语言', plainText: '纯文本' },\n toggle: { expand: '展开', collapse: '收起' },\n mention: { label: '提及', searching: '正在搜索', noResults: '没有找到' },\n table: {\n row: '选择这一行',\n column: '选择这一列',\n insertAbove: '在上方插入行',\n insertBelow: '在下方插入行',\n insertLeft: '在左侧插入列',\n insertRight: '在右侧插入列',\n moveUp: '上移',\n moveDown: '下移',\n moveLeft: '左移',\n moveRight: '右移',\n deleteRow: '删除行',\n deleteColumn: '删除列',\n merge: '合并单元格',\n split: '取消合并',\n clear: '清空内容',\n headerRow: '标题行',\n headerColumn: '标题列',\n alignLeft: '左对齐',\n alignCenter: '居中',\n alignRight: '右对齐',\n addRow: '添加一行',\n addColumn: '添加一列',\n },\n callout: {\n change: '点击更换',\n tones: { info: '说明', tip: '提示', warning: '注意', danger: '警告' },\n },\n columns: {\n pick: '选择栏数',\n count: '{count} 栏',\n select: '选中整个分栏',\n resize: '调整栏宽',\n even: '平分栏宽',\n column: '第 {index} 栏,共 {count} 栏',\n },\n colors: {\n label: '颜色',\n text: '文字颜色',\n background: '背景色',\n none: '默认',\n names: {\n gray: '灰色',\n red: '红色',\n orange: '橙色',\n yellow: '黄色',\n green: '绿色',\n blue: '蓝色',\n purple: '紫色',\n pink: '粉色',\n },\n },\n align: { label: '对齐', left: '左对齐', center: '居中', right: '右对齐' },\n attachment: {\n empty: '添加附件',\n upload: '选择文件',\n uploading: '正在上传…',\n failed: '上传失败',\n retry: '重试',\n download: '下载',\n },\n embed: {\n empty: '嵌入视频、音频或网页',\n urlPlaceholder: '粘贴链接',\n apply: '嵌入',\n invalid: '无法嵌入这个链接',\n insecure: '只能嵌入 https 开头的链接',\n edit: '修改链接',\n cancel: '取消',\n caption: '添加说明',\n },\n board: {\n empty: '还没有内容',\n start: '开始绘制',\n edit: '编辑',\n view: '查看',\n resize: '拖动以调整高度',\n addNode: '添加节点',\n searchNodes: '搜索节点',\n noNodes: '没有匹配的节点',\n node: '节点',\n emptyFlow: '使用左上角的“添加节点”添加第一个节点,也可以按住按钮拖到画布上',\n },\n noResults: '没有匹配的块',\n addBlock: '在下方添加块',\n dragHandle: '拖动以移动,点击打开菜单',\n turnInto: '转换为',\n duplicate: '复制',\n delete: '删除',\n moveUp: '上移',\n moveDown: '下移',\n bold: '粗体',\n italic: '斜体',\n underline: '下划线',\n strike: '删除线',\n code: '行内代码',\n link: '链接',\n linkPlaceholder: '粘贴或输入链接',\n applyLink: '确定',\n removeLink: '移除链接',\n comment: '评论',\n commentThread: '评论',\n removedBlock: '已删除的内容',\n restored: '已恢复到这个版本',\n changeAdded: '新增',\n changeRemoved: '删除',\n changeChanged: '修改',\n formatting: '文字格式',\n blockTypes: '块类型',\n}\n\nconst zhTW: EditorMessages = {\n placeholder: '輸入 / 插入內容',\n emptyPlaceholder: '開始寫點什麼,或輸入 / 插入內容',\n headingPlaceholder: '標題',\n types: {\n paragraph: '內文',\n heading1: '一級標題',\n heading2: '二級標題',\n heading3: '三級標題',\n bulletItem: '項目清單',\n numberedItem: '編號清單',\n checkItem: '待辦事項',\n quote: '引用',\n codeBlock: '程式碼',\n divider: '分隔線',\n image: '圖片',\n toggle: '摺疊區塊',\n callout: '提示區塊',\n table: '表格',\n columns: '分欄',\n attachment: '附件',\n embed: '嵌入',\n whiteboard: '白板',\n },\n hints: {\n paragraph: '一般的文字',\n heading1: '最大的標題',\n heading2: '中等的標題',\n heading3: '較小的標題',\n bulletItem: '用圓點列出幾項',\n numberedItem: '依序編號',\n checkItem: '可以勾選的事項',\n quote: '引用一段話',\n codeBlock: '等寬顯示程式碼',\n divider: '分隔上下內容',\n image: '上傳或嵌入一張圖片',\n toggle: '可以展開和收合的內容',\n callout: '帶圖示的醒目說明',\n table: '插入一個表格',\n columns: '把內容並排分成幾欄',\n attachment: '上傳一個檔案',\n embed: '影片、音訊或網頁',\n whiteboard: '圖形、便籤和連線',\n },\n image: {\n empty: '新增一張圖片',\n upload: '上傳',\n embed: '嵌入連結',\n urlPlaceholder: '貼上圖片連結',\n apply: '確定',\n uploading: '正在上傳',\n failed: '上傳失敗,請重試',\n caption: '新增說明',\n resize: '拖曳調整寬度',\n },\n codeBlock: { language: '語言', plainText: '純文字' },\n toggle: { expand: '展開', collapse: '收合' },\n mention: { label: '提及', searching: '正在搜尋', noResults: '沒有找到' },\n table: {\n row: '選擇這一列',\n column: '選擇這一欄',\n insertAbove: '在上方插入列',\n insertBelow: '在下方插入列',\n insertLeft: '在左側插入欄',\n insertRight: '在右側插入欄',\n moveUp: '上移',\n moveDown: '下移',\n moveLeft: '左移',\n moveRight: '右移',\n deleteRow: '刪除列',\n deleteColumn: '刪除欄',\n merge: '合併儲存格',\n split: '取消合併',\n clear: '清除內容',\n headerRow: '標題列',\n headerColumn: '標題欄',\n alignLeft: '靠左對齊',\n alignCenter: '置中',\n alignRight: '靠右對齊',\n addRow: '新增一列',\n addColumn: '新增一欄',\n },\n callout: {\n change: '點擊更換',\n tones: { info: '說明', tip: '提示', warning: '注意', danger: '警告' },\n },\n columns: {\n pick: '選擇欄數',\n count: '{count} 欄',\n select: '選取整個分欄',\n resize: '調整欄寬',\n even: '平分欄寬',\n column: '第 {index} 欄,共 {count} 欄',\n },\n colors: {\n label: '顏色',\n text: '文字顏色',\n background: '背景色',\n none: '預設',\n names: {\n gray: '灰色',\n red: '紅色',\n orange: '橙色',\n yellow: '黃色',\n green: '綠色',\n blue: '藍色',\n purple: '紫色',\n pink: '粉紅色',\n },\n },\n align: { label: '對齊', left: '靠左對齊', center: '置中', right: '靠右對齊' },\n attachment: {\n empty: '新增附件',\n upload: '選擇檔案',\n uploading: '正在上傳…',\n failed: '上傳失敗',\n retry: '重試',\n download: '下載',\n },\n embed: {\n empty: '嵌入影片、音訊或網頁',\n urlPlaceholder: '貼上連結',\n apply: '嵌入',\n invalid: '無法嵌入這個連結',\n insecure: '只能嵌入 https 開頭的連結',\n edit: '修改連結',\n cancel: '取消',\n caption: '新增說明',\n },\n board: {\n empty: '還沒有內容',\n start: '開始繪製',\n edit: '編輯',\n view: '查看',\n resize: '拖曳以調整高度',\n addNode: '新增節點',\n searchNodes: '搜尋節點',\n noNodes: '沒有符合的節點',\n node: '節點',\n emptyFlow: '使用左上角的「新增節點」新增第一個節點,也可以按住按鈕拖曳到畫布上',\n },\n noResults: '沒有符合的區塊',\n addBlock: '在下方新增區塊',\n dragHandle: '拖曳以移動,點擊開啟選單',\n turnInto: '轉換為',\n duplicate: '複製',\n delete: '刪除',\n moveUp: '上移',\n moveDown: '下移',\n bold: '粗體',\n italic: '斜體',\n underline: '底線',\n strike: '刪除線',\n code: '行內程式碼',\n link: '連結',\n linkPlaceholder: '貼上或輸入連結',\n applyLink: '確定',\n removeLink: '移除連結',\n comment: '評論',\n commentThread: '評論',\n removedBlock: '已刪除的內容',\n restored: '已還原到這個版本',\n changeAdded: '新增',\n changeRemoved: '刪除',\n changeChanged: '修改',\n formatting: '文字格式',\n blockTypes: '區塊類型',\n}\n\nconst en: EditorMessages = {\n placeholder: 'Type / for blocks',\n emptyPlaceholder: 'Start writing, or type / for blocks',\n headingPlaceholder: 'Heading',\n types: {\n paragraph: 'Text',\n heading1: 'Heading 1',\n heading2: 'Heading 2',\n heading3: 'Heading 3',\n bulletItem: 'Bulleted list',\n numberedItem: 'Numbered list',\n checkItem: 'To-do',\n quote: 'Quote',\n codeBlock: 'Code',\n divider: 'Divider',\n image: 'Image',\n toggle: 'Toggle',\n callout: 'Callout',\n table: 'Table',\n columns: 'Columns',\n attachment: 'File',\n embed: 'Embed',\n whiteboard: 'Whiteboard',\n },\n hints: {\n paragraph: 'Plain text',\n heading1: 'Large section heading',\n heading2: 'Medium section heading',\n heading3: 'Small section heading',\n bulletItem: 'A simple list',\n numberedItem: 'A list with numbers',\n checkItem: 'Items to tick off',\n quote: 'Quote someone',\n codeBlock: 'Code in a monospace font',\n divider: 'Separate sections',\n image: 'Upload or embed an image',\n toggle: 'Content that can be shown or hidden',\n callout: 'A note that stands out, with an icon',\n table: 'A grid of rows and columns',\n columns: 'Put content side by side',\n attachment: 'Upload a file',\n embed: 'Video, audio or a web page',\n whiteboard: 'Shapes, sticky notes and connectors',\n },\n image: {\n empty: 'Add an image',\n upload: 'Upload',\n embed: 'Embed link',\n urlPlaceholder: 'Paste the image link',\n apply: 'Apply',\n uploading: 'Uploading',\n failed: 'Upload failed, try again',\n caption: 'Add a caption',\n resize: 'Drag to resize',\n },\n codeBlock: { language: 'Language', plainText: 'Plain text' },\n toggle: { expand: 'Expand', collapse: 'Collapse' },\n mention: { label: 'Mention', searching: 'Searching', noResults: 'No one found' },\n table: {\n row: 'Select row',\n column: 'Select column',\n insertAbove: 'Insert row above',\n insertBelow: 'Insert row below',\n insertLeft: 'Insert column left',\n insertRight: 'Insert column right',\n moveUp: 'Move up',\n moveDown: 'Move down',\n moveLeft: 'Move left',\n moveRight: 'Move right',\n deleteRow: 'Delete row',\n deleteColumn: 'Delete column',\n merge: 'Merge cells',\n split: 'Unmerge',\n clear: 'Clear contents',\n headerRow: 'Header row',\n headerColumn: 'Header column',\n alignLeft: 'Align left',\n alignCenter: 'Align center',\n alignRight: 'Align right',\n addRow: 'Add a row',\n addColumn: 'Add a column',\n },\n callout: {\n change: 'click to change',\n tones: { info: 'Info', tip: 'Tip', warning: 'Warning', danger: 'Danger' },\n },\n columns: {\n pick: 'Number of columns',\n count: '{count} columns',\n select: 'Select all columns',\n resize: 'Resize columns',\n even: 'Even out columns',\n column: 'Column {index} of {count}',\n },\n colors: {\n label: 'Color',\n text: 'Text color',\n background: 'Background',\n none: 'Default',\n names: {\n gray: 'Gray',\n red: 'Red',\n orange: 'Orange',\n yellow: 'Yellow',\n green: 'Green',\n blue: 'Blue',\n purple: 'Purple',\n pink: 'Pink',\n },\n },\n align: { label: 'Align', left: 'Align left', center: 'Center', right: 'Align right' },\n attachment: {\n empty: 'Add a file',\n upload: 'Choose a file',\n uploading: 'Uploading…',\n failed: 'Upload failed',\n retry: 'Retry',\n download: 'Download',\n },\n embed: {\n empty: 'Embed a video, audio or web page',\n urlPlaceholder: 'Paste a link',\n apply: 'Embed',\n invalid: \"This link can't be embedded\",\n insecure: 'Only https links can be embedded',\n edit: 'Change link',\n cancel: 'Cancel',\n caption: 'Add a caption',\n },\n board: {\n empty: 'Nothing drawn yet',\n start: 'Start drawing',\n edit: 'Edit',\n view: 'View',\n resize: 'Drag to change the height',\n addNode: 'Add node',\n searchNodes: 'Search nodes',\n noNodes: 'No matching nodes',\n node: 'Node',\n emptyFlow:\n 'Use “Add node” at the top left to add the first node, or hold the button and drag it onto the canvas',\n },\n noResults: 'No matching blocks',\n addBlock: 'Add a block below',\n dragHandle: 'Drag to move, click for the menu',\n turnInto: 'Turn into',\n duplicate: 'Duplicate',\n delete: 'Delete',\n moveUp: 'Move up',\n moveDown: 'Move down',\n bold: 'Bold',\n italic: 'Italic',\n underline: 'Underline',\n strike: 'Strikethrough',\n code: 'Inline code',\n link: 'Link',\n linkPlaceholder: 'Paste or type a link',\n applyLink: 'Apply',\n removeLink: 'Remove link',\n comment: 'Comment',\n commentThread: 'Comments',\n removedBlock: 'Removed content',\n restored: 'Restored this version',\n changeAdded: 'Added',\n changeRemoved: 'Removed',\n changeChanged: 'Changed',\n formatting: 'Text formatting',\n blockTypes: 'Block types',\n}\n\nexport const editorLocales: Record<string, EditorMessages> = {\n 'zh-CN': zhCN,\n 'zh-TW': zhTW,\n en,\n}\n\n/**\n * The editor's texts, picked by the name of DouUI's current locale.\n * Pass `messages` to override any of them.\n */\ntype DeepPartial<T> = { [K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K] }\n\n/** Any part of the messages: a nested group can be given in part too. */\nexport type EditorMessagesOverride = DeepPartial<EditorMessages>\n\nfunction merge<T>(base: T, extra: unknown): T {\n if (!extra || typeof extra !== 'object') return (extra ?? base) as T\n const result: Record<string, unknown> = { ...(base as Record<string, unknown>) }\n for (const [key, value] of Object.entries(extra)) {\n if (value === undefined) continue\n const current = result[key]\n result[key] =\n current && typeof current === 'object' && typeof value === 'object'\n ? merge(current, value)\n : value\n }\n return result as T\n}\n\nexport function useEditorMessages(override?: MaybeRefOrGetter<EditorMessagesOverride | undefined>) {\n const { locale } = useLocale()\n return computed<EditorMessages>(() => {\n const name = locale.value.name\n const base =\n editorLocales[name] ??\n editorLocales[name.split('-')[0]!] ??\n (name.startsWith('zh') ? zhCN : en)\n const extra = toValue(override)\n return extra ? merge(base, extra) : base\n })\n}\n"],"mappings":";;;AA2MA,IAAM,OAAuB;CAC3B,aAAa;CACb,kBAAkB;CAClB,oBAAoB;CACpB,OAAO;EACL,WAAW;EACX,UAAU;EACV,UAAU;EACV,UAAU;EACV,YAAY;EACZ,cAAc;EACd,WAAW;EACX,OAAO;EACP,WAAW;EACX,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,YAAY;EACZ,OAAO;EACP,YAAY;CACd;CACA,OAAO;EACL,WAAW;EACX,UAAU;EACV,UAAU;EACV,UAAU;EACV,YAAY;EACZ,cAAc;EACd,WAAW;EACX,OAAO;EACP,WAAW;EACX,SAAS;EACT,OAAO;EACP,QAAQ;EACR,SAAS;EACT,OAAO;EACP,SAAS;EACT,YAAY;EACZ,OAAO;EACP,YAAY;CACd;CACA,OAAO;EACL,OAAO;EACP,QAAQ;EACR,OAAO;EACP,gBAAgB;EAChB,OAAO;EACP,WAAW;EACX,QAAQ;EACR,SAAS;EACT,QAAQ;CACV;CACA,WAAW;EAAE,UAAU;EAAM,WAAW;CAAM;CAC9C,QAAQ;EAAE,Q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