@ones-editor/editor 2.2.8-beta.1 → 2.2.8-beta.10
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/@ones-editor/core/src/core/editor/editor-dom/dom-events.d.ts +2 -2
- package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +2 -3
- package/@ones-editor/core/src/core/types.d.ts +2 -2
- package/@ones-editor/core/src/utils/character.d.ts +1 -0
- package/@ones-editor/mathjax/package.json +2 -1
- package/@ones-editor/mathjax/src/mathjax-box/mathjax-editor.d.ts +1 -0
- package/@ones-editor/to-docx/src/errors.d.ts +3 -0
- package/@ones-editor/to-docx/src/index.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/box-helper/standard-box-commands.d.ts +6 -2
- package/@ones-editor/ui/src/index.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -1
- package/dist/index.js +848 -797
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -858,10 +858,10 @@ div.tippy-box[data-theme=menu] .tippy-arrow::after {
|
|
|
858
858
|
transform: rotate(45deg);
|
|
859
859
|
}
|
|
860
860
|
div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar-root, div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
|
|
861
|
-
box-shadow: 0px 0px
|
|
861
|
+
box-shadow: rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(45, 45, 46, 0.15) 0px 8px 16px -4px, rgba(45, 45, 46, 0.2) 0px 0px 1px 0px;
|
|
862
862
|
}
|
|
863
863
|
div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
|
|
864
|
-
|
|
864
|
+
border-radius: 3px;
|
|
865
865
|
}
|
|
866
866
|
div.tippy-box button {
|
|
867
867
|
outline: none;
|
|
@@ -901,7 +901,7 @@ div.tippy-box button {
|
|
|
901
901
|
}
|
|
902
902
|
.editor-command-bar.fixed.mobile .command-item.checked, .editor-command-bar.toolbar.mobile .command-item.checked {
|
|
903
903
|
border-radius: 3px;
|
|
904
|
-
background: #
|
|
904
|
+
background: #f0f6ff;
|
|
905
905
|
}
|
|
906
906
|
.editor-command-bar {
|
|
907
907
|
pointer-events: all;
|
|
@@ -1019,8 +1019,6 @@ div.tippy-box button {
|
|
|
1019
1019
|
gap: 5px;
|
|
1020
1020
|
padding: 5px 10px;
|
|
1021
1021
|
background: #ffffff;
|
|
1022
|
-
box-shadow: 0px 0px 1px rgba(48, 48, 48, 0.2), 0px 8px 16px rgba(48, 48, 48, 0.15);
|
|
1023
|
-
border-radius: 3px;
|
|
1024
1022
|
}
|
|
1025
1023
|
.editor-command-bar.toolbar .command-item {
|
|
1026
1024
|
background: transparent;
|
|
@@ -2054,11 +2052,6 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2054
2052
|
border-radius: 8px;
|
|
2055
2053
|
background: none;
|
|
2056
2054
|
}
|
|
2057
|
-
[data-command-bar-id=cursor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root,
|
|
2058
|
-
[data-command-bar-id=paste-special-button].mobile .tippy-box .tippy-content .editor-command-bar-root,
|
|
2059
|
-
[data-command-bar-id=editor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root {
|
|
2060
|
-
box-shadow: none;
|
|
2061
|
-
}
|
|
2062
2055
|
[data-command-bar-id=cursor-toolbar].mobile .tippy-content,
|
|
2063
2056
|
[data-command-bar-id=cursor-toolbar].mobile .editor-command-bar-root,
|
|
2064
2057
|
[data-command-bar-id=cursor-toolbar].mobile .editor-command-bar,
|
|
@@ -2091,6 +2084,61 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2091
2084
|
height: 40px;
|
|
2092
2085
|
transform: scaleX(0.5);
|
|
2093
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;
|
|
2094
2142
|
}div[data-type=editor-block].block-exclusive:after {
|
|
2095
2143
|
content: attr(data-exclusive-tips);
|
|
2096
2144
|
position: absolute;
|
|
@@ -2896,61 +2944,6 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] div[data
|
|
|
2896
2944
|
}
|
|
2897
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 {
|
|
2898
2946
|
outline: none;
|
|
2899
|
-
}div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer {
|
|
2900
|
-
position: absolute;
|
|
2901
|
-
background-color: transparent;
|
|
2902
|
-
border: 1px solid #0064ff;
|
|
2903
|
-
pointer-events: none;
|
|
2904
|
-
z-index: 1;
|
|
2905
|
-
display: none;
|
|
2906
|
-
}
|
|
2907
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer.active {
|
|
2908
|
-
display: block;
|
|
2909
|
-
}
|
|
2910
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper {
|
|
2911
|
-
position: absolute;
|
|
2912
|
-
width: 10px;
|
|
2913
|
-
height: 10px;
|
|
2914
|
-
background-color: #0064ff;
|
|
2915
|
-
border-radius: 50%;
|
|
2916
|
-
pointer-events: all;
|
|
2917
|
-
outline: 2px solid #fff;
|
|
2918
|
-
}
|
|
2919
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper::before {
|
|
2920
|
-
content: "";
|
|
2921
|
-
position: absolute;
|
|
2922
|
-
top: -3px;
|
|
2923
|
-
left: -3px;
|
|
2924
|
-
width: 16px;
|
|
2925
|
-
height: 16px;
|
|
2926
|
-
}
|
|
2927
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom {
|
|
2928
|
-
left: calc(50% - 5px);
|
|
2929
|
-
bottom: -5px;
|
|
2930
|
-
cursor: ns-resize;
|
|
2931
|
-
}
|
|
2932
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-left {
|
|
2933
|
-
left: -5px;
|
|
2934
|
-
top: -5px;
|
|
2935
|
-
cursor: nwse-resize;
|
|
2936
|
-
}
|
|
2937
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.top-right {
|
|
2938
|
-
right: -5px;
|
|
2939
|
-
top: -5px;
|
|
2940
|
-
cursor: nesw-resize;
|
|
2941
|
-
}
|
|
2942
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-left {
|
|
2943
|
-
left: -5px;
|
|
2944
|
-
bottom: -5px;
|
|
2945
|
-
cursor: nesw-resize;
|
|
2946
|
-
}
|
|
2947
|
-
div.editor-root div.editor-content div[data-type=editor-block] [data-type=block-tools] .block-resizer .resize-gripper.bottom-right {
|
|
2948
|
-
right: -5px;
|
|
2949
|
-
bottom: -5px;
|
|
2950
|
-
cursor: nwse-resize;
|
|
2951
|
-
}
|
|
2952
|
-
div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-type=block-tools] .block-resizer {
|
|
2953
|
-
display: none;
|
|
2954
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 {
|
|
2955
2948
|
content: " ";
|
|
2956
2949
|
position: absolute;
|
|
@@ -10086,6 +10079,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10086
10079
|
c = "\\\\";
|
|
10087
10080
|
return s.replace(new RegExp(`^[${c}]+|[${c}]+$`, "g"), "");
|
|
10088
10081
|
}
|
|
10082
|
+
function isFunction$1(functionToCheck) {
|
|
10083
|
+
return !!functionToCheck && {}.toString.call(functionToCheck) === "[object Function]";
|
|
10084
|
+
}
|
|
10089
10085
|
function isPrintableKey(key) {
|
|
10090
10086
|
if (!key)
|
|
10091
10087
|
return false;
|
|
@@ -11560,7 +11556,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11560
11556
|
}
|
|
11561
11557
|
this.editor.selectionHandler.handleMouseDown(event, { autoScroll: true });
|
|
11562
11558
|
}
|
|
11563
|
-
this.editor.input.focus();
|
|
11559
|
+
this.editor.input.focus({ preventScroll: true });
|
|
11564
11560
|
});
|
|
11565
11561
|
__publicField(this, "handleMouseMove", (event) => {
|
|
11566
11562
|
assert(logger$4p, this.mouseDownEvent, "no mouse down event");
|
|
@@ -13108,7 +13104,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13108
13104
|
if (pointX < rect.left) {
|
|
13109
13105
|
x = rect.left;
|
|
13110
13106
|
} else if (pointX > rect.right) {
|
|
13111
|
-
|
|
13107
|
+
const offset = targetBlock && isTextKindBlock(editor, targetBlock) ? 3 : 50;
|
|
13108
|
+
x = rect.right - offset;
|
|
13112
13109
|
}
|
|
13113
13110
|
}
|
|
13114
13111
|
for (let i = 0; i < yOffsets.length; i++) {
|
|
@@ -14457,10 +14454,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14457
14454
|
}
|
|
14458
14455
|
if (isTextBlockContentBoxChild(child)) {
|
|
14459
14456
|
const boxChild = child;
|
|
14460
|
-
const nextChild = children[i + 1];
|
|
14461
|
-
if (!nextChild) {
|
|
14462
|
-
break;
|
|
14463
|
-
}
|
|
14464
14457
|
const prevChild = children[i - 1];
|
|
14465
14458
|
if (prevChild) {
|
|
14466
14459
|
if (endAtNewLine(prevChild, boxChild)) {
|
|
@@ -14477,6 +14470,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14477
14470
|
});
|
|
14478
14471
|
}
|
|
14479
14472
|
}
|
|
14473
|
+
const nextChild = children[i + 1];
|
|
14474
|
+
if (!nextChild) {
|
|
14475
|
+
break;
|
|
14476
|
+
}
|
|
14480
14477
|
if (nextChildStartsNewLine(boxChild, nextChild)) {
|
|
14481
14478
|
offset += 1;
|
|
14482
14479
|
lineBreaks.push({
|
|
@@ -25712,7 +25709,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25712
25709
|
if (enableHorizontal) {
|
|
25713
25710
|
animateScrollTo(target, {
|
|
25714
25711
|
elementToScroll: getScrollContainer$1(target, { horizontal: true }),
|
|
25715
|
-
disableHorizontal: false
|
|
25712
|
+
disableHorizontal: false,
|
|
25713
|
+
speed: options.speed
|
|
25716
25714
|
});
|
|
25717
25715
|
}
|
|
25718
25716
|
const mobileClient = editor.options.componentsOptions.mobile;
|
|
@@ -25720,7 +25718,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25720
25718
|
elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
|
|
25721
25719
|
disableHorizontal: true,
|
|
25722
25720
|
verticalOffset: options == null ? void 0 : options.verticalOffset,
|
|
25723
|
-
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
|
|
25721
|
+
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0,
|
|
25722
|
+
speed: options.speed
|
|
25724
25723
|
});
|
|
25725
25724
|
} else if (target.scrollIntoView) {
|
|
25726
25725
|
target.scrollIntoView({
|
|
@@ -27432,7 +27431,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27432
27431
|
}
|
|
27433
27432
|
const logger$3g = getLogger("table-scroll");
|
|
27434
27433
|
class DomEventHandler {
|
|
27435
|
-
constructor(editor, dom, name, handler, data2) {
|
|
27434
|
+
constructor(editor, dom, name, handler, data2, options) {
|
|
27436
27435
|
__publicField(this, "handleEvent", (event) => {
|
|
27437
27436
|
this.handler(this.editor, event, this.data);
|
|
27438
27437
|
});
|
|
@@ -27441,7 +27440,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27441
27440
|
this.name = name;
|
|
27442
27441
|
this.handler = handler;
|
|
27443
27442
|
this.data = data2;
|
|
27444
|
-
dom.addEventListener(name, this.handleEvent);
|
|
27443
|
+
dom.addEventListener(name, this.handleEvent, options);
|
|
27445
27444
|
}
|
|
27446
27445
|
destroy() {
|
|
27447
27446
|
this.dom.removeEventListener(this.name, this.handleEvent);
|
|
@@ -27458,16 +27457,16 @@ var __publicField = (obj, key, value) => {
|
|
|
27458
27457
|
this.handlers.delete(element);
|
|
27459
27458
|
});
|
|
27460
27459
|
}
|
|
27461
|
-
addEventListener(element, eventName, eventHandler, data2) {
|
|
27460
|
+
addEventListener(element, eventName, eventHandler, data2, options) {
|
|
27462
27461
|
const existsHandlers = this.handlers.get(element);
|
|
27463
27462
|
if (existsHandlers) {
|
|
27464
27463
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
27465
27464
|
logger$3g.warn(`event has already registered: ${eventName}`);
|
|
27466
27465
|
return;
|
|
27467
27466
|
}
|
|
27468
|
-
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2));
|
|
27467
|
+
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
27469
27468
|
} else {
|
|
27470
|
-
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2);
|
|
27469
|
+
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options);
|
|
27471
27470
|
this.handlers.set(element, [handler]);
|
|
27472
27471
|
}
|
|
27473
27472
|
}
|
|
@@ -39900,17 +39899,23 @@ ${codeText}
|
|
|
39900
39899
|
return true;
|
|
39901
39900
|
}
|
|
39902
39901
|
if (event.key === "ArrowUp") {
|
|
39903
|
-
const
|
|
39904
|
-
this.
|
|
39905
|
-
|
|
39906
|
-
|
|
39907
|
-
|
|
39902
|
+
const curr = this.getSelectedItemIndex();
|
|
39903
|
+
const prev = this.getPrevItemIndex(curr);
|
|
39904
|
+
if (curr !== prev) {
|
|
39905
|
+
this.startPauseMouseEnter();
|
|
39906
|
+
this.selectItem(this.items[prev].id);
|
|
39907
|
+
event.preventDefault();
|
|
39908
|
+
event.stopPropagation();
|
|
39909
|
+
}
|
|
39908
39910
|
} else if (event.key === "ArrowDown") {
|
|
39909
|
-
const
|
|
39910
|
-
this.
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39911
|
+
const curr = this.getSelectedItemIndex();
|
|
39912
|
+
const next2 = this.getNextItemIndex(curr);
|
|
39913
|
+
if (curr !== next2) {
|
|
39914
|
+
this.startPauseMouseEnter();
|
|
39915
|
+
this.selectItem(this.items[next2].id);
|
|
39916
|
+
event.preventDefault();
|
|
39917
|
+
event.stopPropagation();
|
|
39918
|
+
}
|
|
39914
39919
|
} else if (event.key === "ArrowRight") {
|
|
39915
39920
|
const item = this.getSelectedItem();
|
|
39916
39921
|
if (item && item.children) {
|
|
@@ -40116,7 +40121,7 @@ ${codeText}
|
|
|
40116
40121
|
this.emit("click", this, item, target);
|
|
40117
40122
|
}
|
|
40118
40123
|
createPopperOptions() {
|
|
40119
|
-
var _a, _b;
|
|
40124
|
+
var _a, _b, _c;
|
|
40120
40125
|
const popperOptions = { modifiers: [] };
|
|
40121
40126
|
const overflowBoundary = this.options.overflowBoundary;
|
|
40122
40127
|
const padding = this.options.padding;
|
|
@@ -40127,7 +40132,13 @@ ${codeText}
|
|
|
40127
40132
|
phase: "main",
|
|
40128
40133
|
fn: ({ state }) => {
|
|
40129
40134
|
const popper = state.elements.popper;
|
|
40130
|
-
|
|
40135
|
+
const popperRect = popper.getBoundingClientRect();
|
|
40136
|
+
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40137
|
+
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40138
|
+
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40139
|
+
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40140
|
+
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40141
|
+
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40131
40142
|
popper.setAttribute("data-tippy-hidden", "");
|
|
40132
40143
|
} else {
|
|
40133
40144
|
popper.removeAttribute("data-tippy-hidden");
|
|
@@ -40143,6 +40154,10 @@ ${codeText}
|
|
|
40143
40154
|
}
|
|
40144
40155
|
});
|
|
40145
40156
|
}
|
|
40157
|
+
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40158
|
+
name: "flip",
|
|
40159
|
+
enabled: false
|
|
40160
|
+
});
|
|
40146
40161
|
return popperOptions;
|
|
40147
40162
|
}
|
|
40148
40163
|
destroy() {
|
|
@@ -40489,6 +40504,9 @@ ${codeText}
|
|
|
40489
40504
|
static hasExistsCommandBar() {
|
|
40490
40505
|
return !!document.querySelector("[data-command-bar-id]");
|
|
40491
40506
|
}
|
|
40507
|
+
static hideAll() {
|
|
40508
|
+
tippy$1.hideAll();
|
|
40509
|
+
}
|
|
40492
40510
|
};
|
|
40493
40511
|
let CommandBar = _CommandBar;
|
|
40494
40512
|
__publicField(CommandBar, "commandBarCreators", /* @__PURE__ */ new Map());
|
|
@@ -46984,7 +47002,413 @@ ${codeText}
|
|
|
46984
47002
|
}
|
|
46985
47003
|
return rects[0];
|
|
46986
47004
|
}
|
|
46987
|
-
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");
|
|
46988
47412
|
function addExclusiveStyle(editor, block, userId, displayName) {
|
|
46989
47413
|
var _a;
|
|
46990
47414
|
addClass(block, "block-exclusive");
|
|
@@ -47002,7 +47426,7 @@ ${codeText}
|
|
|
47002
47426
|
block.removeAttribute("data-exclusive-tips");
|
|
47003
47427
|
}
|
|
47004
47428
|
function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
|
|
47005
|
-
logger$
|
|
47429
|
+
logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
|
|
47006
47430
|
if (exclusive) {
|
|
47007
47431
|
addExclusiveStyle(editor, block, userId, displayName);
|
|
47008
47432
|
} else {
|
|
@@ -47159,28 +47583,28 @@ ${codeText}
|
|
|
47159
47583
|
}
|
|
47160
47584
|
}
|
|
47161
47585
|
const exclusiveBlockStyles = "";
|
|
47162
|
-
const zhCN$
|
|
47586
|
+
const zhCN$u = {
|
|
47163
47587
|
exclusive: {
|
|
47164
47588
|
tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
|
|
47165
47589
|
fallbackAbstract: "\u8BE5 Block"
|
|
47166
47590
|
}
|
|
47167
47591
|
};
|
|
47168
|
-
const enUS$
|
|
47592
|
+
const enUS$u = {
|
|
47169
47593
|
exclusive: {
|
|
47170
47594
|
tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
|
|
47171
47595
|
fallbackAbstract: "This Block"
|
|
47172
47596
|
}
|
|
47173
47597
|
};
|
|
47174
|
-
const jaJP$
|
|
47598
|
+
const jaJP$u = {
|
|
47175
47599
|
exclusive: {
|
|
47176
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",
|
|
47177
47601
|
fallbackAbstract: "\u3053\u306E\u8981\u7D20"
|
|
47178
47602
|
}
|
|
47179
47603
|
};
|
|
47180
47604
|
i18n$1.mergeLang({
|
|
47181
|
-
"zh-CN": zhCN$
|
|
47182
|
-
"en-US": enUS$
|
|
47183
|
-
"ja-JP": jaJP$
|
|
47605
|
+
"zh-CN": zhCN$u,
|
|
47606
|
+
"en-US": enUS$u,
|
|
47607
|
+
"ja-JP": jaJP$u
|
|
47184
47608
|
});
|
|
47185
47609
|
function getBlockInfo(editor, block) {
|
|
47186
47610
|
const data2 = editor.getBlockData(block);
|
|
@@ -47356,22 +47780,22 @@ ${codeText}
|
|
|
47356
47780
|
};
|
|
47357
47781
|
}
|
|
47358
47782
|
}
|
|
47359
|
-
const style$
|
|
47360
|
-
const zhCN$
|
|
47783
|
+
const style$9 = "";
|
|
47784
|
+
const zhCN$t = {
|
|
47361
47785
|
locker: {
|
|
47362
47786
|
lock: "\u9501\u5B9A",
|
|
47363
47787
|
unlock: "\u89E3\u9664\u9501\u5B9A",
|
|
47364
47788
|
lockedBy: "\u88AB {name} \u9501\u5B9A"
|
|
47365
47789
|
}
|
|
47366
47790
|
};
|
|
47367
|
-
const enUS$
|
|
47791
|
+
const enUS$t = {
|
|
47368
47792
|
locker: {
|
|
47369
47793
|
lock: "Lock",
|
|
47370
47794
|
unlock: "Unlock",
|
|
47371
47795
|
lockedBy: "Locked by {name}"
|
|
47372
47796
|
}
|
|
47373
47797
|
};
|
|
47374
|
-
const jaJP$
|
|
47798
|
+
const jaJP$t = {
|
|
47375
47799
|
locker: {
|
|
47376
47800
|
lock: "\u30ED\u30C3\u30AF",
|
|
47377
47801
|
unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
|
|
@@ -47379,9 +47803,9 @@ ${codeText}
|
|
|
47379
47803
|
}
|
|
47380
47804
|
};
|
|
47381
47805
|
i18n$1.mergeLang({
|
|
47382
|
-
"zh-CN": zhCN$
|
|
47383
|
-
"en-US": enUS$
|
|
47384
|
-
"ja-JP": jaJP$
|
|
47806
|
+
"zh-CN": zhCN$t,
|
|
47807
|
+
"en-US": enUS$t,
|
|
47808
|
+
"ja-JP": jaJP$t
|
|
47385
47809
|
});
|
|
47386
47810
|
class BlockLockerPasteHandler {
|
|
47387
47811
|
async handleBeforePasteDoc(editor, doc2) {
|
|
@@ -47393,7 +47817,7 @@ ${codeText}
|
|
|
47393
47817
|
return false;
|
|
47394
47818
|
}
|
|
47395
47819
|
}
|
|
47396
|
-
const logger$
|
|
47820
|
+
const logger$21 = getLogger("context-menu-utils");
|
|
47397
47821
|
function blobToString(blob) {
|
|
47398
47822
|
return new Promise((resolve, reject) => {
|
|
47399
47823
|
const reader = new FileReader();
|
|
@@ -47414,7 +47838,7 @@ ${codeText}
|
|
|
47414
47838
|
const types2 = items[0].types;
|
|
47415
47839
|
return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
|
|
47416
47840
|
} catch (error2) {
|
|
47417
|
-
logger$
|
|
47841
|
+
logger$21.warn(`Failed to read clipboard data: ${error2}`);
|
|
47418
47842
|
return true;
|
|
47419
47843
|
}
|
|
47420
47844
|
}
|
|
@@ -47463,7 +47887,7 @@ ${codeText}
|
|
|
47463
47887
|
}
|
|
47464
47888
|
return dataTransfer;
|
|
47465
47889
|
}
|
|
47466
|
-
const logger$
|
|
47890
|
+
const logger$20 = getLogger("ClipboardProvider");
|
|
47467
47891
|
class ClipboardProvider {
|
|
47468
47892
|
constructor(editor, options) {
|
|
47469
47893
|
__publicField(this, "id", "ClipboardProvider");
|
|
@@ -47549,7 +47973,7 @@ ${codeText}
|
|
|
47549
47973
|
}
|
|
47550
47974
|
}).catch((err) => {
|
|
47551
47975
|
this.clipboardPermission.read = "denied";
|
|
47552
|
-
logger$
|
|
47976
|
+
logger$20.log(err);
|
|
47553
47977
|
});
|
|
47554
47978
|
} catch (error2) {
|
|
47555
47979
|
this.clipboardPermission = {
|
|
@@ -47610,13 +48034,14 @@ ${codeText}
|
|
|
47610
48034
|
}
|
|
47611
48035
|
}
|
|
47612
48036
|
class StandardBoxCommands {
|
|
47613
|
-
constructor(editor) {
|
|
48037
|
+
constructor(editor, extIds) {
|
|
47614
48038
|
__publicField(this, "group", "standard-box-commands");
|
|
47615
48039
|
__publicField(this, "providers", []);
|
|
47616
48040
|
this.editor = editor;
|
|
47617
|
-
|
|
47618
|
-
|
|
47619
|
-
|
|
48041
|
+
this.extIds = extIds;
|
|
48042
|
+
}
|
|
48043
|
+
addProvider(provider) {
|
|
48044
|
+
this.providers.push(provider);
|
|
47620
48045
|
}
|
|
47621
48046
|
get commands() {
|
|
47622
48047
|
if (this.editor.readonly) {
|
|
@@ -47624,8 +48049,17 @@ ${codeText}
|
|
|
47624
48049
|
}
|
|
47625
48050
|
const items = [];
|
|
47626
48051
|
const focusedBlock = this.editor.selection.focusedBlock;
|
|
48052
|
+
const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
|
|
47627
48053
|
for (const provider of this.providers) {
|
|
47628
|
-
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
|
|
48054
|
+
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
|
|
48055
|
+
}
|
|
48056
|
+
for (const extId of this.extIds || []) {
|
|
48057
|
+
if (extId === "separator") {
|
|
48058
|
+
items.push({ id: "sep", name: "", type: "separator" });
|
|
48059
|
+
}
|
|
48060
|
+
if (extId === "add-comment") {
|
|
48061
|
+
items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
|
|
48062
|
+
}
|
|
47629
48063
|
}
|
|
47630
48064
|
return items;
|
|
47631
48065
|
}
|
|
@@ -47634,19 +48068,27 @@ ${codeText}
|
|
|
47634
48068
|
const { start, end } = getChildOffset(block, box);
|
|
47635
48069
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
47636
48070
|
for (const provider of this.providers) {
|
|
47637
|
-
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
|
|
48071
|
+
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
|
|
47638
48072
|
return;
|
|
47639
48073
|
}
|
|
47640
|
-
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
|
|
48074
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
|
|
47641
48075
|
return;
|
|
47642
48076
|
}
|
|
47643
48077
|
}
|
|
48078
|
+
if (item.id === "add-comment") {
|
|
48079
|
+
addCommentToBlock$1(editor, block);
|
|
48080
|
+
}
|
|
47644
48081
|
}
|
|
47645
|
-
static create(editor) {
|
|
47646
|
-
return new StandardBoxCommands(editor);
|
|
48082
|
+
static create(editor, extIds) {
|
|
48083
|
+
return new StandardBoxCommands(editor, extIds);
|
|
48084
|
+
}
|
|
48085
|
+
static mobileCreate(editor, extIds) {
|
|
48086
|
+
const instance = new StandardBoxCommands(editor, extIds);
|
|
48087
|
+
instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
|
|
48088
|
+
return instance;
|
|
47647
48089
|
}
|
|
47648
48090
|
}
|
|
47649
|
-
const logger$
|
|
48091
|
+
const logger$1$ = getLogger("object-commands");
|
|
47650
48092
|
const SEP$1 = {
|
|
47651
48093
|
id: "",
|
|
47652
48094
|
name: "",
|
|
@@ -47702,7 +48144,7 @@ ${codeText}
|
|
|
47702
48144
|
let element = null;
|
|
47703
48145
|
const commands = [];
|
|
47704
48146
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47705
|
-
boxCommands.push(
|
|
48147
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47706
48148
|
}
|
|
47707
48149
|
if (boxCommands.length > 0) {
|
|
47708
48150
|
element = child;
|
|
@@ -47732,10 +48174,10 @@ ${codeText}
|
|
|
47732
48174
|
const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
|
|
47733
48175
|
const { boxCommands, blockCommands } = result;
|
|
47734
48176
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47735
|
-
boxCommands.push(
|
|
48177
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47736
48178
|
}
|
|
47737
48179
|
if (boxCommands.length > 0) {
|
|
47738
|
-
assert(logger$
|
|
48180
|
+
assert(logger$1$, child, "child is null");
|
|
47739
48181
|
for (let i = 0; i < boxCommands.length; i++) {
|
|
47740
48182
|
if (boxCommands[i].commands.find((c) => c.id === item.id)) {
|
|
47741
48183
|
boxCommands[i].executeCommand(editor, block, child, item);
|
|
@@ -48002,18 +48444,18 @@ ${codeText}
|
|
|
48002
48444
|
}
|
|
48003
48445
|
}
|
|
48004
48446
|
const LIST_MAX_LEVEL = 8;
|
|
48005
|
-
const logger$
|
|
48006
|
-
const logger$
|
|
48447
|
+
const logger$1_ = getLogger("list-block");
|
|
48448
|
+
const logger$1Z = getLogger("list-block");
|
|
48007
48449
|
function isListBlock(block) {
|
|
48008
48450
|
return getBlockType(block) === "list";
|
|
48009
48451
|
}
|
|
48010
48452
|
function ensureIsListBlock(block) {
|
|
48011
|
-
assert(logger$
|
|
48453
|
+
assert(logger$1Z, isListBlock(block), "not a list block");
|
|
48012
48454
|
}
|
|
48013
48455
|
function getListBlockType(block) {
|
|
48014
48456
|
ensureIsListBlock(block);
|
|
48015
48457
|
const type = block.getAttribute("data-list-type");
|
|
48016
|
-
assert(logger$
|
|
48458
|
+
assert(logger$1Z, type, "no list type");
|
|
48017
48459
|
return type;
|
|
48018
48460
|
}
|
|
48019
48461
|
function isTextOnlyListBlock(block) {
|
|
@@ -48032,7 +48474,7 @@ ${codeText}
|
|
|
48032
48474
|
function getListBlockGroupId(block) {
|
|
48033
48475
|
ensureIsListBlock(block);
|
|
48034
48476
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48035
|
-
assert(logger$
|
|
48477
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48036
48478
|
return groupId;
|
|
48037
48479
|
}
|
|
48038
48480
|
function getListBlockProperties(block) {
|
|
@@ -48042,7 +48484,7 @@ ${codeText}
|
|
|
48042
48484
|
const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
|
|
48043
48485
|
const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
|
|
48044
48486
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48045
|
-
assert(logger$
|
|
48487
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48046
48488
|
return {
|
|
48047
48489
|
type,
|
|
48048
48490
|
start,
|
|
@@ -48311,7 +48753,7 @@ ${codeText}
|
|
|
48311
48753
|
this.nodeMap.set(block, node);
|
|
48312
48754
|
if (parentBlock) {
|
|
48313
48755
|
const parentNode = this.nodeMap.get(parentBlock);
|
|
48314
|
-
assert(logger$
|
|
48756
|
+
assert(logger$1_, parentNode, "no parent node");
|
|
48315
48757
|
parentNode.children.push(node);
|
|
48316
48758
|
} else {
|
|
48317
48759
|
this.rootNodes.push(node);
|
|
@@ -48379,7 +48821,7 @@ ${codeText}
|
|
|
48379
48821
|
return hasClass(block, "editor-in-mindmap-first");
|
|
48380
48822
|
}
|
|
48381
48823
|
function isViewingAsMindmap(block) {
|
|
48382
|
-
assert(logger$
|
|
48824
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
48383
48825
|
if (hasClass(block, "editor-in-mindmap-first")) {
|
|
48384
48826
|
return true;
|
|
48385
48827
|
}
|
|
@@ -48400,12 +48842,12 @@ ${codeText}
|
|
|
48400
48842
|
const container = getParentContainer(from);
|
|
48401
48843
|
if (to) {
|
|
48402
48844
|
const container2 = getParentContainer(to);
|
|
48403
|
-
assert(logger$
|
|
48845
|
+
assert(logger$1_, container === container2, "invalid block container");
|
|
48404
48846
|
}
|
|
48405
48847
|
const fromIndex = getBlockIndex(from);
|
|
48406
48848
|
if (to) {
|
|
48407
48849
|
const toIndex = getBlockIndex(to);
|
|
48408
|
-
assert(logger$
|
|
48850
|
+
assert(logger$1_, fromIndex <= toIndex, "invalid block index");
|
|
48409
48851
|
}
|
|
48410
48852
|
addClass(from, ...styles);
|
|
48411
48853
|
if (!to || to === from) {
|
|
@@ -48413,7 +48855,7 @@ ${codeText}
|
|
|
48413
48855
|
}
|
|
48414
48856
|
let next2 = getNextBlock(from);
|
|
48415
48857
|
while (next2 !== to) {
|
|
48416
|
-
assert(logger$
|
|
48858
|
+
assert(logger$1_, next2, "no next button");
|
|
48417
48859
|
addClass(next2, ...styles);
|
|
48418
48860
|
next2 = getNextBlock(next2);
|
|
48419
48861
|
}
|
|
@@ -48424,7 +48866,7 @@ ${codeText}
|
|
|
48424
48866
|
async function requestMindmapFullscreen(editor, block, mindmapTools) {
|
|
48425
48867
|
const tools = getBlockTools(block);
|
|
48426
48868
|
const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
|
|
48427
|
-
assert(logger$
|
|
48869
|
+
assert(logger$1_, exitFullscreenButton, "no full screen button");
|
|
48428
48870
|
const resetMindmap = () => {
|
|
48429
48871
|
setTimeout(() => {
|
|
48430
48872
|
mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
|
|
@@ -48444,7 +48886,7 @@ ${codeText}
|
|
|
48444
48886
|
try {
|
|
48445
48887
|
await exitFullscreen();
|
|
48446
48888
|
} catch (err) {
|
|
48447
|
-
logger$
|
|
48889
|
+
logger$1_.error(err);
|
|
48448
48890
|
}
|
|
48449
48891
|
onExitFullscreen();
|
|
48450
48892
|
} else {
|
|
@@ -48453,7 +48895,7 @@ ${codeText}
|
|
|
48453
48895
|
await requestFullscreen(tools);
|
|
48454
48896
|
resetMindmap();
|
|
48455
48897
|
} catch (err) {
|
|
48456
|
-
logger$
|
|
48898
|
+
logger$1_.error(err);
|
|
48457
48899
|
}
|
|
48458
48900
|
exitFullscreenButton.innerHTML = ExitFullScreenIcon;
|
|
48459
48901
|
exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
|
|
@@ -48734,7 +49176,7 @@ ${codeText}
|
|
|
48734
49176
|
if (!svg) {
|
|
48735
49177
|
return;
|
|
48736
49178
|
}
|
|
48737
|
-
assert(logger$
|
|
49179
|
+
assert(logger$1_, svg, "no mindmap svg");
|
|
48738
49180
|
svg.remove();
|
|
48739
49181
|
editor.domEvents.removeAllListeners(svg);
|
|
48740
49182
|
destroyMindmapButtons(editor, block);
|
|
@@ -48786,7 +49228,7 @@ ${codeText}
|
|
|
48786
49228
|
});
|
|
48787
49229
|
__publicField(this, "handleMouseEnter", () => {
|
|
48788
49230
|
const block = getParentBlock(this.toMindmapButton);
|
|
48789
|
-
assert(logger$
|
|
49231
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48790
49232
|
highlightEntireList(this.editor, block, true);
|
|
48791
49233
|
this.currentBlock = block;
|
|
48792
49234
|
});
|
|
@@ -48798,7 +49240,7 @@ ${codeText}
|
|
|
48798
49240
|
});
|
|
48799
49241
|
__publicField(this, "handleClick", () => {
|
|
48800
49242
|
const block = getParentBlock(this.toMindmapButton);
|
|
48801
|
-
assert(logger$
|
|
49243
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48802
49244
|
toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
|
|
48803
49245
|
});
|
|
48804
49246
|
this.editor = editor;
|
|
@@ -48926,11 +49368,11 @@ ${codeText}
|
|
|
48926
49368
|
}
|
|
48927
49369
|
}
|
|
48928
49370
|
function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
|
|
48929
|
-
logger$
|
|
49371
|
+
logger$1_.debug("drag a block on a list block");
|
|
48930
49372
|
if (!isTextKindBlock(editor, draggedBlock)) {
|
|
48931
49373
|
return false;
|
|
48932
49374
|
}
|
|
48933
|
-
assert(logger$
|
|
49375
|
+
assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
|
|
48934
49376
|
const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
|
|
48935
49377
|
const newStart = insertPos === "after" ? start + 1 : start;
|
|
48936
49378
|
const oldData = editor.getBlockData(draggedBlock);
|
|
@@ -48963,7 +49405,7 @@ ${codeText}
|
|
|
48963
49405
|
return true;
|
|
48964
49406
|
}
|
|
48965
49407
|
function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
|
|
48966
|
-
logger$
|
|
49408
|
+
logger$1_.debug("drag a list between text blocks");
|
|
48967
49409
|
if (insertPos === "after") {
|
|
48968
49410
|
const nextBlock = getNextBlock(targetBlock);
|
|
48969
49411
|
if (nextBlock && isListBlock(nextBlock)) {
|
|
@@ -49000,11 +49442,11 @@ ${codeText}
|
|
|
49000
49442
|
}
|
|
49001
49443
|
const { blockId } = dragData;
|
|
49002
49444
|
const draggedBlock = editor.getBlockById(blockId);
|
|
49003
|
-
assert(logger$
|
|
49445
|
+
assert(logger$1_, draggedBlock, "no dragged block");
|
|
49004
49446
|
const { isSourceBlock, targetBlock } = options;
|
|
49005
49447
|
if (!isSourceBlock && targetBlock) {
|
|
49006
|
-
assert(logger$
|
|
49007
|
-
assert(logger$
|
|
49448
|
+
assert(logger$1_, block === targetBlock, "block !== target block");
|
|
49449
|
+
assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
|
|
49008
49450
|
return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
|
|
49009
49451
|
}
|
|
49010
49452
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
@@ -49506,7 +49948,7 @@ ${codeText}
|
|
|
49506
49948
|
}
|
|
49507
49949
|
const nextBrother = getListNextBrother(block);
|
|
49508
49950
|
while (nextBlock !== nextBrother) {
|
|
49509
|
-
assert(logger$
|
|
49951
|
+
assert(logger$1_, nextBlock, "no next block");
|
|
49510
49952
|
if (isListBlock(nextBlock)) {
|
|
49511
49953
|
if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
|
|
49512
49954
|
return nextBlock;
|
|
@@ -49605,9 +50047,9 @@ ${codeText}
|
|
|
49605
50047
|
}
|
|
49606
50048
|
return true;
|
|
49607
50049
|
}
|
|
49608
|
-
const logger$
|
|
50050
|
+
const logger$1Y = getLogger("list-block");
|
|
49609
50051
|
function cloneListData(editor, block, options) {
|
|
49610
|
-
assert(logger$
|
|
50052
|
+
assert(logger$1Y, isListBlock(block), "not a list block");
|
|
49611
50053
|
const blockData = {
|
|
49612
50054
|
...editor.getBlockData(block),
|
|
49613
50055
|
id: genId()
|
|
@@ -49682,7 +50124,7 @@ ${codeText}
|
|
|
49682
50124
|
return true;
|
|
49683
50125
|
}
|
|
49684
50126
|
function findPrevBrotherAsParent(block) {
|
|
49685
|
-
assert(logger$
|
|
50127
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
49686
50128
|
const { level } = getListBlockProperties(block);
|
|
49687
50129
|
let prevBlock = getPrevBlock(block);
|
|
49688
50130
|
while (prevBlock) {
|
|
@@ -49709,7 +50151,7 @@ ${codeText}
|
|
|
49709
50151
|
}
|
|
49710
50152
|
function findPrevBrother(editor, fromBlock, toParentBlock) {
|
|
49711
50153
|
let prevBlock = getPrevBlock(fromBlock);
|
|
49712
|
-
assert(logger$
|
|
50154
|
+
assert(logger$1_, prevBlock, "no prev brother");
|
|
49713
50155
|
const parentLevel = getListBlockLevel(toParentBlock);
|
|
49714
50156
|
while (prevBlock) {
|
|
49715
50157
|
if (prevBlock === toParentBlock) {
|
|
@@ -49730,7 +50172,7 @@ ${codeText}
|
|
|
49730
50172
|
}
|
|
49731
50173
|
ensureIsListBlock(block);
|
|
49732
50174
|
const prevBrother = findPrevBrotherAsParent(block);
|
|
49733
|
-
assert(logger$
|
|
50175
|
+
assert(logger$1_, prevBrother, "no list prev brother");
|
|
49734
50176
|
const newParent = prevBrother;
|
|
49735
50177
|
const newBrother = findPrevBrother(editor, block, newParent);
|
|
49736
50178
|
const level = getListBlockLevel(newParent) + 1;
|
|
@@ -49929,14 +50371,14 @@ ${codeText}
|
|
|
49929
50371
|
this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
|
|
49930
50372
|
}
|
|
49931
50373
|
}
|
|
49932
|
-
const logger$
|
|
50374
|
+
const logger$1X = getLogger("customize-list-start-menu");
|
|
49933
50375
|
class CustomizeListStartDialog {
|
|
49934
50376
|
constructor(editor) {
|
|
49935
50377
|
__publicField(this, "popup");
|
|
49936
50378
|
__publicField(this, "block", null);
|
|
49937
50379
|
__publicField(this, "show", (editor, block) => {
|
|
49938
50380
|
const listBlockMarker = block.querySelector("div.list-container");
|
|
49939
|
-
assert(logger$
|
|
50381
|
+
assert(logger$1X, listBlockMarker, "list-block mark does not exist");
|
|
49940
50382
|
this.block = block;
|
|
49941
50383
|
this.popup.manualShow(listBlockMarker, {
|
|
49942
50384
|
theme: "light"
|
|
@@ -50094,7 +50536,7 @@ ${codeText}
|
|
|
50094
50536
|
const listContainer = findTarget(event, "div.list-container");
|
|
50095
50537
|
if (listContainer && this.editor.isWritable()) {
|
|
50096
50538
|
const block = getParentBlock(listContainer);
|
|
50097
|
-
assert(logger$
|
|
50539
|
+
assert(logger$1_, block, "no parent block");
|
|
50098
50540
|
ensureIsListBlock(block);
|
|
50099
50541
|
const blockData = editor.getBlockData(block);
|
|
50100
50542
|
if (blockData && blockData.checkbox) {
|
|
@@ -50234,7 +50676,7 @@ ${codeText}
|
|
|
50234
50676
|
}
|
|
50235
50677
|
return blockContent;
|
|
50236
50678
|
}
|
|
50237
|
-
const zhCN$
|
|
50679
|
+
const zhCN$s = {
|
|
50238
50680
|
list: {
|
|
50239
50681
|
confirm: "\u786E\u5B9A",
|
|
50240
50682
|
setStart: "\u8BBE\u7F6E\u7F16\u53F7",
|
|
@@ -50254,7 +50696,7 @@ ${codeText}
|
|
|
50254
50696
|
exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
|
|
50255
50697
|
}
|
|
50256
50698
|
};
|
|
50257
|
-
const enUS$
|
|
50699
|
+
const enUS$s = {
|
|
50258
50700
|
list: {
|
|
50259
50701
|
confirm: "Confirm",
|
|
50260
50702
|
setStart: "Set number",
|
|
@@ -50274,7 +50716,7 @@ ${codeText}
|
|
|
50274
50716
|
exitFullscreen: "Exit full screen"
|
|
50275
50717
|
}
|
|
50276
50718
|
};
|
|
50277
|
-
const jaJP$
|
|
50719
|
+
const jaJP$s = {
|
|
50278
50720
|
list: {
|
|
50279
50721
|
confirm: "OK",
|
|
50280
50722
|
setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
|
|
@@ -50295,12 +50737,12 @@ ${codeText}
|
|
|
50295
50737
|
}
|
|
50296
50738
|
};
|
|
50297
50739
|
i18n$1.mergeLang({
|
|
50298
|
-
"zh-CN": zhCN$
|
|
50299
|
-
"en-US": enUS$
|
|
50300
|
-
"ja-JP": jaJP$
|
|
50740
|
+
"zh-CN": zhCN$s,
|
|
50741
|
+
"en-US": enUS$s,
|
|
50742
|
+
"ja-JP": jaJP$s
|
|
50301
50743
|
});
|
|
50302
|
-
const style$
|
|
50303
|
-
const logger$
|
|
50744
|
+
const style$8 = "";
|
|
50745
|
+
const logger$1W = getLogger("list-block:paste-handler");
|
|
50304
50746
|
class ListPasteHandler {
|
|
50305
50747
|
constructor() {
|
|
50306
50748
|
__publicField(this, "fixStartByList", null);
|
|
@@ -50354,7 +50796,7 @@ ${codeText}
|
|
|
50354
50796
|
startIds.set(newGroupId, 1);
|
|
50355
50797
|
} else {
|
|
50356
50798
|
const start = startIds.get(groupId);
|
|
50357
|
-
assert(logger$
|
|
50799
|
+
assert(logger$1W, start, "start is null");
|
|
50358
50800
|
block.start = start + 1;
|
|
50359
50801
|
block.groupId = groupId;
|
|
50360
50802
|
startIds.set(groupId, start + 1);
|
|
@@ -50374,7 +50816,7 @@ ${codeText}
|
|
|
50374
50816
|
return false;
|
|
50375
50817
|
}
|
|
50376
50818
|
}
|
|
50377
|
-
const logger$
|
|
50819
|
+
const logger$1V = getLogger("list selection to doc");
|
|
50378
50820
|
function convertListToText(data2) {
|
|
50379
50821
|
const textData = { type: "text" };
|
|
50380
50822
|
Object.entries(data2).forEach(([key, value]) => {
|
|
@@ -50389,7 +50831,7 @@ ${codeText}
|
|
|
50389
50831
|
const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
|
|
50390
50832
|
const start = selectedBlock.start;
|
|
50391
50833
|
const end = selectedBlock.end;
|
|
50392
|
-
assert(logger$
|
|
50834
|
+
assert(logger$1V, data2.text, "no block text");
|
|
50393
50835
|
const len = getBlockTextLength$6(editor, selectedBlock.block);
|
|
50394
50836
|
if (end.offset - start.offset === len) {
|
|
50395
50837
|
return {
|
|
@@ -50965,7 +51407,7 @@ ${codeText}
|
|
|
50965
51407
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
50966
51408
|
}, 300);
|
|
50967
51409
|
};
|
|
50968
|
-
const logger$
|
|
51410
|
+
const logger$1U = getLogger("inline-box-items");
|
|
50969
51411
|
function insertEmptyBlockLink(editor, containerId, blockIndex) {
|
|
50970
51412
|
let block = editor.findBlockByIndex(containerId, blockIndex);
|
|
50971
51413
|
let placement = "bottom-start";
|
|
@@ -50976,7 +51418,7 @@ ${codeText}
|
|
|
50976
51418
|
const onFinished = (linkText, linkUrl) => {
|
|
50977
51419
|
editor.undoManager.runInGroup(() => {
|
|
50978
51420
|
try {
|
|
50979
|
-
assert(logger$
|
|
51421
|
+
assert(logger$1U, block, "block not found");
|
|
50980
51422
|
if (!isEmptyTextBlock(editor, block)) {
|
|
50981
51423
|
block = editor.insertTextBlock([], containerId, blockIndex);
|
|
50982
51424
|
}
|
|
@@ -50987,7 +51429,7 @@ ${codeText}
|
|
|
50987
51429
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
50988
51430
|
editor.focus();
|
|
50989
51431
|
} catch (error2) {
|
|
50990
|
-
logger$
|
|
51432
|
+
logger$1U.error(error2);
|
|
50991
51433
|
}
|
|
50992
51434
|
});
|
|
50993
51435
|
};
|
|
@@ -51007,7 +51449,7 @@ ${codeText}
|
|
|
51007
51449
|
function insertLink(editor, containerId, blockIndex) {
|
|
51008
51450
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
51009
51451
|
const range = editor.selection.range;
|
|
51010
|
-
assert(logger$
|
|
51452
|
+
assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
|
|
51011
51453
|
const rects = getBlockClientRects(editor, block, range);
|
|
51012
51454
|
if (rects.length === 0) {
|
|
51013
51455
|
return;
|
|
@@ -51033,7 +51475,7 @@ ${codeText}
|
|
|
51033
51475
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
51034
51476
|
editor.focus();
|
|
51035
51477
|
} catch (error2) {
|
|
51036
|
-
logger$
|
|
51478
|
+
logger$1U.error(error2);
|
|
51037
51479
|
}
|
|
51038
51480
|
});
|
|
51039
51481
|
};
|
|
@@ -51251,7 +51693,7 @@ ${codeText}
|
|
|
51251
51693
|
function getToolbar(editor) {
|
|
51252
51694
|
return editor.findCustom("toolbar-handler");
|
|
51253
51695
|
}
|
|
51254
|
-
const logger$
|
|
51696
|
+
const logger$1T = getLogger("link-popup");
|
|
51255
51697
|
function getLinkHref(child) {
|
|
51256
51698
|
var _a, _b;
|
|
51257
51699
|
return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
|
|
@@ -51289,7 +51731,7 @@ ${codeText}
|
|
|
51289
51731
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
51290
51732
|
editor.focus();
|
|
51291
51733
|
} catch (error2) {
|
|
51292
|
-
logger$
|
|
51734
|
+
logger$1T.error(error2);
|
|
51293
51735
|
}
|
|
51294
51736
|
};
|
|
51295
51737
|
const onClose = () => {
|
|
@@ -51528,7 +51970,7 @@ ${codeText}
|
|
|
51528
51970
|
this.editProvider = new EditLinkProvider();
|
|
51529
51971
|
}
|
|
51530
51972
|
}
|
|
51531
|
-
const logger$
|
|
51973
|
+
const logger$1S = getLogger("readonly-toolbar");
|
|
51532
51974
|
const SEP = {
|
|
51533
51975
|
id: "",
|
|
51534
51976
|
name: "",
|
|
@@ -51591,7 +52033,7 @@ ${codeText}
|
|
|
51591
52033
|
});
|
|
51592
52034
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51593
52035
|
var _a;
|
|
51594
|
-
assert(logger$
|
|
52036
|
+
assert(logger$1S, editor === this.editor, "editor mismatch");
|
|
51595
52037
|
if (!editor.readonly) {
|
|
51596
52038
|
this.toolbar.close("selectionChange");
|
|
51597
52039
|
return;
|
|
@@ -51670,7 +52112,7 @@ ${codeText}
|
|
|
51670
52112
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
51671
52113
|
tooltipId: editor.clientId,
|
|
51672
52114
|
id: "editor-readonly-toolbar",
|
|
51673
|
-
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
52115
|
+
overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
|
|
51674
52116
|
refuseOverflow: true,
|
|
51675
52117
|
padding: 20
|
|
51676
52118
|
});
|
|
@@ -51777,7 +52219,7 @@ ${codeText}
|
|
|
51777
52219
|
return visible;
|
|
51778
52220
|
}
|
|
51779
52221
|
}
|
|
51780
|
-
const logger$
|
|
52222
|
+
const logger$1R = getLogger("toolbar-handler");
|
|
51781
52223
|
class OnesEditorToolbar {
|
|
51782
52224
|
constructor(editor) {
|
|
51783
52225
|
__publicField(this, "id", "editor-toolbar");
|
|
@@ -51864,7 +52306,7 @@ ${codeText}
|
|
|
51864
52306
|
});
|
|
51865
52307
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51866
52308
|
var _a;
|
|
51867
|
-
assert(logger$
|
|
52309
|
+
assert(logger$1R, editor === this.editor, "editor mismatch");
|
|
51868
52310
|
if (editor.selection.range.isCollapsed() || this.mouseDown) {
|
|
51869
52311
|
if (this.toolbarType === "object") {
|
|
51870
52312
|
const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
|
|
@@ -51904,7 +52346,7 @@ ${codeText}
|
|
|
51904
52346
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
51905
52347
|
tooltipId: editor.clientId,
|
|
51906
52348
|
id: "editor-toolbar",
|
|
51907
|
-
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
52349
|
+
overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
|
|
51908
52350
|
refuseOverflow: true,
|
|
51909
52351
|
padding: 20,
|
|
51910
52352
|
showName: clientType.isMobile,
|
|
@@ -52183,7 +52625,7 @@ ${codeText}
|
|
|
52183
52625
|
this.texWidth = [tex, width];
|
|
52184
52626
|
}
|
|
52185
52627
|
}
|
|
52186
|
-
const logger$
|
|
52628
|
+
const logger$1Q = getLogger("mathjax-converter");
|
|
52187
52629
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
52188
52630
|
const MATHJAX_BUFFER = 30;
|
|
52189
52631
|
const REDUCED_UNIT = 8;
|
|
@@ -52232,7 +52674,7 @@ ${codeText}
|
|
|
52232
52674
|
const svg = result.querySelector("svg");
|
|
52233
52675
|
return svg.outerHTML;
|
|
52234
52676
|
} catch (err) {
|
|
52235
|
-
logger$
|
|
52677
|
+
logger$1Q.error(err);
|
|
52236
52678
|
throw err;
|
|
52237
52679
|
} finally {
|
|
52238
52680
|
lockers.release(lockId);
|
|
@@ -52280,12 +52722,13 @@ ${codeText}
|
|
|
52280
52722
|
...perfectState
|
|
52281
52723
|
};
|
|
52282
52724
|
}
|
|
52283
|
-
const logger$
|
|
52725
|
+
const logger$1P = getLogger("edit-mathjax");
|
|
52284
52726
|
class MathjaxEditor {
|
|
52285
52727
|
constructor() {
|
|
52286
52728
|
__publicField(this, "editMathjaxPopup", null);
|
|
52287
52729
|
__publicField(this, "onChange", null);
|
|
52288
52730
|
__publicField(this, "tex", "");
|
|
52731
|
+
__publicField(this, "oldTex", "");
|
|
52289
52732
|
__publicField(this, "observer", null);
|
|
52290
52733
|
__publicField(this, "handleClose", (commandBar2) => {
|
|
52291
52734
|
var _a;
|
|
@@ -52309,6 +52752,10 @@ ${codeText}
|
|
|
52309
52752
|
});
|
|
52310
52753
|
__publicField(this, "handleChange", debounce__default.default((text2) => {
|
|
52311
52754
|
var _a;
|
|
52755
|
+
if (text2 === this.oldTex) {
|
|
52756
|
+
return;
|
|
52757
|
+
}
|
|
52758
|
+
this.oldTex = text2;
|
|
52312
52759
|
(_a = this.onChange) == null ? void 0 : _a.call(this, text2, false);
|
|
52313
52760
|
}, 300));
|
|
52314
52761
|
}
|
|
@@ -52321,6 +52768,7 @@ ${codeText}
|
|
|
52321
52768
|
const textarea2 = this.getTextarea();
|
|
52322
52769
|
textarea2.value = tex;
|
|
52323
52770
|
}
|
|
52771
|
+
this.oldTex = tex;
|
|
52324
52772
|
this.tex = tex;
|
|
52325
52773
|
this.editMathjaxPopup.manualShow(elem, { theme: "light", placement: options == null ? void 0 : options.placement });
|
|
52326
52774
|
this.editMathjaxPopup.removeAllListeners("close");
|
|
@@ -52351,9 +52799,9 @@ ${codeText}
|
|
|
52351
52799
|
this.observer.observe(textarea2);
|
|
52352
52800
|
}
|
|
52353
52801
|
getTextarea() {
|
|
52354
|
-
assert(logger$
|
|
52802
|
+
assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
|
|
52355
52803
|
const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
|
|
52356
|
-
assert(logger$
|
|
52804
|
+
assert(logger$1P, textarea2, "no textarea");
|
|
52357
52805
|
return textarea2;
|
|
52358
52806
|
}
|
|
52359
52807
|
destroy() {
|
|
@@ -52423,7 +52871,7 @@ ${codeText}
|
|
|
52423
52871
|
};
|
|
52424
52872
|
editMathjax(editor, box, data2.tex, update2);
|
|
52425
52873
|
}
|
|
52426
|
-
const logger$
|
|
52874
|
+
const logger$1O = getLogger("mathjax-box");
|
|
52427
52875
|
function updateCaret(editor, event) {
|
|
52428
52876
|
editor.selection.updateSelection(null);
|
|
52429
52877
|
const target = event.target;
|
|
@@ -52528,7 +52976,7 @@ ${codeText}
|
|
|
52528
52976
|
};
|
|
52529
52977
|
editor.updateBoxData(newData);
|
|
52530
52978
|
}).catch((err) => {
|
|
52531
|
-
logger$
|
|
52979
|
+
logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
|
|
52532
52980
|
});
|
|
52533
52981
|
return data2;
|
|
52534
52982
|
}
|
|
@@ -52547,7 +52995,7 @@ ${codeText}
|
|
|
52547
52995
|
}
|
|
52548
52996
|
function handleClickBox$3(editor, box, event) {
|
|
52549
52997
|
const parentBlock = getParentBlock(box);
|
|
52550
|
-
assert(logger$
|
|
52998
|
+
assert(logger$1O, parentBlock, "failed to get block");
|
|
52551
52999
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
52552
53000
|
return;
|
|
52553
53001
|
}
|
|
@@ -52616,7 +53064,7 @@ ${codeText}
|
|
|
52616
53064
|
}
|
|
52617
53065
|
const data2 = editor.getBlockData(block);
|
|
52618
53066
|
const embedData = data2.embedData;
|
|
52619
|
-
editMathjax(editor,
|
|
53067
|
+
editMathjax(editor, block, embedData.mathjaxText, async (tex) => {
|
|
52620
53068
|
const { resourceId: src, width, height } = await convertAndUploadMathjaxForEmbed(editor, tex);
|
|
52621
53069
|
const newData = {
|
|
52622
53070
|
mathjaxText: tex,
|
|
@@ -52744,28 +53192,28 @@ $$${mathData.mathjaxText}$$
|
|
|
52744
53192
|
getBlockProperties: getBlockProperties$b
|
|
52745
53193
|
};
|
|
52746
53194
|
const mathjaxStyle = "";
|
|
52747
|
-
const zhCN$
|
|
53195
|
+
const zhCN$r = {
|
|
52748
53196
|
mathjax: {
|
|
52749
53197
|
emptyText: "\u7A7A\u7684\u516C\u5F0F",
|
|
52750
53198
|
abstract: "\u516C\u5F0F"
|
|
52751
53199
|
}
|
|
52752
53200
|
};
|
|
52753
|
-
const enUS$
|
|
53201
|
+
const enUS$r = {
|
|
52754
53202
|
mathjax: {
|
|
52755
53203
|
emptyText: "Empty formula",
|
|
52756
53204
|
abstract: "Formula"
|
|
52757
53205
|
}
|
|
52758
53206
|
};
|
|
52759
|
-
const jaJP$
|
|
53207
|
+
const jaJP$r = {
|
|
52760
53208
|
mathjax: {
|
|
52761
53209
|
emptyText: "\u6570\u5F0F\u306A\u3057",
|
|
52762
53210
|
abstract: "\u6570\u5F0F"
|
|
52763
53211
|
}
|
|
52764
53212
|
};
|
|
52765
53213
|
i18n$1.mergeLang({
|
|
52766
|
-
"zh-CN": zhCN$
|
|
52767
|
-
"en-US": enUS$
|
|
52768
|
-
"ja-JP": jaJP$
|
|
53214
|
+
"zh-CN": zhCN$r,
|
|
53215
|
+
"en-US": enUS$r,
|
|
53216
|
+
"ja-JP": jaJP$r
|
|
52769
53217
|
});
|
|
52770
53218
|
function convertToMath(editor, containerId, blockIndex, offset) {
|
|
52771
53219
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -58299,7 +58747,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58299
58747
|
const docBlockText = { insert: " ", attributes: data2 };
|
|
58300
58748
|
return docBlockText;
|
|
58301
58749
|
}
|
|
58302
|
-
const logger$
|
|
58750
|
+
const logger$1N = getLogger("StatusBoxEditor");
|
|
58303
58751
|
class StatusBoxEditor {
|
|
58304
58752
|
constructor(editor) {
|
|
58305
58753
|
__publicField(this, "linkPopup", null);
|
|
@@ -58322,10 +58770,10 @@ $$${mathData.mathjaxText}$$
|
|
|
58322
58770
|
});
|
|
58323
58771
|
__publicField(this, "handClose", () => {
|
|
58324
58772
|
var _a;
|
|
58325
|
-
assert(logger$
|
|
58773
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58326
58774
|
const boxData = this.editor.getBoxData(this.boxElement);
|
|
58327
58775
|
const block = getParentBlock(this.boxElement);
|
|
58328
|
-
assert(logger$
|
|
58776
|
+
assert(logger$1N, block, "block not found");
|
|
58329
58777
|
if (!boxData.title) {
|
|
58330
58778
|
const offset = getChildOffset(block, this.boxElement);
|
|
58331
58779
|
this.editor.deleteTextFromBlock(block, offset.start, 1);
|
|
@@ -58363,7 +58811,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58363
58811
|
return;
|
|
58364
58812
|
}
|
|
58365
58813
|
const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
|
|
58366
|
-
assert(logger$
|
|
58814
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58367
58815
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58368
58816
|
this.statusPalette.changeColor(color);
|
|
58369
58817
|
const newData = { ...data2, color };
|
|
@@ -58380,7 +58828,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58380
58828
|
});
|
|
58381
58829
|
__publicField(this, "onTitleChange", (e2) => {
|
|
58382
58830
|
const title = e2.target.value;
|
|
58383
|
-
assert(logger$
|
|
58831
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58384
58832
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58385
58833
|
const newData = { ...data2, title: title.trim() };
|
|
58386
58834
|
this.editor.updateBoxData(newData, { noFocus: true });
|
|
@@ -58493,7 +58941,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58493
58941
|
toStandardText: toStandardText$1,
|
|
58494
58942
|
matchText: matchText$1
|
|
58495
58943
|
};
|
|
58496
|
-
const logger$
|
|
58944
|
+
const logger$1M = getLogger("status-box-command");
|
|
58497
58945
|
class StatusBoxCommand {
|
|
58498
58946
|
static get commands() {
|
|
58499
58947
|
return [
|
|
@@ -58512,7 +58960,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58512
58960
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58513
58961
|
const boxOp = createEmptyStatusBox();
|
|
58514
58962
|
const { start } = editor.selection.range;
|
|
58515
|
-
assert(logger$
|
|
58963
|
+
assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
|
|
58516
58964
|
editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
|
|
58517
58965
|
const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
|
|
58518
58966
|
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
|
|
@@ -58531,7 +58979,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58531
58979
|
}
|
|
58532
58980
|
}
|
|
58533
58981
|
__publicField(StatusBoxCommand, "id", "insert-status");
|
|
58534
|
-
const enUS$
|
|
58982
|
+
const enUS$q = {
|
|
58535
58983
|
status: {
|
|
58536
58984
|
empty: "Set status",
|
|
58537
58985
|
command: {
|
|
@@ -58555,7 +59003,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58555
59003
|
}
|
|
58556
59004
|
}
|
|
58557
59005
|
};
|
|
58558
|
-
const zhCN$
|
|
59006
|
+
const zhCN$q = {
|
|
58559
59007
|
status: {
|
|
58560
59008
|
empty: "\u8BBE\u7F6E\u72B6\u6001",
|
|
58561
59009
|
command: {
|
|
@@ -58579,7 +59027,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58579
59027
|
}
|
|
58580
59028
|
}
|
|
58581
59029
|
};
|
|
58582
|
-
const jaJP$
|
|
59030
|
+
const jaJP$q = {
|
|
58583
59031
|
status: {
|
|
58584
59032
|
empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
|
|
58585
59033
|
command: {
|
|
@@ -58604,12 +59052,12 @@ $$${mathData.mathjaxText}$$
|
|
|
58604
59052
|
}
|
|
58605
59053
|
};
|
|
58606
59054
|
const langs$2 = {
|
|
58607
|
-
"en-US": enUS$
|
|
58608
|
-
"zh-CN": zhCN$
|
|
58609
|
-
"ja-JP": jaJP$
|
|
59055
|
+
"en-US": enUS$q,
|
|
59056
|
+
"zh-CN": zhCN$q,
|
|
59057
|
+
"ja-JP": jaJP$q
|
|
58610
59058
|
};
|
|
58611
59059
|
i18n$1.mergeLang(langs$2);
|
|
58612
|
-
const logger$
|
|
59060
|
+
const logger$1L = getLogger("inline-box-items");
|
|
58613
59061
|
function insertEmptyBlockMath(editor, containerId, blockIndex) {
|
|
58614
59062
|
return editor.undoManager.runInGroup(() => {
|
|
58615
59063
|
var _a;
|
|
@@ -58620,7 +59068,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58620
59068
|
const boxOp = createEmptyMathjaxBox();
|
|
58621
59069
|
editor.setBlockText(block, [boxOp]);
|
|
58622
59070
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58623
|
-
assert(logger$
|
|
59071
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58624
59072
|
setTimeout(() => {
|
|
58625
59073
|
const box = editor.getBoxById(boxId);
|
|
58626
59074
|
editMathjaxBox(editor, box);
|
|
@@ -58633,11 +59081,11 @@ $$${mathData.mathjaxText}$$
|
|
|
58633
59081
|
var _a;
|
|
58634
59082
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58635
59083
|
const range = editor.selection.range;
|
|
58636
|
-
assert(logger$
|
|
59084
|
+
assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
|
|
58637
59085
|
const boxOp = createEmptyMathjaxBox();
|
|
58638
59086
|
editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
|
|
58639
59087
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58640
|
-
assert(logger$
|
|
59088
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58641
59089
|
setTimeout(() => {
|
|
58642
59090
|
const box = editor.getBoxById(boxId);
|
|
58643
59091
|
editMathjaxBox(editor, box);
|
|
@@ -58804,7 +59252,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58804
59252
|
}
|
|
58805
59253
|
}
|
|
58806
59254
|
};
|
|
58807
|
-
const logger$
|
|
59255
|
+
const logger$1K = getLogger("insert-menu");
|
|
58808
59256
|
const injectGroup = (commands, group, startIndex) => {
|
|
58809
59257
|
commands.forEach((command, index2) => {
|
|
58810
59258
|
command.group = group;
|
|
@@ -58943,7 +59391,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58943
59391
|
return true;
|
|
58944
59392
|
}
|
|
58945
59393
|
const blockId = getBlockId(block);
|
|
58946
|
-
assert(logger$
|
|
59394
|
+
assert(logger$1K, range.isSimple(), "invalid range");
|
|
58947
59395
|
const offset = range.start.offset;
|
|
58948
59396
|
if (quickItem.commandProvider) {
|
|
58949
59397
|
const params2 = { from: "quick-menu", blockId, offset };
|
|
@@ -58979,7 +59427,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58979
59427
|
});
|
|
58980
59428
|
}
|
|
58981
59429
|
}
|
|
58982
|
-
const logger$
|
|
59430
|
+
const logger$1J = getLogger("quick-command-providers");
|
|
58983
59431
|
class QuickCommandProviders extends AbstractProvider {
|
|
58984
59432
|
constructor(editor) {
|
|
58985
59433
|
super(editor);
|
|
@@ -58999,7 +59447,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58999
59447
|
}
|
|
59000
59448
|
getCommands(range) {
|
|
59001
59449
|
var _a, _b;
|
|
59002
|
-
assert(logger$
|
|
59450
|
+
assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
|
|
59003
59451
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59004
59452
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59005
59453
|
const container = getParentContainer(block);
|
|
@@ -59404,7 +59852,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59404
59852
|
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
59405
59853
|
...headingShortcut()
|
|
59406
59854
|
};
|
|
59407
|
-
const zhCN$
|
|
59855
|
+
const zhCN$p = {
|
|
59408
59856
|
quickMenu: {
|
|
59409
59857
|
basic: {
|
|
59410
59858
|
heading: {
|
|
@@ -59460,7 +59908,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59460
59908
|
selectBlock: "\u9009\u62E9\u533A\u5757"
|
|
59461
59909
|
}
|
|
59462
59910
|
};
|
|
59463
|
-
const enUS$
|
|
59911
|
+
const enUS$p = {
|
|
59464
59912
|
quickMenu: {
|
|
59465
59913
|
basic: {
|
|
59466
59914
|
heading: {
|
|
@@ -59516,7 +59964,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59516
59964
|
selectBlock: "Select Block"
|
|
59517
59965
|
}
|
|
59518
59966
|
};
|
|
59519
|
-
const jaJP$
|
|
59967
|
+
const jaJP$p = {
|
|
59520
59968
|
quickMenu: {
|
|
59521
59969
|
basic: {
|
|
59522
59970
|
heading: {
|
|
@@ -59573,9 +60021,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59573
60021
|
}
|
|
59574
60022
|
};
|
|
59575
60023
|
i18n$1.mergeLang({
|
|
59576
|
-
"zh-CN": zhCN$
|
|
59577
|
-
"en-US": enUS$
|
|
59578
|
-
"ja-JP": jaJP$
|
|
60024
|
+
"zh-CN": zhCN$p,
|
|
60025
|
+
"en-US": enUS$p,
|
|
60026
|
+
"ja-JP": jaJP$p
|
|
59579
60027
|
});
|
|
59580
60028
|
class TextStylesFixedProvider extends ProxyProvider {
|
|
59581
60029
|
constructor(editor, afterCommandCallback) {
|
|
@@ -59780,7 +60228,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59780
60228
|
return false;
|
|
59781
60229
|
}
|
|
59782
60230
|
}
|
|
59783
|
-
const logger$
|
|
60231
|
+
const logger$1I = getLogger("block-command-providers");
|
|
59784
60232
|
class BlockCommandProviders extends AbstractProvider {
|
|
59785
60233
|
constructor(editor, afterCommandCallback) {
|
|
59786
60234
|
super(editor);
|
|
@@ -59801,7 +60249,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59801
60249
|
this.registerCommandProvider(new InsertGroupProvider(editor));
|
|
59802
60250
|
}
|
|
59803
60251
|
getCommands(range) {
|
|
59804
|
-
assert(logger$
|
|
60252
|
+
assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
|
|
59805
60253
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59806
60254
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59807
60255
|
let startIndex = 100;
|
|
@@ -59815,7 +60263,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59815
60263
|
return this.filterItems(range, commands);
|
|
59816
60264
|
}
|
|
59817
60265
|
}
|
|
59818
|
-
const logger$
|
|
60266
|
+
const logger$1H = getLogger("standard-block-actions");
|
|
59819
60267
|
class StandardBlockActionHook {
|
|
59820
60268
|
constructor() {
|
|
59821
60269
|
__publicField(this, "executeCommand", (editor, bloockElement, item) => {
|
|
@@ -59834,7 +60282,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59834
60282
|
this.deleteBlock(editor, block);
|
|
59835
60283
|
}
|
|
59836
60284
|
} catch (err) {
|
|
59837
|
-
logger$
|
|
60285
|
+
logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
59838
60286
|
}
|
|
59839
60287
|
});
|
|
59840
60288
|
}
|
|
@@ -59902,7 +60350,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59902
60350
|
}
|
|
59903
60351
|
}
|
|
59904
60352
|
}
|
|
59905
|
-
const logger$
|
|
60353
|
+
const logger$1G = getLogger("block-menu");
|
|
59906
60354
|
class BlockMenu {
|
|
59907
60355
|
constructor(editor) {
|
|
59908
60356
|
__publicField(this, "menu");
|
|
@@ -59910,7 +60358,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59910
60358
|
__publicField(this, "commandBlock", null);
|
|
59911
60359
|
__publicField(this, "blockCommandProviders");
|
|
59912
60360
|
__publicField(this, "handleShow", () => {
|
|
59913
|
-
assert(logger$
|
|
60361
|
+
assert(logger$1G, this.currentBlock, "no target block before show block menu");
|
|
59914
60362
|
const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
|
|
59915
60363
|
this.menu.updateItems(items);
|
|
59916
60364
|
this.commandBlock = this.currentBlock;
|
|
@@ -59921,7 +60369,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59921
60369
|
}
|
|
59922
60370
|
});
|
|
59923
60371
|
__publicField(this, "handleItemClick", (bar2, item) => {
|
|
59924
|
-
assert(logger$
|
|
60372
|
+
assert(logger$1G, this.commandBlock, "no command block before show block menu");
|
|
59925
60373
|
this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
|
|
59926
60374
|
if (!item.element) {
|
|
59927
60375
|
this.close();
|
|
@@ -59964,7 +60412,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59964
60412
|
this.menu.destroy();
|
|
59965
60413
|
}
|
|
59966
60414
|
}
|
|
59967
|
-
const logger$
|
|
60415
|
+
const logger$1F = getLogger("text-styles");
|
|
59968
60416
|
function getIntersectionStyles(text2) {
|
|
59969
60417
|
const getOpStyle = (op) => {
|
|
59970
60418
|
if (!op.attributes) {
|
|
@@ -59998,10 +60446,10 @@ $$${mathData.mathjaxText}$$
|
|
|
59998
60446
|
return new Map(Object.entries(attributes));
|
|
59999
60447
|
}
|
|
60000
60448
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
60001
|
-
assert(logger$
|
|
60449
|
+
assert(logger$1F, range.isSimple(), "invalid range");
|
|
60002
60450
|
const { start, end } = range;
|
|
60003
|
-
assert(logger$
|
|
60004
|
-
assert(logger$
|
|
60451
|
+
assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
60452
|
+
assert(logger$1F, style2.startsWith("style-"), "invalid style");
|
|
60005
60453
|
const oldText = editor.getBlockText(block);
|
|
60006
60454
|
let newText = oldText;
|
|
60007
60455
|
if (style2 === "style-sub") {
|
|
@@ -60047,13 +60495,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60047
60495
|
return standardItems;
|
|
60048
60496
|
}
|
|
60049
60497
|
function getSubText(editor, block, range) {
|
|
60050
|
-
assert(logger$
|
|
60498
|
+
assert(logger$1F, range.isSimple(), "nor a simple range");
|
|
60051
60499
|
const { start, end } = range;
|
|
60052
|
-
assert(logger$
|
|
60053
|
-
assert(logger$
|
|
60054
|
-
assert(logger$
|
|
60500
|
+
assert(logger$1F, start.isSimple(), "is not a simple block position");
|
|
60501
|
+
assert(logger$1F, end.isSimple(), "is not a simple block position");
|
|
60502
|
+
assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
|
|
60055
60503
|
const blockId = getBlockId(block);
|
|
60056
|
-
assert(logger$
|
|
60504
|
+
assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
|
|
60057
60505
|
const text2 = editor.getBlockText(block);
|
|
60058
60506
|
let subText2 = [];
|
|
60059
60507
|
if (start.offset === end.offset) {
|
|
@@ -60065,7 +60513,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60065
60513
|
}
|
|
60066
60514
|
return subText2;
|
|
60067
60515
|
}
|
|
60068
|
-
const logger$
|
|
60516
|
+
const logger$1E = getLogger("text-commands");
|
|
60069
60517
|
function getCommands$1(editor, text2) {
|
|
60070
60518
|
const StandardTextStyles = {
|
|
60071
60519
|
"style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
|
|
@@ -60083,13 +60531,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60083
60531
|
}
|
|
60084
60532
|
function executeStyleCommand(editor, block, range, command, params, result) {
|
|
60085
60533
|
if (!command.startsWith("style-")) {
|
|
60086
|
-
logger$
|
|
60534
|
+
logger$1E.warn(`unknown command: ${command}`);
|
|
60087
60535
|
return false;
|
|
60088
60536
|
}
|
|
60089
60537
|
const value = params == null ? void 0 : params.value;
|
|
60090
60538
|
const type = typeof value;
|
|
60091
60539
|
if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
|
|
60092
|
-
logger$
|
|
60540
|
+
logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
|
|
60093
60541
|
return false;
|
|
60094
60542
|
}
|
|
60095
60543
|
const newText = applyTextStyle(editor, block, range, command, value);
|
|
@@ -60314,7 +60762,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60314
60762
|
this.providers = [new TextScriptProvider(editor)];
|
|
60315
60763
|
}
|
|
60316
60764
|
}
|
|
60317
|
-
const logger$
|
|
60765
|
+
const logger$1D = getLogger("text-command-provider");
|
|
60318
60766
|
class TextCommandProvider {
|
|
60319
60767
|
constructor(editor, options) {
|
|
60320
60768
|
__publicField(this, "id", "TextCommandProvider");
|
|
@@ -60434,7 +60882,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60434
60882
|
}
|
|
60435
60883
|
static fromTextCommandId(id) {
|
|
60436
60884
|
const prefix = "text/";
|
|
60437
|
-
assert(logger$
|
|
60885
|
+
assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
|
|
60438
60886
|
return id.substring(prefix.length);
|
|
60439
60887
|
}
|
|
60440
60888
|
}
|
|
@@ -60550,7 +60998,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60550
60998
|
};
|
|
60551
60999
|
editor.updateBlockData(block, newData);
|
|
60552
61000
|
}
|
|
60553
|
-
function addCommentToBlock
|
|
61001
|
+
function addCommentToBlock(editor, block, provider) {
|
|
60554
61002
|
const abstract = getCommentAbstract(editor, [block]);
|
|
60555
61003
|
const comment = createComment({
|
|
60556
61004
|
editor,
|
|
@@ -60561,7 +61009,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60561
61009
|
provider.localCreateComment(comment, doc2);
|
|
60562
61010
|
return comment;
|
|
60563
61011
|
}
|
|
60564
|
-
const logger$
|
|
61012
|
+
const logger$1C = getLogger("standard-block-actions");
|
|
60565
61013
|
class CommentBlockHook {
|
|
60566
61014
|
constructor(provider, editorComments) {
|
|
60567
61015
|
__publicField(this, "executeCommand", (editor, block, item) => {
|
|
@@ -60569,9 +61017,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60569
61017
|
try {
|
|
60570
61018
|
this.editorComments.showCommentList();
|
|
60571
61019
|
const block2 = editor.getBlockById(blockId);
|
|
60572
|
-
addCommentToBlock
|
|
61020
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
60573
61021
|
} catch (err) {
|
|
60574
|
-
logger$
|
|
61022
|
+
logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
60575
61023
|
}
|
|
60576
61024
|
});
|
|
60577
61025
|
this.provider = provider;
|
|
@@ -60675,7 +61123,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60675
61123
|
const attributes = Array.from(element.attributes).map((c) => c.name);
|
|
60676
61124
|
return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
|
|
60677
61125
|
}
|
|
60678
|
-
const logger$
|
|
61126
|
+
const logger$1B = getLogger("doc-comments");
|
|
60679
61127
|
function addBlockComments(doc2, block, result, resultSet) {
|
|
60680
61128
|
if (block.comments) {
|
|
60681
61129
|
const blockComments = block.comments;
|
|
@@ -60770,8 +61218,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60770
61218
|
const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
|
|
60771
61219
|
const index1 = commentsMap.get(group1.groupId);
|
|
60772
61220
|
const index2 = commentsMap.get(group2.groupId);
|
|
60773
|
-
assert(logger$
|
|
60774
|
-
assert(logger$
|
|
61221
|
+
assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
|
|
61222
|
+
assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
|
|
60775
61223
|
return index1 - index2;
|
|
60776
61224
|
});
|
|
60777
61225
|
return result;
|
|
@@ -60832,7 +61280,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60832
61280
|
const commentIds = intersection__default.default(comments1, comments2);
|
|
60833
61281
|
return commentIds;
|
|
60834
61282
|
}
|
|
60835
|
-
const logger$
|
|
61283
|
+
const logger$1A = getLogger("active-comments");
|
|
60836
61284
|
function inactiveComment(editor, commentId) {
|
|
60837
61285
|
const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
|
|
60838
61286
|
activeCommentElements.forEach((el) => {
|
|
@@ -60868,13 +61316,12 @@ $$${mathData.mathjaxText}$$
|
|
|
60868
61316
|
const commentIds = getCommentsFromSelection(editor);
|
|
60869
61317
|
if (commentIds.indexOf(commentId) === -1) {
|
|
60870
61318
|
const block = getParentBlock(targetElement);
|
|
60871
|
-
assert(logger$
|
|
61319
|
+
assert(logger$1A, block, "block not found");
|
|
60872
61320
|
const offset = getChildOffset(block, targetElement);
|
|
60873
61321
|
const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
|
|
60874
61322
|
editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
|
|
60875
61323
|
}
|
|
60876
61324
|
}
|
|
60877
|
-
editor.focus();
|
|
60878
61325
|
if (direction === "next") {
|
|
60879
61326
|
const targetElementRect = targetElement.getBoundingClientRect();
|
|
60880
61327
|
const clientHeight = editor.scrollContainer.clientHeight;
|
|
@@ -60911,7 +61358,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60911
61358
|
function isValidSize(size) {
|
|
60912
61359
|
return typeof size === "number";
|
|
60913
61360
|
}
|
|
60914
|
-
const logger$
|
|
61361
|
+
const logger$1z = getLogger("image-data");
|
|
60915
61362
|
const md5Cache = /* @__PURE__ */ new Map();
|
|
60916
61363
|
const DEFAULT_WIDTH$1 = 1e3;
|
|
60917
61364
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -61043,7 +61490,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61043
61490
|
if (heightKey && isValidSize(image.height)) {
|
|
61044
61491
|
result[heightKey] = image.height;
|
|
61045
61492
|
}
|
|
61046
|
-
assert(logger$
|
|
61493
|
+
assert(logger$1z, image.flex, "no image flex");
|
|
61047
61494
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
61048
61495
|
result[flexKey] = image.flex;
|
|
61049
61496
|
});
|
|
@@ -61099,224 +61546,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61099
61546
|
const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
|
|
61100
61547
|
return totalFlex;
|
|
61101
61548
|
}
|
|
61102
|
-
|
|
61103
|
-
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
61104
|
-
elem.setAttribute("data-resize-type", type);
|
|
61105
|
-
}
|
|
61106
|
-
function getExistsResizer(block) {
|
|
61107
|
-
const tools = getBlockTools(block);
|
|
61108
|
-
return tools.querySelector(".block-resizer");
|
|
61109
|
-
}
|
|
61110
|
-
function hideResizer(block) {
|
|
61111
|
-
const exists = getExistsResizer(block);
|
|
61112
|
-
if (exists) {
|
|
61113
|
-
removeClass(exists, "active");
|
|
61114
|
-
}
|
|
61115
|
-
}
|
|
61116
|
-
function updateSize(block, element, resizer) {
|
|
61117
|
-
const blockRect = block.getBoundingClientRect();
|
|
61118
|
-
const elementRect = element.getBoundingClientRect();
|
|
61119
|
-
const top = elementRect.top - blockRect.top;
|
|
61120
|
-
const left = elementRect.left - blockRect.left;
|
|
61121
|
-
const width = elementRect.width;
|
|
61122
|
-
const height = elementRect.height;
|
|
61123
|
-
resizer.style.top = `${top}px`;
|
|
61124
|
-
resizer.style.left = `${left}px`;
|
|
61125
|
-
resizer.style.width = `${width}px`;
|
|
61126
|
-
resizer.style.height = `${height}px`;
|
|
61127
|
-
}
|
|
61128
|
-
function createResizer(block, element, options, mouseDownEvent) {
|
|
61129
|
-
const exists = getExistsResizer(block);
|
|
61130
|
-
if (exists) {
|
|
61131
|
-
addClass(exists, "active");
|
|
61132
|
-
updateSize(block, element, exists);
|
|
61133
|
-
return exists;
|
|
61134
|
-
}
|
|
61135
|
-
const tools = getBlockTools(block);
|
|
61136
|
-
const resizer = createElement("div", ["block-resizer"], tools);
|
|
61137
|
-
updateSize(block, element, resizer);
|
|
61138
|
-
options.resize.forEach((type) => {
|
|
61139
|
-
createResizeGripper(resizer, type);
|
|
61140
|
-
});
|
|
61141
|
-
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
61142
|
-
addClass(resizer, "active");
|
|
61143
|
-
return resizer;
|
|
61144
|
-
}
|
|
61145
|
-
function updateResizer(block, element) {
|
|
61146
|
-
const resizer = getExistsResizer(block);
|
|
61147
|
-
if (!resizer) {
|
|
61148
|
-
return;
|
|
61149
|
-
}
|
|
61150
|
-
if (!isChildNode(block, element)) {
|
|
61151
|
-
return;
|
|
61152
|
-
}
|
|
61153
|
-
const blockRect = block.getBoundingClientRect();
|
|
61154
|
-
const elementRect = element.getBoundingClientRect();
|
|
61155
|
-
const top = elementRect.top - blockRect.top;
|
|
61156
|
-
const left = elementRect.left - blockRect.left;
|
|
61157
|
-
const width = elementRect.width;
|
|
61158
|
-
const height = elementRect.height;
|
|
61159
|
-
resizer.style.top = `${top}px`;
|
|
61160
|
-
resizer.style.left = `${left}px`;
|
|
61161
|
-
resizer.style.width = `${width}px`;
|
|
61162
|
-
resizer.style.height = `${height}px`;
|
|
61163
|
-
}
|
|
61164
|
-
const style$8 = "";
|
|
61165
|
-
const logger$1A = getLogger("block-resizer");
|
|
61166
|
-
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
61167
|
-
constructor(editor, options) {
|
|
61168
|
-
super();
|
|
61169
|
-
__publicField(this, "resizableElement");
|
|
61170
|
-
__publicField(this, "block", null);
|
|
61171
|
-
__publicField(this, "startRect", null);
|
|
61172
|
-
__publicField(this, "startPos", null);
|
|
61173
|
-
__publicField(this, "resizeType", null);
|
|
61174
|
-
__publicField(this, "enabled", false);
|
|
61175
|
-
__publicField(this, "handleEditorResize", () => {
|
|
61176
|
-
if (this.block) {
|
|
61177
|
-
this.updateResizer();
|
|
61178
|
-
}
|
|
61179
|
-
});
|
|
61180
|
-
__publicField(this, "handleMouseDown", (event) => {
|
|
61181
|
-
event.preventDefault();
|
|
61182
|
-
event.stopPropagation();
|
|
61183
|
-
const element = this.getResizableElement();
|
|
61184
|
-
if (!element) {
|
|
61185
|
-
return;
|
|
61186
|
-
}
|
|
61187
|
-
if (event.button !== 0) {
|
|
61188
|
-
return;
|
|
61189
|
-
}
|
|
61190
|
-
const gripper = event.target;
|
|
61191
|
-
if (!gripper) {
|
|
61192
|
-
return;
|
|
61193
|
-
}
|
|
61194
|
-
if (!(gripper instanceof HTMLElement)) {
|
|
61195
|
-
return;
|
|
61196
|
-
}
|
|
61197
|
-
const resizeType = gripper.getAttribute("data-resize-type");
|
|
61198
|
-
if (!resizeType) {
|
|
61199
|
-
return;
|
|
61200
|
-
}
|
|
61201
|
-
this.bindEvents();
|
|
61202
|
-
this.startRect = element.getBoundingClientRect();
|
|
61203
|
-
this.startPos = event;
|
|
61204
|
-
this.resizeType = resizeType;
|
|
61205
|
-
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
61206
|
-
if (this.block) {
|
|
61207
|
-
this.editor.selection.selectBlock(this.block, 0);
|
|
61208
|
-
}
|
|
61209
|
-
});
|
|
61210
|
-
__publicField(this, "handleMouseMove", (event) => {
|
|
61211
|
-
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
61212
|
-
return;
|
|
61213
|
-
}
|
|
61214
|
-
const element = this.getResizableElement();
|
|
61215
|
-
if (!element || !this.block) {
|
|
61216
|
-
return;
|
|
61217
|
-
}
|
|
61218
|
-
const deltaX = event.x - this.startPos.x;
|
|
61219
|
-
const deltaY = event.y - this.startPos.y;
|
|
61220
|
-
const oldRect = this.startRect;
|
|
61221
|
-
let { top, left, right, bottom } = oldRect;
|
|
61222
|
-
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
61223
|
-
bottom += deltaY;
|
|
61224
|
-
}
|
|
61225
|
-
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
61226
|
-
top += deltaY;
|
|
61227
|
-
}
|
|
61228
|
-
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
61229
|
-
left += deltaX;
|
|
61230
|
-
}
|
|
61231
|
-
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
61232
|
-
right += deltaX;
|
|
61233
|
-
}
|
|
61234
|
-
const width = right > left ? right - left : 0;
|
|
61235
|
-
const height = bottom > top ? bottom - top : 0;
|
|
61236
|
-
const newRect = new DOMRect(left, top, width, height);
|
|
61237
|
-
this.emit("resizing", this, newRect);
|
|
61238
|
-
const newElement = this.getResizableElement();
|
|
61239
|
-
if (newElement) {
|
|
61240
|
-
updateResizer(this.block, newElement);
|
|
61241
|
-
}
|
|
61242
|
-
});
|
|
61243
|
-
__publicField(this, "handleMouseUp", (event) => {
|
|
61244
|
-
if (event.button !== 0) {
|
|
61245
|
-
return;
|
|
61246
|
-
}
|
|
61247
|
-
setDefaultCursor("");
|
|
61248
|
-
this.unbindEvents();
|
|
61249
|
-
this.emit("resized", this);
|
|
61250
|
-
const element = this.getResizableElement();
|
|
61251
|
-
if (!element || !this.block) {
|
|
61252
|
-
return;
|
|
61253
|
-
}
|
|
61254
|
-
updateResizer(this.block, element);
|
|
61255
|
-
});
|
|
61256
|
-
this.editor = editor;
|
|
61257
|
-
this.options = options;
|
|
61258
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
61259
|
-
}
|
|
61260
|
-
enableResize(block, resizableElement) {
|
|
61261
|
-
this.block = block;
|
|
61262
|
-
this.resizableElement = resizableElement;
|
|
61263
|
-
this.createResizer();
|
|
61264
|
-
this.enabled = true;
|
|
61265
|
-
}
|
|
61266
|
-
disableResize() {
|
|
61267
|
-
if (!this.block) {
|
|
61268
|
-
return;
|
|
61269
|
-
}
|
|
61270
|
-
hideResizer(this.block);
|
|
61271
|
-
this.enabled = false;
|
|
61272
|
-
}
|
|
61273
|
-
update(block, resizableElement) {
|
|
61274
|
-
this.block = block;
|
|
61275
|
-
this.resizableElement = resizableElement;
|
|
61276
|
-
const elem = this.getResizableElement();
|
|
61277
|
-
if (elem && this.enabled) {
|
|
61278
|
-
this.createResizer();
|
|
61279
|
-
}
|
|
61280
|
-
}
|
|
61281
|
-
updateResizer() {
|
|
61282
|
-
const newElement = this.getResizableElement();
|
|
61283
|
-
if (newElement && this.block) {
|
|
61284
|
-
updateResizer(this.block, newElement);
|
|
61285
|
-
}
|
|
61286
|
-
}
|
|
61287
|
-
getBlock() {
|
|
61288
|
-
return this.block;
|
|
61289
|
-
}
|
|
61290
|
-
destroy() {
|
|
61291
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
61292
|
-
}
|
|
61293
|
-
getResizableElement() {
|
|
61294
|
-
if (this.resizableElement) {
|
|
61295
|
-
return this.resizableElement;
|
|
61296
|
-
}
|
|
61297
|
-
if (!this.block) {
|
|
61298
|
-
return null;
|
|
61299
|
-
}
|
|
61300
|
-
return getBlockContent(this.block);
|
|
61301
|
-
}
|
|
61302
|
-
createResizer() {
|
|
61303
|
-
const element = this.getResizableElement();
|
|
61304
|
-
if (!element || !this.block) {
|
|
61305
|
-
return;
|
|
61306
|
-
}
|
|
61307
|
-
assert(logger$1A, isChildNode(this.block, element), "not a block child element");
|
|
61308
|
-
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
61309
|
-
}
|
|
61310
|
-
bindEvents() {
|
|
61311
|
-
document.addEventListener("mousemove", this.handleMouseMove);
|
|
61312
|
-
document.addEventListener("mouseup", this.handleMouseUp);
|
|
61313
|
-
}
|
|
61314
|
-
unbindEvents() {
|
|
61315
|
-
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
61316
|
-
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
61317
|
-
}
|
|
61318
|
-
}
|
|
61319
|
-
const logger$1z = getLogger("image-dom");
|
|
61549
|
+
const logger$1y = getLogger("image-dom");
|
|
61320
61550
|
function getExistsProgressMask(imageContainer) {
|
|
61321
61551
|
return imageContainer.querySelector(".uploading-progress-mask");
|
|
61322
61552
|
}
|
|
@@ -61333,7 +61563,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61333
61563
|
function getImageUploadingProgressValueElement(imageContainer) {
|
|
61334
61564
|
const bar2 = getImageUploadingProgressMask(imageContainer);
|
|
61335
61565
|
const value = bar2.querySelector(".uploading-progress-bar-value");
|
|
61336
|
-
assert(logger$
|
|
61566
|
+
assert(logger$1y, value, "no progress value");
|
|
61337
61567
|
return value;
|
|
61338
61568
|
}
|
|
61339
61569
|
function setImageUploading(imageContainer, progress) {
|
|
@@ -61423,7 +61653,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61423
61653
|
const images = Array.from(block.querySelectorAll(".image-container"));
|
|
61424
61654
|
return images;
|
|
61425
61655
|
}
|
|
61426
|
-
const logger$
|
|
61656
|
+
const logger$1x = getLogger("table-resize-drag-drop");
|
|
61427
61657
|
class ImageSplitterResizer {
|
|
61428
61658
|
constructor(editor, elem, data2, mouseDownEvent) {
|
|
61429
61659
|
__publicField(this, "cursor", "col-resize");
|
|
@@ -61436,7 +61666,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61436
61666
|
const imageObject = getImageObject(this.editor, block);
|
|
61437
61667
|
const images = imageObject.getImages();
|
|
61438
61668
|
const splitterIndex = this.data.splitterIndex;
|
|
61439
|
-
assert(logger$
|
|
61669
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61440
61670
|
const imageContainers = getImageContainersByBlock(block);
|
|
61441
61671
|
const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
|
|
61442
61672
|
this.initWidths = initWidths;
|
|
@@ -61454,7 +61684,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61454
61684
|
const imageObject = getImageObject(this.editor, block);
|
|
61455
61685
|
const images = cloneDeep__default.default(imageObject.getImages());
|
|
61456
61686
|
const splitterIndex = this.data.splitterIndex;
|
|
61457
|
-
assert(logger$
|
|
61687
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61458
61688
|
const width1 = this.initWidths[splitterIndex];
|
|
61459
61689
|
const width2 = this.initWidths[splitterIndex + 1];
|
|
61460
61690
|
if (width1 + width2 < 100) {
|
|
@@ -61473,7 +61703,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61473
61703
|
newWidths[splitterIndex] += delta;
|
|
61474
61704
|
newWidths[splitterIndex + 1] -= delta;
|
|
61475
61705
|
const imageContainers = getImageContainersByBlock(block);
|
|
61476
|
-
assert(logger$
|
|
61706
|
+
assert(logger$1x, imageContainers.length === images.length, "invalid image data");
|
|
61477
61707
|
const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
61478
61708
|
for (let i = 0; i < images.length; i++) {
|
|
61479
61709
|
const flex = newWidths[i] / totalWidth;
|
|
@@ -61546,7 +61776,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61546
61776
|
editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
|
|
61547
61777
|
editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
|
|
61548
61778
|
}
|
|
61549
|
-
const logger$
|
|
61779
|
+
const logger$1w = getLogger("image-item");
|
|
61550
61780
|
function getParentImageBlock(eventTarget) {
|
|
61551
61781
|
if (!eventTarget) {
|
|
61552
61782
|
return null;
|
|
@@ -61625,7 +61855,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61625
61855
|
if (file2) {
|
|
61626
61856
|
imageObject.replaceImage(index2, file2);
|
|
61627
61857
|
} else {
|
|
61628
|
-
logger$
|
|
61858
|
+
logger$1w.warn(`failed to download image: ${imageData.src}`);
|
|
61629
61859
|
}
|
|
61630
61860
|
}
|
|
61631
61861
|
function createLoadErrorElement(editor, imageContainer, imageData) {
|
|
@@ -61848,7 +62078,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61848
62078
|
function isImageFile(fileType) {
|
|
61849
62079
|
return fileType.startsWith("image/");
|
|
61850
62080
|
}
|
|
61851
|
-
const logger$
|
|
62081
|
+
const logger$1v = getLogger("image-object");
|
|
61852
62082
|
class ImageObject {
|
|
61853
62083
|
constructor(editor, blockData) {
|
|
61854
62084
|
__publicField(this, "images", []);
|
|
@@ -62139,7 +62369,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62139
62369
|
this.editor.updateEmbedData(block2, embedData);
|
|
62140
62370
|
return true;
|
|
62141
62371
|
} catch (err) {
|
|
62142
|
-
logger$
|
|
62372
|
+
logger$1v.error(err);
|
|
62143
62373
|
const block2 = this.editor.findBlockById(this.blockData.id);
|
|
62144
62374
|
if (!block2) {
|
|
62145
62375
|
return false;
|
|
@@ -62156,7 +62386,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62156
62386
|
if (!block) {
|
|
62157
62387
|
return;
|
|
62158
62388
|
}
|
|
62159
|
-
assert(logger$
|
|
62389
|
+
assert(logger$1v, flex.length === this.images.length, "invalid flex");
|
|
62160
62390
|
for (let i = 0; i < this.images.length; i++) {
|
|
62161
62391
|
this.images[i].flex = flex[i];
|
|
62162
62392
|
}
|
|
@@ -62205,7 +62435,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62205
62435
|
}
|
|
62206
62436
|
}
|
|
62207
62437
|
const imageEmbedStyle = "";
|
|
62208
|
-
const logger$
|
|
62438
|
+
const logger$1u = getLogger("drop-indicator");
|
|
62209
62439
|
const INDICATOR_SIZE$1 = 2;
|
|
62210
62440
|
class DropIndicator {
|
|
62211
62441
|
constructor(editor) {
|
|
@@ -62250,7 +62480,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62250
62480
|
if (insertPos === "before") {
|
|
62251
62481
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
62252
62482
|
if (!beforeBlock) {
|
|
62253
|
-
assert(logger$
|
|
62483
|
+
assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
62254
62484
|
const rect = block.getBoundingClientRect();
|
|
62255
62485
|
const viewRect2 = this.getViewRect(block);
|
|
62256
62486
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -62276,14 +62506,14 @@ $$${mathData.mathjaxText}$$
|
|
|
62276
62506
|
const PADDING = 5;
|
|
62277
62507
|
if (insertPos.pos === "left") {
|
|
62278
62508
|
const parent = getParentContainer(block);
|
|
62279
|
-
assert(logger$
|
|
62509
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62280
62510
|
const rect = block.getBoundingClientRect();
|
|
62281
62511
|
const viewRect = this.getViewRect(block);
|
|
62282
62512
|
return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
|
|
62283
62513
|
}
|
|
62284
62514
|
if (insertPos.pos === "right") {
|
|
62285
62515
|
const parent = getParentContainer(block);
|
|
62286
|
-
assert(logger$
|
|
62516
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62287
62517
|
const rect = block.getBoundingClientRect();
|
|
62288
62518
|
let viewRect;
|
|
62289
62519
|
if (isEmbedBlock(block)) {
|
|
@@ -62380,7 +62610,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62380
62610
|
}
|
|
62381
62611
|
return void 0;
|
|
62382
62612
|
}
|
|
62383
|
-
const logger$
|
|
62613
|
+
const logger$1t = getLogger("code-dom");
|
|
62384
62614
|
function isCodeBlock(block) {
|
|
62385
62615
|
return getBlockType(block) === "code";
|
|
62386
62616
|
}
|
|
@@ -62398,8 +62628,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62398
62628
|
}
|
|
62399
62629
|
function getParentCodeBlock(elem) {
|
|
62400
62630
|
const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
|
|
62401
|
-
assert(logger$
|
|
62402
|
-
assert(logger$
|
|
62631
|
+
assert(logger$1t, codeBlock2, "no parent code block");
|
|
62632
|
+
assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
|
|
62403
62633
|
return codeBlock2;
|
|
62404
62634
|
}
|
|
62405
62635
|
const SUPPORTED_LANGUAGES = () => ({
|
|
@@ -62490,7 +62720,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62490
62720
|
function setDefaultLanguage(editor, lang) {
|
|
62491
62721
|
return editor.settingsProvider.setItem("editor-code-lang", lang);
|
|
62492
62722
|
}
|
|
62493
|
-
const logger$
|
|
62723
|
+
const logger$1s = getLogger("convert-to-code");
|
|
62494
62724
|
function convertToCode(editor, srcBlock) {
|
|
62495
62725
|
if (!isTextKindBlock(editor, srcBlock)) {
|
|
62496
62726
|
return null;
|
|
@@ -62503,7 +62733,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62503
62733
|
const textContainerId = genId();
|
|
62504
62734
|
editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
|
|
62505
62735
|
const text2 = editor.getBlockData(srcBlock).text;
|
|
62506
|
-
assert(logger$
|
|
62736
|
+
assert(logger$1s, text2, "no text");
|
|
62507
62737
|
let alias = toPlainText(text2);
|
|
62508
62738
|
if (alias.startsWith("```")) {
|
|
62509
62739
|
alias = alias.substring(3);
|
|
@@ -62521,16 +62751,16 @@ $$${mathData.mathjaxText}$$
|
|
|
62521
62751
|
};
|
|
62522
62752
|
}
|
|
62523
62753
|
const codeBlock = "";
|
|
62524
|
-
const logger$
|
|
62754
|
+
const logger$1r = getLogger("code-block-child-container");
|
|
62525
62755
|
function getTextContainer(codeBlock2) {
|
|
62526
|
-
assert(logger$
|
|
62756
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62527
62757
|
const content = getBlockContent(codeBlock2);
|
|
62528
62758
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
|
|
62529
|
-
assert(logger$
|
|
62759
|
+
assert(logger$1r, textContainer, "no code text container");
|
|
62530
62760
|
return textContainer;
|
|
62531
62761
|
}
|
|
62532
62762
|
function getCaptionContainer(codeBlock2) {
|
|
62533
|
-
assert(logger$
|
|
62763
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62534
62764
|
const content = getBlockContent(codeBlock2);
|
|
62535
62765
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
|
|
62536
62766
|
if (!textContainer)
|
|
@@ -62559,7 +62789,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62559
62789
|
}
|
|
62560
62790
|
return getBlockType(block) === "code";
|
|
62561
62791
|
}
|
|
62562
|
-
const logger$
|
|
62792
|
+
const logger$1q = getLogger("code-caption");
|
|
62563
62793
|
function toggleCodeCaption(editor, codeBlock2) {
|
|
62564
62794
|
if (editor.readonly) {
|
|
62565
62795
|
return;
|
|
@@ -62572,7 +62802,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62572
62802
|
}
|
|
62573
62803
|
const captionContainerId = createEmptyContainer(editor.doc);
|
|
62574
62804
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62575
|
-
assert(logger$
|
|
62805
|
+
assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
|
|
62576
62806
|
const newData = {
|
|
62577
62807
|
...oldData,
|
|
62578
62808
|
children: [oldData.children[0], captionContainerId]
|
|
@@ -62588,7 +62818,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62588
62818
|
return false;
|
|
62589
62819
|
}
|
|
62590
62820
|
const parentBlock = getParentBlock(parentContainer);
|
|
62591
|
-
assert(logger$
|
|
62821
|
+
assert(logger$1q, parentBlock, "no parent block");
|
|
62592
62822
|
if (!isCodeBlock(parentBlock)) {
|
|
62593
62823
|
return false;
|
|
62594
62824
|
}
|
|
@@ -62608,7 +62838,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62608
62838
|
const lastBlock2 = getLastChildBlock(textContainer);
|
|
62609
62839
|
editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
|
|
62610
62840
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62611
|
-
assert(logger$
|
|
62841
|
+
assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
|
|
62612
62842
|
const captionContainerId = oldData.children[1];
|
|
62613
62843
|
const newData = {
|
|
62614
62844
|
...oldData,
|
|
@@ -62617,7 +62847,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62617
62847
|
editor.updateBlockData(codeBlock2, newData);
|
|
62618
62848
|
editor.deleteChildContainers([captionContainerId]);
|
|
62619
62849
|
}
|
|
62620
|
-
const logger$
|
|
62850
|
+
const logger$1p = getLogger("paste-in-table-block");
|
|
62621
62851
|
class PasteEventHandler {
|
|
62622
62852
|
constructor(editor) {
|
|
62623
62853
|
this.editor = editor;
|
|
@@ -62638,7 +62868,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62638
62868
|
return false;
|
|
62639
62869
|
}
|
|
62640
62870
|
const parentBlock = getParentBlock(parentContainer);
|
|
62641
|
-
assert(logger$
|
|
62871
|
+
assert(logger$1p, parentBlock, "no parent block");
|
|
62642
62872
|
if (!isCodeBlock(parentBlock)) {
|
|
62643
62873
|
return false;
|
|
62644
62874
|
}
|
|
@@ -62702,7 +62932,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62702
62932
|
function registerCodeBlockCommandProvider(editor) {
|
|
62703
62933
|
editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
|
|
62704
62934
|
}
|
|
62705
|
-
const logger$
|
|
62935
|
+
const logger$1o = getLogger("code-caption-input-handler");
|
|
62706
62936
|
function getCurrentCaptionBlock(editor) {
|
|
62707
62937
|
if (!editor.selection.range.isSimple()) {
|
|
62708
62938
|
return null;
|
|
@@ -62815,7 +63045,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62815
63045
|
editor.undoManager.runInGroup(() => {
|
|
62816
63046
|
editor.clearSelectedContents();
|
|
62817
63047
|
const start = editor.selection.range.start;
|
|
62818
|
-
assert(logger$
|
|
63048
|
+
assert(logger$1o, start.isSimple(), "not simple position");
|
|
62819
63049
|
editor.insertTextToBlock(block, start.offset, text2);
|
|
62820
63050
|
});
|
|
62821
63051
|
return true;
|
|
@@ -62860,9 +63090,9 @@ $$${mathData.mathjaxText}$$
|
|
|
62860
63090
|
};
|
|
62861
63091
|
editor.updateBlockData(codeBlock2, newData);
|
|
62862
63092
|
}
|
|
62863
|
-
const logger$
|
|
63093
|
+
const logger$1n = getLogger("code-block-header");
|
|
62864
63094
|
function selectCodeBlock(editor, block, options) {
|
|
62865
|
-
assert(logger$
|
|
63095
|
+
assert(logger$1n, isCodeBlock(block), "not a code block");
|
|
62866
63096
|
const firstBlock = getFirstChildBlock(getTextContainer(block));
|
|
62867
63097
|
editor.selection.selectBlock(firstBlock, 0);
|
|
62868
63098
|
if (options.focusToEditor) {
|
|
@@ -62904,14 +63134,15 @@ $$${mathData.mathjaxText}$$
|
|
|
62904
63134
|
const target = event.target;
|
|
62905
63135
|
const select2 = target.closest(".language-select");
|
|
62906
63136
|
const block = getParentBlock(select2);
|
|
62907
|
-
assert(logger$
|
|
62908
|
-
assert(logger$
|
|
63137
|
+
assert(logger$1n, block, "no parent block");
|
|
63138
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62909
63139
|
const codeData = editor2.getBlockData(block);
|
|
62910
63140
|
const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
|
|
62911
63141
|
dropdown2.custom = { codeBlock: block, editor: editor2 };
|
|
62912
63142
|
dropdown2.setSelectedId(codeData.language);
|
|
62913
63143
|
selectCodeBlock(editor2, block, { focusToEditor: false });
|
|
62914
63144
|
setTimeout(() => {
|
|
63145
|
+
CommandBar.hideAll();
|
|
62915
63146
|
dropdown2.show(select2);
|
|
62916
63147
|
});
|
|
62917
63148
|
addClass(codeBlock2, "editing-language");
|
|
@@ -62927,11 +63158,11 @@ $$${mathData.mathjaxText}$$
|
|
|
62927
63158
|
function handleCodeHeaderButtonClick(editor, event) {
|
|
62928
63159
|
const target = event.target;
|
|
62929
63160
|
const button2 = target.closest(".code-header-button");
|
|
62930
|
-
assert(logger$
|
|
63161
|
+
assert(logger$1n, button2, "no button");
|
|
62931
63162
|
const block = getParentBlock(target);
|
|
62932
|
-
assert(logger$
|
|
63163
|
+
assert(logger$1n, block, "no parent block");
|
|
62933
63164
|
const id = button2.getAttribute("data-id");
|
|
62934
|
-
assert(logger$
|
|
63165
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62935
63166
|
if (id === "wrap") {
|
|
62936
63167
|
const old = editor.getBlockData(block);
|
|
62937
63168
|
changeCodeBlockWrap(editor, block, !old.nowrap);
|
|
@@ -62957,7 +63188,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62957
63188
|
}
|
|
62958
63189
|
});
|
|
62959
63190
|
}).catch((err) => {
|
|
62960
|
-
logger$
|
|
63191
|
+
logger$1n.error(err.message);
|
|
62961
63192
|
});
|
|
62962
63193
|
return;
|
|
62963
63194
|
}
|
|
@@ -63008,7 +63239,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63008
63239
|
}
|
|
63009
63240
|
function getCodeBlockHeader(block) {
|
|
63010
63241
|
const header = block.querySelector(".code-block-header");
|
|
63011
|
-
assert(logger$
|
|
63242
|
+
assert(logger$1n, header, "no code block header");
|
|
63012
63243
|
return header;
|
|
63013
63244
|
}
|
|
63014
63245
|
function handleCodeScroll(editor, event) {
|
|
@@ -63057,7 +63288,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63057
63288
|
focusBlockId: textBlock.id
|
|
63058
63289
|
};
|
|
63059
63290
|
}
|
|
63060
|
-
const logger$
|
|
63291
|
+
const logger$1m = getLogger("code-block");
|
|
63061
63292
|
function getPaddingNum(index2) {
|
|
63062
63293
|
if (index2 <= 2) {
|
|
63063
63294
|
return 32;
|
|
@@ -63084,10 +63315,10 @@ $$${mathData.mathjaxText}$$
|
|
|
63084
63315
|
handlePasteInTableEvent(editor);
|
|
63085
63316
|
registerCodeBlockCommandProvider(editor);
|
|
63086
63317
|
trackChildBlockEvent(editor, handleDebounceUpdate);
|
|
63087
|
-
assert(logger$
|
|
63318
|
+
assert(logger$1m, blockData.type === "code", "invalid block data type");
|
|
63088
63319
|
const codeData = blockData;
|
|
63089
|
-
assert(logger$
|
|
63090
|
-
assert(logger$
|
|
63320
|
+
assert(logger$1m, codeData.children, "invalid block data children");
|
|
63321
|
+
assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
|
|
63091
63322
|
setTimeout(() => {
|
|
63092
63323
|
if (isNodeRemoved(blockElement))
|
|
63093
63324
|
return;
|
|
@@ -63138,15 +63369,15 @@ $$${mathData.mathjaxText}$$
|
|
|
63138
63369
|
}
|
|
63139
63370
|
function updateSelection$3(editor, block, from, to) {
|
|
63140
63371
|
if (from.isSimple()) {
|
|
63141
|
-
assert(logger$
|
|
63142
|
-
logger$
|
|
63372
|
+
assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
|
|
63373
|
+
logger$1m.debug("full select list");
|
|
63143
63374
|
addClass(block, "full-selected");
|
|
63144
63375
|
return;
|
|
63145
63376
|
}
|
|
63146
|
-
assert(logger$
|
|
63377
|
+
assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
|
|
63147
63378
|
const f = from;
|
|
63148
63379
|
const t2 = to;
|
|
63149
|
-
assert(logger$
|
|
63380
|
+
assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
|
|
63150
63381
|
const containers = getCodeChildContainers(block);
|
|
63151
63382
|
containers.forEach((container) => {
|
|
63152
63383
|
const containerId = getContainerId(container);
|
|
@@ -63181,8 +63412,8 @@ $$${mathData.mathjaxText}$$
|
|
|
63181
63412
|
const containersIds = childContainers.map(getContainerId);
|
|
63182
63413
|
const startIndex = containersIds.indexOf(start.childContainerId);
|
|
63183
63414
|
const endIndex = containersIds.indexOf(end.childContainerId);
|
|
63184
|
-
assert(logger$
|
|
63185
|
-
assert(logger$
|
|
63415
|
+
assert(logger$1m, startIndex !== -1, "invalid start pos");
|
|
63416
|
+
assert(logger$1m, endIndex !== -1, "invalid end pos");
|
|
63186
63417
|
const ret = [childContainers[startIndex]];
|
|
63187
63418
|
if (startIndex !== endIndex) {
|
|
63188
63419
|
ret.push(childContainers[endIndex]);
|
|
@@ -63190,7 +63421,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63190
63421
|
return ret;
|
|
63191
63422
|
}
|
|
63192
63423
|
function handleBlockElementUpdated(editor, block, blockData) {
|
|
63193
|
-
assert(logger$
|
|
63424
|
+
assert(logger$1m, isCodeBlock(block), "invalid block type");
|
|
63194
63425
|
const codeData = blockData;
|
|
63195
63426
|
updateCodeBlockElementStyles(editor, block, codeData);
|
|
63196
63427
|
}
|
|
@@ -63382,10 +63613,10 @@ ${codeText}
|
|
|
63382
63613
|
"Shift+Tab": handleShiftTab$1,
|
|
63383
63614
|
"CtrlOrCmd+A": selectCode
|
|
63384
63615
|
};
|
|
63385
|
-
const logger$
|
|
63616
|
+
const logger$1l = getLogger("code-text-decorate");
|
|
63386
63617
|
class CodeTextDecorator {
|
|
63387
63618
|
decorateText(editor, path, blockText) {
|
|
63388
|
-
assert(logger$
|
|
63619
|
+
assert(logger$1l, path.length > 0, "invalid path");
|
|
63389
63620
|
if (path.length === 1) {
|
|
63390
63621
|
return {};
|
|
63391
63622
|
}
|
|
@@ -63410,7 +63641,7 @@ ${codeText}
|
|
|
63410
63641
|
const grammar = getProsmGrammar(codeData.language);
|
|
63411
63642
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63412
63643
|
const tokenToText = (token, attributes) => {
|
|
63413
|
-
assert(logger$
|
|
63644
|
+
assert(logger$1l, token, "no token");
|
|
63414
63645
|
if (typeof token === "string") {
|
|
63415
63646
|
const ret = {
|
|
63416
63647
|
insert: token,
|
|
@@ -63418,7 +63649,7 @@ ${codeText}
|
|
|
63418
63649
|
};
|
|
63419
63650
|
return [ret];
|
|
63420
63651
|
}
|
|
63421
|
-
assert(logger$
|
|
63652
|
+
assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
|
|
63422
63653
|
const content = token.content;
|
|
63423
63654
|
const newAttributes = cloneDeep__default.default(attributes);
|
|
63424
63655
|
newAttributes[`style-code-${token.type}`] = true;
|
|
@@ -63434,18 +63665,18 @@ ${codeText}
|
|
|
63434
63665
|
const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
|
|
63435
63666
|
return ret;
|
|
63436
63667
|
}
|
|
63437
|
-
assert(logger$
|
|
63668
|
+
assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
|
|
63438
63669
|
return tokenToText(content, newAttributes);
|
|
63439
63670
|
};
|
|
63440
63671
|
const ops = tokens.map((token) => tokenToText(token, {}));
|
|
63441
63672
|
const newText = ops.flat();
|
|
63442
|
-
assert(logger$
|
|
63673
|
+
assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
|
|
63443
63674
|
return {
|
|
63444
63675
|
text: newText
|
|
63445
63676
|
};
|
|
63446
63677
|
}
|
|
63447
63678
|
}
|
|
63448
|
-
const zhCN$
|
|
63679
|
+
const zhCN$o = {
|
|
63449
63680
|
code: {
|
|
63450
63681
|
title: "\u4EE3\u7801",
|
|
63451
63682
|
abstract: "\u4EE3\u7801",
|
|
@@ -63457,7 +63688,7 @@ ${codeText}
|
|
|
63457
63688
|
plainText: "Plain Text"
|
|
63458
63689
|
}
|
|
63459
63690
|
};
|
|
63460
|
-
const enUS$
|
|
63691
|
+
const enUS$o = {
|
|
63461
63692
|
code: {
|
|
63462
63693
|
title: "Code",
|
|
63463
63694
|
abstract: "Code",
|
|
@@ -63469,7 +63700,7 @@ ${codeText}
|
|
|
63469
63700
|
plainText: "Plain Text"
|
|
63470
63701
|
}
|
|
63471
63702
|
};
|
|
63472
|
-
const jaJP$
|
|
63703
|
+
const jaJP$o = {
|
|
63473
63704
|
code: {
|
|
63474
63705
|
title: "\u30B3\u30FC\u30C9",
|
|
63475
63706
|
abstract: "\u30B3\u30FC\u30C9",
|
|
@@ -63482,9 +63713,9 @@ ${codeText}
|
|
|
63482
63713
|
}
|
|
63483
63714
|
};
|
|
63484
63715
|
i18n$1.mergeLang({
|
|
63485
|
-
"zh-CN": zhCN$
|
|
63486
|
-
"en-US": enUS$
|
|
63487
|
-
"ja-JP": jaJP$
|
|
63716
|
+
"zh-CN": zhCN$o,
|
|
63717
|
+
"en-US": enUS$o,
|
|
63718
|
+
"ja-JP": jaJP$o
|
|
63488
63719
|
});
|
|
63489
63720
|
function convertToTable(editor, containerId, blockIndex, offset) {
|
|
63490
63721
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -63745,7 +63976,7 @@ ${codeText}
|
|
|
63745
63976
|
}
|
|
63746
63977
|
return false;
|
|
63747
63978
|
}
|
|
63748
|
-
const logger$
|
|
63979
|
+
const logger$1k = getLogger("match-text-style");
|
|
63749
63980
|
function matchTextPair(text2, find) {
|
|
63750
63981
|
if (text2.length < find.length * 2 + 1) {
|
|
63751
63982
|
return -1;
|
|
@@ -63815,7 +64046,7 @@ ${codeText}
|
|
|
63815
64046
|
editor.insertBoxToBlock(block, start, boxData);
|
|
63816
64047
|
});
|
|
63817
64048
|
} catch (err) {
|
|
63818
|
-
logger$
|
|
64049
|
+
logger$1k.warn(`failed to convert to box, ${err.message}`);
|
|
63819
64050
|
continue;
|
|
63820
64051
|
}
|
|
63821
64052
|
}
|
|
@@ -63878,7 +64109,7 @@ ${codeText}
|
|
|
63878
64109
|
return false;
|
|
63879
64110
|
}
|
|
63880
64111
|
}
|
|
63881
|
-
const enUS$
|
|
64112
|
+
const enUS$n = {
|
|
63882
64113
|
placeholder: {
|
|
63883
64114
|
default: "Type / for commands",
|
|
63884
64115
|
heading: "Heading {heading}",
|
|
@@ -63889,7 +64120,7 @@ ${codeText}
|
|
|
63889
64120
|
mobileDefault: "Type to add content"
|
|
63890
64121
|
}
|
|
63891
64122
|
};
|
|
63892
|
-
const zhCN$
|
|
64123
|
+
const zhCN$n = {
|
|
63893
64124
|
placeholder: {
|
|
63894
64125
|
default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
|
|
63895
64126
|
heading: "\u6807\u9898{heading}",
|
|
@@ -63900,7 +64131,7 @@ ${codeText}
|
|
|
63900
64131
|
mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
|
|
63901
64132
|
}
|
|
63902
64133
|
};
|
|
63903
|
-
const jaJP$
|
|
64134
|
+
const jaJP$n = {
|
|
63904
64135
|
placeholder: {
|
|
63905
64136
|
default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
|
|
63906
64137
|
heading: "\u898B\u51FA\u3057{heading}",
|
|
@@ -63912,9 +64143,9 @@ ${codeText}
|
|
|
63912
64143
|
}
|
|
63913
64144
|
};
|
|
63914
64145
|
const langs$1 = {
|
|
63915
|
-
"en-US": enUS$
|
|
63916
|
-
"zh-CN": zhCN$
|
|
63917
|
-
"ja-JP": jaJP$
|
|
64146
|
+
"en-US": enUS$n,
|
|
64147
|
+
"zh-CN": zhCN$n,
|
|
64148
|
+
"ja-JP": jaJP$n
|
|
63918
64149
|
};
|
|
63919
64150
|
i18n$1.mergeLang(langs$1);
|
|
63920
64151
|
function isEmptyTextBlockWithoutCompositionText(editor, block) {
|
|
@@ -64081,7 +64312,7 @@ ${codeText}
|
|
|
64081
64312
|
}
|
|
64082
64313
|
return false;
|
|
64083
64314
|
}
|
|
64084
|
-
const logger$
|
|
64315
|
+
const logger$1j = getLogger("enforce-title");
|
|
64085
64316
|
class EnforceWithDocumentTitleHandler {
|
|
64086
64317
|
constructor(editor, options = {
|
|
64087
64318
|
headingLevel: 1
|
|
@@ -64153,7 +64384,7 @@ ${codeText}
|
|
|
64153
64384
|
var _a, _b;
|
|
64154
64385
|
try {
|
|
64155
64386
|
const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
|
|
64156
|
-
assert(logger$
|
|
64387
|
+
assert(logger$1j, blocks.length > 0, "root container is empty");
|
|
64157
64388
|
const firstBlock = blocks[0];
|
|
64158
64389
|
if (firstBlock.type !== "text" && !this.options.hideTitle) {
|
|
64159
64390
|
const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
|
|
@@ -64162,7 +64393,7 @@ ${codeText}
|
|
|
64162
64393
|
return;
|
|
64163
64394
|
}
|
|
64164
64395
|
if (!this.options.hideTitle) {
|
|
64165
|
-
assert(logger$
|
|
64396
|
+
assert(logger$1j, firstBlock.text, "invalid text block");
|
|
64166
64397
|
const block = editor.getBlockById(firstBlock.id);
|
|
64167
64398
|
if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
|
|
64168
64399
|
const text2 = editor.getBlockString(block);
|
|
@@ -64247,7 +64478,7 @@ ${codeText}
|
|
|
64247
64478
|
});
|
|
64248
64479
|
return orgDataUrl;
|
|
64249
64480
|
}
|
|
64250
|
-
const logger$
|
|
64481
|
+
const logger$1i = getLogger("drag-preview-image");
|
|
64251
64482
|
class DragPreviewImage {
|
|
64252
64483
|
constructor(editor) {
|
|
64253
64484
|
__publicField(this, "startPosition", null);
|
|
@@ -64255,7 +64486,7 @@ ${codeText}
|
|
|
64255
64486
|
__publicField(this, "handleDragStart", async (e2, preview) => {
|
|
64256
64487
|
var _a, _b, _c, _d, _e, _f;
|
|
64257
64488
|
const target = e2.target;
|
|
64258
|
-
assert(logger$
|
|
64489
|
+
assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
|
|
64259
64490
|
const { x: startX, y: startY } = e2;
|
|
64260
64491
|
this.startPosition = {
|
|
64261
64492
|
x: startX,
|
|
@@ -64341,7 +64572,7 @@ ${codeText}
|
|
|
64341
64572
|
}
|
|
64342
64573
|
return block;
|
|
64343
64574
|
}
|
|
64344
|
-
const logger$
|
|
64575
|
+
const logger$1h = getLogger("block-menu-drag-handler");
|
|
64345
64576
|
function createDragEventFromMouseEvent$2(event, type) {
|
|
64346
64577
|
const dragEvent = new DragEvent(type, {
|
|
64347
64578
|
bubbles: true,
|
|
@@ -64362,7 +64593,7 @@ ${codeText}
|
|
|
64362
64593
|
__publicField(this, "oldPos", { x: 0, y: 0 });
|
|
64363
64594
|
__publicField(this, "handleMouseDown", (event) => {
|
|
64364
64595
|
const block = this.button.blockMenu.currentBlock;
|
|
64365
|
-
assert(logger$
|
|
64596
|
+
assert(logger$1h, block, "no dragged block");
|
|
64366
64597
|
if (event.button !== 0) {
|
|
64367
64598
|
return;
|
|
64368
64599
|
}
|
|
@@ -64390,7 +64621,7 @@ ${codeText}
|
|
|
64390
64621
|
});
|
|
64391
64622
|
}
|
|
64392
64623
|
const block = this.button.blockMenu.currentBlock;
|
|
64393
|
-
assert(logger$
|
|
64624
|
+
assert(logger$1h, block, "no dragged block");
|
|
64394
64625
|
(_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
|
|
64395
64626
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
|
|
64396
64627
|
registerStandardDraggedObject(this.editor, dragEvent, block);
|
|
@@ -64410,7 +64641,7 @@ ${codeText}
|
|
|
64410
64641
|
this.handleDragStart(event);
|
|
64411
64642
|
}
|
|
64412
64643
|
this.oldPos = { x, y };
|
|
64413
|
-
assert(logger$
|
|
64644
|
+
assert(logger$1h, target instanceof Element, "target is invalid");
|
|
64414
64645
|
this.dragPreview.handleDrag(event);
|
|
64415
64646
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
|
|
64416
64647
|
this.editor.contentElement.dispatchEvent(dragEvent);
|
|
@@ -64418,7 +64649,7 @@ ${codeText}
|
|
|
64418
64649
|
__publicField(this, "handleDragEnd", (event) => {
|
|
64419
64650
|
var _a;
|
|
64420
64651
|
const block = this.button.blockMenu.currentBlock;
|
|
64421
|
-
assert(logger$
|
|
64652
|
+
assert(logger$1h, block, "no dragged block");
|
|
64422
64653
|
window.isDragging = false;
|
|
64423
64654
|
this.dragPreview.handleDragEnd();
|
|
64424
64655
|
(_a = this.autoScroll) == null ? void 0 : _a.inactive();
|
|
@@ -64641,7 +64872,7 @@ ${codeText}
|
|
|
64641
64872
|
this.rootButton.destroy();
|
|
64642
64873
|
}
|
|
64643
64874
|
}
|
|
64644
|
-
const zhCN$
|
|
64875
|
+
const zhCN$m = {
|
|
64645
64876
|
blockMenu: {
|
|
64646
64877
|
section: {
|
|
64647
64878
|
basics: "\u57FA\u7840",
|
|
@@ -64665,7 +64896,7 @@ ${codeText}
|
|
|
64665
64896
|
}
|
|
64666
64897
|
}
|
|
64667
64898
|
};
|
|
64668
|
-
const enUS$
|
|
64899
|
+
const enUS$m = {
|
|
64669
64900
|
blockMenu: {
|
|
64670
64901
|
section: {
|
|
64671
64902
|
basics: "Basic",
|
|
@@ -64689,7 +64920,7 @@ ${codeText}
|
|
|
64689
64920
|
}
|
|
64690
64921
|
}
|
|
64691
64922
|
};
|
|
64692
|
-
const jaJP$
|
|
64923
|
+
const jaJP$m = {
|
|
64693
64924
|
blockMenu: {
|
|
64694
64925
|
section: {
|
|
64695
64926
|
basics: "\u4E00\u822C",
|
|
@@ -64714,9 +64945,9 @@ ${codeText}
|
|
|
64714
64945
|
}
|
|
64715
64946
|
};
|
|
64716
64947
|
i18n$1.mergeLang({
|
|
64717
|
-
"zh-CN": zhCN$
|
|
64718
|
-
"en-US": enUS$
|
|
64719
|
-
"ja-JP": jaJP$
|
|
64948
|
+
"zh-CN": zhCN$m,
|
|
64949
|
+
"en-US": enUS$m,
|
|
64950
|
+
"ja-JP": jaJP$m
|
|
64720
64951
|
});
|
|
64721
64952
|
const style$6 = "";
|
|
64722
64953
|
class DragData {
|
|
@@ -64796,7 +65027,7 @@ ${codeText}
|
|
|
64796
65027
|
function clearDraggedObject(editor) {
|
|
64797
65028
|
getDragData(editor).clearData();
|
|
64798
65029
|
}
|
|
64799
|
-
const logger$
|
|
65030
|
+
const logger$1g = getLogger("find-drop-target");
|
|
64800
65031
|
function childContainerFromPoint(x, y) {
|
|
64801
65032
|
const elem = getElementFromPoint(x, y);
|
|
64802
65033
|
if (!elem) {
|
|
@@ -64909,13 +65140,13 @@ ${codeText}
|
|
|
64909
65140
|
return true;
|
|
64910
65141
|
}
|
|
64911
65142
|
const parentBlock = getParentBlock(container);
|
|
64912
|
-
assert(logger$
|
|
65143
|
+
assert(logger$1g, parentBlock, "no parent block");
|
|
64913
65144
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
64914
65145
|
return false;
|
|
64915
65146
|
}
|
|
64916
65147
|
return canInsertAsSibling(editor, parentBlock);
|
|
64917
65148
|
}
|
|
64918
|
-
const logger$
|
|
65149
|
+
const logger$1f = getLogger("drop-target");
|
|
64919
65150
|
function getEmbedClassByFile(editor, file2) {
|
|
64920
65151
|
let embedClass = {};
|
|
64921
65152
|
if (/image/.test(file2.type)) {
|
|
@@ -64925,7 +65156,7 @@ ${codeText}
|
|
|
64925
65156
|
} else if (/video/.test(file2.type)) {
|
|
64926
65157
|
embedClass = editor.editorEmbeds.getEmbedClass("video");
|
|
64927
65158
|
}
|
|
64928
|
-
assert(logger$
|
|
65159
|
+
assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
|
|
64929
65160
|
return embedClass;
|
|
64930
65161
|
}
|
|
64931
65162
|
async function patchInsertFile(editor, files, containerId, blockIndex) {
|
|
@@ -65672,7 +65903,7 @@ ${codeText}
|
|
|
65672
65903
|
}
|
|
65673
65904
|
}
|
|
65674
65905
|
}
|
|
65675
|
-
const zhCN$
|
|
65906
|
+
const zhCN$l = {
|
|
65676
65907
|
image: {
|
|
65677
65908
|
title: "\u56FE\u7247",
|
|
65678
65909
|
upload: {
|
|
@@ -65688,7 +65919,7 @@ ${codeText}
|
|
|
65688
65919
|
abstract: "\u56FE\u7247"
|
|
65689
65920
|
}
|
|
65690
65921
|
};
|
|
65691
|
-
const enUS$
|
|
65922
|
+
const enUS$l = {
|
|
65692
65923
|
image: {
|
|
65693
65924
|
title: "Image",
|
|
65694
65925
|
upload: {
|
|
@@ -65704,7 +65935,7 @@ ${codeText}
|
|
|
65704
65935
|
abstract: "Image"
|
|
65705
65936
|
}
|
|
65706
65937
|
};
|
|
65707
|
-
const jaJP$
|
|
65938
|
+
const jaJP$l = {
|
|
65708
65939
|
image: {
|
|
65709
65940
|
title: "\u753B\u50CF",
|
|
65710
65941
|
upload: {
|
|
@@ -65721,9 +65952,9 @@ ${codeText}
|
|
|
65721
65952
|
}
|
|
65722
65953
|
};
|
|
65723
65954
|
i18n$1.mergeLang({
|
|
65724
|
-
"zh-CN": zhCN$
|
|
65725
|
-
"en-US": enUS$
|
|
65726
|
-
"ja-JP": jaJP$
|
|
65955
|
+
"zh-CN": zhCN$l,
|
|
65956
|
+
"en-US": enUS$l,
|
|
65957
|
+
"ja-JP": jaJP$l
|
|
65727
65958
|
});
|
|
65728
65959
|
function convertToImage(editor, containerId, blockIndex, offset) {
|
|
65729
65960
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -65777,7 +66008,7 @@ ${codeText}
|
|
|
65777
66008
|
return false;
|
|
65778
66009
|
}
|
|
65779
66010
|
}
|
|
65780
|
-
const logger$
|
|
66011
|
+
const logger$1e = getLogger("copy-image");
|
|
65781
66012
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
65782
66013
|
const imageData = imageObject.getImages()[index2];
|
|
65783
66014
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
@@ -65818,7 +66049,7 @@ ${codeText}
|
|
|
65818
66049
|
});
|
|
65819
66050
|
clipboardData["image/png"] = fileBlob;
|
|
65820
66051
|
} catch (error2) {
|
|
65821
|
-
logger$
|
|
66052
|
+
logger$1e.error(error2);
|
|
65822
66053
|
}
|
|
65823
66054
|
addMetaToDoc(editor, doc2);
|
|
65824
66055
|
const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
|
|
@@ -66091,195 +66322,6 @@ ${codeText}
|
|
|
66091
66322
|
}
|
|
66092
66323
|
return getDragInsertPos(editor, block, images, x);
|
|
66093
66324
|
}
|
|
66094
|
-
const zhCN$l = {
|
|
66095
|
-
embedProperties: {
|
|
66096
|
-
edit: "\u7F16\u8F91",
|
|
66097
|
-
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
66098
|
-
}
|
|
66099
|
-
};
|
|
66100
|
-
const enUS$l = {
|
|
66101
|
-
embedProperties: {
|
|
66102
|
-
edit: "Edit",
|
|
66103
|
-
addComment: "Add annotation"
|
|
66104
|
-
}
|
|
66105
|
-
};
|
|
66106
|
-
const jaJP$l = {
|
|
66107
|
-
embedProperties: {
|
|
66108
|
-
edit: "\u7DE8\u96C6",
|
|
66109
|
-
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
66110
|
-
}
|
|
66111
|
-
};
|
|
66112
|
-
i18n$1.mergeLang({
|
|
66113
|
-
"zh-CN": zhCN$l,
|
|
66114
|
-
"en-US": enUS$l,
|
|
66115
|
-
"ja-JP": jaJP$l
|
|
66116
|
-
});
|
|
66117
|
-
const logger$1e = getLogger("embed-block-properties");
|
|
66118
|
-
function addCommentToBlock(editor, block) {
|
|
66119
|
-
var _a;
|
|
66120
|
-
for (const hook of editor.blockHooks) {
|
|
66121
|
-
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
66122
|
-
if (!commands) {
|
|
66123
|
-
continue;
|
|
66124
|
-
}
|
|
66125
|
-
if (commands.group === "block-comment-actions") {
|
|
66126
|
-
const command = commands.commands[0];
|
|
66127
|
-
if (!command) {
|
|
66128
|
-
continue;
|
|
66129
|
-
}
|
|
66130
|
-
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
66131
|
-
return true;
|
|
66132
|
-
}
|
|
66133
|
-
}
|
|
66134
|
-
return false;
|
|
66135
|
-
}
|
|
66136
|
-
class StandardEmbedBlockCommands {
|
|
66137
|
-
constructor(editor, block, properties) {
|
|
66138
|
-
__publicField(this, "group", "hovering-toolbar");
|
|
66139
|
-
__publicField(this, "_commands", [{
|
|
66140
|
-
id: "edit",
|
|
66141
|
-
name: i18n$1.t("embedProperties.edit"),
|
|
66142
|
-
icon: EditIcon
|
|
66143
|
-
}, {
|
|
66144
|
-
id: "separator",
|
|
66145
|
-
name: "",
|
|
66146
|
-
type: "separator"
|
|
66147
|
-
}]);
|
|
66148
|
-
this.editor = editor;
|
|
66149
|
-
this.block = block;
|
|
66150
|
-
this.properties = properties;
|
|
66151
|
-
}
|
|
66152
|
-
get commands() {
|
|
66153
|
-
var _a, _b, _c, _d;
|
|
66154
|
-
if (clientType.isMobile) {
|
|
66155
|
-
return [];
|
|
66156
|
-
}
|
|
66157
|
-
let standardCommands = [];
|
|
66158
|
-
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
66159
|
-
this.properties.presetIds.forEach((id) => {
|
|
66160
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66161
|
-
if (command) {
|
|
66162
|
-
standardCommands.push(command);
|
|
66163
|
-
}
|
|
66164
|
-
});
|
|
66165
|
-
}
|
|
66166
|
-
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
66167
|
-
standardCommands.push(...this.properties.extCommands);
|
|
66168
|
-
}
|
|
66169
|
-
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
66170
|
-
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
66171
|
-
}
|
|
66172
|
-
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
66173
|
-
this.properties.extIds.forEach((id) => {
|
|
66174
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66175
|
-
if (command) {
|
|
66176
|
-
standardCommands.push(command);
|
|
66177
|
-
}
|
|
66178
|
-
});
|
|
66179
|
-
}
|
|
66180
|
-
const { enableComments = true } = this.editor.options;
|
|
66181
|
-
if (!enableComments || this.editor.readonly) {
|
|
66182
|
-
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
66183
|
-
}
|
|
66184
|
-
if (this.editor.readonly) {
|
|
66185
|
-
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
66186
|
-
}
|
|
66187
|
-
standardCommands.forEach((item) => {
|
|
66188
|
-
if (item.id === "add-comment" || item.id === "edit") {
|
|
66189
|
-
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
66190
|
-
}
|
|
66191
|
-
});
|
|
66192
|
-
return standardCommands;
|
|
66193
|
-
}
|
|
66194
|
-
executeCommand(editor, block, item) {
|
|
66195
|
-
var _a, _b;
|
|
66196
|
-
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
66197
|
-
return;
|
|
66198
|
-
}
|
|
66199
|
-
if (item.id === "add-comment") {
|
|
66200
|
-
if (!addCommentToBlock(editor, block)) {
|
|
66201
|
-
logger$1e.error("failed to add comment to block");
|
|
66202
|
-
}
|
|
66203
|
-
return;
|
|
66204
|
-
}
|
|
66205
|
-
logger$1e.error(`unknown command: ${JSON.stringify(item)}`);
|
|
66206
|
-
}
|
|
66207
|
-
}
|
|
66208
|
-
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
66209
|
-
return {
|
|
66210
|
-
blockCommands: {
|
|
66211
|
-
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
66212
|
-
}
|
|
66213
|
-
};
|
|
66214
|
-
}
|
|
66215
|
-
class EmbedBlockResizer {
|
|
66216
|
-
constructor(editor) {
|
|
66217
|
-
__publicField(this, "resizing", false);
|
|
66218
|
-
__publicField(this, "blockResizer");
|
|
66219
|
-
__publicField(this, "handleResized", () => {
|
|
66220
|
-
this.resizing = false;
|
|
66221
|
-
});
|
|
66222
|
-
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
66223
|
-
var _a, _b;
|
|
66224
|
-
this.resizing = true;
|
|
66225
|
-
const block = resizer.getBlock();
|
|
66226
|
-
if (block) {
|
|
66227
|
-
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
66228
|
-
return;
|
|
66229
|
-
}
|
|
66230
|
-
const blockType = getEmbedType(block);
|
|
66231
|
-
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
66232
|
-
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
66233
|
-
const oldData = this.editor.getBlockData(block);
|
|
66234
|
-
const oldEmbedData = oldData.embedData;
|
|
66235
|
-
const newEmbedData = {
|
|
66236
|
-
...oldEmbedData,
|
|
66237
|
-
height
|
|
66238
|
-
};
|
|
66239
|
-
this.editor.updateEmbedData(block, newEmbedData);
|
|
66240
|
-
}
|
|
66241
|
-
});
|
|
66242
|
-
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
66243
|
-
if (this.resizing) {
|
|
66244
|
-
return;
|
|
66245
|
-
}
|
|
66246
|
-
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
66247
|
-
this.disableResizer();
|
|
66248
|
-
}
|
|
66249
|
-
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
66250
|
-
this.tryEnableResizer(block);
|
|
66251
|
-
}
|
|
66252
|
-
});
|
|
66253
|
-
__publicField(this, "handleEditorResize", () => {
|
|
66254
|
-
this.blockResizer.updateResizer();
|
|
66255
|
-
});
|
|
66256
|
-
this.editor = editor;
|
|
66257
|
-
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
66258
|
-
this.blockResizer = new BlockResizer(this.editor, {
|
|
66259
|
-
resize: ["bottom"]
|
|
66260
|
-
});
|
|
66261
|
-
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
66262
|
-
this.blockResizer.addListener("resized", this.handleResized);
|
|
66263
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
66264
|
-
}
|
|
66265
|
-
destroy() {
|
|
66266
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
66267
|
-
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
66268
|
-
}
|
|
66269
|
-
tryEnableResizer(block) {
|
|
66270
|
-
this.blockResizer.enableResize(block);
|
|
66271
|
-
}
|
|
66272
|
-
disableResizer() {
|
|
66273
|
-
this.blockResizer.disableResize();
|
|
66274
|
-
}
|
|
66275
|
-
static get(editor) {
|
|
66276
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66277
|
-
}
|
|
66278
|
-
static register(editor, block) {
|
|
66279
|
-
addClass(block, "resizable");
|
|
66280
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66281
|
-
}
|
|
66282
|
-
}
|
|
66283
66325
|
class ImageHoveringToolbarCommands$1 {
|
|
66284
66326
|
constructor(editor, block) {
|
|
66285
66327
|
__publicField(this, "group", "hovering-toolbar");
|
|
@@ -66351,7 +66393,7 @@ ${codeText}
|
|
|
66351
66393
|
executeCommand(editor, block, item) {
|
|
66352
66394
|
switch (item.id) {
|
|
66353
66395
|
case "addComment":
|
|
66354
|
-
addCommentToBlock(editor, block);
|
|
66396
|
+
addCommentToBlock$1(editor, block);
|
|
66355
66397
|
break;
|
|
66356
66398
|
case "left":
|
|
66357
66399
|
case "center":
|
|
@@ -67731,7 +67773,7 @@ ${codeText}
|
|
|
67731
67773
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
67732
67774
|
this.editor.addListener("resize", this.handleEditorResize);
|
|
67733
67775
|
this.editor.addListener("docChanged", this.handleDocChanged);
|
|
67734
|
-
this.editor.
|
|
67776
|
+
this.editor.domEvents.addEventListener(this.editor.scrollContainer, "wheel", (ed, e2) => this.handleScroll(e2), { passive: false });
|
|
67735
67777
|
this.items.forEach((item) => item.addListener("resize", this.handleItemResize));
|
|
67736
67778
|
this.groupItemHandlers = new CommentGroupItemHandlers(this, commentsProvider);
|
|
67737
67779
|
document.addEventListener("click", this.handleDocumentClick);
|
|
@@ -67740,7 +67782,6 @@ ${codeText}
|
|
|
67740
67782
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
67741
67783
|
this.editor.removeListener("resize", this.handleEditorResize);
|
|
67742
67784
|
this.editor.removeListener("docChanged", this.handleDocChanged);
|
|
67743
|
-
this.editor.scrollContainer.removeEventListener("wheel", this.handleScroll);
|
|
67744
67785
|
super.destroy();
|
|
67745
67786
|
this.unbindEvents();
|
|
67746
67787
|
this.removeAllListeners();
|
|
@@ -68615,7 +68656,7 @@ ${codeText}
|
|
|
68615
68656
|
const types2 = ["table", "layout"];
|
|
68616
68657
|
if (types2.includes(getBlockType(block))) {
|
|
68617
68658
|
editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
|
|
68618
|
-
comment = addCommentToBlock
|
|
68659
|
+
comment = addCommentToBlock(editor, block, this.provider);
|
|
68619
68660
|
}
|
|
68620
68661
|
}
|
|
68621
68662
|
comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
|
|
@@ -68636,7 +68677,7 @@ ${codeText}
|
|
|
68636
68677
|
try {
|
|
68637
68678
|
this.editorComments.showCommentList();
|
|
68638
68679
|
const block2 = editor.getBlockById(blockId);
|
|
68639
|
-
addCommentToBlock
|
|
68680
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
68640
68681
|
} catch (err) {
|
|
68641
68682
|
logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
68642
68683
|
}
|
|
@@ -68972,11 +69013,11 @@ ${codeText}
|
|
|
68972
69013
|
const { containerId } = path[path.length - 1];
|
|
68973
69014
|
const targetBlock = getParentBlock(getContainerById(editor, containerId));
|
|
68974
69015
|
if (targetBlock && getBlockType(targetBlock) === "code") {
|
|
68975
|
-
addCommentToBlock
|
|
69016
|
+
addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
|
|
68976
69017
|
return;
|
|
68977
69018
|
}
|
|
68978
69019
|
}
|
|
68979
|
-
addCommentToBlock
|
|
69020
|
+
addCommentToBlock(editor, block, editorComments.commentProvider);
|
|
68980
69021
|
return;
|
|
68981
69022
|
}
|
|
68982
69023
|
const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
|
|
@@ -69213,7 +69254,7 @@ ${codeText}
|
|
|
69213
69254
|
editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
|
|
69214
69255
|
const editorComments = editor2.getCustom("editor-comments");
|
|
69215
69256
|
editorComments.showCommentList();
|
|
69216
|
-
addCommentToBlock
|
|
69257
|
+
addCommentToBlock(editor2, block, editorComments.commentProvider);
|
|
69217
69258
|
}
|
|
69218
69259
|
}
|
|
69219
69260
|
};
|
|
@@ -69247,7 +69288,7 @@ ${codeText}
|
|
|
69247
69288
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
69248
69289
|
if (selectedBlock) {
|
|
69249
69290
|
const editorComments = editor.getCustom("editor-comments");
|
|
69250
|
-
addCommentToBlock
|
|
69291
|
+
addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
|
|
69251
69292
|
}
|
|
69252
69293
|
return;
|
|
69253
69294
|
}
|
|
@@ -69555,7 +69596,7 @@ ${codeText}
|
|
|
69555
69596
|
const popover = editor.options.componentsOptions.popover;
|
|
69556
69597
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
69557
69598
|
id: "table-row-column-toolbar",
|
|
69558
|
-
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
69599
|
+
overflowBoundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
|
|
69559
69600
|
refuseOverflow: true,
|
|
69560
69601
|
tooltipId: this.editor.clientId
|
|
69561
69602
|
});
|
|
@@ -69619,7 +69660,7 @@ ${codeText}
|
|
|
69619
69660
|
modifiers: [{
|
|
69620
69661
|
name: "flip",
|
|
69621
69662
|
options: {
|
|
69622
|
-
boundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
69663
|
+
boundary: isFunction$1(popover == null ? void 0 : popover.overflowBoundary) ? popover == null ? void 0 : popover.overflowBoundary() : popover == null ? void 0 : popover.overflowBoundary,
|
|
69623
69664
|
fallbackPlacements: ["left", "right"]
|
|
69624
69665
|
}
|
|
69625
69666
|
}]
|
|
@@ -76508,7 +76549,7 @@ ${content}
|
|
|
76508
76549
|
} else if (item.id === "download") {
|
|
76509
76550
|
downloadFile$1(editor, box);
|
|
76510
76551
|
} else if (item.id === "add-comment") {
|
|
76511
|
-
addCommentToBlock(editor, block);
|
|
76552
|
+
addCommentToBlock$1(editor, block);
|
|
76512
76553
|
}
|
|
76513
76554
|
}
|
|
76514
76555
|
}
|
|
@@ -76800,7 +76841,7 @@ ${content}
|
|
|
76800
76841
|
} else if (item.id === "download") {
|
|
76801
76842
|
downloadFile(editor, block);
|
|
76802
76843
|
} else if (item.id === "add-comment") {
|
|
76803
|
-
addCommentToBlock(editor, block);
|
|
76844
|
+
addCommentToBlock$1(editor, block);
|
|
76804
76845
|
}
|
|
76805
76846
|
}
|
|
76806
76847
|
}
|
|
@@ -79558,6 +79599,7 @@ ${content}
|
|
|
79558
79599
|
}
|
|
79559
79600
|
destroy() {
|
|
79560
79601
|
this.editor.doc.unregisterCallback(this);
|
|
79602
|
+
this.removeAllListeners();
|
|
79561
79603
|
}
|
|
79562
79604
|
isHeadingBlock(blockData) {
|
|
79563
79605
|
return !!blockData.heading;
|
|
@@ -80319,22 +80361,22 @@ ${content}
|
|
|
80319
80361
|
const image = createElement("img", ["editor-template-thumb"], imageContaniner);
|
|
80320
80362
|
image.src = imageSrc;
|
|
80321
80363
|
image.style.display = "none";
|
|
80322
|
-
image
|
|
80364
|
+
editor.domEvents.addEventListener(image, "error", () => {
|
|
80323
80365
|
var _a2;
|
|
80324
80366
|
const placeholder2 = (_a2 = options == null ? void 0 : options.placeHolderImageSrc) != null ? _a2 : TEMPLATE_PLACEHOLDER;
|
|
80325
80367
|
if (image.src !== placeholder2) {
|
|
80326
80368
|
image.src = placeholder2;
|
|
80327
80369
|
}
|
|
80328
|
-
};
|
|
80329
|
-
image
|
|
80370
|
+
});
|
|
80371
|
+
editor.domEvents.addEventListener(image, "load", () => {
|
|
80330
80372
|
image.style.display = "";
|
|
80331
|
-
};
|
|
80373
|
+
});
|
|
80332
80374
|
const nameDiv = createElement("div", ["editor-template-name"], card);
|
|
80333
80375
|
const span = createElement("span", [], nameDiv, name);
|
|
80334
80376
|
if (options == null ? void 0 : options.showTemplateTitleAttr) {
|
|
80335
80377
|
span.setAttribute("title", name);
|
|
80336
80378
|
}
|
|
80337
|
-
card
|
|
80379
|
+
editor.domEvents.addEventListener(card, "click", () => clickHandler(card));
|
|
80338
80380
|
return card;
|
|
80339
80381
|
}
|
|
80340
80382
|
function getDocThumbImage(editor, template) {
|
|
@@ -86306,7 +86348,7 @@ ${data2.flowchartText}
|
|
|
86306
86348
|
executeCommand(editor, block, item) {
|
|
86307
86349
|
switch (item.id) {
|
|
86308
86350
|
case "addComment":
|
|
86309
|
-
addCommentToBlock(editor, block);
|
|
86351
|
+
addCommentToBlock$1(editor, block);
|
|
86310
86352
|
break;
|
|
86311
86353
|
case "left":
|
|
86312
86354
|
case "center":
|
|
@@ -88076,20 +88118,32 @@ ${data2.flowchartText}
|
|
|
88076
88118
|
return docx.Packer.toBlob(doc2);
|
|
88077
88119
|
}
|
|
88078
88120
|
}
|
|
88121
|
+
class ExportImageError extends Error {
|
|
88122
|
+
constructor(message) {
|
|
88123
|
+
super(message);
|
|
88124
|
+
this.name = this.constructor.name;
|
|
88125
|
+
}
|
|
88126
|
+
}
|
|
88079
88127
|
const logger$1 = getLogger("editor-to-docx");
|
|
88128
|
+
const ERROR_MESSAGE = "editor-to-docx: read image error";
|
|
88080
88129
|
async function readImage(editor, _appId, _docId, _src) {
|
|
88081
|
-
|
|
88082
|
-
|
|
88083
|
-
|
|
88084
|
-
|
|
88085
|
-
|
|
88086
|
-
|
|
88087
|
-
if (
|
|
88088
|
-
|
|
88130
|
+
try {
|
|
88131
|
+
const url = editor.doc.buildResourceUrl(_src, { withToken: true });
|
|
88132
|
+
let file2 = await downloadImageToFile$1(url);
|
|
88133
|
+
if (!file2) {
|
|
88134
|
+
throw new Error(ERROR_MESSAGE);
|
|
88135
|
+
}
|
|
88136
|
+
if (file2.type.indexOf("/svg") !== -1) {
|
|
88137
|
+
const pngFile = await convertImageFileToPng(file2);
|
|
88138
|
+
if (pngFile) {
|
|
88139
|
+
file2 = new File([pngFile], file2.name);
|
|
88140
|
+
}
|
|
88089
88141
|
}
|
|
88142
|
+
const arrayBuffer = await file2.arrayBuffer();
|
|
88143
|
+
return [arrayBuffer, url];
|
|
88144
|
+
} catch (error2) {
|
|
88145
|
+
throw new ExportImageError(error2.message || ERROR_MESSAGE);
|
|
88090
88146
|
}
|
|
88091
|
-
const arrayBuffer = await file2.arrayBuffer();
|
|
88092
|
-
return [arrayBuffer, url];
|
|
88093
88147
|
}
|
|
88094
88148
|
async function getDocByBlock(editor, doc2, block) {
|
|
88095
88149
|
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
@@ -88323,13 +88377,7 @@ ${data2.flowchartText}
|
|
|
88323
88377
|
}
|
|
88324
88378
|
}
|
|
88325
88379
|
});
|
|
88326
|
-
editor.version = "2.2.8-beta.
|
|
88327
|
-
if (Logger$2.level === LogLevel.DEBUG) {
|
|
88328
|
-
window.setReauthFail = (fail) => {
|
|
88329
|
-
window.isReauthError = fail;
|
|
88330
|
-
};
|
|
88331
|
-
window.reConnect = (token) => editor.doc.externalDoc.client.connection.reConnect(token);
|
|
88332
|
-
}
|
|
88380
|
+
editor.version = "2.2.8-beta.10";
|
|
88333
88381
|
return editor;
|
|
88334
88382
|
}
|
|
88335
88383
|
function isDoc(doc2) {
|
|
@@ -88424,7 +88472,7 @@ ${data2.flowchartText}
|
|
|
88424
88472
|
});
|
|
88425
88473
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88426
88474
|
OnesEditorToolbar.register(editor);
|
|
88427
|
-
editor.version = "2.2.8-beta.
|
|
88475
|
+
editor.version = "2.2.8-beta.10";
|
|
88428
88476
|
return editor;
|
|
88429
88477
|
}
|
|
88430
88478
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134203,6 +134251,7 @@ ${data2.flowchartText}
|
|
|
134203
134251
|
exports2.EmbedBlockResizer = EmbedBlockResizer;
|
|
134204
134252
|
exports2.EnforceWithDocumentTitleHandler = EnforceWithDocumentTitleHandler;
|
|
134205
134253
|
exports2.EventCallbacks = EventCallbacks;
|
|
134254
|
+
exports2.ExportImageError = ExportImageError;
|
|
134206
134255
|
exports2.FILL_CHAR = FILL_CHAR;
|
|
134207
134256
|
exports2.FileExtError = FileExtError;
|
|
134208
134257
|
exports2.FixedToolbar = FixedToolbar;
|
|
@@ -134266,6 +134315,7 @@ ${data2.flowchartText}
|
|
|
134266
134315
|
exports2.ShareDBLocalDoc = ShareDBLocalDoc;
|
|
134267
134316
|
exports2.ShareDBServer = ShareDBServer;
|
|
134268
134317
|
exports2.SimpleCache = SimpleCache;
|
|
134318
|
+
exports2.StandardBoxCommands = StandardBoxCommands;
|
|
134269
134319
|
exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
|
|
134270
134320
|
exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
|
|
134271
134321
|
exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
|
|
@@ -134284,7 +134334,7 @@ ${data2.flowchartText}
|
|
|
134284
134334
|
exports2.addAttribute = addAttribute;
|
|
134285
134335
|
exports2.addClass = addClass;
|
|
134286
134336
|
exports2.addColor = addColor;
|
|
134287
|
-
exports2.addCommentToBlock = addCommentToBlock;
|
|
134337
|
+
exports2.addCommentToBlock = addCommentToBlock$1;
|
|
134288
134338
|
exports2.addDays = addDays;
|
|
134289
134339
|
exports2.addMetaToDoc = addMetaToDoc;
|
|
134290
134340
|
exports2.addMonths = addMonths;
|
|
@@ -134653,6 +134703,7 @@ ${data2.flowchartText}
|
|
|
134653
134703
|
exports2.isFirefox = isFirefox;
|
|
134654
134704
|
exports2.isFirstChildBlockInComplexBlock = isFirstChildBlockInComplexBlock;
|
|
134655
134705
|
exports2.isFullSelectedOneComplexBlock = isFullSelectedOneComplexBlock;
|
|
134706
|
+
exports2.isFunction = isFunction$1;
|
|
134656
134707
|
exports2.isHeadingBlock = isHeadingBlock$1;
|
|
134657
134708
|
exports2.isHighSurrogate = t$7;
|
|
134658
134709
|
exports2.isInBlock = isInBlock;
|