@ones-editor/editor 2.2.8-beta.7 → 2.2.8-beta.8
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/index.js
CHANGED
|
@@ -2084,6 +2084,61 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2084
2084
|
height: 40px;
|
|
2085
2085
|
transform: scaleX(0.5);
|
|
2086
2086
|
background-color: var(--Fills-Vibrant-Secondary, rgba(127, 127, 127, 0.4));
|
|
2087
|
+
}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
|
|
2088
|
+
position: absolute;
|
|
2089
|
+
background-color: transparent;
|
|
2090
|
+
border: 1px solid #0064ff;
|
|
2091
|
+
pointer-events: none;
|
|
2092
|
+
z-index: 1;
|
|
2093
|
+
display: none;
|
|
2094
|
+
}
|
|
2095
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
|
|
2096
|
+
display: block;
|
|
2097
|
+
}
|
|
2098
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
|
|
2099
|
+
position: absolute;
|
|
2100
|
+
width: 10px;
|
|
2101
|
+
height: 10px;
|
|
2102
|
+
background-color: #0064ff;
|
|
2103
|
+
border-radius: 50%;
|
|
2104
|
+
pointer-events: all;
|
|
2105
|
+
outline: 2px solid #fff;
|
|
2106
|
+
}
|
|
2107
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
|
|
2108
|
+
content: "";
|
|
2109
|
+
position: absolute;
|
|
2110
|
+
top: -3px;
|
|
2111
|
+
left: -3px;
|
|
2112
|
+
width: 16px;
|
|
2113
|
+
height: 16px;
|
|
2114
|
+
}
|
|
2115
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
|
|
2116
|
+
left: calc(50% - 5px);
|
|
2117
|
+
bottom: -5px;
|
|
2118
|
+
cursor: ns-resize;
|
|
2119
|
+
}
|
|
2120
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
|
|
2121
|
+
left: -5px;
|
|
2122
|
+
top: -5px;
|
|
2123
|
+
cursor: nwse-resize;
|
|
2124
|
+
}
|
|
2125
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
|
|
2126
|
+
right: -5px;
|
|
2127
|
+
top: -5px;
|
|
2128
|
+
cursor: nesw-resize;
|
|
2129
|
+
}
|
|
2130
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
|
|
2131
|
+
left: -5px;
|
|
2132
|
+
bottom: -5px;
|
|
2133
|
+
cursor: nesw-resize;
|
|
2134
|
+
}
|
|
2135
|
+
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
|
|
2136
|
+
right: -5px;
|
|
2137
|
+
bottom: -5px;
|
|
2138
|
+
cursor: nwse-resize;
|
|
2139
|
+
}
|
|
2140
|
+
div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
|
|
2141
|
+
display: none;
|
|
2087
2142
|
}div[data-type=editor-block].block-exclusive:after {
|
|
2088
2143
|
content: attr(data-exclusive-tips);
|
|
2089
2144
|
position: absolute;
|
|
@@ -2889,61 +2944,6 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data
|
|
|
2889
2944
|
}
|
|
2890
2945
|
div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data-type=block-content] > span.status-box .box-status-common:hover {
|
|
2891
2946
|
outline: none;
|
|
2892
|
-
}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
|
|
2893
|
-
position: absolute;
|
|
2894
|
-
background-color: transparent;
|
|
2895
|
-
border: 1px solid #0064ff;
|
|
2896
|
-
pointer-events: none;
|
|
2897
|
-
z-index: 1;
|
|
2898
|
-
display: none;
|
|
2899
|
-
}
|
|
2900
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
|
|
2901
|
-
display: block;
|
|
2902
|
-
}
|
|
2903
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
|
|
2904
|
-
position: absolute;
|
|
2905
|
-
width: 10px;
|
|
2906
|
-
height: 10px;
|
|
2907
|
-
background-color: #0064ff;
|
|
2908
|
-
border-radius: 50%;
|
|
2909
|
-
pointer-events: all;
|
|
2910
|
-
outline: 2px solid #fff;
|
|
2911
|
-
}
|
|
2912
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
|
|
2913
|
-
content: "";
|
|
2914
|
-
position: absolute;
|
|
2915
|
-
top: -3px;
|
|
2916
|
-
left: -3px;
|
|
2917
|
-
width: 16px;
|
|
2918
|
-
height: 16px;
|
|
2919
|
-
}
|
|
2920
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
|
|
2921
|
-
left: calc(50% - 5px);
|
|
2922
|
-
bottom: -5px;
|
|
2923
|
-
cursor: ns-resize;
|
|
2924
|
-
}
|
|
2925
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
|
|
2926
|
-
left: -5px;
|
|
2927
|
-
top: -5px;
|
|
2928
|
-
cursor: nwse-resize;
|
|
2929
|
-
}
|
|
2930
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
|
|
2931
|
-
right: -5px;
|
|
2932
|
-
top: -5px;
|
|
2933
|
-
cursor: nesw-resize;
|
|
2934
|
-
}
|
|
2935
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
|
|
2936
|
-
left: -5px;
|
|
2937
|
-
bottom: -5px;
|
|
2938
|
-
cursor: nesw-resize;
|
|
2939
|
-
}
|
|
2940
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
|
|
2941
|
-
right: -5px;
|
|
2942
|
-
bottom: -5px;
|
|
2943
|
-
cursor: nwse-resize;
|
|
2944
|
-
}
|
|
2945
|
-
div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
|
|
2946
|
-
display: none;
|
|
2947
2947
|
}.before-content, .editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected [data-type=block-content] .images .image-container.active::before, .editor-root div.editor-content div[data-type=editor-container] .embed-block[data-type=editor-block][data-embed-type=image].selected:not(.focused) [data-type=block-content] .images .image-container::before {
|
|
2948
2948
|
content: " ";
|
|
2949
2949
|
position: absolute;
|
|
@@ -47002,7 +47002,413 @@ ${codeText}
|
|
|
47002
47002
|
}
|
|
47003
47003
|
return rects[0];
|
|
47004
47004
|
}
|
|
47005
|
-
const
|
|
47005
|
+
const zhCN$v = {
|
|
47006
|
+
embedProperties: {
|
|
47007
|
+
edit: "\u7F16\u8F91",
|
|
47008
|
+
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
47009
|
+
}
|
|
47010
|
+
};
|
|
47011
|
+
const enUS$v = {
|
|
47012
|
+
embedProperties: {
|
|
47013
|
+
edit: "Edit",
|
|
47014
|
+
addComment: "Add annotation"
|
|
47015
|
+
}
|
|
47016
|
+
};
|
|
47017
|
+
const jaJP$v = {
|
|
47018
|
+
embedProperties: {
|
|
47019
|
+
edit: "\u7DE8\u96C6",
|
|
47020
|
+
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
47021
|
+
}
|
|
47022
|
+
};
|
|
47023
|
+
i18n$1.mergeLang({
|
|
47024
|
+
"zh-CN": zhCN$v,
|
|
47025
|
+
"en-US": enUS$v,
|
|
47026
|
+
"ja-JP": jaJP$v
|
|
47027
|
+
});
|
|
47028
|
+
const logger$24 = getLogger("embed-block-properties");
|
|
47029
|
+
function addCommentToBlock$1(editor, block) {
|
|
47030
|
+
var _a;
|
|
47031
|
+
for (const hook of editor.blockHooks) {
|
|
47032
|
+
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
47033
|
+
if (!commands) {
|
|
47034
|
+
continue;
|
|
47035
|
+
}
|
|
47036
|
+
if (commands.group === "block-comment-actions") {
|
|
47037
|
+
const command = commands.commands[0];
|
|
47038
|
+
if (!command) {
|
|
47039
|
+
continue;
|
|
47040
|
+
}
|
|
47041
|
+
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
47042
|
+
return true;
|
|
47043
|
+
}
|
|
47044
|
+
}
|
|
47045
|
+
return false;
|
|
47046
|
+
}
|
|
47047
|
+
class StandardEmbedBlockCommands {
|
|
47048
|
+
constructor(editor, block, properties) {
|
|
47049
|
+
__publicField(this, "group", "hovering-toolbar");
|
|
47050
|
+
__publicField(this, "_commands", [{
|
|
47051
|
+
id: "edit",
|
|
47052
|
+
name: i18n$1.t("embedProperties.edit"),
|
|
47053
|
+
icon: EditIcon
|
|
47054
|
+
}, {
|
|
47055
|
+
id: "separator",
|
|
47056
|
+
name: "",
|
|
47057
|
+
type: "separator"
|
|
47058
|
+
}]);
|
|
47059
|
+
this.editor = editor;
|
|
47060
|
+
this.block = block;
|
|
47061
|
+
this.properties = properties;
|
|
47062
|
+
}
|
|
47063
|
+
get commands() {
|
|
47064
|
+
var _a, _b, _c, _d;
|
|
47065
|
+
if (clientType.isMobile) {
|
|
47066
|
+
return [];
|
|
47067
|
+
}
|
|
47068
|
+
let standardCommands = [];
|
|
47069
|
+
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
47070
|
+
this.properties.presetIds.forEach((id) => {
|
|
47071
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47072
|
+
if (command) {
|
|
47073
|
+
standardCommands.push(command);
|
|
47074
|
+
}
|
|
47075
|
+
});
|
|
47076
|
+
}
|
|
47077
|
+
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
47078
|
+
standardCommands.push(...this.properties.extCommands);
|
|
47079
|
+
}
|
|
47080
|
+
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
47081
|
+
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
47082
|
+
}
|
|
47083
|
+
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
47084
|
+
this.properties.extIds.forEach((id) => {
|
|
47085
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47086
|
+
if (command) {
|
|
47087
|
+
standardCommands.push(command);
|
|
47088
|
+
}
|
|
47089
|
+
});
|
|
47090
|
+
}
|
|
47091
|
+
const { enableComments = true } = this.editor.options;
|
|
47092
|
+
if (!enableComments || this.editor.readonly) {
|
|
47093
|
+
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
47094
|
+
}
|
|
47095
|
+
if (this.editor.readonly) {
|
|
47096
|
+
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
47097
|
+
}
|
|
47098
|
+
standardCommands.forEach((item) => {
|
|
47099
|
+
if (item.id === "add-comment" || item.id === "edit") {
|
|
47100
|
+
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
47101
|
+
}
|
|
47102
|
+
});
|
|
47103
|
+
return standardCommands;
|
|
47104
|
+
}
|
|
47105
|
+
executeCommand(editor, block, item) {
|
|
47106
|
+
var _a, _b;
|
|
47107
|
+
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
47108
|
+
return;
|
|
47109
|
+
}
|
|
47110
|
+
if (item.id === "add-comment") {
|
|
47111
|
+
if (!addCommentToBlock$1(editor, block)) {
|
|
47112
|
+
logger$24.error("failed to add comment to block");
|
|
47113
|
+
}
|
|
47114
|
+
return;
|
|
47115
|
+
}
|
|
47116
|
+
logger$24.error(`unknown command: ${JSON.stringify(item)}`);
|
|
47117
|
+
}
|
|
47118
|
+
}
|
|
47119
|
+
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
47120
|
+
return {
|
|
47121
|
+
blockCommands: {
|
|
47122
|
+
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
47123
|
+
}
|
|
47124
|
+
};
|
|
47125
|
+
}
|
|
47126
|
+
function createResizeGripper(parent, type) {
|
|
47127
|
+
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
47128
|
+
elem.setAttribute("data-resize-type", type);
|
|
47129
|
+
}
|
|
47130
|
+
function getExistsResizer(block) {
|
|
47131
|
+
const tools = getBlockTools(block);
|
|
47132
|
+
return tools.querySelector(".block-resizer");
|
|
47133
|
+
}
|
|
47134
|
+
function hideResizer(block) {
|
|
47135
|
+
const exists = getExistsResizer(block);
|
|
47136
|
+
if (exists) {
|
|
47137
|
+
removeClass(exists, "active");
|
|
47138
|
+
}
|
|
47139
|
+
}
|
|
47140
|
+
function updateSize(block, element, resizer) {
|
|
47141
|
+
const blockRect = block.getBoundingClientRect();
|
|
47142
|
+
const elementRect = element.getBoundingClientRect();
|
|
47143
|
+
const top = elementRect.top - blockRect.top;
|
|
47144
|
+
const left = elementRect.left - blockRect.left;
|
|
47145
|
+
const width = elementRect.width;
|
|
47146
|
+
const height = elementRect.height;
|
|
47147
|
+
resizer.style.top = `${top}px`;
|
|
47148
|
+
resizer.style.left = `${left}px`;
|
|
47149
|
+
resizer.style.width = `${width}px`;
|
|
47150
|
+
resizer.style.height = `${height}px`;
|
|
47151
|
+
}
|
|
47152
|
+
function createResizer(block, element, options, mouseDownEvent) {
|
|
47153
|
+
const exists = getExistsResizer(block);
|
|
47154
|
+
if (exists) {
|
|
47155
|
+
addClass(exists, "active");
|
|
47156
|
+
updateSize(block, element, exists);
|
|
47157
|
+
return exists;
|
|
47158
|
+
}
|
|
47159
|
+
const tools = getBlockTools(block);
|
|
47160
|
+
const resizer = createElement("div", ["block-resizer"], tools);
|
|
47161
|
+
updateSize(block, element, resizer);
|
|
47162
|
+
options.resize.forEach((type) => {
|
|
47163
|
+
createResizeGripper(resizer, type);
|
|
47164
|
+
});
|
|
47165
|
+
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
47166
|
+
addClass(resizer, "active");
|
|
47167
|
+
return resizer;
|
|
47168
|
+
}
|
|
47169
|
+
function updateResizer(block, element) {
|
|
47170
|
+
const resizer = getExistsResizer(block);
|
|
47171
|
+
if (!resizer) {
|
|
47172
|
+
return;
|
|
47173
|
+
}
|
|
47174
|
+
if (!isChildNode(block, element)) {
|
|
47175
|
+
return;
|
|
47176
|
+
}
|
|
47177
|
+
const blockRect = block.getBoundingClientRect();
|
|
47178
|
+
const elementRect = element.getBoundingClientRect();
|
|
47179
|
+
const top = elementRect.top - blockRect.top;
|
|
47180
|
+
const left = elementRect.left - blockRect.left;
|
|
47181
|
+
const width = elementRect.width;
|
|
47182
|
+
const height = elementRect.height;
|
|
47183
|
+
resizer.style.top = `${top}px`;
|
|
47184
|
+
resizer.style.left = `${left}px`;
|
|
47185
|
+
resizer.style.width = `${width}px`;
|
|
47186
|
+
resizer.style.height = `${height}px`;
|
|
47187
|
+
}
|
|
47188
|
+
const style$a = "";
|
|
47189
|
+
const logger$23 = getLogger("block-resizer");
|
|
47190
|
+
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
47191
|
+
constructor(editor, options) {
|
|
47192
|
+
super();
|
|
47193
|
+
__publicField(this, "resizableElement");
|
|
47194
|
+
__publicField(this, "block", null);
|
|
47195
|
+
__publicField(this, "startRect", null);
|
|
47196
|
+
__publicField(this, "startPos", null);
|
|
47197
|
+
__publicField(this, "resizeType", null);
|
|
47198
|
+
__publicField(this, "enabled", false);
|
|
47199
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47200
|
+
if (this.block) {
|
|
47201
|
+
this.updateResizer();
|
|
47202
|
+
}
|
|
47203
|
+
});
|
|
47204
|
+
__publicField(this, "handleMouseDown", (event) => {
|
|
47205
|
+
event.preventDefault();
|
|
47206
|
+
event.stopPropagation();
|
|
47207
|
+
const element = this.getResizableElement();
|
|
47208
|
+
if (!element) {
|
|
47209
|
+
return;
|
|
47210
|
+
}
|
|
47211
|
+
if (event.button !== 0) {
|
|
47212
|
+
return;
|
|
47213
|
+
}
|
|
47214
|
+
const gripper = event.target;
|
|
47215
|
+
if (!gripper) {
|
|
47216
|
+
return;
|
|
47217
|
+
}
|
|
47218
|
+
if (!(gripper instanceof HTMLElement)) {
|
|
47219
|
+
return;
|
|
47220
|
+
}
|
|
47221
|
+
const resizeType = gripper.getAttribute("data-resize-type");
|
|
47222
|
+
if (!resizeType) {
|
|
47223
|
+
return;
|
|
47224
|
+
}
|
|
47225
|
+
this.bindEvents();
|
|
47226
|
+
this.startRect = element.getBoundingClientRect();
|
|
47227
|
+
this.startPos = event;
|
|
47228
|
+
this.resizeType = resizeType;
|
|
47229
|
+
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
47230
|
+
if (this.block) {
|
|
47231
|
+
this.editor.selection.selectBlock(this.block, 0);
|
|
47232
|
+
}
|
|
47233
|
+
});
|
|
47234
|
+
__publicField(this, "handleMouseMove", (event) => {
|
|
47235
|
+
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
47236
|
+
return;
|
|
47237
|
+
}
|
|
47238
|
+
const element = this.getResizableElement();
|
|
47239
|
+
if (!element || !this.block) {
|
|
47240
|
+
return;
|
|
47241
|
+
}
|
|
47242
|
+
const deltaX = event.x - this.startPos.x;
|
|
47243
|
+
const deltaY = event.y - this.startPos.y;
|
|
47244
|
+
const oldRect = this.startRect;
|
|
47245
|
+
let { top, left, right, bottom } = oldRect;
|
|
47246
|
+
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
47247
|
+
bottom += deltaY;
|
|
47248
|
+
}
|
|
47249
|
+
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
47250
|
+
top += deltaY;
|
|
47251
|
+
}
|
|
47252
|
+
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
47253
|
+
left += deltaX;
|
|
47254
|
+
}
|
|
47255
|
+
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
47256
|
+
right += deltaX;
|
|
47257
|
+
}
|
|
47258
|
+
const width = right > left ? right - left : 0;
|
|
47259
|
+
const height = bottom > top ? bottom - top : 0;
|
|
47260
|
+
const newRect = new DOMRect(left, top, width, height);
|
|
47261
|
+
this.emit("resizing", this, newRect);
|
|
47262
|
+
const newElement = this.getResizableElement();
|
|
47263
|
+
if (newElement) {
|
|
47264
|
+
updateResizer(this.block, newElement);
|
|
47265
|
+
}
|
|
47266
|
+
});
|
|
47267
|
+
__publicField(this, "handleMouseUp", (event) => {
|
|
47268
|
+
if (event.button !== 0) {
|
|
47269
|
+
return;
|
|
47270
|
+
}
|
|
47271
|
+
setDefaultCursor("");
|
|
47272
|
+
this.unbindEvents();
|
|
47273
|
+
this.emit("resized", this);
|
|
47274
|
+
const element = this.getResizableElement();
|
|
47275
|
+
if (!element || !this.block) {
|
|
47276
|
+
return;
|
|
47277
|
+
}
|
|
47278
|
+
updateResizer(this.block, element);
|
|
47279
|
+
});
|
|
47280
|
+
this.editor = editor;
|
|
47281
|
+
this.options = options;
|
|
47282
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47283
|
+
}
|
|
47284
|
+
enableResize(block, resizableElement) {
|
|
47285
|
+
this.block = block;
|
|
47286
|
+
this.resizableElement = resizableElement;
|
|
47287
|
+
this.createResizer();
|
|
47288
|
+
this.enabled = true;
|
|
47289
|
+
}
|
|
47290
|
+
disableResize() {
|
|
47291
|
+
if (!this.block) {
|
|
47292
|
+
return;
|
|
47293
|
+
}
|
|
47294
|
+
hideResizer(this.block);
|
|
47295
|
+
this.enabled = false;
|
|
47296
|
+
}
|
|
47297
|
+
update(block, resizableElement) {
|
|
47298
|
+
this.block = block;
|
|
47299
|
+
this.resizableElement = resizableElement;
|
|
47300
|
+
const elem = this.getResizableElement();
|
|
47301
|
+
if (elem && this.enabled) {
|
|
47302
|
+
this.createResizer();
|
|
47303
|
+
}
|
|
47304
|
+
}
|
|
47305
|
+
updateResizer() {
|
|
47306
|
+
const newElement = this.getResizableElement();
|
|
47307
|
+
if (newElement && this.block) {
|
|
47308
|
+
updateResizer(this.block, newElement);
|
|
47309
|
+
}
|
|
47310
|
+
}
|
|
47311
|
+
getBlock() {
|
|
47312
|
+
return this.block;
|
|
47313
|
+
}
|
|
47314
|
+
destroy() {
|
|
47315
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47316
|
+
}
|
|
47317
|
+
getResizableElement() {
|
|
47318
|
+
if (this.resizableElement) {
|
|
47319
|
+
return this.resizableElement;
|
|
47320
|
+
}
|
|
47321
|
+
if (!this.block) {
|
|
47322
|
+
return null;
|
|
47323
|
+
}
|
|
47324
|
+
return getBlockContent(this.block);
|
|
47325
|
+
}
|
|
47326
|
+
createResizer() {
|
|
47327
|
+
const element = this.getResizableElement();
|
|
47328
|
+
if (!element || !this.block) {
|
|
47329
|
+
return;
|
|
47330
|
+
}
|
|
47331
|
+
assert(logger$23, isChildNode(this.block, element), "not a block child element");
|
|
47332
|
+
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
47333
|
+
}
|
|
47334
|
+
bindEvents() {
|
|
47335
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
47336
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
47337
|
+
}
|
|
47338
|
+
unbindEvents() {
|
|
47339
|
+
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
47340
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
47341
|
+
}
|
|
47342
|
+
}
|
|
47343
|
+
class EmbedBlockResizer {
|
|
47344
|
+
constructor(editor) {
|
|
47345
|
+
__publicField(this, "resizing", false);
|
|
47346
|
+
__publicField(this, "blockResizer");
|
|
47347
|
+
__publicField(this, "handleResized", () => {
|
|
47348
|
+
this.resizing = false;
|
|
47349
|
+
});
|
|
47350
|
+
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
47351
|
+
var _a, _b;
|
|
47352
|
+
this.resizing = true;
|
|
47353
|
+
const block = resizer.getBlock();
|
|
47354
|
+
if (block) {
|
|
47355
|
+
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
47356
|
+
return;
|
|
47357
|
+
}
|
|
47358
|
+
const blockType = getEmbedType(block);
|
|
47359
|
+
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
47360
|
+
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
47361
|
+
const oldData = this.editor.getBlockData(block);
|
|
47362
|
+
const oldEmbedData = oldData.embedData;
|
|
47363
|
+
const newEmbedData = {
|
|
47364
|
+
...oldEmbedData,
|
|
47365
|
+
height
|
|
47366
|
+
};
|
|
47367
|
+
this.editor.updateEmbedData(block, newEmbedData);
|
|
47368
|
+
}
|
|
47369
|
+
});
|
|
47370
|
+
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
47371
|
+
if (this.resizing) {
|
|
47372
|
+
return;
|
|
47373
|
+
}
|
|
47374
|
+
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
47375
|
+
this.disableResizer();
|
|
47376
|
+
}
|
|
47377
|
+
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
47378
|
+
this.tryEnableResizer(block);
|
|
47379
|
+
}
|
|
47380
|
+
});
|
|
47381
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47382
|
+
this.blockResizer.updateResizer();
|
|
47383
|
+
});
|
|
47384
|
+
this.editor = editor;
|
|
47385
|
+
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
47386
|
+
this.blockResizer = new BlockResizer(this.editor, {
|
|
47387
|
+
resize: ["bottom"]
|
|
47388
|
+
});
|
|
47389
|
+
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
47390
|
+
this.blockResizer.addListener("resized", this.handleResized);
|
|
47391
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47392
|
+
}
|
|
47393
|
+
destroy() {
|
|
47394
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47395
|
+
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
47396
|
+
}
|
|
47397
|
+
tryEnableResizer(block) {
|
|
47398
|
+
this.blockResizer.enableResize(block);
|
|
47399
|
+
}
|
|
47400
|
+
disableResizer() {
|
|
47401
|
+
this.blockResizer.disableResize();
|
|
47402
|
+
}
|
|
47403
|
+
static get(editor) {
|
|
47404
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47405
|
+
}
|
|
47406
|
+
static register(editor, block) {
|
|
47407
|
+
addClass(block, "resizable");
|
|
47408
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47409
|
+
}
|
|
47410
|
+
}
|
|
47411
|
+
const logger$22 = getLogger("exclusive-block");
|
|
47006
47412
|
function addExclusiveStyle(editor, block, userId, displayName) {
|
|
47007
47413
|
var _a;
|
|
47008
47414
|
addClass(block, "block-exclusive");
|
|
@@ -47020,7 +47426,7 @@ ${codeText}
|
|
|
47020
47426
|
block.removeAttribute("data-exclusive-tips");
|
|
47021
47427
|
}
|
|
47022
47428
|
function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
|
|
47023
|
-
logger$
|
|
47429
|
+
logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
|
|
47024
47430
|
if (exclusive) {
|
|
47025
47431
|
addExclusiveStyle(editor, block, userId, displayName);
|
|
47026
47432
|
} else {
|
|
@@ -47177,28 +47583,28 @@ ${codeText}
|
|
|
47177
47583
|
}
|
|
47178
47584
|
}
|
|
47179
47585
|
const exclusiveBlockStyles = "";
|
|
47180
|
-
const zhCN$
|
|
47586
|
+
const zhCN$u = {
|
|
47181
47587
|
exclusive: {
|
|
47182
47588
|
tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
|
|
47183
47589
|
fallbackAbstract: "\u8BE5 Block"
|
|
47184
47590
|
}
|
|
47185
47591
|
};
|
|
47186
|
-
const enUS$
|
|
47592
|
+
const enUS$u = {
|
|
47187
47593
|
exclusive: {
|
|
47188
47594
|
tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
|
|
47189
47595
|
fallbackAbstract: "This Block"
|
|
47190
47596
|
}
|
|
47191
47597
|
};
|
|
47192
|
-
const jaJP$
|
|
47598
|
+
const jaJP$u = {
|
|
47193
47599
|
exclusive: {
|
|
47194
47600
|
tips: "\u300C{editor}\u300D\u306F\u7DE8\u96C6\u4E2D\u3067\u3059\u3002\u300C{embedType}\u300D\u306F\u8907\u6570\u4EBA\u3067\u540C\u6642\u7DE8\u96C6\u3067\u304D\u307E\u305B\u3093",
|
|
47195
47601
|
fallbackAbstract: "\u3053\u306E\u8981\u7D20"
|
|
47196
47602
|
}
|
|
47197
47603
|
};
|
|
47198
47604
|
i18n$1.mergeLang({
|
|
47199
|
-
"zh-CN": zhCN$
|
|
47200
|
-
"en-US": enUS$
|
|
47201
|
-
"ja-JP": jaJP$
|
|
47605
|
+
"zh-CN": zhCN$u,
|
|
47606
|
+
"en-US": enUS$u,
|
|
47607
|
+
"ja-JP": jaJP$u
|
|
47202
47608
|
});
|
|
47203
47609
|
function getBlockInfo(editor, block) {
|
|
47204
47610
|
const data2 = editor.getBlockData(block);
|
|
@@ -47374,22 +47780,22 @@ ${codeText}
|
|
|
47374
47780
|
};
|
|
47375
47781
|
}
|
|
47376
47782
|
}
|
|
47377
|
-
const style$
|
|
47378
|
-
const zhCN$
|
|
47783
|
+
const style$9 = "";
|
|
47784
|
+
const zhCN$t = {
|
|
47379
47785
|
locker: {
|
|
47380
47786
|
lock: "\u9501\u5B9A",
|
|
47381
47787
|
unlock: "\u89E3\u9664\u9501\u5B9A",
|
|
47382
47788
|
lockedBy: "\u88AB {name} \u9501\u5B9A"
|
|
47383
47789
|
}
|
|
47384
47790
|
};
|
|
47385
|
-
const enUS$
|
|
47791
|
+
const enUS$t = {
|
|
47386
47792
|
locker: {
|
|
47387
47793
|
lock: "Lock",
|
|
47388
47794
|
unlock: "Unlock",
|
|
47389
47795
|
lockedBy: "Locked by {name}"
|
|
47390
47796
|
}
|
|
47391
47797
|
};
|
|
47392
|
-
const jaJP$
|
|
47798
|
+
const jaJP$t = {
|
|
47393
47799
|
locker: {
|
|
47394
47800
|
lock: "\u30ED\u30C3\u30AF",
|
|
47395
47801
|
unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
|
|
@@ -47397,9 +47803,9 @@ ${codeText}
|
|
|
47397
47803
|
}
|
|
47398
47804
|
};
|
|
47399
47805
|
i18n$1.mergeLang({
|
|
47400
|
-
"zh-CN": zhCN$
|
|
47401
|
-
"en-US": enUS$
|
|
47402
|
-
"ja-JP": jaJP$
|
|
47806
|
+
"zh-CN": zhCN$t,
|
|
47807
|
+
"en-US": enUS$t,
|
|
47808
|
+
"ja-JP": jaJP$t
|
|
47403
47809
|
});
|
|
47404
47810
|
class BlockLockerPasteHandler {
|
|
47405
47811
|
async handleBeforePasteDoc(editor, doc2) {
|
|
@@ -47411,7 +47817,7 @@ ${codeText}
|
|
|
47411
47817
|
return false;
|
|
47412
47818
|
}
|
|
47413
47819
|
}
|
|
47414
|
-
const logger$
|
|
47820
|
+
const logger$21 = getLogger("context-menu-utils");
|
|
47415
47821
|
function blobToString(blob) {
|
|
47416
47822
|
return new Promise((resolve, reject) => {
|
|
47417
47823
|
const reader = new FileReader();
|
|
@@ -47432,7 +47838,7 @@ ${codeText}
|
|
|
47432
47838
|
const types2 = items[0].types;
|
|
47433
47839
|
return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
|
|
47434
47840
|
} catch (error2) {
|
|
47435
|
-
logger$
|
|
47841
|
+
logger$21.warn(`Failed to read clipboard data: ${error2}`);
|
|
47436
47842
|
return true;
|
|
47437
47843
|
}
|
|
47438
47844
|
}
|
|
@@ -47481,7 +47887,7 @@ ${codeText}
|
|
|
47481
47887
|
}
|
|
47482
47888
|
return dataTransfer;
|
|
47483
47889
|
}
|
|
47484
|
-
const logger$
|
|
47890
|
+
const logger$20 = getLogger("ClipboardProvider");
|
|
47485
47891
|
class ClipboardProvider {
|
|
47486
47892
|
constructor(editor, options) {
|
|
47487
47893
|
__publicField(this, "id", "ClipboardProvider");
|
|
@@ -47567,7 +47973,7 @@ ${codeText}
|
|
|
47567
47973
|
}
|
|
47568
47974
|
}).catch((err) => {
|
|
47569
47975
|
this.clipboardPermission.read = "denied";
|
|
47570
|
-
logger$
|
|
47976
|
+
logger$20.log(err);
|
|
47571
47977
|
});
|
|
47572
47978
|
} catch (error2) {
|
|
47573
47979
|
this.clipboardPermission = {
|
|
@@ -47628,13 +48034,14 @@ ${codeText}
|
|
|
47628
48034
|
}
|
|
47629
48035
|
}
|
|
47630
48036
|
class StandardBoxCommands {
|
|
47631
|
-
constructor(editor) {
|
|
48037
|
+
constructor(editor, extIds) {
|
|
47632
48038
|
__publicField(this, "group", "standard-box-commands");
|
|
47633
48039
|
__publicField(this, "providers", []);
|
|
47634
48040
|
this.editor = editor;
|
|
47635
|
-
|
|
47636
|
-
|
|
47637
|
-
|
|
48041
|
+
this.extIds = extIds;
|
|
48042
|
+
}
|
|
48043
|
+
addProvider(provider) {
|
|
48044
|
+
this.providers.push(provider);
|
|
47638
48045
|
}
|
|
47639
48046
|
get commands() {
|
|
47640
48047
|
if (this.editor.readonly) {
|
|
@@ -47645,6 +48052,14 @@ ${codeText}
|
|
|
47645
48052
|
for (const provider of this.providers) {
|
|
47646
48053
|
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
|
|
47647
48054
|
}
|
|
48055
|
+
for (const extId of this.extIds || []) {
|
|
48056
|
+
if (extId === "separator") {
|
|
48057
|
+
items.push({ id: "sep", name: "", type: "separator" });
|
|
48058
|
+
}
|
|
48059
|
+
if (extId === "add-comment") {
|
|
48060
|
+
items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
|
|
48061
|
+
}
|
|
48062
|
+
}
|
|
47648
48063
|
return items;
|
|
47649
48064
|
}
|
|
47650
48065
|
executeCommand(editor, block, box, item) {
|
|
@@ -47659,12 +48074,20 @@ ${codeText}
|
|
|
47659
48074
|
return;
|
|
47660
48075
|
}
|
|
47661
48076
|
}
|
|
48077
|
+
if (item.id === "add-comment") {
|
|
48078
|
+
addCommentToBlock$1(editor, block);
|
|
48079
|
+
}
|
|
47662
48080
|
}
|
|
47663
48081
|
static create(editor) {
|
|
47664
48082
|
return new StandardBoxCommands(editor);
|
|
47665
48083
|
}
|
|
48084
|
+
static mobileCreate(editor) {
|
|
48085
|
+
const instance = new StandardBoxCommands(editor);
|
|
48086
|
+
instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
|
|
48087
|
+
return instance;
|
|
48088
|
+
}
|
|
47666
48089
|
}
|
|
47667
|
-
const logger$
|
|
48090
|
+
const logger$1$ = getLogger("object-commands");
|
|
47668
48091
|
const SEP$1 = {
|
|
47669
48092
|
id: "",
|
|
47670
48093
|
name: "",
|
|
@@ -47720,7 +48143,7 @@ ${codeText}
|
|
|
47720
48143
|
let element = null;
|
|
47721
48144
|
const commands = [];
|
|
47722
48145
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47723
|
-
boxCommands.push(
|
|
48146
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47724
48147
|
}
|
|
47725
48148
|
if (boxCommands.length > 0) {
|
|
47726
48149
|
element = child;
|
|
@@ -47750,10 +48173,10 @@ ${codeText}
|
|
|
47750
48173
|
const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
|
|
47751
48174
|
const { boxCommands, blockCommands } = result;
|
|
47752
48175
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47753
|
-
boxCommands.push(
|
|
48176
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47754
48177
|
}
|
|
47755
48178
|
if (boxCommands.length > 0) {
|
|
47756
|
-
assert(logger$
|
|
48179
|
+
assert(logger$1$, child, "child is null");
|
|
47757
48180
|
for (let i = 0; i < boxCommands.length; i++) {
|
|
47758
48181
|
if (boxCommands[i].commands.find((c) => c.id === item.id)) {
|
|
47759
48182
|
boxCommands[i].executeCommand(editor, block, child, item);
|
|
@@ -48020,18 +48443,18 @@ ${codeText}
|
|
|
48020
48443
|
}
|
|
48021
48444
|
}
|
|
48022
48445
|
const LIST_MAX_LEVEL = 8;
|
|
48023
|
-
const logger$
|
|
48024
|
-
const logger$
|
|
48446
|
+
const logger$1_ = getLogger("list-block");
|
|
48447
|
+
const logger$1Z = getLogger("list-block");
|
|
48025
48448
|
function isListBlock(block) {
|
|
48026
48449
|
return getBlockType(block) === "list";
|
|
48027
48450
|
}
|
|
48028
48451
|
function ensureIsListBlock(block) {
|
|
48029
|
-
assert(logger$
|
|
48452
|
+
assert(logger$1Z, isListBlock(block), "not a list block");
|
|
48030
48453
|
}
|
|
48031
48454
|
function getListBlockType(block) {
|
|
48032
48455
|
ensureIsListBlock(block);
|
|
48033
48456
|
const type = block.getAttribute("data-list-type");
|
|
48034
|
-
assert(logger$
|
|
48457
|
+
assert(logger$1Z, type, "no list type");
|
|
48035
48458
|
return type;
|
|
48036
48459
|
}
|
|
48037
48460
|
function isTextOnlyListBlock(block) {
|
|
@@ -48050,7 +48473,7 @@ ${codeText}
|
|
|
48050
48473
|
function getListBlockGroupId(block) {
|
|
48051
48474
|
ensureIsListBlock(block);
|
|
48052
48475
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48053
|
-
assert(logger$
|
|
48476
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48054
48477
|
return groupId;
|
|
48055
48478
|
}
|
|
48056
48479
|
function getListBlockProperties(block) {
|
|
@@ -48060,7 +48483,7 @@ ${codeText}
|
|
|
48060
48483
|
const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
|
|
48061
48484
|
const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
|
|
48062
48485
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48063
|
-
assert(logger$
|
|
48486
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48064
48487
|
return {
|
|
48065
48488
|
type,
|
|
48066
48489
|
start,
|
|
@@ -48329,7 +48752,7 @@ ${codeText}
|
|
|
48329
48752
|
this.nodeMap.set(block, node);
|
|
48330
48753
|
if (parentBlock) {
|
|
48331
48754
|
const parentNode = this.nodeMap.get(parentBlock);
|
|
48332
|
-
assert(logger$
|
|
48755
|
+
assert(logger$1_, parentNode, "no parent node");
|
|
48333
48756
|
parentNode.children.push(node);
|
|
48334
48757
|
} else {
|
|
48335
48758
|
this.rootNodes.push(node);
|
|
@@ -48397,7 +48820,7 @@ ${codeText}
|
|
|
48397
48820
|
return hasClass(block, "editor-in-mindmap-first");
|
|
48398
48821
|
}
|
|
48399
48822
|
function isViewingAsMindmap(block) {
|
|
48400
|
-
assert(logger$
|
|
48823
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
48401
48824
|
if (hasClass(block, "editor-in-mindmap-first")) {
|
|
48402
48825
|
return true;
|
|
48403
48826
|
}
|
|
@@ -48418,12 +48841,12 @@ ${codeText}
|
|
|
48418
48841
|
const container = getParentContainer(from);
|
|
48419
48842
|
if (to) {
|
|
48420
48843
|
const container2 = getParentContainer(to);
|
|
48421
|
-
assert(logger$
|
|
48844
|
+
assert(logger$1_, container === container2, "invalid block container");
|
|
48422
48845
|
}
|
|
48423
48846
|
const fromIndex = getBlockIndex(from);
|
|
48424
48847
|
if (to) {
|
|
48425
48848
|
const toIndex = getBlockIndex(to);
|
|
48426
|
-
assert(logger$
|
|
48849
|
+
assert(logger$1_, fromIndex <= toIndex, "invalid block index");
|
|
48427
48850
|
}
|
|
48428
48851
|
addClass(from, ...styles);
|
|
48429
48852
|
if (!to || to === from) {
|
|
@@ -48431,7 +48854,7 @@ ${codeText}
|
|
|
48431
48854
|
}
|
|
48432
48855
|
let next2 = getNextBlock(from);
|
|
48433
48856
|
while (next2 !== to) {
|
|
48434
|
-
assert(logger$
|
|
48857
|
+
assert(logger$1_, next2, "no next button");
|
|
48435
48858
|
addClass(next2, ...styles);
|
|
48436
48859
|
next2 = getNextBlock(next2);
|
|
48437
48860
|
}
|
|
@@ -48442,7 +48865,7 @@ ${codeText}
|
|
|
48442
48865
|
async function requestMindmapFullscreen(editor, block, mindmapTools) {
|
|
48443
48866
|
const tools = getBlockTools(block);
|
|
48444
48867
|
const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
|
|
48445
|
-
assert(logger$
|
|
48868
|
+
assert(logger$1_, exitFullscreenButton, "no full screen button");
|
|
48446
48869
|
const resetMindmap = () => {
|
|
48447
48870
|
setTimeout(() => {
|
|
48448
48871
|
mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
|
|
@@ -48462,7 +48885,7 @@ ${codeText}
|
|
|
48462
48885
|
try {
|
|
48463
48886
|
await exitFullscreen();
|
|
48464
48887
|
} catch (err) {
|
|
48465
|
-
logger$
|
|
48888
|
+
logger$1_.error(err);
|
|
48466
48889
|
}
|
|
48467
48890
|
onExitFullscreen();
|
|
48468
48891
|
} else {
|
|
@@ -48471,7 +48894,7 @@ ${codeText}
|
|
|
48471
48894
|
await requestFullscreen(tools);
|
|
48472
48895
|
resetMindmap();
|
|
48473
48896
|
} catch (err) {
|
|
48474
|
-
logger$
|
|
48897
|
+
logger$1_.error(err);
|
|
48475
48898
|
}
|
|
48476
48899
|
exitFullscreenButton.innerHTML = ExitFullScreenIcon;
|
|
48477
48900
|
exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
|
|
@@ -48752,7 +49175,7 @@ ${codeText}
|
|
|
48752
49175
|
if (!svg) {
|
|
48753
49176
|
return;
|
|
48754
49177
|
}
|
|
48755
|
-
assert(logger$
|
|
49178
|
+
assert(logger$1_, svg, "no mindmap svg");
|
|
48756
49179
|
svg.remove();
|
|
48757
49180
|
editor.domEvents.removeAllListeners(svg);
|
|
48758
49181
|
destroyMindmapButtons(editor, block);
|
|
@@ -48804,7 +49227,7 @@ ${codeText}
|
|
|
48804
49227
|
});
|
|
48805
49228
|
__publicField(this, "handleMouseEnter", () => {
|
|
48806
49229
|
const block = getParentBlock(this.toMindmapButton);
|
|
48807
|
-
assert(logger$
|
|
49230
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48808
49231
|
highlightEntireList(this.editor, block, true);
|
|
48809
49232
|
this.currentBlock = block;
|
|
48810
49233
|
});
|
|
@@ -48816,7 +49239,7 @@ ${codeText}
|
|
|
48816
49239
|
});
|
|
48817
49240
|
__publicField(this, "handleClick", () => {
|
|
48818
49241
|
const block = getParentBlock(this.toMindmapButton);
|
|
48819
|
-
assert(logger$
|
|
49242
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48820
49243
|
toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
|
|
48821
49244
|
});
|
|
48822
49245
|
this.editor = editor;
|
|
@@ -48944,11 +49367,11 @@ ${codeText}
|
|
|
48944
49367
|
}
|
|
48945
49368
|
}
|
|
48946
49369
|
function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
|
|
48947
|
-
logger$
|
|
49370
|
+
logger$1_.debug("drag a block on a list block");
|
|
48948
49371
|
if (!isTextKindBlock(editor, draggedBlock)) {
|
|
48949
49372
|
return false;
|
|
48950
49373
|
}
|
|
48951
|
-
assert(logger$
|
|
49374
|
+
assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
|
|
48952
49375
|
const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
|
|
48953
49376
|
const newStart = insertPos === "after" ? start + 1 : start;
|
|
48954
49377
|
const oldData = editor.getBlockData(draggedBlock);
|
|
@@ -48981,7 +49404,7 @@ ${codeText}
|
|
|
48981
49404
|
return true;
|
|
48982
49405
|
}
|
|
48983
49406
|
function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
|
|
48984
|
-
logger$
|
|
49407
|
+
logger$1_.debug("drag a list between text blocks");
|
|
48985
49408
|
if (insertPos === "after") {
|
|
48986
49409
|
const nextBlock = getNextBlock(targetBlock);
|
|
48987
49410
|
if (nextBlock && isListBlock(nextBlock)) {
|
|
@@ -49018,11 +49441,11 @@ ${codeText}
|
|
|
49018
49441
|
}
|
|
49019
49442
|
const { blockId } = dragData;
|
|
49020
49443
|
const draggedBlock = editor.getBlockById(blockId);
|
|
49021
|
-
assert(logger$
|
|
49444
|
+
assert(logger$1_, draggedBlock, "no dragged block");
|
|
49022
49445
|
const { isSourceBlock, targetBlock } = options;
|
|
49023
49446
|
if (!isSourceBlock && targetBlock) {
|
|
49024
|
-
assert(logger$
|
|
49025
|
-
assert(logger$
|
|
49447
|
+
assert(logger$1_, block === targetBlock, "block !== target block");
|
|
49448
|
+
assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
|
|
49026
49449
|
return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
|
|
49027
49450
|
}
|
|
49028
49451
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
@@ -49524,7 +49947,7 @@ ${codeText}
|
|
|
49524
49947
|
}
|
|
49525
49948
|
const nextBrother = getListNextBrother(block);
|
|
49526
49949
|
while (nextBlock !== nextBrother) {
|
|
49527
|
-
assert(logger$
|
|
49950
|
+
assert(logger$1_, nextBlock, "no next block");
|
|
49528
49951
|
if (isListBlock(nextBlock)) {
|
|
49529
49952
|
if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
|
|
49530
49953
|
return nextBlock;
|
|
@@ -49623,9 +50046,9 @@ ${codeText}
|
|
|
49623
50046
|
}
|
|
49624
50047
|
return true;
|
|
49625
50048
|
}
|
|
49626
|
-
const logger$
|
|
50049
|
+
const logger$1Y = getLogger("list-block");
|
|
49627
50050
|
function cloneListData(editor, block, options) {
|
|
49628
|
-
assert(logger$
|
|
50051
|
+
assert(logger$1Y, isListBlock(block), "not a list block");
|
|
49629
50052
|
const blockData = {
|
|
49630
50053
|
...editor.getBlockData(block),
|
|
49631
50054
|
id: genId()
|
|
@@ -49700,7 +50123,7 @@ ${codeText}
|
|
|
49700
50123
|
return true;
|
|
49701
50124
|
}
|
|
49702
50125
|
function findPrevBrotherAsParent(block) {
|
|
49703
|
-
assert(logger$
|
|
50126
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
49704
50127
|
const { level } = getListBlockProperties(block);
|
|
49705
50128
|
let prevBlock = getPrevBlock(block);
|
|
49706
50129
|
while (prevBlock) {
|
|
@@ -49727,7 +50150,7 @@ ${codeText}
|
|
|
49727
50150
|
}
|
|
49728
50151
|
function findPrevBrother(editor, fromBlock, toParentBlock) {
|
|
49729
50152
|
let prevBlock = getPrevBlock(fromBlock);
|
|
49730
|
-
assert(logger$
|
|
50153
|
+
assert(logger$1_, prevBlock, "no prev brother");
|
|
49731
50154
|
const parentLevel = getListBlockLevel(toParentBlock);
|
|
49732
50155
|
while (prevBlock) {
|
|
49733
50156
|
if (prevBlock === toParentBlock) {
|
|
@@ -49748,7 +50171,7 @@ ${codeText}
|
|
|
49748
50171
|
}
|
|
49749
50172
|
ensureIsListBlock(block);
|
|
49750
50173
|
const prevBrother = findPrevBrotherAsParent(block);
|
|
49751
|
-
assert(logger$
|
|
50174
|
+
assert(logger$1_, prevBrother, "no list prev brother");
|
|
49752
50175
|
const newParent = prevBrother;
|
|
49753
50176
|
const newBrother = findPrevBrother(editor, block, newParent);
|
|
49754
50177
|
const level = getListBlockLevel(newParent) + 1;
|
|
@@ -49947,14 +50370,14 @@ ${codeText}
|
|
|
49947
50370
|
this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
|
|
49948
50371
|
}
|
|
49949
50372
|
}
|
|
49950
|
-
const logger$
|
|
50373
|
+
const logger$1X = getLogger("customize-list-start-menu");
|
|
49951
50374
|
class CustomizeListStartDialog {
|
|
49952
50375
|
constructor(editor) {
|
|
49953
50376
|
__publicField(this, "popup");
|
|
49954
50377
|
__publicField(this, "block", null);
|
|
49955
50378
|
__publicField(this, "show", (editor, block) => {
|
|
49956
50379
|
const listBlockMarker = block.querySelector("div.list-container");
|
|
49957
|
-
assert(logger$
|
|
50380
|
+
assert(logger$1X, listBlockMarker, "list-block mark does not exist");
|
|
49958
50381
|
this.block = block;
|
|
49959
50382
|
this.popup.manualShow(listBlockMarker, {
|
|
49960
50383
|
theme: "light"
|
|
@@ -50112,7 +50535,7 @@ ${codeText}
|
|
|
50112
50535
|
const listContainer = findTarget(event, "div.list-container");
|
|
50113
50536
|
if (listContainer && this.editor.isWritable()) {
|
|
50114
50537
|
const block = getParentBlock(listContainer);
|
|
50115
|
-
assert(logger$
|
|
50538
|
+
assert(logger$1_, block, "no parent block");
|
|
50116
50539
|
ensureIsListBlock(block);
|
|
50117
50540
|
const blockData = editor.getBlockData(block);
|
|
50118
50541
|
if (blockData && blockData.checkbox) {
|
|
@@ -50252,7 +50675,7 @@ ${codeText}
|
|
|
50252
50675
|
}
|
|
50253
50676
|
return blockContent;
|
|
50254
50677
|
}
|
|
50255
|
-
const zhCN$
|
|
50678
|
+
const zhCN$s = {
|
|
50256
50679
|
list: {
|
|
50257
50680
|
confirm: "\u786E\u5B9A",
|
|
50258
50681
|
setStart: "\u8BBE\u7F6E\u7F16\u53F7",
|
|
@@ -50272,7 +50695,7 @@ ${codeText}
|
|
|
50272
50695
|
exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
|
|
50273
50696
|
}
|
|
50274
50697
|
};
|
|
50275
|
-
const enUS$
|
|
50698
|
+
const enUS$s = {
|
|
50276
50699
|
list: {
|
|
50277
50700
|
confirm: "Confirm",
|
|
50278
50701
|
setStart: "Set number",
|
|
@@ -50292,7 +50715,7 @@ ${codeText}
|
|
|
50292
50715
|
exitFullscreen: "Exit full screen"
|
|
50293
50716
|
}
|
|
50294
50717
|
};
|
|
50295
|
-
const jaJP$
|
|
50718
|
+
const jaJP$s = {
|
|
50296
50719
|
list: {
|
|
50297
50720
|
confirm: "OK",
|
|
50298
50721
|
setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
|
|
@@ -50313,12 +50736,12 @@ ${codeText}
|
|
|
50313
50736
|
}
|
|
50314
50737
|
};
|
|
50315
50738
|
i18n$1.mergeLang({
|
|
50316
|
-
"zh-CN": zhCN$
|
|
50317
|
-
"en-US": enUS$
|
|
50318
|
-
"ja-JP": jaJP$
|
|
50739
|
+
"zh-CN": zhCN$s,
|
|
50740
|
+
"en-US": enUS$s,
|
|
50741
|
+
"ja-JP": jaJP$s
|
|
50319
50742
|
});
|
|
50320
|
-
const style$
|
|
50321
|
-
const logger$
|
|
50743
|
+
const style$8 = "";
|
|
50744
|
+
const logger$1W = getLogger("list-block:paste-handler");
|
|
50322
50745
|
class ListPasteHandler {
|
|
50323
50746
|
constructor() {
|
|
50324
50747
|
__publicField(this, "fixStartByList", null);
|
|
@@ -50372,7 +50795,7 @@ ${codeText}
|
|
|
50372
50795
|
startIds.set(newGroupId, 1);
|
|
50373
50796
|
} else {
|
|
50374
50797
|
const start = startIds.get(groupId);
|
|
50375
|
-
assert(logger$
|
|
50798
|
+
assert(logger$1W, start, "start is null");
|
|
50376
50799
|
block.start = start + 1;
|
|
50377
50800
|
block.groupId = groupId;
|
|
50378
50801
|
startIds.set(groupId, start + 1);
|
|
@@ -50392,7 +50815,7 @@ ${codeText}
|
|
|
50392
50815
|
return false;
|
|
50393
50816
|
}
|
|
50394
50817
|
}
|
|
50395
|
-
const logger$
|
|
50818
|
+
const logger$1V = getLogger("list selection to doc");
|
|
50396
50819
|
function convertListToText(data2) {
|
|
50397
50820
|
const textData = { type: "text" };
|
|
50398
50821
|
Object.entries(data2).forEach(([key, value]) => {
|
|
@@ -50407,7 +50830,7 @@ ${codeText}
|
|
|
50407
50830
|
const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
|
|
50408
50831
|
const start = selectedBlock.start;
|
|
50409
50832
|
const end = selectedBlock.end;
|
|
50410
|
-
assert(logger$
|
|
50833
|
+
assert(logger$1V, data2.text, "no block text");
|
|
50411
50834
|
const len = getBlockTextLength$6(editor, selectedBlock.block);
|
|
50412
50835
|
if (end.offset - start.offset === len) {
|
|
50413
50836
|
return {
|
|
@@ -50983,7 +51406,7 @@ ${codeText}
|
|
|
50983
51406
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
50984
51407
|
}, 300);
|
|
50985
51408
|
};
|
|
50986
|
-
const logger$
|
|
51409
|
+
const logger$1U = getLogger("inline-box-items");
|
|
50987
51410
|
function insertEmptyBlockLink(editor, containerId, blockIndex) {
|
|
50988
51411
|
let block = editor.findBlockByIndex(containerId, blockIndex);
|
|
50989
51412
|
let placement = "bottom-start";
|
|
@@ -50994,7 +51417,7 @@ ${codeText}
|
|
|
50994
51417
|
const onFinished = (linkText, linkUrl) => {
|
|
50995
51418
|
editor.undoManager.runInGroup(() => {
|
|
50996
51419
|
try {
|
|
50997
|
-
assert(logger$
|
|
51420
|
+
assert(logger$1U, block, "block not found");
|
|
50998
51421
|
if (!isEmptyTextBlock(editor, block)) {
|
|
50999
51422
|
block = editor.insertTextBlock([], containerId, blockIndex);
|
|
51000
51423
|
}
|
|
@@ -51005,7 +51428,7 @@ ${codeText}
|
|
|
51005
51428
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
51006
51429
|
editor.focus();
|
|
51007
51430
|
} catch (error2) {
|
|
51008
|
-
logger$
|
|
51431
|
+
logger$1U.error(error2);
|
|
51009
51432
|
}
|
|
51010
51433
|
});
|
|
51011
51434
|
};
|
|
@@ -51025,7 +51448,7 @@ ${codeText}
|
|
|
51025
51448
|
function insertLink(editor, containerId, blockIndex) {
|
|
51026
51449
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
51027
51450
|
const range = editor.selection.range;
|
|
51028
|
-
assert(logger$
|
|
51451
|
+
assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
|
|
51029
51452
|
const rects = getBlockClientRects(editor, block, range);
|
|
51030
51453
|
if (rects.length === 0) {
|
|
51031
51454
|
return;
|
|
@@ -51051,7 +51474,7 @@ ${codeText}
|
|
|
51051
51474
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
51052
51475
|
editor.focus();
|
|
51053
51476
|
} catch (error2) {
|
|
51054
|
-
logger$
|
|
51477
|
+
logger$1U.error(error2);
|
|
51055
51478
|
}
|
|
51056
51479
|
});
|
|
51057
51480
|
};
|
|
@@ -51269,7 +51692,7 @@ ${codeText}
|
|
|
51269
51692
|
function getToolbar(editor) {
|
|
51270
51693
|
return editor.findCustom("toolbar-handler");
|
|
51271
51694
|
}
|
|
51272
|
-
const logger$
|
|
51695
|
+
const logger$1T = getLogger("link-popup");
|
|
51273
51696
|
function getLinkHref(child) {
|
|
51274
51697
|
var _a, _b;
|
|
51275
51698
|
return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
|
|
@@ -51307,7 +51730,7 @@ ${codeText}
|
|
|
51307
51730
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
51308
51731
|
editor.focus();
|
|
51309
51732
|
} catch (error2) {
|
|
51310
|
-
logger$
|
|
51733
|
+
logger$1T.error(error2);
|
|
51311
51734
|
}
|
|
51312
51735
|
};
|
|
51313
51736
|
const onClose = () => {
|
|
@@ -51546,7 +51969,7 @@ ${codeText}
|
|
|
51546
51969
|
this.editProvider = new EditLinkProvider();
|
|
51547
51970
|
}
|
|
51548
51971
|
}
|
|
51549
|
-
const logger$
|
|
51972
|
+
const logger$1S = getLogger("readonly-toolbar");
|
|
51550
51973
|
const SEP = {
|
|
51551
51974
|
id: "",
|
|
51552
51975
|
name: "",
|
|
@@ -51609,7 +52032,7 @@ ${codeText}
|
|
|
51609
52032
|
});
|
|
51610
52033
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51611
52034
|
var _a;
|
|
51612
|
-
assert(logger$
|
|
52035
|
+
assert(logger$1S, editor === this.editor, "editor mismatch");
|
|
51613
52036
|
if (!editor.readonly) {
|
|
51614
52037
|
this.toolbar.close("selectionChange");
|
|
51615
52038
|
return;
|
|
@@ -51795,7 +52218,7 @@ ${codeText}
|
|
|
51795
52218
|
return visible;
|
|
51796
52219
|
}
|
|
51797
52220
|
}
|
|
51798
|
-
const logger$
|
|
52221
|
+
const logger$1R = getLogger("toolbar-handler");
|
|
51799
52222
|
class OnesEditorToolbar {
|
|
51800
52223
|
constructor(editor) {
|
|
51801
52224
|
__publicField(this, "id", "editor-toolbar");
|
|
@@ -51882,7 +52305,7 @@ ${codeText}
|
|
|
51882
52305
|
});
|
|
51883
52306
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51884
52307
|
var _a;
|
|
51885
|
-
assert(logger$
|
|
52308
|
+
assert(logger$1R, editor === this.editor, "editor mismatch");
|
|
51886
52309
|
if (editor.selection.range.isCollapsed() || this.mouseDown) {
|
|
51887
52310
|
if (this.toolbarType === "object") {
|
|
51888
52311
|
const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
|
|
@@ -52201,7 +52624,7 @@ ${codeText}
|
|
|
52201
52624
|
this.texWidth = [tex, width];
|
|
52202
52625
|
}
|
|
52203
52626
|
}
|
|
52204
|
-
const logger$
|
|
52627
|
+
const logger$1Q = getLogger("mathjax-converter");
|
|
52205
52628
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
52206
52629
|
const MATHJAX_BUFFER = 30;
|
|
52207
52630
|
const REDUCED_UNIT = 8;
|
|
@@ -52250,7 +52673,7 @@ ${codeText}
|
|
|
52250
52673
|
const svg = result.querySelector("svg");
|
|
52251
52674
|
return svg.outerHTML;
|
|
52252
52675
|
} catch (err) {
|
|
52253
|
-
logger$
|
|
52676
|
+
logger$1Q.error(err);
|
|
52254
52677
|
throw err;
|
|
52255
52678
|
} finally {
|
|
52256
52679
|
lockers.release(lockId);
|
|
@@ -52298,7 +52721,7 @@ ${codeText}
|
|
|
52298
52721
|
...perfectState
|
|
52299
52722
|
};
|
|
52300
52723
|
}
|
|
52301
|
-
const logger$
|
|
52724
|
+
const logger$1P = getLogger("edit-mathjax");
|
|
52302
52725
|
class MathjaxEditor {
|
|
52303
52726
|
constructor() {
|
|
52304
52727
|
__publicField(this, "editMathjaxPopup", null);
|
|
@@ -52375,9 +52798,9 @@ ${codeText}
|
|
|
52375
52798
|
this.observer.observe(textarea2);
|
|
52376
52799
|
}
|
|
52377
52800
|
getTextarea() {
|
|
52378
|
-
assert(logger$
|
|
52801
|
+
assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
|
|
52379
52802
|
const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
|
|
52380
|
-
assert(logger$
|
|
52803
|
+
assert(logger$1P, textarea2, "no textarea");
|
|
52381
52804
|
return textarea2;
|
|
52382
52805
|
}
|
|
52383
52806
|
destroy() {
|
|
@@ -52447,7 +52870,7 @@ ${codeText}
|
|
|
52447
52870
|
};
|
|
52448
52871
|
editMathjax(editor, box, data2.tex, update2);
|
|
52449
52872
|
}
|
|
52450
|
-
const logger$
|
|
52873
|
+
const logger$1O = getLogger("mathjax-box");
|
|
52451
52874
|
function updateCaret(editor, event) {
|
|
52452
52875
|
editor.selection.updateSelection(null);
|
|
52453
52876
|
const target = event.target;
|
|
@@ -52552,7 +52975,7 @@ ${codeText}
|
|
|
52552
52975
|
};
|
|
52553
52976
|
editor.updateBoxData(newData);
|
|
52554
52977
|
}).catch((err) => {
|
|
52555
|
-
logger$
|
|
52978
|
+
logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
|
|
52556
52979
|
});
|
|
52557
52980
|
return data2;
|
|
52558
52981
|
}
|
|
@@ -52571,7 +52994,7 @@ ${codeText}
|
|
|
52571
52994
|
}
|
|
52572
52995
|
function handleClickBox$3(editor, box, event) {
|
|
52573
52996
|
const parentBlock = getParentBlock(box);
|
|
52574
|
-
assert(logger$
|
|
52997
|
+
assert(logger$1O, parentBlock, "failed to get block");
|
|
52575
52998
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
52576
52999
|
return;
|
|
52577
53000
|
}
|
|
@@ -52768,28 +53191,28 @@ $$${mathData.mathjaxText}$$
|
|
|
52768
53191
|
getBlockProperties: getBlockProperties$b
|
|
52769
53192
|
};
|
|
52770
53193
|
const mathjaxStyle = "";
|
|
52771
|
-
const zhCN$
|
|
53194
|
+
const zhCN$r = {
|
|
52772
53195
|
mathjax: {
|
|
52773
53196
|
emptyText: "\u7A7A\u7684\u516C\u5F0F",
|
|
52774
53197
|
abstract: "\u516C\u5F0F"
|
|
52775
53198
|
}
|
|
52776
53199
|
};
|
|
52777
|
-
const enUS$
|
|
53200
|
+
const enUS$r = {
|
|
52778
53201
|
mathjax: {
|
|
52779
53202
|
emptyText: "Empty formula",
|
|
52780
53203
|
abstract: "Formula"
|
|
52781
53204
|
}
|
|
52782
53205
|
};
|
|
52783
|
-
const jaJP$
|
|
53206
|
+
const jaJP$r = {
|
|
52784
53207
|
mathjax: {
|
|
52785
53208
|
emptyText: "\u6570\u5F0F\u306A\u3057",
|
|
52786
53209
|
abstract: "\u6570\u5F0F"
|
|
52787
53210
|
}
|
|
52788
53211
|
};
|
|
52789
53212
|
i18n$1.mergeLang({
|
|
52790
|
-
"zh-CN": zhCN$
|
|
52791
|
-
"en-US": enUS$
|
|
52792
|
-
"ja-JP": jaJP$
|
|
53213
|
+
"zh-CN": zhCN$r,
|
|
53214
|
+
"en-US": enUS$r,
|
|
53215
|
+
"ja-JP": jaJP$r
|
|
52793
53216
|
});
|
|
52794
53217
|
function convertToMath(editor, containerId, blockIndex, offset) {
|
|
52795
53218
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -58323,7 +58746,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58323
58746
|
const docBlockText = { insert: " ", attributes: data2 };
|
|
58324
58747
|
return docBlockText;
|
|
58325
58748
|
}
|
|
58326
|
-
const logger$
|
|
58749
|
+
const logger$1N = getLogger("StatusBoxEditor");
|
|
58327
58750
|
class StatusBoxEditor {
|
|
58328
58751
|
constructor(editor) {
|
|
58329
58752
|
__publicField(this, "linkPopup", null);
|
|
@@ -58346,10 +58769,10 @@ $$${mathData.mathjaxText}$$
|
|
|
58346
58769
|
});
|
|
58347
58770
|
__publicField(this, "handClose", () => {
|
|
58348
58771
|
var _a;
|
|
58349
|
-
assert(logger$
|
|
58772
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58350
58773
|
const boxData = this.editor.getBoxData(this.boxElement);
|
|
58351
58774
|
const block = getParentBlock(this.boxElement);
|
|
58352
|
-
assert(logger$
|
|
58775
|
+
assert(logger$1N, block, "block not found");
|
|
58353
58776
|
if (!boxData.title) {
|
|
58354
58777
|
const offset = getChildOffset(block, this.boxElement);
|
|
58355
58778
|
this.editor.deleteTextFromBlock(block, offset.start, 1);
|
|
@@ -58387,7 +58810,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58387
58810
|
return;
|
|
58388
58811
|
}
|
|
58389
58812
|
const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
|
|
58390
|
-
assert(logger$
|
|
58813
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58391
58814
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58392
58815
|
this.statusPalette.changeColor(color);
|
|
58393
58816
|
const newData = { ...data2, color };
|
|
@@ -58404,7 +58827,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58404
58827
|
});
|
|
58405
58828
|
__publicField(this, "onTitleChange", (e2) => {
|
|
58406
58829
|
const title = e2.target.value;
|
|
58407
|
-
assert(logger$
|
|
58830
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58408
58831
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58409
58832
|
const newData = { ...data2, title: title.trim() };
|
|
58410
58833
|
this.editor.updateBoxData(newData, { noFocus: true });
|
|
@@ -58517,7 +58940,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58517
58940
|
toStandardText: toStandardText$1,
|
|
58518
58941
|
matchText: matchText$1
|
|
58519
58942
|
};
|
|
58520
|
-
const logger$
|
|
58943
|
+
const logger$1M = getLogger("status-box-command");
|
|
58521
58944
|
class StatusBoxCommand {
|
|
58522
58945
|
static get commands() {
|
|
58523
58946
|
return [
|
|
@@ -58536,7 +58959,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58536
58959
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58537
58960
|
const boxOp = createEmptyStatusBox();
|
|
58538
58961
|
const { start } = editor.selection.range;
|
|
58539
|
-
assert(logger$
|
|
58962
|
+
assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
|
|
58540
58963
|
editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
|
|
58541
58964
|
const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
|
|
58542
58965
|
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
|
|
@@ -58555,7 +58978,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58555
58978
|
}
|
|
58556
58979
|
}
|
|
58557
58980
|
__publicField(StatusBoxCommand, "id", "insert-status");
|
|
58558
|
-
const enUS$
|
|
58981
|
+
const enUS$q = {
|
|
58559
58982
|
status: {
|
|
58560
58983
|
empty: "Set status",
|
|
58561
58984
|
command: {
|
|
@@ -58579,7 +59002,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58579
59002
|
}
|
|
58580
59003
|
}
|
|
58581
59004
|
};
|
|
58582
|
-
const zhCN$
|
|
59005
|
+
const zhCN$q = {
|
|
58583
59006
|
status: {
|
|
58584
59007
|
empty: "\u8BBE\u7F6E\u72B6\u6001",
|
|
58585
59008
|
command: {
|
|
@@ -58603,7 +59026,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58603
59026
|
}
|
|
58604
59027
|
}
|
|
58605
59028
|
};
|
|
58606
|
-
const jaJP$
|
|
59029
|
+
const jaJP$q = {
|
|
58607
59030
|
status: {
|
|
58608
59031
|
empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
|
|
58609
59032
|
command: {
|
|
@@ -58628,12 +59051,12 @@ $$${mathData.mathjaxText}$$
|
|
|
58628
59051
|
}
|
|
58629
59052
|
};
|
|
58630
59053
|
const langs$2 = {
|
|
58631
|
-
"en-US": enUS$
|
|
58632
|
-
"zh-CN": zhCN$
|
|
58633
|
-
"ja-JP": jaJP$
|
|
59054
|
+
"en-US": enUS$q,
|
|
59055
|
+
"zh-CN": zhCN$q,
|
|
59056
|
+
"ja-JP": jaJP$q
|
|
58634
59057
|
};
|
|
58635
59058
|
i18n$1.mergeLang(langs$2);
|
|
58636
|
-
const logger$
|
|
59059
|
+
const logger$1L = getLogger("inline-box-items");
|
|
58637
59060
|
function insertEmptyBlockMath(editor, containerId, blockIndex) {
|
|
58638
59061
|
return editor.undoManager.runInGroup(() => {
|
|
58639
59062
|
var _a;
|
|
@@ -58644,7 +59067,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58644
59067
|
const boxOp = createEmptyMathjaxBox();
|
|
58645
59068
|
editor.setBlockText(block, [boxOp]);
|
|
58646
59069
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58647
|
-
assert(logger$
|
|
59070
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58648
59071
|
setTimeout(() => {
|
|
58649
59072
|
const box = editor.getBoxById(boxId);
|
|
58650
59073
|
editMathjaxBox(editor, box);
|
|
@@ -58657,11 +59080,11 @@ $$${mathData.mathjaxText}$$
|
|
|
58657
59080
|
var _a;
|
|
58658
59081
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58659
59082
|
const range = editor.selection.range;
|
|
58660
|
-
assert(logger$
|
|
59083
|
+
assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
|
|
58661
59084
|
const boxOp = createEmptyMathjaxBox();
|
|
58662
59085
|
editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
|
|
58663
59086
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58664
|
-
assert(logger$
|
|
59087
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58665
59088
|
setTimeout(() => {
|
|
58666
59089
|
const box = editor.getBoxById(boxId);
|
|
58667
59090
|
editMathjaxBox(editor, box);
|
|
@@ -58828,7 +59251,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58828
59251
|
}
|
|
58829
59252
|
}
|
|
58830
59253
|
};
|
|
58831
|
-
const logger$
|
|
59254
|
+
const logger$1K = getLogger("insert-menu");
|
|
58832
59255
|
const injectGroup = (commands, group, startIndex) => {
|
|
58833
59256
|
commands.forEach((command, index2) => {
|
|
58834
59257
|
command.group = group;
|
|
@@ -58967,7 +59390,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58967
59390
|
return true;
|
|
58968
59391
|
}
|
|
58969
59392
|
const blockId = getBlockId(block);
|
|
58970
|
-
assert(logger$
|
|
59393
|
+
assert(logger$1K, range.isSimple(), "invalid range");
|
|
58971
59394
|
const offset = range.start.offset;
|
|
58972
59395
|
if (quickItem.commandProvider) {
|
|
58973
59396
|
const params2 = { from: "quick-menu", blockId, offset };
|
|
@@ -59003,7 +59426,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59003
59426
|
});
|
|
59004
59427
|
}
|
|
59005
59428
|
}
|
|
59006
|
-
const logger$
|
|
59429
|
+
const logger$1J = getLogger("quick-command-providers");
|
|
59007
59430
|
class QuickCommandProviders extends AbstractProvider {
|
|
59008
59431
|
constructor(editor) {
|
|
59009
59432
|
super(editor);
|
|
@@ -59023,7 +59446,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59023
59446
|
}
|
|
59024
59447
|
getCommands(range) {
|
|
59025
59448
|
var _a, _b;
|
|
59026
|
-
assert(logger$
|
|
59449
|
+
assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
|
|
59027
59450
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59028
59451
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59029
59452
|
const container = getParentContainer(block);
|
|
@@ -59428,7 +59851,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59428
59851
|
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
59429
59852
|
...headingShortcut()
|
|
59430
59853
|
};
|
|
59431
|
-
const zhCN$
|
|
59854
|
+
const zhCN$p = {
|
|
59432
59855
|
quickMenu: {
|
|
59433
59856
|
basic: {
|
|
59434
59857
|
heading: {
|
|
@@ -59484,7 +59907,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59484
59907
|
selectBlock: "\u9009\u62E9\u533A\u5757"
|
|
59485
59908
|
}
|
|
59486
59909
|
};
|
|
59487
|
-
const enUS$
|
|
59910
|
+
const enUS$p = {
|
|
59488
59911
|
quickMenu: {
|
|
59489
59912
|
basic: {
|
|
59490
59913
|
heading: {
|
|
@@ -59540,7 +59963,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59540
59963
|
selectBlock: "Select Block"
|
|
59541
59964
|
}
|
|
59542
59965
|
};
|
|
59543
|
-
const jaJP$
|
|
59966
|
+
const jaJP$p = {
|
|
59544
59967
|
quickMenu: {
|
|
59545
59968
|
basic: {
|
|
59546
59969
|
heading: {
|
|
@@ -59597,9 +60020,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59597
60020
|
}
|
|
59598
60021
|
};
|
|
59599
60022
|
i18n$1.mergeLang({
|
|
59600
|
-
"zh-CN": zhCN$
|
|
59601
|
-
"en-US": enUS$
|
|
59602
|
-
"ja-JP": jaJP$
|
|
60023
|
+
"zh-CN": zhCN$p,
|
|
60024
|
+
"en-US": enUS$p,
|
|
60025
|
+
"ja-JP": jaJP$p
|
|
59603
60026
|
});
|
|
59604
60027
|
class TextStylesFixedProvider extends ProxyProvider {
|
|
59605
60028
|
constructor(editor, afterCommandCallback) {
|
|
@@ -59804,7 +60227,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59804
60227
|
return false;
|
|
59805
60228
|
}
|
|
59806
60229
|
}
|
|
59807
|
-
const logger$
|
|
60230
|
+
const logger$1I = getLogger("block-command-providers");
|
|
59808
60231
|
class BlockCommandProviders extends AbstractProvider {
|
|
59809
60232
|
constructor(editor, afterCommandCallback) {
|
|
59810
60233
|
super(editor);
|
|
@@ -59825,7 +60248,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59825
60248
|
this.registerCommandProvider(new InsertGroupProvider(editor));
|
|
59826
60249
|
}
|
|
59827
60250
|
getCommands(range) {
|
|
59828
|
-
assert(logger$
|
|
60251
|
+
assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
|
|
59829
60252
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59830
60253
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59831
60254
|
let startIndex = 100;
|
|
@@ -59839,7 +60262,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59839
60262
|
return this.filterItems(range, commands);
|
|
59840
60263
|
}
|
|
59841
60264
|
}
|
|
59842
|
-
const logger$
|
|
60265
|
+
const logger$1H = getLogger("standard-block-actions");
|
|
59843
60266
|
class StandardBlockActionHook {
|
|
59844
60267
|
constructor() {
|
|
59845
60268
|
__publicField(this, "executeCommand", (editor, bloockElement, item) => {
|
|
@@ -59858,7 +60281,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59858
60281
|
this.deleteBlock(editor, block);
|
|
59859
60282
|
}
|
|
59860
60283
|
} catch (err) {
|
|
59861
|
-
logger$
|
|
60284
|
+
logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
59862
60285
|
}
|
|
59863
60286
|
});
|
|
59864
60287
|
}
|
|
@@ -59926,7 +60349,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59926
60349
|
}
|
|
59927
60350
|
}
|
|
59928
60351
|
}
|
|
59929
|
-
const logger$
|
|
60352
|
+
const logger$1G = getLogger("block-menu");
|
|
59930
60353
|
class BlockMenu {
|
|
59931
60354
|
constructor(editor) {
|
|
59932
60355
|
__publicField(this, "menu");
|
|
@@ -59934,7 +60357,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59934
60357
|
__publicField(this, "commandBlock", null);
|
|
59935
60358
|
__publicField(this, "blockCommandProviders");
|
|
59936
60359
|
__publicField(this, "handleShow", () => {
|
|
59937
|
-
assert(logger$
|
|
60360
|
+
assert(logger$1G, this.currentBlock, "no target block before show block menu");
|
|
59938
60361
|
const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
|
|
59939
60362
|
this.menu.updateItems(items);
|
|
59940
60363
|
this.commandBlock = this.currentBlock;
|
|
@@ -59945,7 +60368,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59945
60368
|
}
|
|
59946
60369
|
});
|
|
59947
60370
|
__publicField(this, "handleItemClick", (bar2, item) => {
|
|
59948
|
-
assert(logger$
|
|
60371
|
+
assert(logger$1G, this.commandBlock, "no command block before show block menu");
|
|
59949
60372
|
this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
|
|
59950
60373
|
if (!item.element) {
|
|
59951
60374
|
this.close();
|
|
@@ -59988,7 +60411,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59988
60411
|
this.menu.destroy();
|
|
59989
60412
|
}
|
|
59990
60413
|
}
|
|
59991
|
-
const logger$
|
|
60414
|
+
const logger$1F = getLogger("text-styles");
|
|
59992
60415
|
function getIntersectionStyles(text2) {
|
|
59993
60416
|
const getOpStyle = (op) => {
|
|
59994
60417
|
if (!op.attributes) {
|
|
@@ -60022,10 +60445,10 @@ $$${mathData.mathjaxText}$$
|
|
|
60022
60445
|
return new Map(Object.entries(attributes));
|
|
60023
60446
|
}
|
|
60024
60447
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
60025
|
-
assert(logger$
|
|
60448
|
+
assert(logger$1F, range.isSimple(), "invalid range");
|
|
60026
60449
|
const { start, end } = range;
|
|
60027
|
-
assert(logger$
|
|
60028
|
-
assert(logger$
|
|
60450
|
+
assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
60451
|
+
assert(logger$1F, style2.startsWith("style-"), "invalid style");
|
|
60029
60452
|
const oldText = editor.getBlockText(block);
|
|
60030
60453
|
let newText = oldText;
|
|
60031
60454
|
if (style2 === "style-sub") {
|
|
@@ -60071,13 +60494,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60071
60494
|
return standardItems;
|
|
60072
60495
|
}
|
|
60073
60496
|
function getSubText(editor, block, range) {
|
|
60074
|
-
assert(logger$
|
|
60497
|
+
assert(logger$1F, range.isSimple(), "nor a simple range");
|
|
60075
60498
|
const { start, end } = range;
|
|
60076
|
-
assert(logger$
|
|
60077
|
-
assert(logger$
|
|
60078
|
-
assert(logger$
|
|
60499
|
+
assert(logger$1F, start.isSimple(), "is not a simple block position");
|
|
60500
|
+
assert(logger$1F, end.isSimple(), "is not a simple block position");
|
|
60501
|
+
assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
|
|
60079
60502
|
const blockId = getBlockId(block);
|
|
60080
|
-
assert(logger$
|
|
60503
|
+
assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
|
|
60081
60504
|
const text2 = editor.getBlockText(block);
|
|
60082
60505
|
let subText2 = [];
|
|
60083
60506
|
if (start.offset === end.offset) {
|
|
@@ -60089,7 +60512,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60089
60512
|
}
|
|
60090
60513
|
return subText2;
|
|
60091
60514
|
}
|
|
60092
|
-
const logger$
|
|
60515
|
+
const logger$1E = getLogger("text-commands");
|
|
60093
60516
|
function getCommands$1(editor, text2) {
|
|
60094
60517
|
const StandardTextStyles = {
|
|
60095
60518
|
"style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
|
|
@@ -60107,13 +60530,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60107
60530
|
}
|
|
60108
60531
|
function executeStyleCommand(editor, block, range, command, params, result) {
|
|
60109
60532
|
if (!command.startsWith("style-")) {
|
|
60110
|
-
logger$
|
|
60533
|
+
logger$1E.warn(`unknown command: ${command}`);
|
|
60111
60534
|
return false;
|
|
60112
60535
|
}
|
|
60113
60536
|
const value = params == null ? void 0 : params.value;
|
|
60114
60537
|
const type = typeof value;
|
|
60115
60538
|
if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
|
|
60116
|
-
logger$
|
|
60539
|
+
logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
|
|
60117
60540
|
return false;
|
|
60118
60541
|
}
|
|
60119
60542
|
const newText = applyTextStyle(editor, block, range, command, value);
|
|
@@ -60338,7 +60761,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60338
60761
|
this.providers = [new TextScriptProvider(editor)];
|
|
60339
60762
|
}
|
|
60340
60763
|
}
|
|
60341
|
-
const logger$
|
|
60764
|
+
const logger$1D = getLogger("text-command-provider");
|
|
60342
60765
|
class TextCommandProvider {
|
|
60343
60766
|
constructor(editor, options) {
|
|
60344
60767
|
__publicField(this, "id", "TextCommandProvider");
|
|
@@ -60458,7 +60881,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60458
60881
|
}
|
|
60459
60882
|
static fromTextCommandId(id) {
|
|
60460
60883
|
const prefix = "text/";
|
|
60461
|
-
assert(logger$
|
|
60884
|
+
assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
|
|
60462
60885
|
return id.substring(prefix.length);
|
|
60463
60886
|
}
|
|
60464
60887
|
}
|
|
@@ -60574,7 +60997,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60574
60997
|
};
|
|
60575
60998
|
editor.updateBlockData(block, newData);
|
|
60576
60999
|
}
|
|
60577
|
-
function addCommentToBlock
|
|
61000
|
+
function addCommentToBlock(editor, block, provider) {
|
|
60578
61001
|
const abstract = getCommentAbstract(editor, [block]);
|
|
60579
61002
|
const comment = createComment({
|
|
60580
61003
|
editor,
|
|
@@ -60585,7 +61008,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60585
61008
|
provider.localCreateComment(comment, doc2);
|
|
60586
61009
|
return comment;
|
|
60587
61010
|
}
|
|
60588
|
-
const logger$
|
|
61011
|
+
const logger$1C = getLogger("standard-block-actions");
|
|
60589
61012
|
class CommentBlockHook {
|
|
60590
61013
|
constructor(provider, editorComments) {
|
|
60591
61014
|
__publicField(this, "executeCommand", (editor, block, item) => {
|
|
@@ -60593,9 +61016,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60593
61016
|
try {
|
|
60594
61017
|
this.editorComments.showCommentList();
|
|
60595
61018
|
const block2 = editor.getBlockById(blockId);
|
|
60596
|
-
addCommentToBlock
|
|
61019
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
60597
61020
|
} catch (err) {
|
|
60598
|
-
logger$
|
|
61021
|
+
logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
60599
61022
|
}
|
|
60600
61023
|
});
|
|
60601
61024
|
this.provider = provider;
|
|
@@ -60699,7 +61122,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60699
61122
|
const attributes = Array.from(element.attributes).map((c) => c.name);
|
|
60700
61123
|
return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
|
|
60701
61124
|
}
|
|
60702
|
-
const logger$
|
|
61125
|
+
const logger$1B = getLogger("doc-comments");
|
|
60703
61126
|
function addBlockComments(doc2, block, result, resultSet) {
|
|
60704
61127
|
if (block.comments) {
|
|
60705
61128
|
const blockComments = block.comments;
|
|
@@ -60794,8 +61217,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60794
61217
|
const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
|
|
60795
61218
|
const index1 = commentsMap.get(group1.groupId);
|
|
60796
61219
|
const index2 = commentsMap.get(group2.groupId);
|
|
60797
|
-
assert(logger$
|
|
60798
|
-
assert(logger$
|
|
61220
|
+
assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
|
|
61221
|
+
assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
|
|
60799
61222
|
return index1 - index2;
|
|
60800
61223
|
});
|
|
60801
61224
|
return result;
|
|
@@ -60856,7 +61279,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60856
61279
|
const commentIds = intersection__default.default(comments1, comments2);
|
|
60857
61280
|
return commentIds;
|
|
60858
61281
|
}
|
|
60859
|
-
const logger$
|
|
61282
|
+
const logger$1A = getLogger("active-comments");
|
|
60860
61283
|
function inactiveComment(editor, commentId) {
|
|
60861
61284
|
const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
|
|
60862
61285
|
activeCommentElements.forEach((el) => {
|
|
@@ -60892,7 +61315,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60892
61315
|
const commentIds = getCommentsFromSelection(editor);
|
|
60893
61316
|
if (commentIds.indexOf(commentId) === -1) {
|
|
60894
61317
|
const block = getParentBlock(targetElement);
|
|
60895
|
-
assert(logger$
|
|
61318
|
+
assert(logger$1A, block, "block not found");
|
|
60896
61319
|
const offset = getChildOffset(block, targetElement);
|
|
60897
61320
|
const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
|
|
60898
61321
|
editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
|
|
@@ -60934,7 +61357,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60934
61357
|
function isValidSize(size) {
|
|
60935
61358
|
return typeof size === "number";
|
|
60936
61359
|
}
|
|
60937
|
-
const logger$
|
|
61360
|
+
const logger$1z = getLogger("image-data");
|
|
60938
61361
|
const md5Cache = /* @__PURE__ */ new Map();
|
|
60939
61362
|
const DEFAULT_WIDTH$1 = 1e3;
|
|
60940
61363
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -61066,7 +61489,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61066
61489
|
if (heightKey && isValidSize(image.height)) {
|
|
61067
61490
|
result[heightKey] = image.height;
|
|
61068
61491
|
}
|
|
61069
|
-
assert(logger$
|
|
61492
|
+
assert(logger$1z, image.flex, "no image flex");
|
|
61070
61493
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
61071
61494
|
result[flexKey] = image.flex;
|
|
61072
61495
|
});
|
|
@@ -61122,224 +61545,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61122
61545
|
const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
|
|
61123
61546
|
return totalFlex;
|
|
61124
61547
|
}
|
|
61125
|
-
|
|
61126
|
-
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
61127
|
-
elem.setAttribute("data-resize-type", type);
|
|
61128
|
-
}
|
|
61129
|
-
function getExistsResizer(block) {
|
|
61130
|
-
const tools = getBlockTools(block);
|
|
61131
|
-
return tools.querySelector(".block-resizer");
|
|
61132
|
-
}
|
|
61133
|
-
function hideResizer(block) {
|
|
61134
|
-
const exists = getExistsResizer(block);
|
|
61135
|
-
if (exists) {
|
|
61136
|
-
removeClass(exists, "active");
|
|
61137
|
-
}
|
|
61138
|
-
}
|
|
61139
|
-
function updateSize(block, element, resizer) {
|
|
61140
|
-
const blockRect = block.getBoundingClientRect();
|
|
61141
|
-
const elementRect = element.getBoundingClientRect();
|
|
61142
|
-
const top = elementRect.top - blockRect.top;
|
|
61143
|
-
const left = elementRect.left - blockRect.left;
|
|
61144
|
-
const width = elementRect.width;
|
|
61145
|
-
const height = elementRect.height;
|
|
61146
|
-
resizer.style.top = `${top}px`;
|
|
61147
|
-
resizer.style.left = `${left}px`;
|
|
61148
|
-
resizer.style.width = `${width}px`;
|
|
61149
|
-
resizer.style.height = `${height}px`;
|
|
61150
|
-
}
|
|
61151
|
-
function createResizer(block, element, options, mouseDownEvent) {
|
|
61152
|
-
const exists = getExistsResizer(block);
|
|
61153
|
-
if (exists) {
|
|
61154
|
-
addClass(exists, "active");
|
|
61155
|
-
updateSize(block, element, exists);
|
|
61156
|
-
return exists;
|
|
61157
|
-
}
|
|
61158
|
-
const tools = getBlockTools(block);
|
|
61159
|
-
const resizer = createElement("div", ["block-resizer"], tools);
|
|
61160
|
-
updateSize(block, element, resizer);
|
|
61161
|
-
options.resize.forEach((type) => {
|
|
61162
|
-
createResizeGripper(resizer, type);
|
|
61163
|
-
});
|
|
61164
|
-
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
61165
|
-
addClass(resizer, "active");
|
|
61166
|
-
return resizer;
|
|
61167
|
-
}
|
|
61168
|
-
function updateResizer(block, element) {
|
|
61169
|
-
const resizer = getExistsResizer(block);
|
|
61170
|
-
if (!resizer) {
|
|
61171
|
-
return;
|
|
61172
|
-
}
|
|
61173
|
-
if (!isChildNode(block, element)) {
|
|
61174
|
-
return;
|
|
61175
|
-
}
|
|
61176
|
-
const blockRect = block.getBoundingClientRect();
|
|
61177
|
-
const elementRect = element.getBoundingClientRect();
|
|
61178
|
-
const top = elementRect.top - blockRect.top;
|
|
61179
|
-
const left = elementRect.left - blockRect.left;
|
|
61180
|
-
const width = elementRect.width;
|
|
61181
|
-
const height = elementRect.height;
|
|
61182
|
-
resizer.style.top = `${top}px`;
|
|
61183
|
-
resizer.style.left = `${left}px`;
|
|
61184
|
-
resizer.style.width = `${width}px`;
|
|
61185
|
-
resizer.style.height = `${height}px`;
|
|
61186
|
-
}
|
|
61187
|
-
const style$8 = "";
|
|
61188
|
-
const logger$1A = getLogger("block-resizer");
|
|
61189
|
-
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
61190
|
-
constructor(editor, options) {
|
|
61191
|
-
super();
|
|
61192
|
-
__publicField(this, "resizableElement");
|
|
61193
|
-
__publicField(this, "block", null);
|
|
61194
|
-
__publicField(this, "startRect", null);
|
|
61195
|
-
__publicField(this, "startPos", null);
|
|
61196
|
-
__publicField(this, "resizeType", null);
|
|
61197
|
-
__publicField(this, "enabled", false);
|
|
61198
|
-
__publicField(this, "handleEditorResize", () => {
|
|
61199
|
-
if (this.block) {
|
|
61200
|
-
this.updateResizer();
|
|
61201
|
-
}
|
|
61202
|
-
});
|
|
61203
|
-
__publicField(this, "handleMouseDown", (event) => {
|
|
61204
|
-
event.preventDefault();
|
|
61205
|
-
event.stopPropagation();
|
|
61206
|
-
const element = this.getResizableElement();
|
|
61207
|
-
if (!element) {
|
|
61208
|
-
return;
|
|
61209
|
-
}
|
|
61210
|
-
if (event.button !== 0) {
|
|
61211
|
-
return;
|
|
61212
|
-
}
|
|
61213
|
-
const gripper = event.target;
|
|
61214
|
-
if (!gripper) {
|
|
61215
|
-
return;
|
|
61216
|
-
}
|
|
61217
|
-
if (!(gripper instanceof HTMLElement)) {
|
|
61218
|
-
return;
|
|
61219
|
-
}
|
|
61220
|
-
const resizeType = gripper.getAttribute("data-resize-type");
|
|
61221
|
-
if (!resizeType) {
|
|
61222
|
-
return;
|
|
61223
|
-
}
|
|
61224
|
-
this.bindEvents();
|
|
61225
|
-
this.startRect = element.getBoundingClientRect();
|
|
61226
|
-
this.startPos = event;
|
|
61227
|
-
this.resizeType = resizeType;
|
|
61228
|
-
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
61229
|
-
if (this.block) {
|
|
61230
|
-
this.editor.selection.selectBlock(this.block, 0);
|
|
61231
|
-
}
|
|
61232
|
-
});
|
|
61233
|
-
__publicField(this, "handleMouseMove", (event) => {
|
|
61234
|
-
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
61235
|
-
return;
|
|
61236
|
-
}
|
|
61237
|
-
const element = this.getResizableElement();
|
|
61238
|
-
if (!element || !this.block) {
|
|
61239
|
-
return;
|
|
61240
|
-
}
|
|
61241
|
-
const deltaX = event.x - this.startPos.x;
|
|
61242
|
-
const deltaY = event.y - this.startPos.y;
|
|
61243
|
-
const oldRect = this.startRect;
|
|
61244
|
-
let { top, left, right, bottom } = oldRect;
|
|
61245
|
-
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
61246
|
-
bottom += deltaY;
|
|
61247
|
-
}
|
|
61248
|
-
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
61249
|
-
top += deltaY;
|
|
61250
|
-
}
|
|
61251
|
-
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
61252
|
-
left += deltaX;
|
|
61253
|
-
}
|
|
61254
|
-
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
61255
|
-
right += deltaX;
|
|
61256
|
-
}
|
|
61257
|
-
const width = right > left ? right - left : 0;
|
|
61258
|
-
const height = bottom > top ? bottom - top : 0;
|
|
61259
|
-
const newRect = new DOMRect(left, top, width, height);
|
|
61260
|
-
this.emit("resizing", this, newRect);
|
|
61261
|
-
const newElement = this.getResizableElement();
|
|
61262
|
-
if (newElement) {
|
|
61263
|
-
updateResizer(this.block, newElement);
|
|
61264
|
-
}
|
|
61265
|
-
});
|
|
61266
|
-
__publicField(this, "handleMouseUp", (event) => {
|
|
61267
|
-
if (event.button !== 0) {
|
|
61268
|
-
return;
|
|
61269
|
-
}
|
|
61270
|
-
setDefaultCursor("");
|
|
61271
|
-
this.unbindEvents();
|
|
61272
|
-
this.emit("resized", this);
|
|
61273
|
-
const element = this.getResizableElement();
|
|
61274
|
-
if (!element || !this.block) {
|
|
61275
|
-
return;
|
|
61276
|
-
}
|
|
61277
|
-
updateResizer(this.block, element);
|
|
61278
|
-
});
|
|
61279
|
-
this.editor = editor;
|
|
61280
|
-
this.options = options;
|
|
61281
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
61282
|
-
}
|
|
61283
|
-
enableResize(block, resizableElement) {
|
|
61284
|
-
this.block = block;
|
|
61285
|
-
this.resizableElement = resizableElement;
|
|
61286
|
-
this.createResizer();
|
|
61287
|
-
this.enabled = true;
|
|
61288
|
-
}
|
|
61289
|
-
disableResize() {
|
|
61290
|
-
if (!this.block) {
|
|
61291
|
-
return;
|
|
61292
|
-
}
|
|
61293
|
-
hideResizer(this.block);
|
|
61294
|
-
this.enabled = false;
|
|
61295
|
-
}
|
|
61296
|
-
update(block, resizableElement) {
|
|
61297
|
-
this.block = block;
|
|
61298
|
-
this.resizableElement = resizableElement;
|
|
61299
|
-
const elem = this.getResizableElement();
|
|
61300
|
-
if (elem && this.enabled) {
|
|
61301
|
-
this.createResizer();
|
|
61302
|
-
}
|
|
61303
|
-
}
|
|
61304
|
-
updateResizer() {
|
|
61305
|
-
const newElement = this.getResizableElement();
|
|
61306
|
-
if (newElement && this.block) {
|
|
61307
|
-
updateResizer(this.block, newElement);
|
|
61308
|
-
}
|
|
61309
|
-
}
|
|
61310
|
-
getBlock() {
|
|
61311
|
-
return this.block;
|
|
61312
|
-
}
|
|
61313
|
-
destroy() {
|
|
61314
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
61315
|
-
}
|
|
61316
|
-
getResizableElement() {
|
|
61317
|
-
if (this.resizableElement) {
|
|
61318
|
-
return this.resizableElement;
|
|
61319
|
-
}
|
|
61320
|
-
if (!this.block) {
|
|
61321
|
-
return null;
|
|
61322
|
-
}
|
|
61323
|
-
return getBlockContent(this.block);
|
|
61324
|
-
}
|
|
61325
|
-
createResizer() {
|
|
61326
|
-
const element = this.getResizableElement();
|
|
61327
|
-
if (!element || !this.block) {
|
|
61328
|
-
return;
|
|
61329
|
-
}
|
|
61330
|
-
assert(logger$1A, isChildNode(this.block, element), "not a block child element");
|
|
61331
|
-
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
61332
|
-
}
|
|
61333
|
-
bindEvents() {
|
|
61334
|
-
document.addEventListener("mousemove", this.handleMouseMove);
|
|
61335
|
-
document.addEventListener("mouseup", this.handleMouseUp);
|
|
61336
|
-
}
|
|
61337
|
-
unbindEvents() {
|
|
61338
|
-
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
61339
|
-
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
61340
|
-
}
|
|
61341
|
-
}
|
|
61342
|
-
const logger$1z = getLogger("image-dom");
|
|
61548
|
+
const logger$1y = getLogger("image-dom");
|
|
61343
61549
|
function getExistsProgressMask(imageContainer) {
|
|
61344
61550
|
return imageContainer.querySelector(".uploading-progress-mask");
|
|
61345
61551
|
}
|
|
@@ -61356,7 +61562,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61356
61562
|
function getImageUploadingProgressValueElement(imageContainer) {
|
|
61357
61563
|
const bar2 = getImageUploadingProgressMask(imageContainer);
|
|
61358
61564
|
const value = bar2.querySelector(".uploading-progress-bar-value");
|
|
61359
|
-
assert(logger$
|
|
61565
|
+
assert(logger$1y, value, "no progress value");
|
|
61360
61566
|
return value;
|
|
61361
61567
|
}
|
|
61362
61568
|
function setImageUploading(imageContainer, progress) {
|
|
@@ -61446,7 +61652,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61446
61652
|
const images = Array.from(block.querySelectorAll(".image-container"));
|
|
61447
61653
|
return images;
|
|
61448
61654
|
}
|
|
61449
|
-
const logger$
|
|
61655
|
+
const logger$1x = getLogger("table-resize-drag-drop");
|
|
61450
61656
|
class ImageSplitterResizer {
|
|
61451
61657
|
constructor(editor, elem, data2, mouseDownEvent) {
|
|
61452
61658
|
__publicField(this, "cursor", "col-resize");
|
|
@@ -61459,7 +61665,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61459
61665
|
const imageObject = getImageObject(this.editor, block);
|
|
61460
61666
|
const images = imageObject.getImages();
|
|
61461
61667
|
const splitterIndex = this.data.splitterIndex;
|
|
61462
|
-
assert(logger$
|
|
61668
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61463
61669
|
const imageContainers = getImageContainersByBlock(block);
|
|
61464
61670
|
const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
|
|
61465
61671
|
this.initWidths = initWidths;
|
|
@@ -61477,7 +61683,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61477
61683
|
const imageObject = getImageObject(this.editor, block);
|
|
61478
61684
|
const images = cloneDeep__default.default(imageObject.getImages());
|
|
61479
61685
|
const splitterIndex = this.data.splitterIndex;
|
|
61480
|
-
assert(logger$
|
|
61686
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61481
61687
|
const width1 = this.initWidths[splitterIndex];
|
|
61482
61688
|
const width2 = this.initWidths[splitterIndex + 1];
|
|
61483
61689
|
if (width1 + width2 < 100) {
|
|
@@ -61496,7 +61702,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61496
61702
|
newWidths[splitterIndex] += delta;
|
|
61497
61703
|
newWidths[splitterIndex + 1] -= delta;
|
|
61498
61704
|
const imageContainers = getImageContainersByBlock(block);
|
|
61499
|
-
assert(logger$
|
|
61705
|
+
assert(logger$1x, imageContainers.length === images.length, "invalid image data");
|
|
61500
61706
|
const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
61501
61707
|
for (let i = 0; i < images.length; i++) {
|
|
61502
61708
|
const flex = newWidths[i] / totalWidth;
|
|
@@ -61569,7 +61775,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61569
61775
|
editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
|
|
61570
61776
|
editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
|
|
61571
61777
|
}
|
|
61572
|
-
const logger$
|
|
61778
|
+
const logger$1w = getLogger("image-item");
|
|
61573
61779
|
function getParentImageBlock(eventTarget) {
|
|
61574
61780
|
if (!eventTarget) {
|
|
61575
61781
|
return null;
|
|
@@ -61648,7 +61854,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61648
61854
|
if (file2) {
|
|
61649
61855
|
imageObject.replaceImage(index2, file2);
|
|
61650
61856
|
} else {
|
|
61651
|
-
logger$
|
|
61857
|
+
logger$1w.warn(`failed to download image: ${imageData.src}`);
|
|
61652
61858
|
}
|
|
61653
61859
|
}
|
|
61654
61860
|
function createLoadErrorElement(editor, imageContainer, imageData) {
|
|
@@ -61871,7 +62077,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61871
62077
|
function isImageFile(fileType) {
|
|
61872
62078
|
return fileType.startsWith("image/");
|
|
61873
62079
|
}
|
|
61874
|
-
const logger$
|
|
62080
|
+
const logger$1v = getLogger("image-object");
|
|
61875
62081
|
class ImageObject {
|
|
61876
62082
|
constructor(editor, blockData) {
|
|
61877
62083
|
__publicField(this, "images", []);
|
|
@@ -62162,7 +62368,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62162
62368
|
this.editor.updateEmbedData(block2, embedData);
|
|
62163
62369
|
return true;
|
|
62164
62370
|
} catch (err) {
|
|
62165
|
-
logger$
|
|
62371
|
+
logger$1v.error(err);
|
|
62166
62372
|
const block2 = this.editor.findBlockById(this.blockData.id);
|
|
62167
62373
|
if (!block2) {
|
|
62168
62374
|
return false;
|
|
@@ -62179,7 +62385,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62179
62385
|
if (!block) {
|
|
62180
62386
|
return;
|
|
62181
62387
|
}
|
|
62182
|
-
assert(logger$
|
|
62388
|
+
assert(logger$1v, flex.length === this.images.length, "invalid flex");
|
|
62183
62389
|
for (let i = 0; i < this.images.length; i++) {
|
|
62184
62390
|
this.images[i].flex = flex[i];
|
|
62185
62391
|
}
|
|
@@ -62228,7 +62434,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62228
62434
|
}
|
|
62229
62435
|
}
|
|
62230
62436
|
const imageEmbedStyle = "";
|
|
62231
|
-
const logger$
|
|
62437
|
+
const logger$1u = getLogger("drop-indicator");
|
|
62232
62438
|
const INDICATOR_SIZE$1 = 2;
|
|
62233
62439
|
class DropIndicator {
|
|
62234
62440
|
constructor(editor) {
|
|
@@ -62273,7 +62479,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62273
62479
|
if (insertPos === "before") {
|
|
62274
62480
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
62275
62481
|
if (!beforeBlock) {
|
|
62276
|
-
assert(logger$
|
|
62482
|
+
assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
62277
62483
|
const rect = block.getBoundingClientRect();
|
|
62278
62484
|
const viewRect2 = this.getViewRect(block);
|
|
62279
62485
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -62299,14 +62505,14 @@ $$${mathData.mathjaxText}$$
|
|
|
62299
62505
|
const PADDING = 5;
|
|
62300
62506
|
if (insertPos.pos === "left") {
|
|
62301
62507
|
const parent = getParentContainer(block);
|
|
62302
|
-
assert(logger$
|
|
62508
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62303
62509
|
const rect = block.getBoundingClientRect();
|
|
62304
62510
|
const viewRect = this.getViewRect(block);
|
|
62305
62511
|
return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
|
|
62306
62512
|
}
|
|
62307
62513
|
if (insertPos.pos === "right") {
|
|
62308
62514
|
const parent = getParentContainer(block);
|
|
62309
|
-
assert(logger$
|
|
62515
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62310
62516
|
const rect = block.getBoundingClientRect();
|
|
62311
62517
|
let viewRect;
|
|
62312
62518
|
if (isEmbedBlock(block)) {
|
|
@@ -62403,7 +62609,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62403
62609
|
}
|
|
62404
62610
|
return void 0;
|
|
62405
62611
|
}
|
|
62406
|
-
const logger$
|
|
62612
|
+
const logger$1t = getLogger("code-dom");
|
|
62407
62613
|
function isCodeBlock(block) {
|
|
62408
62614
|
return getBlockType(block) === "code";
|
|
62409
62615
|
}
|
|
@@ -62421,8 +62627,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62421
62627
|
}
|
|
62422
62628
|
function getParentCodeBlock(elem) {
|
|
62423
62629
|
const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
|
|
62424
|
-
assert(logger$
|
|
62425
|
-
assert(logger$
|
|
62630
|
+
assert(logger$1t, codeBlock2, "no parent code block");
|
|
62631
|
+
assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
|
|
62426
62632
|
return codeBlock2;
|
|
62427
62633
|
}
|
|
62428
62634
|
const SUPPORTED_LANGUAGES = () => ({
|
|
@@ -62513,7 +62719,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62513
62719
|
function setDefaultLanguage(editor, lang) {
|
|
62514
62720
|
return editor.settingsProvider.setItem("editor-code-lang", lang);
|
|
62515
62721
|
}
|
|
62516
|
-
const logger$
|
|
62722
|
+
const logger$1s = getLogger("convert-to-code");
|
|
62517
62723
|
function convertToCode(editor, srcBlock) {
|
|
62518
62724
|
if (!isTextKindBlock(editor, srcBlock)) {
|
|
62519
62725
|
return null;
|
|
@@ -62526,7 +62732,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62526
62732
|
const textContainerId = genId();
|
|
62527
62733
|
editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
|
|
62528
62734
|
const text2 = editor.getBlockData(srcBlock).text;
|
|
62529
|
-
assert(logger$
|
|
62735
|
+
assert(logger$1s, text2, "no text");
|
|
62530
62736
|
let alias = toPlainText(text2);
|
|
62531
62737
|
if (alias.startsWith("```")) {
|
|
62532
62738
|
alias = alias.substring(3);
|
|
@@ -62544,16 +62750,16 @@ $$${mathData.mathjaxText}$$
|
|
|
62544
62750
|
};
|
|
62545
62751
|
}
|
|
62546
62752
|
const codeBlock = "";
|
|
62547
|
-
const logger$
|
|
62753
|
+
const logger$1r = getLogger("code-block-child-container");
|
|
62548
62754
|
function getTextContainer(codeBlock2) {
|
|
62549
|
-
assert(logger$
|
|
62755
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62550
62756
|
const content = getBlockContent(codeBlock2);
|
|
62551
62757
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
|
|
62552
|
-
assert(logger$
|
|
62758
|
+
assert(logger$1r, textContainer, "no code text container");
|
|
62553
62759
|
return textContainer;
|
|
62554
62760
|
}
|
|
62555
62761
|
function getCaptionContainer(codeBlock2) {
|
|
62556
|
-
assert(logger$
|
|
62762
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62557
62763
|
const content = getBlockContent(codeBlock2);
|
|
62558
62764
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
|
|
62559
62765
|
if (!textContainer)
|
|
@@ -62582,7 +62788,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62582
62788
|
}
|
|
62583
62789
|
return getBlockType(block) === "code";
|
|
62584
62790
|
}
|
|
62585
|
-
const logger$
|
|
62791
|
+
const logger$1q = getLogger("code-caption");
|
|
62586
62792
|
function toggleCodeCaption(editor, codeBlock2) {
|
|
62587
62793
|
if (editor.readonly) {
|
|
62588
62794
|
return;
|
|
@@ -62595,7 +62801,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62595
62801
|
}
|
|
62596
62802
|
const captionContainerId = createEmptyContainer(editor.doc);
|
|
62597
62803
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62598
|
-
assert(logger$
|
|
62804
|
+
assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
|
|
62599
62805
|
const newData = {
|
|
62600
62806
|
...oldData,
|
|
62601
62807
|
children: [oldData.children[0], captionContainerId]
|
|
@@ -62611,7 +62817,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62611
62817
|
return false;
|
|
62612
62818
|
}
|
|
62613
62819
|
const parentBlock = getParentBlock(parentContainer);
|
|
62614
|
-
assert(logger$
|
|
62820
|
+
assert(logger$1q, parentBlock, "no parent block");
|
|
62615
62821
|
if (!isCodeBlock(parentBlock)) {
|
|
62616
62822
|
return false;
|
|
62617
62823
|
}
|
|
@@ -62631,7 +62837,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62631
62837
|
const lastBlock2 = getLastChildBlock(textContainer);
|
|
62632
62838
|
editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
|
|
62633
62839
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62634
|
-
assert(logger$
|
|
62840
|
+
assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
|
|
62635
62841
|
const captionContainerId = oldData.children[1];
|
|
62636
62842
|
const newData = {
|
|
62637
62843
|
...oldData,
|
|
@@ -62640,7 +62846,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62640
62846
|
editor.updateBlockData(codeBlock2, newData);
|
|
62641
62847
|
editor.deleteChildContainers([captionContainerId]);
|
|
62642
62848
|
}
|
|
62643
|
-
const logger$
|
|
62849
|
+
const logger$1p = getLogger("paste-in-table-block");
|
|
62644
62850
|
class PasteEventHandler {
|
|
62645
62851
|
constructor(editor) {
|
|
62646
62852
|
this.editor = editor;
|
|
@@ -62661,7 +62867,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62661
62867
|
return false;
|
|
62662
62868
|
}
|
|
62663
62869
|
const parentBlock = getParentBlock(parentContainer);
|
|
62664
|
-
assert(logger$
|
|
62870
|
+
assert(logger$1p, parentBlock, "no parent block");
|
|
62665
62871
|
if (!isCodeBlock(parentBlock)) {
|
|
62666
62872
|
return false;
|
|
62667
62873
|
}
|
|
@@ -62725,7 +62931,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62725
62931
|
function registerCodeBlockCommandProvider(editor) {
|
|
62726
62932
|
editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
|
|
62727
62933
|
}
|
|
62728
|
-
const logger$
|
|
62934
|
+
const logger$1o = getLogger("code-caption-input-handler");
|
|
62729
62935
|
function getCurrentCaptionBlock(editor) {
|
|
62730
62936
|
if (!editor.selection.range.isSimple()) {
|
|
62731
62937
|
return null;
|
|
@@ -62838,7 +63044,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62838
63044
|
editor.undoManager.runInGroup(() => {
|
|
62839
63045
|
editor.clearSelectedContents();
|
|
62840
63046
|
const start = editor.selection.range.start;
|
|
62841
|
-
assert(logger$
|
|
63047
|
+
assert(logger$1o, start.isSimple(), "not simple position");
|
|
62842
63048
|
editor.insertTextToBlock(block, start.offset, text2);
|
|
62843
63049
|
});
|
|
62844
63050
|
return true;
|
|
@@ -62883,9 +63089,9 @@ $$${mathData.mathjaxText}$$
|
|
|
62883
63089
|
};
|
|
62884
63090
|
editor.updateBlockData(codeBlock2, newData);
|
|
62885
63091
|
}
|
|
62886
|
-
const logger$
|
|
63092
|
+
const logger$1n = getLogger("code-block-header");
|
|
62887
63093
|
function selectCodeBlock(editor, block, options) {
|
|
62888
|
-
assert(logger$
|
|
63094
|
+
assert(logger$1n, isCodeBlock(block), "not a code block");
|
|
62889
63095
|
const firstBlock = getFirstChildBlock(getTextContainer(block));
|
|
62890
63096
|
editor.selection.selectBlock(firstBlock, 0);
|
|
62891
63097
|
if (options.focusToEditor) {
|
|
@@ -62927,8 +63133,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62927
63133
|
const target = event.target;
|
|
62928
63134
|
const select2 = target.closest(".language-select");
|
|
62929
63135
|
const block = getParentBlock(select2);
|
|
62930
|
-
assert(logger$
|
|
62931
|
-
assert(logger$
|
|
63136
|
+
assert(logger$1n, block, "no parent block");
|
|
63137
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62932
63138
|
const codeData = editor2.getBlockData(block);
|
|
62933
63139
|
const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
|
|
62934
63140
|
dropdown2.custom = { codeBlock: block, editor: editor2 };
|
|
@@ -62951,11 +63157,11 @@ $$${mathData.mathjaxText}$$
|
|
|
62951
63157
|
function handleCodeHeaderButtonClick(editor, event) {
|
|
62952
63158
|
const target = event.target;
|
|
62953
63159
|
const button2 = target.closest(".code-header-button");
|
|
62954
|
-
assert(logger$
|
|
63160
|
+
assert(logger$1n, button2, "no button");
|
|
62955
63161
|
const block = getParentBlock(target);
|
|
62956
|
-
assert(logger$
|
|
63162
|
+
assert(logger$1n, block, "no parent block");
|
|
62957
63163
|
const id = button2.getAttribute("data-id");
|
|
62958
|
-
assert(logger$
|
|
63164
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62959
63165
|
if (id === "wrap") {
|
|
62960
63166
|
const old = editor.getBlockData(block);
|
|
62961
63167
|
changeCodeBlockWrap(editor, block, !old.nowrap);
|
|
@@ -62981,7 +63187,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62981
63187
|
}
|
|
62982
63188
|
});
|
|
62983
63189
|
}).catch((err) => {
|
|
62984
|
-
logger$
|
|
63190
|
+
logger$1n.error(err.message);
|
|
62985
63191
|
});
|
|
62986
63192
|
return;
|
|
62987
63193
|
}
|
|
@@ -63032,7 +63238,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63032
63238
|
}
|
|
63033
63239
|
function getCodeBlockHeader(block) {
|
|
63034
63240
|
const header = block.querySelector(".code-block-header");
|
|
63035
|
-
assert(logger$
|
|
63241
|
+
assert(logger$1n, header, "no code block header");
|
|
63036
63242
|
return header;
|
|
63037
63243
|
}
|
|
63038
63244
|
function handleCodeScroll(editor, event) {
|
|
@@ -63081,7 +63287,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63081
63287
|
focusBlockId: textBlock.id
|
|
63082
63288
|
};
|
|
63083
63289
|
}
|
|
63084
|
-
const logger$
|
|
63290
|
+
const logger$1m = getLogger("code-block");
|
|
63085
63291
|
function getPaddingNum(index2) {
|
|
63086
63292
|
if (index2 <= 2) {
|
|
63087
63293
|
return 32;
|
|
@@ -63108,10 +63314,10 @@ $$${mathData.mathjaxText}$$
|
|
|
63108
63314
|
handlePasteInTableEvent(editor);
|
|
63109
63315
|
registerCodeBlockCommandProvider(editor);
|
|
63110
63316
|
trackChildBlockEvent(editor, handleDebounceUpdate);
|
|
63111
|
-
assert(logger$
|
|
63317
|
+
assert(logger$1m, blockData.type === "code", "invalid block data type");
|
|
63112
63318
|
const codeData = blockData;
|
|
63113
|
-
assert(logger$
|
|
63114
|
-
assert(logger$
|
|
63319
|
+
assert(logger$1m, codeData.children, "invalid block data children");
|
|
63320
|
+
assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
|
|
63115
63321
|
setTimeout(() => {
|
|
63116
63322
|
if (isNodeRemoved(blockElement))
|
|
63117
63323
|
return;
|
|
@@ -63162,15 +63368,15 @@ $$${mathData.mathjaxText}$$
|
|
|
63162
63368
|
}
|
|
63163
63369
|
function updateSelection$3(editor, block, from, to) {
|
|
63164
63370
|
if (from.isSimple()) {
|
|
63165
|
-
assert(logger$
|
|
63166
|
-
logger$
|
|
63371
|
+
assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
|
|
63372
|
+
logger$1m.debug("full select list");
|
|
63167
63373
|
addClass(block, "full-selected");
|
|
63168
63374
|
return;
|
|
63169
63375
|
}
|
|
63170
|
-
assert(logger$
|
|
63376
|
+
assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
|
|
63171
63377
|
const f = from;
|
|
63172
63378
|
const t2 = to;
|
|
63173
|
-
assert(logger$
|
|
63379
|
+
assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
|
|
63174
63380
|
const containers = getCodeChildContainers(block);
|
|
63175
63381
|
containers.forEach((container) => {
|
|
63176
63382
|
const containerId = getContainerId(container);
|
|
@@ -63205,8 +63411,8 @@ $$${mathData.mathjaxText}$$
|
|
|
63205
63411
|
const containersIds = childContainers.map(getContainerId);
|
|
63206
63412
|
const startIndex = containersIds.indexOf(start.childContainerId);
|
|
63207
63413
|
const endIndex = containersIds.indexOf(end.childContainerId);
|
|
63208
|
-
assert(logger$
|
|
63209
|
-
assert(logger$
|
|
63414
|
+
assert(logger$1m, startIndex !== -1, "invalid start pos");
|
|
63415
|
+
assert(logger$1m, endIndex !== -1, "invalid end pos");
|
|
63210
63416
|
const ret = [childContainers[startIndex]];
|
|
63211
63417
|
if (startIndex !== endIndex) {
|
|
63212
63418
|
ret.push(childContainers[endIndex]);
|
|
@@ -63214,7 +63420,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63214
63420
|
return ret;
|
|
63215
63421
|
}
|
|
63216
63422
|
function handleBlockElementUpdated(editor, block, blockData) {
|
|
63217
|
-
assert(logger$
|
|
63423
|
+
assert(logger$1m, isCodeBlock(block), "invalid block type");
|
|
63218
63424
|
const codeData = blockData;
|
|
63219
63425
|
updateCodeBlockElementStyles(editor, block, codeData);
|
|
63220
63426
|
}
|
|
@@ -63406,10 +63612,10 @@ ${codeText}
|
|
|
63406
63612
|
"Shift+Tab": handleShiftTab$1,
|
|
63407
63613
|
"CtrlOrCmd+A": selectCode
|
|
63408
63614
|
};
|
|
63409
|
-
const logger$
|
|
63615
|
+
const logger$1l = getLogger("code-text-decorate");
|
|
63410
63616
|
class CodeTextDecorator {
|
|
63411
63617
|
decorateText(editor, path, blockText) {
|
|
63412
|
-
assert(logger$
|
|
63618
|
+
assert(logger$1l, path.length > 0, "invalid path");
|
|
63413
63619
|
if (path.length === 1) {
|
|
63414
63620
|
return {};
|
|
63415
63621
|
}
|
|
@@ -63434,7 +63640,7 @@ ${codeText}
|
|
|
63434
63640
|
const grammar = getProsmGrammar(codeData.language);
|
|
63435
63641
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63436
63642
|
const tokenToText = (token, attributes) => {
|
|
63437
|
-
assert(logger$
|
|
63643
|
+
assert(logger$1l, token, "no token");
|
|
63438
63644
|
if (typeof token === "string") {
|
|
63439
63645
|
const ret = {
|
|
63440
63646
|
insert: token,
|
|
@@ -63442,7 +63648,7 @@ ${codeText}
|
|
|
63442
63648
|
};
|
|
63443
63649
|
return [ret];
|
|
63444
63650
|
}
|
|
63445
|
-
assert(logger$
|
|
63651
|
+
assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
|
|
63446
63652
|
const content = token.content;
|
|
63447
63653
|
const newAttributes = cloneDeep__default.default(attributes);
|
|
63448
63654
|
newAttributes[`style-code-${token.type}`] = true;
|
|
@@ -63458,18 +63664,18 @@ ${codeText}
|
|
|
63458
63664
|
const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
|
|
63459
63665
|
return ret;
|
|
63460
63666
|
}
|
|
63461
|
-
assert(logger$
|
|
63667
|
+
assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
|
|
63462
63668
|
return tokenToText(content, newAttributes);
|
|
63463
63669
|
};
|
|
63464
63670
|
const ops = tokens.map((token) => tokenToText(token, {}));
|
|
63465
63671
|
const newText = ops.flat();
|
|
63466
|
-
assert(logger$
|
|
63672
|
+
assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
|
|
63467
63673
|
return {
|
|
63468
63674
|
text: newText
|
|
63469
63675
|
};
|
|
63470
63676
|
}
|
|
63471
63677
|
}
|
|
63472
|
-
const zhCN$
|
|
63678
|
+
const zhCN$o = {
|
|
63473
63679
|
code: {
|
|
63474
63680
|
title: "\u4EE3\u7801",
|
|
63475
63681
|
abstract: "\u4EE3\u7801",
|
|
@@ -63481,7 +63687,7 @@ ${codeText}
|
|
|
63481
63687
|
plainText: "Plain Text"
|
|
63482
63688
|
}
|
|
63483
63689
|
};
|
|
63484
|
-
const enUS$
|
|
63690
|
+
const enUS$o = {
|
|
63485
63691
|
code: {
|
|
63486
63692
|
title: "Code",
|
|
63487
63693
|
abstract: "Code",
|
|
@@ -63493,7 +63699,7 @@ ${codeText}
|
|
|
63493
63699
|
plainText: "Plain Text"
|
|
63494
63700
|
}
|
|
63495
63701
|
};
|
|
63496
|
-
const jaJP$
|
|
63702
|
+
const jaJP$o = {
|
|
63497
63703
|
code: {
|
|
63498
63704
|
title: "\u30B3\u30FC\u30C9",
|
|
63499
63705
|
abstract: "\u30B3\u30FC\u30C9",
|
|
@@ -63506,9 +63712,9 @@ ${codeText}
|
|
|
63506
63712
|
}
|
|
63507
63713
|
};
|
|
63508
63714
|
i18n$1.mergeLang({
|
|
63509
|
-
"zh-CN": zhCN$
|
|
63510
|
-
"en-US": enUS$
|
|
63511
|
-
"ja-JP": jaJP$
|
|
63715
|
+
"zh-CN": zhCN$o,
|
|
63716
|
+
"en-US": enUS$o,
|
|
63717
|
+
"ja-JP": jaJP$o
|
|
63512
63718
|
});
|
|
63513
63719
|
function convertToTable(editor, containerId, blockIndex, offset) {
|
|
63514
63720
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -63769,7 +63975,7 @@ ${codeText}
|
|
|
63769
63975
|
}
|
|
63770
63976
|
return false;
|
|
63771
63977
|
}
|
|
63772
|
-
const logger$
|
|
63978
|
+
const logger$1k = getLogger("match-text-style");
|
|
63773
63979
|
function matchTextPair(text2, find) {
|
|
63774
63980
|
if (text2.length < find.length * 2 + 1) {
|
|
63775
63981
|
return -1;
|
|
@@ -63839,7 +64045,7 @@ ${codeText}
|
|
|
63839
64045
|
editor.insertBoxToBlock(block, start, boxData);
|
|
63840
64046
|
});
|
|
63841
64047
|
} catch (err) {
|
|
63842
|
-
logger$
|
|
64048
|
+
logger$1k.warn(`failed to convert to box, ${err.message}`);
|
|
63843
64049
|
continue;
|
|
63844
64050
|
}
|
|
63845
64051
|
}
|
|
@@ -63902,7 +64108,7 @@ ${codeText}
|
|
|
63902
64108
|
return false;
|
|
63903
64109
|
}
|
|
63904
64110
|
}
|
|
63905
|
-
const enUS$
|
|
64111
|
+
const enUS$n = {
|
|
63906
64112
|
placeholder: {
|
|
63907
64113
|
default: "Type / for commands",
|
|
63908
64114
|
heading: "Heading {heading}",
|
|
@@ -63913,7 +64119,7 @@ ${codeText}
|
|
|
63913
64119
|
mobileDefault: "Type to add content"
|
|
63914
64120
|
}
|
|
63915
64121
|
};
|
|
63916
|
-
const zhCN$
|
|
64122
|
+
const zhCN$n = {
|
|
63917
64123
|
placeholder: {
|
|
63918
64124
|
default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
|
|
63919
64125
|
heading: "\u6807\u9898{heading}",
|
|
@@ -63924,7 +64130,7 @@ ${codeText}
|
|
|
63924
64130
|
mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
|
|
63925
64131
|
}
|
|
63926
64132
|
};
|
|
63927
|
-
const jaJP$
|
|
64133
|
+
const jaJP$n = {
|
|
63928
64134
|
placeholder: {
|
|
63929
64135
|
default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
|
|
63930
64136
|
heading: "\u898B\u51FA\u3057{heading}",
|
|
@@ -63936,9 +64142,9 @@ ${codeText}
|
|
|
63936
64142
|
}
|
|
63937
64143
|
};
|
|
63938
64144
|
const langs$1 = {
|
|
63939
|
-
"en-US": enUS$
|
|
63940
|
-
"zh-CN": zhCN$
|
|
63941
|
-
"ja-JP": jaJP$
|
|
64145
|
+
"en-US": enUS$n,
|
|
64146
|
+
"zh-CN": zhCN$n,
|
|
64147
|
+
"ja-JP": jaJP$n
|
|
63942
64148
|
};
|
|
63943
64149
|
i18n$1.mergeLang(langs$1);
|
|
63944
64150
|
function isEmptyTextBlockWithoutCompositionText(editor, block) {
|
|
@@ -64105,7 +64311,7 @@ ${codeText}
|
|
|
64105
64311
|
}
|
|
64106
64312
|
return false;
|
|
64107
64313
|
}
|
|
64108
|
-
const logger$
|
|
64314
|
+
const logger$1j = getLogger("enforce-title");
|
|
64109
64315
|
class EnforceWithDocumentTitleHandler {
|
|
64110
64316
|
constructor(editor, options = {
|
|
64111
64317
|
headingLevel: 1
|
|
@@ -64177,7 +64383,7 @@ ${codeText}
|
|
|
64177
64383
|
var _a, _b;
|
|
64178
64384
|
try {
|
|
64179
64385
|
const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
|
|
64180
|
-
assert(logger$
|
|
64386
|
+
assert(logger$1j, blocks.length > 0, "root container is empty");
|
|
64181
64387
|
const firstBlock = blocks[0];
|
|
64182
64388
|
if (firstBlock.type !== "text" && !this.options.hideTitle) {
|
|
64183
64389
|
const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
|
|
@@ -64186,7 +64392,7 @@ ${codeText}
|
|
|
64186
64392
|
return;
|
|
64187
64393
|
}
|
|
64188
64394
|
if (!this.options.hideTitle) {
|
|
64189
|
-
assert(logger$
|
|
64395
|
+
assert(logger$1j, firstBlock.text, "invalid text block");
|
|
64190
64396
|
const block = editor.getBlockById(firstBlock.id);
|
|
64191
64397
|
if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
|
|
64192
64398
|
const text2 = editor.getBlockString(block);
|
|
@@ -64271,7 +64477,7 @@ ${codeText}
|
|
|
64271
64477
|
});
|
|
64272
64478
|
return orgDataUrl;
|
|
64273
64479
|
}
|
|
64274
|
-
const logger$
|
|
64480
|
+
const logger$1i = getLogger("drag-preview-image");
|
|
64275
64481
|
class DragPreviewImage {
|
|
64276
64482
|
constructor(editor) {
|
|
64277
64483
|
__publicField(this, "startPosition", null);
|
|
@@ -64279,7 +64485,7 @@ ${codeText}
|
|
|
64279
64485
|
__publicField(this, "handleDragStart", async (e2, preview) => {
|
|
64280
64486
|
var _a, _b, _c, _d, _e, _f;
|
|
64281
64487
|
const target = e2.target;
|
|
64282
|
-
assert(logger$
|
|
64488
|
+
assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
|
|
64283
64489
|
const { x: startX, y: startY } = e2;
|
|
64284
64490
|
this.startPosition = {
|
|
64285
64491
|
x: startX,
|
|
@@ -64365,7 +64571,7 @@ ${codeText}
|
|
|
64365
64571
|
}
|
|
64366
64572
|
return block;
|
|
64367
64573
|
}
|
|
64368
|
-
const logger$
|
|
64574
|
+
const logger$1h = getLogger("block-menu-drag-handler");
|
|
64369
64575
|
function createDragEventFromMouseEvent$2(event, type) {
|
|
64370
64576
|
const dragEvent = new DragEvent(type, {
|
|
64371
64577
|
bubbles: true,
|
|
@@ -64386,7 +64592,7 @@ ${codeText}
|
|
|
64386
64592
|
__publicField(this, "oldPos", { x: 0, y: 0 });
|
|
64387
64593
|
__publicField(this, "handleMouseDown", (event) => {
|
|
64388
64594
|
const block = this.button.blockMenu.currentBlock;
|
|
64389
|
-
assert(logger$
|
|
64595
|
+
assert(logger$1h, block, "no dragged block");
|
|
64390
64596
|
if (event.button !== 0) {
|
|
64391
64597
|
return;
|
|
64392
64598
|
}
|
|
@@ -64414,7 +64620,7 @@ ${codeText}
|
|
|
64414
64620
|
});
|
|
64415
64621
|
}
|
|
64416
64622
|
const block = this.button.blockMenu.currentBlock;
|
|
64417
|
-
assert(logger$
|
|
64623
|
+
assert(logger$1h, block, "no dragged block");
|
|
64418
64624
|
(_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
|
|
64419
64625
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
|
|
64420
64626
|
registerStandardDraggedObject(this.editor, dragEvent, block);
|
|
@@ -64434,7 +64640,7 @@ ${codeText}
|
|
|
64434
64640
|
this.handleDragStart(event);
|
|
64435
64641
|
}
|
|
64436
64642
|
this.oldPos = { x, y };
|
|
64437
|
-
assert(logger$
|
|
64643
|
+
assert(logger$1h, target instanceof Element, "target is invalid");
|
|
64438
64644
|
this.dragPreview.handleDrag(event);
|
|
64439
64645
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
|
|
64440
64646
|
this.editor.contentElement.dispatchEvent(dragEvent);
|
|
@@ -64442,7 +64648,7 @@ ${codeText}
|
|
|
64442
64648
|
__publicField(this, "handleDragEnd", (event) => {
|
|
64443
64649
|
var _a;
|
|
64444
64650
|
const block = this.button.blockMenu.currentBlock;
|
|
64445
|
-
assert(logger$
|
|
64651
|
+
assert(logger$1h, block, "no dragged block");
|
|
64446
64652
|
window.isDragging = false;
|
|
64447
64653
|
this.dragPreview.handleDragEnd();
|
|
64448
64654
|
(_a = this.autoScroll) == null ? void 0 : _a.inactive();
|
|
@@ -64665,7 +64871,7 @@ ${codeText}
|
|
|
64665
64871
|
this.rootButton.destroy();
|
|
64666
64872
|
}
|
|
64667
64873
|
}
|
|
64668
|
-
const zhCN$
|
|
64874
|
+
const zhCN$m = {
|
|
64669
64875
|
blockMenu: {
|
|
64670
64876
|
section: {
|
|
64671
64877
|
basics: "\u57FA\u7840",
|
|
@@ -64689,7 +64895,7 @@ ${codeText}
|
|
|
64689
64895
|
}
|
|
64690
64896
|
}
|
|
64691
64897
|
};
|
|
64692
|
-
const enUS$
|
|
64898
|
+
const enUS$m = {
|
|
64693
64899
|
blockMenu: {
|
|
64694
64900
|
section: {
|
|
64695
64901
|
basics: "Basic",
|
|
@@ -64713,7 +64919,7 @@ ${codeText}
|
|
|
64713
64919
|
}
|
|
64714
64920
|
}
|
|
64715
64921
|
};
|
|
64716
|
-
const jaJP$
|
|
64922
|
+
const jaJP$m = {
|
|
64717
64923
|
blockMenu: {
|
|
64718
64924
|
section: {
|
|
64719
64925
|
basics: "\u4E00\u822C",
|
|
@@ -64738,9 +64944,9 @@ ${codeText}
|
|
|
64738
64944
|
}
|
|
64739
64945
|
};
|
|
64740
64946
|
i18n$1.mergeLang({
|
|
64741
|
-
"zh-CN": zhCN$
|
|
64742
|
-
"en-US": enUS$
|
|
64743
|
-
"ja-JP": jaJP$
|
|
64947
|
+
"zh-CN": zhCN$m,
|
|
64948
|
+
"en-US": enUS$m,
|
|
64949
|
+
"ja-JP": jaJP$m
|
|
64744
64950
|
});
|
|
64745
64951
|
const style$6 = "";
|
|
64746
64952
|
class DragData {
|
|
@@ -64820,7 +65026,7 @@ ${codeText}
|
|
|
64820
65026
|
function clearDraggedObject(editor) {
|
|
64821
65027
|
getDragData(editor).clearData();
|
|
64822
65028
|
}
|
|
64823
|
-
const logger$
|
|
65029
|
+
const logger$1g = getLogger("find-drop-target");
|
|
64824
65030
|
function childContainerFromPoint(x, y) {
|
|
64825
65031
|
const elem = getElementFromPoint(x, y);
|
|
64826
65032
|
if (!elem) {
|
|
@@ -64933,13 +65139,13 @@ ${codeText}
|
|
|
64933
65139
|
return true;
|
|
64934
65140
|
}
|
|
64935
65141
|
const parentBlock = getParentBlock(container);
|
|
64936
|
-
assert(logger$
|
|
65142
|
+
assert(logger$1g, parentBlock, "no parent block");
|
|
64937
65143
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
64938
65144
|
return false;
|
|
64939
65145
|
}
|
|
64940
65146
|
return canInsertAsSibling(editor, parentBlock);
|
|
64941
65147
|
}
|
|
64942
|
-
const logger$
|
|
65148
|
+
const logger$1f = getLogger("drop-target");
|
|
64943
65149
|
function getEmbedClassByFile(editor, file2) {
|
|
64944
65150
|
let embedClass = {};
|
|
64945
65151
|
if (/image/.test(file2.type)) {
|
|
@@ -64949,7 +65155,7 @@ ${codeText}
|
|
|
64949
65155
|
} else if (/video/.test(file2.type)) {
|
|
64950
65156
|
embedClass = editor.editorEmbeds.getEmbedClass("video");
|
|
64951
65157
|
}
|
|
64952
|
-
assert(logger$
|
|
65158
|
+
assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
|
|
64953
65159
|
return embedClass;
|
|
64954
65160
|
}
|
|
64955
65161
|
async function patchInsertFile(editor, files, containerId, blockIndex) {
|
|
@@ -65696,7 +65902,7 @@ ${codeText}
|
|
|
65696
65902
|
}
|
|
65697
65903
|
}
|
|
65698
65904
|
}
|
|
65699
|
-
const zhCN$
|
|
65905
|
+
const zhCN$l = {
|
|
65700
65906
|
image: {
|
|
65701
65907
|
title: "\u56FE\u7247",
|
|
65702
65908
|
upload: {
|
|
@@ -65712,7 +65918,7 @@ ${codeText}
|
|
|
65712
65918
|
abstract: "\u56FE\u7247"
|
|
65713
65919
|
}
|
|
65714
65920
|
};
|
|
65715
|
-
const enUS$
|
|
65921
|
+
const enUS$l = {
|
|
65716
65922
|
image: {
|
|
65717
65923
|
title: "Image",
|
|
65718
65924
|
upload: {
|
|
@@ -65728,7 +65934,7 @@ ${codeText}
|
|
|
65728
65934
|
abstract: "Image"
|
|
65729
65935
|
}
|
|
65730
65936
|
};
|
|
65731
|
-
const jaJP$
|
|
65937
|
+
const jaJP$l = {
|
|
65732
65938
|
image: {
|
|
65733
65939
|
title: "\u753B\u50CF",
|
|
65734
65940
|
upload: {
|
|
@@ -65745,9 +65951,9 @@ ${codeText}
|
|
|
65745
65951
|
}
|
|
65746
65952
|
};
|
|
65747
65953
|
i18n$1.mergeLang({
|
|
65748
|
-
"zh-CN": zhCN$
|
|
65749
|
-
"en-US": enUS$
|
|
65750
|
-
"ja-JP": jaJP$
|
|
65954
|
+
"zh-CN": zhCN$l,
|
|
65955
|
+
"en-US": enUS$l,
|
|
65956
|
+
"ja-JP": jaJP$l
|
|
65751
65957
|
});
|
|
65752
65958
|
function convertToImage(editor, containerId, blockIndex, offset) {
|
|
65753
65959
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -65801,7 +66007,7 @@ ${codeText}
|
|
|
65801
66007
|
return false;
|
|
65802
66008
|
}
|
|
65803
66009
|
}
|
|
65804
|
-
const logger$
|
|
66010
|
+
const logger$1e = getLogger("copy-image");
|
|
65805
66011
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
65806
66012
|
const imageData = imageObject.getImages()[index2];
|
|
65807
66013
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
@@ -65842,7 +66048,7 @@ ${codeText}
|
|
|
65842
66048
|
});
|
|
65843
66049
|
clipboardData["image/png"] = fileBlob;
|
|
65844
66050
|
} catch (error2) {
|
|
65845
|
-
logger$
|
|
66051
|
+
logger$1e.error(error2);
|
|
65846
66052
|
}
|
|
65847
66053
|
addMetaToDoc(editor, doc2);
|
|
65848
66054
|
const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
|
|
@@ -66115,195 +66321,6 @@ ${codeText}
|
|
|
66115
66321
|
}
|
|
66116
66322
|
return getDragInsertPos(editor, block, images, x);
|
|
66117
66323
|
}
|
|
66118
|
-
const zhCN$l = {
|
|
66119
|
-
embedProperties: {
|
|
66120
|
-
edit: "\u7F16\u8F91",
|
|
66121
|
-
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
66122
|
-
}
|
|
66123
|
-
};
|
|
66124
|
-
const enUS$l = {
|
|
66125
|
-
embedProperties: {
|
|
66126
|
-
edit: "Edit",
|
|
66127
|
-
addComment: "Add annotation"
|
|
66128
|
-
}
|
|
66129
|
-
};
|
|
66130
|
-
const jaJP$l = {
|
|
66131
|
-
embedProperties: {
|
|
66132
|
-
edit: "\u7DE8\u96C6",
|
|
66133
|
-
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
66134
|
-
}
|
|
66135
|
-
};
|
|
66136
|
-
i18n$1.mergeLang({
|
|
66137
|
-
"zh-CN": zhCN$l,
|
|
66138
|
-
"en-US": enUS$l,
|
|
66139
|
-
"ja-JP": jaJP$l
|
|
66140
|
-
});
|
|
66141
|
-
const logger$1e = getLogger("embed-block-properties");
|
|
66142
|
-
function addCommentToBlock(editor, block) {
|
|
66143
|
-
var _a;
|
|
66144
|
-
for (const hook of editor.blockHooks) {
|
|
66145
|
-
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
66146
|
-
if (!commands) {
|
|
66147
|
-
continue;
|
|
66148
|
-
}
|
|
66149
|
-
if (commands.group === "block-comment-actions") {
|
|
66150
|
-
const command = commands.commands[0];
|
|
66151
|
-
if (!command) {
|
|
66152
|
-
continue;
|
|
66153
|
-
}
|
|
66154
|
-
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
66155
|
-
return true;
|
|
66156
|
-
}
|
|
66157
|
-
}
|
|
66158
|
-
return false;
|
|
66159
|
-
}
|
|
66160
|
-
class StandardEmbedBlockCommands {
|
|
66161
|
-
constructor(editor, block, properties) {
|
|
66162
|
-
__publicField(this, "group", "hovering-toolbar");
|
|
66163
|
-
__publicField(this, "_commands", [{
|
|
66164
|
-
id: "edit",
|
|
66165
|
-
name: i18n$1.t("embedProperties.edit"),
|
|
66166
|
-
icon: EditIcon
|
|
66167
|
-
}, {
|
|
66168
|
-
id: "separator",
|
|
66169
|
-
name: "",
|
|
66170
|
-
type: "separator"
|
|
66171
|
-
}]);
|
|
66172
|
-
this.editor = editor;
|
|
66173
|
-
this.block = block;
|
|
66174
|
-
this.properties = properties;
|
|
66175
|
-
}
|
|
66176
|
-
get commands() {
|
|
66177
|
-
var _a, _b, _c, _d;
|
|
66178
|
-
if (clientType.isMobile) {
|
|
66179
|
-
return [];
|
|
66180
|
-
}
|
|
66181
|
-
let standardCommands = [];
|
|
66182
|
-
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
66183
|
-
this.properties.presetIds.forEach((id) => {
|
|
66184
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66185
|
-
if (command) {
|
|
66186
|
-
standardCommands.push(command);
|
|
66187
|
-
}
|
|
66188
|
-
});
|
|
66189
|
-
}
|
|
66190
|
-
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
66191
|
-
standardCommands.push(...this.properties.extCommands);
|
|
66192
|
-
}
|
|
66193
|
-
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
66194
|
-
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
66195
|
-
}
|
|
66196
|
-
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
66197
|
-
this.properties.extIds.forEach((id) => {
|
|
66198
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66199
|
-
if (command) {
|
|
66200
|
-
standardCommands.push(command);
|
|
66201
|
-
}
|
|
66202
|
-
});
|
|
66203
|
-
}
|
|
66204
|
-
const { enableComments = true } = this.editor.options;
|
|
66205
|
-
if (!enableComments || this.editor.readonly) {
|
|
66206
|
-
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
66207
|
-
}
|
|
66208
|
-
if (this.editor.readonly) {
|
|
66209
|
-
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
66210
|
-
}
|
|
66211
|
-
standardCommands.forEach((item) => {
|
|
66212
|
-
if (item.id === "add-comment" || item.id === "edit") {
|
|
66213
|
-
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
66214
|
-
}
|
|
66215
|
-
});
|
|
66216
|
-
return standardCommands;
|
|
66217
|
-
}
|
|
66218
|
-
executeCommand(editor, block, item) {
|
|
66219
|
-
var _a, _b;
|
|
66220
|
-
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
66221
|
-
return;
|
|
66222
|
-
}
|
|
66223
|
-
if (item.id === "add-comment") {
|
|
66224
|
-
if (!addCommentToBlock(editor, block)) {
|
|
66225
|
-
logger$1e.error("failed to add comment to block");
|
|
66226
|
-
}
|
|
66227
|
-
return;
|
|
66228
|
-
}
|
|
66229
|
-
logger$1e.error(`unknown command: ${JSON.stringify(item)}`);
|
|
66230
|
-
}
|
|
66231
|
-
}
|
|
66232
|
-
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
66233
|
-
return {
|
|
66234
|
-
blockCommands: {
|
|
66235
|
-
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
66236
|
-
}
|
|
66237
|
-
};
|
|
66238
|
-
}
|
|
66239
|
-
class EmbedBlockResizer {
|
|
66240
|
-
constructor(editor) {
|
|
66241
|
-
__publicField(this, "resizing", false);
|
|
66242
|
-
__publicField(this, "blockResizer");
|
|
66243
|
-
__publicField(this, "handleResized", () => {
|
|
66244
|
-
this.resizing = false;
|
|
66245
|
-
});
|
|
66246
|
-
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
66247
|
-
var _a, _b;
|
|
66248
|
-
this.resizing = true;
|
|
66249
|
-
const block = resizer.getBlock();
|
|
66250
|
-
if (block) {
|
|
66251
|
-
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
66252
|
-
return;
|
|
66253
|
-
}
|
|
66254
|
-
const blockType = getEmbedType(block);
|
|
66255
|
-
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
66256
|
-
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
66257
|
-
const oldData = this.editor.getBlockData(block);
|
|
66258
|
-
const oldEmbedData = oldData.embedData;
|
|
66259
|
-
const newEmbedData = {
|
|
66260
|
-
...oldEmbedData,
|
|
66261
|
-
height
|
|
66262
|
-
};
|
|
66263
|
-
this.editor.updateEmbedData(block, newEmbedData);
|
|
66264
|
-
}
|
|
66265
|
-
});
|
|
66266
|
-
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
66267
|
-
if (this.resizing) {
|
|
66268
|
-
return;
|
|
66269
|
-
}
|
|
66270
|
-
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
66271
|
-
this.disableResizer();
|
|
66272
|
-
}
|
|
66273
|
-
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
66274
|
-
this.tryEnableResizer(block);
|
|
66275
|
-
}
|
|
66276
|
-
});
|
|
66277
|
-
__publicField(this, "handleEditorResize", () => {
|
|
66278
|
-
this.blockResizer.updateResizer();
|
|
66279
|
-
});
|
|
66280
|
-
this.editor = editor;
|
|
66281
|
-
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
66282
|
-
this.blockResizer = new BlockResizer(this.editor, {
|
|
66283
|
-
resize: ["bottom"]
|
|
66284
|
-
});
|
|
66285
|
-
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
66286
|
-
this.blockResizer.addListener("resized", this.handleResized);
|
|
66287
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
66288
|
-
}
|
|
66289
|
-
destroy() {
|
|
66290
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
66291
|
-
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
66292
|
-
}
|
|
66293
|
-
tryEnableResizer(block) {
|
|
66294
|
-
this.blockResizer.enableResize(block);
|
|
66295
|
-
}
|
|
66296
|
-
disableResizer() {
|
|
66297
|
-
this.blockResizer.disableResize();
|
|
66298
|
-
}
|
|
66299
|
-
static get(editor) {
|
|
66300
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66301
|
-
}
|
|
66302
|
-
static register(editor, block) {
|
|
66303
|
-
addClass(block, "resizable");
|
|
66304
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66305
|
-
}
|
|
66306
|
-
}
|
|
66307
66324
|
class ImageHoveringToolbarCommands$1 {
|
|
66308
66325
|
constructor(editor, block) {
|
|
66309
66326
|
__publicField(this, "group", "hovering-toolbar");
|
|
@@ -66375,7 +66392,7 @@ ${codeText}
|
|
|
66375
66392
|
executeCommand(editor, block, item) {
|
|
66376
66393
|
switch (item.id) {
|
|
66377
66394
|
case "addComment":
|
|
66378
|
-
addCommentToBlock(editor, block);
|
|
66395
|
+
addCommentToBlock$1(editor, block);
|
|
66379
66396
|
break;
|
|
66380
66397
|
case "left":
|
|
66381
66398
|
case "center":
|
|
@@ -68638,7 +68655,7 @@ ${codeText}
|
|
|
68638
68655
|
const types2 = ["table", "layout"];
|
|
68639
68656
|
if (types2.includes(getBlockType(block))) {
|
|
68640
68657
|
editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
|
|
68641
|
-
comment = addCommentToBlock
|
|
68658
|
+
comment = addCommentToBlock(editor, block, this.provider);
|
|
68642
68659
|
}
|
|
68643
68660
|
}
|
|
68644
68661
|
comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
|
|
@@ -68659,7 +68676,7 @@ ${codeText}
|
|
|
68659
68676
|
try {
|
|
68660
68677
|
this.editorComments.showCommentList();
|
|
68661
68678
|
const block2 = editor.getBlockById(blockId);
|
|
68662
|
-
addCommentToBlock
|
|
68679
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
68663
68680
|
} catch (err) {
|
|
68664
68681
|
logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
68665
68682
|
}
|
|
@@ -68995,11 +69012,11 @@ ${codeText}
|
|
|
68995
69012
|
const { containerId } = path[path.length - 1];
|
|
68996
69013
|
const targetBlock = getParentBlock(getContainerById(editor, containerId));
|
|
68997
69014
|
if (targetBlock && getBlockType(targetBlock) === "code") {
|
|
68998
|
-
addCommentToBlock
|
|
69015
|
+
addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
|
|
68999
69016
|
return;
|
|
69000
69017
|
}
|
|
69001
69018
|
}
|
|
69002
|
-
addCommentToBlock
|
|
69019
|
+
addCommentToBlock(editor, block, editorComments.commentProvider);
|
|
69003
69020
|
return;
|
|
69004
69021
|
}
|
|
69005
69022
|
const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
|
|
@@ -69236,7 +69253,7 @@ ${codeText}
|
|
|
69236
69253
|
editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
|
|
69237
69254
|
const editorComments = editor2.getCustom("editor-comments");
|
|
69238
69255
|
editorComments.showCommentList();
|
|
69239
|
-
addCommentToBlock
|
|
69256
|
+
addCommentToBlock(editor2, block, editorComments.commentProvider);
|
|
69240
69257
|
}
|
|
69241
69258
|
}
|
|
69242
69259
|
};
|
|
@@ -69270,7 +69287,7 @@ ${codeText}
|
|
|
69270
69287
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
69271
69288
|
if (selectedBlock) {
|
|
69272
69289
|
const editorComments = editor.getCustom("editor-comments");
|
|
69273
|
-
addCommentToBlock
|
|
69290
|
+
addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
|
|
69274
69291
|
}
|
|
69275
69292
|
return;
|
|
69276
69293
|
}
|
|
@@ -76531,7 +76548,7 @@ ${content}
|
|
|
76531
76548
|
} else if (item.id === "download") {
|
|
76532
76549
|
downloadFile$1(editor, box);
|
|
76533
76550
|
} else if (item.id === "add-comment") {
|
|
76534
|
-
addCommentToBlock(editor, block);
|
|
76551
|
+
addCommentToBlock$1(editor, block);
|
|
76535
76552
|
}
|
|
76536
76553
|
}
|
|
76537
76554
|
}
|
|
@@ -76823,7 +76840,7 @@ ${content}
|
|
|
76823
76840
|
} else if (item.id === "download") {
|
|
76824
76841
|
downloadFile(editor, block);
|
|
76825
76842
|
} else if (item.id === "add-comment") {
|
|
76826
|
-
addCommentToBlock(editor, block);
|
|
76843
|
+
addCommentToBlock$1(editor, block);
|
|
76827
76844
|
}
|
|
76828
76845
|
}
|
|
76829
76846
|
}
|
|
@@ -86330,7 +86347,7 @@ ${data2.flowchartText}
|
|
|
86330
86347
|
executeCommand(editor, block, item) {
|
|
86331
86348
|
switch (item.id) {
|
|
86332
86349
|
case "addComment":
|
|
86333
|
-
addCommentToBlock(editor, block);
|
|
86350
|
+
addCommentToBlock$1(editor, block);
|
|
86334
86351
|
break;
|
|
86335
86352
|
case "left":
|
|
86336
86353
|
case "center":
|
|
@@ -88359,7 +88376,7 @@ ${data2.flowchartText}
|
|
|
88359
88376
|
}
|
|
88360
88377
|
}
|
|
88361
88378
|
});
|
|
88362
|
-
editor.version = "2.2.8-beta.
|
|
88379
|
+
editor.version = "2.2.8-beta.8";
|
|
88363
88380
|
return editor;
|
|
88364
88381
|
}
|
|
88365
88382
|
function isDoc(doc2) {
|
|
@@ -88454,7 +88471,7 @@ ${data2.flowchartText}
|
|
|
88454
88471
|
});
|
|
88455
88472
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88456
88473
|
OnesEditorToolbar.register(editor);
|
|
88457
|
-
editor.version = "2.2.8-beta.
|
|
88474
|
+
editor.version = "2.2.8-beta.8";
|
|
88458
88475
|
return editor;
|
|
88459
88476
|
}
|
|
88460
88477
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134297,6 +134314,7 @@ ${data2.flowchartText}
|
|
|
134297
134314
|
exports2.ShareDBLocalDoc = ShareDBLocalDoc;
|
|
134298
134315
|
exports2.ShareDBServer = ShareDBServer;
|
|
134299
134316
|
exports2.SimpleCache = SimpleCache;
|
|
134317
|
+
exports2.StandardBoxCommands = StandardBoxCommands;
|
|
134300
134318
|
exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
|
|
134301
134319
|
exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
|
|
134302
134320
|
exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
|
|
@@ -134315,7 +134333,7 @@ ${data2.flowchartText}
|
|
|
134315
134333
|
exports2.addAttribute = addAttribute;
|
|
134316
134334
|
exports2.addClass = addClass;
|
|
134317
134335
|
exports2.addColor = addColor;
|
|
134318
|
-
exports2.addCommentToBlock = addCommentToBlock;
|
|
134336
|
+
exports2.addCommentToBlock = addCommentToBlock$1;
|
|
134319
134337
|
exports2.addDays = addDays;
|
|
134320
134338
|
exports2.addMetaToDoc = addMetaToDoc;
|
|
134321
134339
|
exports2.addMonths = addMonths;
|