@ones-editor/editor 2.2.8-beta.1 → 2.2.8-beta.12
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/comments/src/comments-list/group-list.d.ts +1 -1
- 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/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/dist/index.js +859 -808
- 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;
|
|
@@ -11560,7 +11553,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11560
11553
|
}
|
|
11561
11554
|
this.editor.selectionHandler.handleMouseDown(event, { autoScroll: true });
|
|
11562
11555
|
}
|
|
11563
|
-
this.editor.input.focus();
|
|
11556
|
+
this.editor.input.focus({ preventScroll: true });
|
|
11564
11557
|
});
|
|
11565
11558
|
__publicField(this, "handleMouseMove", (event) => {
|
|
11566
11559
|
assert(logger$4p, this.mouseDownEvent, "no mouse down event");
|
|
@@ -13108,7 +13101,8 @@ var __publicField = (obj, key, value) => {
|
|
|
13108
13101
|
if (pointX < rect.left) {
|
|
13109
13102
|
x = rect.left;
|
|
13110
13103
|
} else if (pointX > rect.right) {
|
|
13111
|
-
|
|
13104
|
+
const offset = targetBlock && isTextKindBlock(editor, targetBlock) ? 3 : 50;
|
|
13105
|
+
x = rect.right - offset;
|
|
13112
13106
|
}
|
|
13113
13107
|
}
|
|
13114
13108
|
for (let i = 0; i < yOffsets.length; i++) {
|
|
@@ -14457,10 +14451,6 @@ var __publicField = (obj, key, value) => {
|
|
|
14457
14451
|
}
|
|
14458
14452
|
if (isTextBlockContentBoxChild(child)) {
|
|
14459
14453
|
const boxChild = child;
|
|
14460
|
-
const nextChild = children[i + 1];
|
|
14461
|
-
if (!nextChild) {
|
|
14462
|
-
break;
|
|
14463
|
-
}
|
|
14464
14454
|
const prevChild = children[i - 1];
|
|
14465
14455
|
if (prevChild) {
|
|
14466
14456
|
if (endAtNewLine(prevChild, boxChild)) {
|
|
@@ -14477,6 +14467,10 @@ var __publicField = (obj, key, value) => {
|
|
|
14477
14467
|
});
|
|
14478
14468
|
}
|
|
14479
14469
|
}
|
|
14470
|
+
const nextChild = children[i + 1];
|
|
14471
|
+
if (!nextChild) {
|
|
14472
|
+
break;
|
|
14473
|
+
}
|
|
14480
14474
|
if (nextChildStartsNewLine(boxChild, nextChild)) {
|
|
14481
14475
|
offset += 1;
|
|
14482
14476
|
lineBreaks.push({
|
|
@@ -25712,7 +25706,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25712
25706
|
if (enableHorizontal) {
|
|
25713
25707
|
animateScrollTo(target, {
|
|
25714
25708
|
elementToScroll: getScrollContainer$1(target, { horizontal: true }),
|
|
25715
|
-
disableHorizontal: false
|
|
25709
|
+
disableHorizontal: false,
|
|
25710
|
+
speed: options.speed
|
|
25716
25711
|
});
|
|
25717
25712
|
}
|
|
25718
25713
|
const mobileClient = editor.options.componentsOptions.mobile;
|
|
@@ -25720,7 +25715,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25720
25715
|
elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
|
|
25721
25716
|
disableHorizontal: true,
|
|
25722
25717
|
verticalOffset: options == null ? void 0 : options.verticalOffset,
|
|
25723
|
-
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
|
|
25718
|
+
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0,
|
|
25719
|
+
speed: options.speed
|
|
25724
25720
|
});
|
|
25725
25721
|
} else if (target.scrollIntoView) {
|
|
25726
25722
|
target.scrollIntoView({
|
|
@@ -27432,7 +27428,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27432
27428
|
}
|
|
27433
27429
|
const logger$3g = getLogger("table-scroll");
|
|
27434
27430
|
class DomEventHandler {
|
|
27435
|
-
constructor(editor, dom, name, handler, data2) {
|
|
27431
|
+
constructor(editor, dom, name, handler, data2, options) {
|
|
27436
27432
|
__publicField(this, "handleEvent", (event) => {
|
|
27437
27433
|
this.handler(this.editor, event, this.data);
|
|
27438
27434
|
});
|
|
@@ -27441,7 +27437,7 @@ var __publicField = (obj, key, value) => {
|
|
|
27441
27437
|
this.name = name;
|
|
27442
27438
|
this.handler = handler;
|
|
27443
27439
|
this.data = data2;
|
|
27444
|
-
dom.addEventListener(name, this.handleEvent);
|
|
27440
|
+
dom.addEventListener(name, this.handleEvent, options);
|
|
27445
27441
|
}
|
|
27446
27442
|
destroy() {
|
|
27447
27443
|
this.dom.removeEventListener(this.name, this.handleEvent);
|
|
@@ -27458,16 +27454,16 @@ var __publicField = (obj, key, value) => {
|
|
|
27458
27454
|
this.handlers.delete(element);
|
|
27459
27455
|
});
|
|
27460
27456
|
}
|
|
27461
|
-
addEventListener(element, eventName, eventHandler, data2) {
|
|
27457
|
+
addEventListener(element, eventName, eventHandler, data2, options) {
|
|
27462
27458
|
const existsHandlers = this.handlers.get(element);
|
|
27463
27459
|
if (existsHandlers) {
|
|
27464
27460
|
if (existsHandlers.find((handler) => handler.handler === eventHandler && handler.name === eventName)) {
|
|
27465
27461
|
logger$3g.warn(`event has already registered: ${eventName}`);
|
|
27466
27462
|
return;
|
|
27467
27463
|
}
|
|
27468
|
-
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2));
|
|
27464
|
+
existsHandlers.push(new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options));
|
|
27469
27465
|
} else {
|
|
27470
|
-
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2);
|
|
27466
|
+
const handler = new DomEventHandler(this.editor, element, eventName, eventHandler, data2, options);
|
|
27471
27467
|
this.handlers.set(element, [handler]);
|
|
27472
27468
|
}
|
|
27473
27469
|
}
|
|
@@ -39900,17 +39896,23 @@ ${codeText}
|
|
|
39900
39896
|
return true;
|
|
39901
39897
|
}
|
|
39902
39898
|
if (event.key === "ArrowUp") {
|
|
39903
|
-
const
|
|
39904
|
-
this.
|
|
39905
|
-
|
|
39906
|
-
|
|
39907
|
-
|
|
39899
|
+
const curr = this.getSelectedItemIndex();
|
|
39900
|
+
const prev = this.getPrevItemIndex(curr);
|
|
39901
|
+
if (curr !== prev) {
|
|
39902
|
+
this.startPauseMouseEnter();
|
|
39903
|
+
this.selectItem(this.items[prev].id);
|
|
39904
|
+
event.preventDefault();
|
|
39905
|
+
event.stopPropagation();
|
|
39906
|
+
}
|
|
39908
39907
|
} else if (event.key === "ArrowDown") {
|
|
39909
|
-
const
|
|
39910
|
-
this.
|
|
39911
|
-
|
|
39912
|
-
|
|
39913
|
-
|
|
39908
|
+
const curr = this.getSelectedItemIndex();
|
|
39909
|
+
const next2 = this.getNextItemIndex(curr);
|
|
39910
|
+
if (curr !== next2) {
|
|
39911
|
+
this.startPauseMouseEnter();
|
|
39912
|
+
this.selectItem(this.items[next2].id);
|
|
39913
|
+
event.preventDefault();
|
|
39914
|
+
event.stopPropagation();
|
|
39915
|
+
}
|
|
39914
39916
|
} else if (event.key === "ArrowRight") {
|
|
39915
39917
|
const item = this.getSelectedItem();
|
|
39916
39918
|
if (item && item.children) {
|
|
@@ -40116,7 +40118,7 @@ ${codeText}
|
|
|
40116
40118
|
this.emit("click", this, item, target);
|
|
40117
40119
|
}
|
|
40118
40120
|
createPopperOptions() {
|
|
40119
|
-
var _a, _b;
|
|
40121
|
+
var _a, _b, _c;
|
|
40120
40122
|
const popperOptions = { modifiers: [] };
|
|
40121
40123
|
const overflowBoundary = this.options.overflowBoundary;
|
|
40122
40124
|
const padding = this.options.padding;
|
|
@@ -40127,7 +40129,13 @@ ${codeText}
|
|
|
40127
40129
|
phase: "main",
|
|
40128
40130
|
fn: ({ state }) => {
|
|
40129
40131
|
const popper = state.elements.popper;
|
|
40130
|
-
|
|
40132
|
+
const popperRect = popper.getBoundingClientRect();
|
|
40133
|
+
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40134
|
+
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40135
|
+
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40136
|
+
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40137
|
+
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40138
|
+
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40131
40139
|
popper.setAttribute("data-tippy-hidden", "");
|
|
40132
40140
|
} else {
|
|
40133
40141
|
popper.removeAttribute("data-tippy-hidden");
|
|
@@ -40143,6 +40151,10 @@ ${codeText}
|
|
|
40143
40151
|
}
|
|
40144
40152
|
});
|
|
40145
40153
|
}
|
|
40154
|
+
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40155
|
+
name: "flip",
|
|
40156
|
+
enabled: false
|
|
40157
|
+
});
|
|
40146
40158
|
return popperOptions;
|
|
40147
40159
|
}
|
|
40148
40160
|
destroy() {
|
|
@@ -40489,6 +40501,9 @@ ${codeText}
|
|
|
40489
40501
|
static hasExistsCommandBar() {
|
|
40490
40502
|
return !!document.querySelector("[data-command-bar-id]");
|
|
40491
40503
|
}
|
|
40504
|
+
static hideAll() {
|
|
40505
|
+
tippy$1.hideAll();
|
|
40506
|
+
}
|
|
40492
40507
|
};
|
|
40493
40508
|
let CommandBar = _CommandBar;
|
|
40494
40509
|
__publicField(CommandBar, "commandBarCreators", /* @__PURE__ */ new Map());
|
|
@@ -46984,7 +46999,413 @@ ${codeText}
|
|
|
46984
46999
|
}
|
|
46985
47000
|
return rects[0];
|
|
46986
47001
|
}
|
|
46987
|
-
const
|
|
47002
|
+
const zhCN$v = {
|
|
47003
|
+
embedProperties: {
|
|
47004
|
+
edit: "\u7F16\u8F91",
|
|
47005
|
+
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
47006
|
+
}
|
|
47007
|
+
};
|
|
47008
|
+
const enUS$v = {
|
|
47009
|
+
embedProperties: {
|
|
47010
|
+
edit: "Edit",
|
|
47011
|
+
addComment: "Add annotation"
|
|
47012
|
+
}
|
|
47013
|
+
};
|
|
47014
|
+
const jaJP$v = {
|
|
47015
|
+
embedProperties: {
|
|
47016
|
+
edit: "\u7DE8\u96C6",
|
|
47017
|
+
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
47018
|
+
}
|
|
47019
|
+
};
|
|
47020
|
+
i18n$1.mergeLang({
|
|
47021
|
+
"zh-CN": zhCN$v,
|
|
47022
|
+
"en-US": enUS$v,
|
|
47023
|
+
"ja-JP": jaJP$v
|
|
47024
|
+
});
|
|
47025
|
+
const logger$24 = getLogger("embed-block-properties");
|
|
47026
|
+
function addCommentToBlock$1(editor, block) {
|
|
47027
|
+
var _a;
|
|
47028
|
+
for (const hook of editor.blockHooks) {
|
|
47029
|
+
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
47030
|
+
if (!commands) {
|
|
47031
|
+
continue;
|
|
47032
|
+
}
|
|
47033
|
+
if (commands.group === "block-comment-actions") {
|
|
47034
|
+
const command = commands.commands[0];
|
|
47035
|
+
if (!command) {
|
|
47036
|
+
continue;
|
|
47037
|
+
}
|
|
47038
|
+
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
47039
|
+
return true;
|
|
47040
|
+
}
|
|
47041
|
+
}
|
|
47042
|
+
return false;
|
|
47043
|
+
}
|
|
47044
|
+
class StandardEmbedBlockCommands {
|
|
47045
|
+
constructor(editor, block, properties) {
|
|
47046
|
+
__publicField(this, "group", "hovering-toolbar");
|
|
47047
|
+
__publicField(this, "_commands", [{
|
|
47048
|
+
id: "edit",
|
|
47049
|
+
name: i18n$1.t("embedProperties.edit"),
|
|
47050
|
+
icon: EditIcon
|
|
47051
|
+
}, {
|
|
47052
|
+
id: "separator",
|
|
47053
|
+
name: "",
|
|
47054
|
+
type: "separator"
|
|
47055
|
+
}]);
|
|
47056
|
+
this.editor = editor;
|
|
47057
|
+
this.block = block;
|
|
47058
|
+
this.properties = properties;
|
|
47059
|
+
}
|
|
47060
|
+
get commands() {
|
|
47061
|
+
var _a, _b, _c, _d;
|
|
47062
|
+
if (clientType.isMobile) {
|
|
47063
|
+
return [];
|
|
47064
|
+
}
|
|
47065
|
+
let standardCommands = [];
|
|
47066
|
+
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
47067
|
+
this.properties.presetIds.forEach((id) => {
|
|
47068
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47069
|
+
if (command) {
|
|
47070
|
+
standardCommands.push(command);
|
|
47071
|
+
}
|
|
47072
|
+
});
|
|
47073
|
+
}
|
|
47074
|
+
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
47075
|
+
standardCommands.push(...this.properties.extCommands);
|
|
47076
|
+
}
|
|
47077
|
+
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
47078
|
+
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
47079
|
+
}
|
|
47080
|
+
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
47081
|
+
this.properties.extIds.forEach((id) => {
|
|
47082
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47083
|
+
if (command) {
|
|
47084
|
+
standardCommands.push(command);
|
|
47085
|
+
}
|
|
47086
|
+
});
|
|
47087
|
+
}
|
|
47088
|
+
const { enableComments = true } = this.editor.options;
|
|
47089
|
+
if (!enableComments || this.editor.readonly) {
|
|
47090
|
+
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
47091
|
+
}
|
|
47092
|
+
if (this.editor.readonly) {
|
|
47093
|
+
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
47094
|
+
}
|
|
47095
|
+
standardCommands.forEach((item) => {
|
|
47096
|
+
if (item.id === "add-comment" || item.id === "edit") {
|
|
47097
|
+
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
47098
|
+
}
|
|
47099
|
+
});
|
|
47100
|
+
return standardCommands;
|
|
47101
|
+
}
|
|
47102
|
+
executeCommand(editor, block, item) {
|
|
47103
|
+
var _a, _b;
|
|
47104
|
+
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
47105
|
+
return;
|
|
47106
|
+
}
|
|
47107
|
+
if (item.id === "add-comment") {
|
|
47108
|
+
if (!addCommentToBlock$1(editor, block)) {
|
|
47109
|
+
logger$24.error("failed to add comment to block");
|
|
47110
|
+
}
|
|
47111
|
+
return;
|
|
47112
|
+
}
|
|
47113
|
+
logger$24.error(`unknown command: ${JSON.stringify(item)}`);
|
|
47114
|
+
}
|
|
47115
|
+
}
|
|
47116
|
+
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
47117
|
+
return {
|
|
47118
|
+
blockCommands: {
|
|
47119
|
+
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
47120
|
+
}
|
|
47121
|
+
};
|
|
47122
|
+
}
|
|
47123
|
+
function createResizeGripper(parent, type) {
|
|
47124
|
+
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
47125
|
+
elem.setAttribute("data-resize-type", type);
|
|
47126
|
+
}
|
|
47127
|
+
function getExistsResizer(block) {
|
|
47128
|
+
const tools = getBlockTools(block);
|
|
47129
|
+
return tools.querySelector(".block-resizer");
|
|
47130
|
+
}
|
|
47131
|
+
function hideResizer(block) {
|
|
47132
|
+
const exists = getExistsResizer(block);
|
|
47133
|
+
if (exists) {
|
|
47134
|
+
removeClass(exists, "active");
|
|
47135
|
+
}
|
|
47136
|
+
}
|
|
47137
|
+
function updateSize(block, element, resizer) {
|
|
47138
|
+
const blockRect = block.getBoundingClientRect();
|
|
47139
|
+
const elementRect = element.getBoundingClientRect();
|
|
47140
|
+
const top = elementRect.top - blockRect.top;
|
|
47141
|
+
const left = elementRect.left - blockRect.left;
|
|
47142
|
+
const width = elementRect.width;
|
|
47143
|
+
const height = elementRect.height;
|
|
47144
|
+
resizer.style.top = `${top}px`;
|
|
47145
|
+
resizer.style.left = `${left}px`;
|
|
47146
|
+
resizer.style.width = `${width}px`;
|
|
47147
|
+
resizer.style.height = `${height}px`;
|
|
47148
|
+
}
|
|
47149
|
+
function createResizer(block, element, options, mouseDownEvent) {
|
|
47150
|
+
const exists = getExistsResizer(block);
|
|
47151
|
+
if (exists) {
|
|
47152
|
+
addClass(exists, "active");
|
|
47153
|
+
updateSize(block, element, exists);
|
|
47154
|
+
return exists;
|
|
47155
|
+
}
|
|
47156
|
+
const tools = getBlockTools(block);
|
|
47157
|
+
const resizer = createElement("div", ["block-resizer"], tools);
|
|
47158
|
+
updateSize(block, element, resizer);
|
|
47159
|
+
options.resize.forEach((type) => {
|
|
47160
|
+
createResizeGripper(resizer, type);
|
|
47161
|
+
});
|
|
47162
|
+
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
47163
|
+
addClass(resizer, "active");
|
|
47164
|
+
return resizer;
|
|
47165
|
+
}
|
|
47166
|
+
function updateResizer(block, element) {
|
|
47167
|
+
const resizer = getExistsResizer(block);
|
|
47168
|
+
if (!resizer) {
|
|
47169
|
+
return;
|
|
47170
|
+
}
|
|
47171
|
+
if (!isChildNode(block, element)) {
|
|
47172
|
+
return;
|
|
47173
|
+
}
|
|
47174
|
+
const blockRect = block.getBoundingClientRect();
|
|
47175
|
+
const elementRect = element.getBoundingClientRect();
|
|
47176
|
+
const top = elementRect.top - blockRect.top;
|
|
47177
|
+
const left = elementRect.left - blockRect.left;
|
|
47178
|
+
const width = elementRect.width;
|
|
47179
|
+
const height = elementRect.height;
|
|
47180
|
+
resizer.style.top = `${top}px`;
|
|
47181
|
+
resizer.style.left = `${left}px`;
|
|
47182
|
+
resizer.style.width = `${width}px`;
|
|
47183
|
+
resizer.style.height = `${height}px`;
|
|
47184
|
+
}
|
|
47185
|
+
const style$a = "";
|
|
47186
|
+
const logger$23 = getLogger("block-resizer");
|
|
47187
|
+
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
47188
|
+
constructor(editor, options) {
|
|
47189
|
+
super();
|
|
47190
|
+
__publicField(this, "resizableElement");
|
|
47191
|
+
__publicField(this, "block", null);
|
|
47192
|
+
__publicField(this, "startRect", null);
|
|
47193
|
+
__publicField(this, "startPos", null);
|
|
47194
|
+
__publicField(this, "resizeType", null);
|
|
47195
|
+
__publicField(this, "enabled", false);
|
|
47196
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47197
|
+
if (this.block) {
|
|
47198
|
+
this.updateResizer();
|
|
47199
|
+
}
|
|
47200
|
+
});
|
|
47201
|
+
__publicField(this, "handleMouseDown", (event) => {
|
|
47202
|
+
event.preventDefault();
|
|
47203
|
+
event.stopPropagation();
|
|
47204
|
+
const element = this.getResizableElement();
|
|
47205
|
+
if (!element) {
|
|
47206
|
+
return;
|
|
47207
|
+
}
|
|
47208
|
+
if (event.button !== 0) {
|
|
47209
|
+
return;
|
|
47210
|
+
}
|
|
47211
|
+
const gripper = event.target;
|
|
47212
|
+
if (!gripper) {
|
|
47213
|
+
return;
|
|
47214
|
+
}
|
|
47215
|
+
if (!(gripper instanceof HTMLElement)) {
|
|
47216
|
+
return;
|
|
47217
|
+
}
|
|
47218
|
+
const resizeType = gripper.getAttribute("data-resize-type");
|
|
47219
|
+
if (!resizeType) {
|
|
47220
|
+
return;
|
|
47221
|
+
}
|
|
47222
|
+
this.bindEvents();
|
|
47223
|
+
this.startRect = element.getBoundingClientRect();
|
|
47224
|
+
this.startPos = event;
|
|
47225
|
+
this.resizeType = resizeType;
|
|
47226
|
+
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
47227
|
+
if (this.block) {
|
|
47228
|
+
this.editor.selection.selectBlock(this.block, 0);
|
|
47229
|
+
}
|
|
47230
|
+
});
|
|
47231
|
+
__publicField(this, "handleMouseMove", (event) => {
|
|
47232
|
+
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
47233
|
+
return;
|
|
47234
|
+
}
|
|
47235
|
+
const element = this.getResizableElement();
|
|
47236
|
+
if (!element || !this.block) {
|
|
47237
|
+
return;
|
|
47238
|
+
}
|
|
47239
|
+
const deltaX = event.x - this.startPos.x;
|
|
47240
|
+
const deltaY = event.y - this.startPos.y;
|
|
47241
|
+
const oldRect = this.startRect;
|
|
47242
|
+
let { top, left, right, bottom } = oldRect;
|
|
47243
|
+
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
47244
|
+
bottom += deltaY;
|
|
47245
|
+
}
|
|
47246
|
+
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
47247
|
+
top += deltaY;
|
|
47248
|
+
}
|
|
47249
|
+
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
47250
|
+
left += deltaX;
|
|
47251
|
+
}
|
|
47252
|
+
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
47253
|
+
right += deltaX;
|
|
47254
|
+
}
|
|
47255
|
+
const width = right > left ? right - left : 0;
|
|
47256
|
+
const height = bottom > top ? bottom - top : 0;
|
|
47257
|
+
const newRect = new DOMRect(left, top, width, height);
|
|
47258
|
+
this.emit("resizing", this, newRect);
|
|
47259
|
+
const newElement = this.getResizableElement();
|
|
47260
|
+
if (newElement) {
|
|
47261
|
+
updateResizer(this.block, newElement);
|
|
47262
|
+
}
|
|
47263
|
+
});
|
|
47264
|
+
__publicField(this, "handleMouseUp", (event) => {
|
|
47265
|
+
if (event.button !== 0) {
|
|
47266
|
+
return;
|
|
47267
|
+
}
|
|
47268
|
+
setDefaultCursor("");
|
|
47269
|
+
this.unbindEvents();
|
|
47270
|
+
this.emit("resized", this);
|
|
47271
|
+
const element = this.getResizableElement();
|
|
47272
|
+
if (!element || !this.block) {
|
|
47273
|
+
return;
|
|
47274
|
+
}
|
|
47275
|
+
updateResizer(this.block, element);
|
|
47276
|
+
});
|
|
47277
|
+
this.editor = editor;
|
|
47278
|
+
this.options = options;
|
|
47279
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47280
|
+
}
|
|
47281
|
+
enableResize(block, resizableElement) {
|
|
47282
|
+
this.block = block;
|
|
47283
|
+
this.resizableElement = resizableElement;
|
|
47284
|
+
this.createResizer();
|
|
47285
|
+
this.enabled = true;
|
|
47286
|
+
}
|
|
47287
|
+
disableResize() {
|
|
47288
|
+
if (!this.block) {
|
|
47289
|
+
return;
|
|
47290
|
+
}
|
|
47291
|
+
hideResizer(this.block);
|
|
47292
|
+
this.enabled = false;
|
|
47293
|
+
}
|
|
47294
|
+
update(block, resizableElement) {
|
|
47295
|
+
this.block = block;
|
|
47296
|
+
this.resizableElement = resizableElement;
|
|
47297
|
+
const elem = this.getResizableElement();
|
|
47298
|
+
if (elem && this.enabled) {
|
|
47299
|
+
this.createResizer();
|
|
47300
|
+
}
|
|
47301
|
+
}
|
|
47302
|
+
updateResizer() {
|
|
47303
|
+
const newElement = this.getResizableElement();
|
|
47304
|
+
if (newElement && this.block) {
|
|
47305
|
+
updateResizer(this.block, newElement);
|
|
47306
|
+
}
|
|
47307
|
+
}
|
|
47308
|
+
getBlock() {
|
|
47309
|
+
return this.block;
|
|
47310
|
+
}
|
|
47311
|
+
destroy() {
|
|
47312
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47313
|
+
}
|
|
47314
|
+
getResizableElement() {
|
|
47315
|
+
if (this.resizableElement) {
|
|
47316
|
+
return this.resizableElement;
|
|
47317
|
+
}
|
|
47318
|
+
if (!this.block) {
|
|
47319
|
+
return null;
|
|
47320
|
+
}
|
|
47321
|
+
return getBlockContent(this.block);
|
|
47322
|
+
}
|
|
47323
|
+
createResizer() {
|
|
47324
|
+
const element = this.getResizableElement();
|
|
47325
|
+
if (!element || !this.block) {
|
|
47326
|
+
return;
|
|
47327
|
+
}
|
|
47328
|
+
assert(logger$23, isChildNode(this.block, element), "not a block child element");
|
|
47329
|
+
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
47330
|
+
}
|
|
47331
|
+
bindEvents() {
|
|
47332
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
47333
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
47334
|
+
}
|
|
47335
|
+
unbindEvents() {
|
|
47336
|
+
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
47337
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
47338
|
+
}
|
|
47339
|
+
}
|
|
47340
|
+
class EmbedBlockResizer {
|
|
47341
|
+
constructor(editor) {
|
|
47342
|
+
__publicField(this, "resizing", false);
|
|
47343
|
+
__publicField(this, "blockResizer");
|
|
47344
|
+
__publicField(this, "handleResized", () => {
|
|
47345
|
+
this.resizing = false;
|
|
47346
|
+
});
|
|
47347
|
+
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
47348
|
+
var _a, _b;
|
|
47349
|
+
this.resizing = true;
|
|
47350
|
+
const block = resizer.getBlock();
|
|
47351
|
+
if (block) {
|
|
47352
|
+
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
47353
|
+
return;
|
|
47354
|
+
}
|
|
47355
|
+
const blockType = getEmbedType(block);
|
|
47356
|
+
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
47357
|
+
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
47358
|
+
const oldData = this.editor.getBlockData(block);
|
|
47359
|
+
const oldEmbedData = oldData.embedData;
|
|
47360
|
+
const newEmbedData = {
|
|
47361
|
+
...oldEmbedData,
|
|
47362
|
+
height
|
|
47363
|
+
};
|
|
47364
|
+
this.editor.updateEmbedData(block, newEmbedData);
|
|
47365
|
+
}
|
|
47366
|
+
});
|
|
47367
|
+
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
47368
|
+
if (this.resizing) {
|
|
47369
|
+
return;
|
|
47370
|
+
}
|
|
47371
|
+
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
47372
|
+
this.disableResizer();
|
|
47373
|
+
}
|
|
47374
|
+
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
47375
|
+
this.tryEnableResizer(block);
|
|
47376
|
+
}
|
|
47377
|
+
});
|
|
47378
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47379
|
+
this.blockResizer.updateResizer();
|
|
47380
|
+
});
|
|
47381
|
+
this.editor = editor;
|
|
47382
|
+
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
47383
|
+
this.blockResizer = new BlockResizer(this.editor, {
|
|
47384
|
+
resize: ["bottom"]
|
|
47385
|
+
});
|
|
47386
|
+
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
47387
|
+
this.blockResizer.addListener("resized", this.handleResized);
|
|
47388
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47389
|
+
}
|
|
47390
|
+
destroy() {
|
|
47391
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47392
|
+
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
47393
|
+
}
|
|
47394
|
+
tryEnableResizer(block) {
|
|
47395
|
+
this.blockResizer.enableResize(block);
|
|
47396
|
+
}
|
|
47397
|
+
disableResizer() {
|
|
47398
|
+
this.blockResizer.disableResize();
|
|
47399
|
+
}
|
|
47400
|
+
static get(editor) {
|
|
47401
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47402
|
+
}
|
|
47403
|
+
static register(editor, block) {
|
|
47404
|
+
addClass(block, "resizable");
|
|
47405
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47406
|
+
}
|
|
47407
|
+
}
|
|
47408
|
+
const logger$22 = getLogger("exclusive-block");
|
|
46988
47409
|
function addExclusiveStyle(editor, block, userId, displayName) {
|
|
46989
47410
|
var _a;
|
|
46990
47411
|
addClass(block, "block-exclusive");
|
|
@@ -47002,7 +47423,7 @@ ${codeText}
|
|
|
47002
47423
|
block.removeAttribute("data-exclusive-tips");
|
|
47003
47424
|
}
|
|
47004
47425
|
function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
|
|
47005
|
-
logger$
|
|
47426
|
+
logger$22.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
|
|
47006
47427
|
if (exclusive) {
|
|
47007
47428
|
addExclusiveStyle(editor, block, userId, displayName);
|
|
47008
47429
|
} else {
|
|
@@ -47159,28 +47580,28 @@ ${codeText}
|
|
|
47159
47580
|
}
|
|
47160
47581
|
}
|
|
47161
47582
|
const exclusiveBlockStyles = "";
|
|
47162
|
-
const zhCN$
|
|
47583
|
+
const zhCN$u = {
|
|
47163
47584
|
exclusive: {
|
|
47164
47585
|
tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
|
|
47165
47586
|
fallbackAbstract: "\u8BE5 Block"
|
|
47166
47587
|
}
|
|
47167
47588
|
};
|
|
47168
|
-
const enUS$
|
|
47589
|
+
const enUS$u = {
|
|
47169
47590
|
exclusive: {
|
|
47170
47591
|
tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
|
|
47171
47592
|
fallbackAbstract: "This Block"
|
|
47172
47593
|
}
|
|
47173
47594
|
};
|
|
47174
|
-
const jaJP$
|
|
47595
|
+
const jaJP$u = {
|
|
47175
47596
|
exclusive: {
|
|
47176
47597
|
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
47598
|
fallbackAbstract: "\u3053\u306E\u8981\u7D20"
|
|
47178
47599
|
}
|
|
47179
47600
|
};
|
|
47180
47601
|
i18n$1.mergeLang({
|
|
47181
|
-
"zh-CN": zhCN$
|
|
47182
|
-
"en-US": enUS$
|
|
47183
|
-
"ja-JP": jaJP$
|
|
47602
|
+
"zh-CN": zhCN$u,
|
|
47603
|
+
"en-US": enUS$u,
|
|
47604
|
+
"ja-JP": jaJP$u
|
|
47184
47605
|
});
|
|
47185
47606
|
function getBlockInfo(editor, block) {
|
|
47186
47607
|
const data2 = editor.getBlockData(block);
|
|
@@ -47356,22 +47777,22 @@ ${codeText}
|
|
|
47356
47777
|
};
|
|
47357
47778
|
}
|
|
47358
47779
|
}
|
|
47359
|
-
const style$
|
|
47360
|
-
const zhCN$
|
|
47780
|
+
const style$9 = "";
|
|
47781
|
+
const zhCN$t = {
|
|
47361
47782
|
locker: {
|
|
47362
47783
|
lock: "\u9501\u5B9A",
|
|
47363
47784
|
unlock: "\u89E3\u9664\u9501\u5B9A",
|
|
47364
47785
|
lockedBy: "\u88AB {name} \u9501\u5B9A"
|
|
47365
47786
|
}
|
|
47366
47787
|
};
|
|
47367
|
-
const enUS$
|
|
47788
|
+
const enUS$t = {
|
|
47368
47789
|
locker: {
|
|
47369
47790
|
lock: "Lock",
|
|
47370
47791
|
unlock: "Unlock",
|
|
47371
47792
|
lockedBy: "Locked by {name}"
|
|
47372
47793
|
}
|
|
47373
47794
|
};
|
|
47374
|
-
const jaJP$
|
|
47795
|
+
const jaJP$t = {
|
|
47375
47796
|
locker: {
|
|
47376
47797
|
lock: "\u30ED\u30C3\u30AF",
|
|
47377
47798
|
unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
|
|
@@ -47379,9 +47800,9 @@ ${codeText}
|
|
|
47379
47800
|
}
|
|
47380
47801
|
};
|
|
47381
47802
|
i18n$1.mergeLang({
|
|
47382
|
-
"zh-CN": zhCN$
|
|
47383
|
-
"en-US": enUS$
|
|
47384
|
-
"ja-JP": jaJP$
|
|
47803
|
+
"zh-CN": zhCN$t,
|
|
47804
|
+
"en-US": enUS$t,
|
|
47805
|
+
"ja-JP": jaJP$t
|
|
47385
47806
|
});
|
|
47386
47807
|
class BlockLockerPasteHandler {
|
|
47387
47808
|
async handleBeforePasteDoc(editor, doc2) {
|
|
@@ -47393,7 +47814,7 @@ ${codeText}
|
|
|
47393
47814
|
return false;
|
|
47394
47815
|
}
|
|
47395
47816
|
}
|
|
47396
|
-
const logger$
|
|
47817
|
+
const logger$21 = getLogger("context-menu-utils");
|
|
47397
47818
|
function blobToString(blob) {
|
|
47398
47819
|
return new Promise((resolve, reject) => {
|
|
47399
47820
|
const reader = new FileReader();
|
|
@@ -47414,7 +47835,7 @@ ${codeText}
|
|
|
47414
47835
|
const types2 = items[0].types;
|
|
47415
47836
|
return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
|
|
47416
47837
|
} catch (error2) {
|
|
47417
|
-
logger$
|
|
47838
|
+
logger$21.warn(`Failed to read clipboard data: ${error2}`);
|
|
47418
47839
|
return true;
|
|
47419
47840
|
}
|
|
47420
47841
|
}
|
|
@@ -47463,7 +47884,7 @@ ${codeText}
|
|
|
47463
47884
|
}
|
|
47464
47885
|
return dataTransfer;
|
|
47465
47886
|
}
|
|
47466
|
-
const logger$
|
|
47887
|
+
const logger$20 = getLogger("ClipboardProvider");
|
|
47467
47888
|
class ClipboardProvider {
|
|
47468
47889
|
constructor(editor, options) {
|
|
47469
47890
|
__publicField(this, "id", "ClipboardProvider");
|
|
@@ -47549,7 +47970,7 @@ ${codeText}
|
|
|
47549
47970
|
}
|
|
47550
47971
|
}).catch((err) => {
|
|
47551
47972
|
this.clipboardPermission.read = "denied";
|
|
47552
|
-
logger$
|
|
47973
|
+
logger$20.log(err);
|
|
47553
47974
|
});
|
|
47554
47975
|
} catch (error2) {
|
|
47555
47976
|
this.clipboardPermission = {
|
|
@@ -47610,13 +48031,14 @@ ${codeText}
|
|
|
47610
48031
|
}
|
|
47611
48032
|
}
|
|
47612
48033
|
class StandardBoxCommands {
|
|
47613
|
-
constructor(editor) {
|
|
48034
|
+
constructor(editor, extIds) {
|
|
47614
48035
|
__publicField(this, "group", "standard-box-commands");
|
|
47615
48036
|
__publicField(this, "providers", []);
|
|
47616
48037
|
this.editor = editor;
|
|
47617
|
-
|
|
47618
|
-
|
|
47619
|
-
|
|
48038
|
+
this.extIds = extIds;
|
|
48039
|
+
}
|
|
48040
|
+
addProvider(provider) {
|
|
48041
|
+
this.providers.push(provider);
|
|
47620
48042
|
}
|
|
47621
48043
|
get commands() {
|
|
47622
48044
|
if (this.editor.readonly) {
|
|
@@ -47624,8 +48046,17 @@ ${codeText}
|
|
|
47624
48046
|
}
|
|
47625
48047
|
const items = [];
|
|
47626
48048
|
const focusedBlock = this.editor.selection.focusedBlock;
|
|
48049
|
+
const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
|
|
47627
48050
|
for (const provider of this.providers) {
|
|
47628
|
-
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
|
|
48051
|
+
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
|
|
48052
|
+
}
|
|
48053
|
+
for (const extId of this.extIds || []) {
|
|
48054
|
+
if (extId === "separator") {
|
|
48055
|
+
items.push({ id: "sep", name: "", type: "separator" });
|
|
48056
|
+
}
|
|
48057
|
+
if (extId === "add-comment") {
|
|
48058
|
+
items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
|
|
48059
|
+
}
|
|
47629
48060
|
}
|
|
47630
48061
|
return items;
|
|
47631
48062
|
}
|
|
@@ -47634,19 +48065,27 @@ ${codeText}
|
|
|
47634
48065
|
const { start, end } = getChildOffset(block, box);
|
|
47635
48066
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
47636
48067
|
for (const provider of this.providers) {
|
|
47637
|
-
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
|
|
48068
|
+
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
|
|
47638
48069
|
return;
|
|
47639
48070
|
}
|
|
47640
|
-
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
|
|
48071
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
|
|
47641
48072
|
return;
|
|
47642
48073
|
}
|
|
47643
48074
|
}
|
|
48075
|
+
if (item.id === "add-comment") {
|
|
48076
|
+
addCommentToBlock$1(editor, block);
|
|
48077
|
+
}
|
|
47644
48078
|
}
|
|
47645
|
-
static create(editor) {
|
|
47646
|
-
return new StandardBoxCommands(editor);
|
|
48079
|
+
static create(editor, extIds) {
|
|
48080
|
+
return new StandardBoxCommands(editor, extIds);
|
|
48081
|
+
}
|
|
48082
|
+
static mobileCreate(editor, extIds) {
|
|
48083
|
+
const instance = new StandardBoxCommands(editor, extIds);
|
|
48084
|
+
instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
|
|
48085
|
+
return instance;
|
|
47647
48086
|
}
|
|
47648
48087
|
}
|
|
47649
|
-
const logger$
|
|
48088
|
+
const logger$1$ = getLogger("object-commands");
|
|
47650
48089
|
const SEP$1 = {
|
|
47651
48090
|
id: "",
|
|
47652
48091
|
name: "",
|
|
@@ -47702,7 +48141,7 @@ ${codeText}
|
|
|
47702
48141
|
let element = null;
|
|
47703
48142
|
const commands = [];
|
|
47704
48143
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47705
|
-
boxCommands.push(
|
|
48144
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47706
48145
|
}
|
|
47707
48146
|
if (boxCommands.length > 0) {
|
|
47708
48147
|
element = child;
|
|
@@ -47732,10 +48171,10 @@ ${codeText}
|
|
|
47732
48171
|
const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
|
|
47733
48172
|
const { boxCommands, blockCommands } = result;
|
|
47734
48173
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47735
|
-
boxCommands.push(
|
|
48174
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47736
48175
|
}
|
|
47737
48176
|
if (boxCommands.length > 0) {
|
|
47738
|
-
assert(logger$
|
|
48177
|
+
assert(logger$1$, child, "child is null");
|
|
47739
48178
|
for (let i = 0; i < boxCommands.length; i++) {
|
|
47740
48179
|
if (boxCommands[i].commands.find((c) => c.id === item.id)) {
|
|
47741
48180
|
boxCommands[i].executeCommand(editor, block, child, item);
|
|
@@ -48002,18 +48441,18 @@ ${codeText}
|
|
|
48002
48441
|
}
|
|
48003
48442
|
}
|
|
48004
48443
|
const LIST_MAX_LEVEL = 8;
|
|
48005
|
-
const logger$
|
|
48006
|
-
const logger$
|
|
48444
|
+
const logger$1_ = getLogger("list-block");
|
|
48445
|
+
const logger$1Z = getLogger("list-block");
|
|
48007
48446
|
function isListBlock(block) {
|
|
48008
48447
|
return getBlockType(block) === "list";
|
|
48009
48448
|
}
|
|
48010
48449
|
function ensureIsListBlock(block) {
|
|
48011
|
-
assert(logger$
|
|
48450
|
+
assert(logger$1Z, isListBlock(block), "not a list block");
|
|
48012
48451
|
}
|
|
48013
48452
|
function getListBlockType(block) {
|
|
48014
48453
|
ensureIsListBlock(block);
|
|
48015
48454
|
const type = block.getAttribute("data-list-type");
|
|
48016
|
-
assert(logger$
|
|
48455
|
+
assert(logger$1Z, type, "no list type");
|
|
48017
48456
|
return type;
|
|
48018
48457
|
}
|
|
48019
48458
|
function isTextOnlyListBlock(block) {
|
|
@@ -48032,7 +48471,7 @@ ${codeText}
|
|
|
48032
48471
|
function getListBlockGroupId(block) {
|
|
48033
48472
|
ensureIsListBlock(block);
|
|
48034
48473
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48035
|
-
assert(logger$
|
|
48474
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48036
48475
|
return groupId;
|
|
48037
48476
|
}
|
|
48038
48477
|
function getListBlockProperties(block) {
|
|
@@ -48042,7 +48481,7 @@ ${codeText}
|
|
|
48042
48481
|
const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
|
|
48043
48482
|
const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
|
|
48044
48483
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48045
|
-
assert(logger$
|
|
48484
|
+
assert(logger$1Z, groupId, "no group id");
|
|
48046
48485
|
return {
|
|
48047
48486
|
type,
|
|
48048
48487
|
start,
|
|
@@ -48311,7 +48750,7 @@ ${codeText}
|
|
|
48311
48750
|
this.nodeMap.set(block, node);
|
|
48312
48751
|
if (parentBlock) {
|
|
48313
48752
|
const parentNode = this.nodeMap.get(parentBlock);
|
|
48314
|
-
assert(logger$
|
|
48753
|
+
assert(logger$1_, parentNode, "no parent node");
|
|
48315
48754
|
parentNode.children.push(node);
|
|
48316
48755
|
} else {
|
|
48317
48756
|
this.rootNodes.push(node);
|
|
@@ -48379,7 +48818,7 @@ ${codeText}
|
|
|
48379
48818
|
return hasClass(block, "editor-in-mindmap-first");
|
|
48380
48819
|
}
|
|
48381
48820
|
function isViewingAsMindmap(block) {
|
|
48382
|
-
assert(logger$
|
|
48821
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
48383
48822
|
if (hasClass(block, "editor-in-mindmap-first")) {
|
|
48384
48823
|
return true;
|
|
48385
48824
|
}
|
|
@@ -48400,12 +48839,12 @@ ${codeText}
|
|
|
48400
48839
|
const container = getParentContainer(from);
|
|
48401
48840
|
if (to) {
|
|
48402
48841
|
const container2 = getParentContainer(to);
|
|
48403
|
-
assert(logger$
|
|
48842
|
+
assert(logger$1_, container === container2, "invalid block container");
|
|
48404
48843
|
}
|
|
48405
48844
|
const fromIndex = getBlockIndex(from);
|
|
48406
48845
|
if (to) {
|
|
48407
48846
|
const toIndex = getBlockIndex(to);
|
|
48408
|
-
assert(logger$
|
|
48847
|
+
assert(logger$1_, fromIndex <= toIndex, "invalid block index");
|
|
48409
48848
|
}
|
|
48410
48849
|
addClass(from, ...styles);
|
|
48411
48850
|
if (!to || to === from) {
|
|
@@ -48413,7 +48852,7 @@ ${codeText}
|
|
|
48413
48852
|
}
|
|
48414
48853
|
let next2 = getNextBlock(from);
|
|
48415
48854
|
while (next2 !== to) {
|
|
48416
|
-
assert(logger$
|
|
48855
|
+
assert(logger$1_, next2, "no next button");
|
|
48417
48856
|
addClass(next2, ...styles);
|
|
48418
48857
|
next2 = getNextBlock(next2);
|
|
48419
48858
|
}
|
|
@@ -48424,7 +48863,7 @@ ${codeText}
|
|
|
48424
48863
|
async function requestMindmapFullscreen(editor, block, mindmapTools) {
|
|
48425
48864
|
const tools = getBlockTools(block);
|
|
48426
48865
|
const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
|
|
48427
|
-
assert(logger$
|
|
48866
|
+
assert(logger$1_, exitFullscreenButton, "no full screen button");
|
|
48428
48867
|
const resetMindmap = () => {
|
|
48429
48868
|
setTimeout(() => {
|
|
48430
48869
|
mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
|
|
@@ -48444,7 +48883,7 @@ ${codeText}
|
|
|
48444
48883
|
try {
|
|
48445
48884
|
await exitFullscreen();
|
|
48446
48885
|
} catch (err) {
|
|
48447
|
-
logger$
|
|
48886
|
+
logger$1_.error(err);
|
|
48448
48887
|
}
|
|
48449
48888
|
onExitFullscreen();
|
|
48450
48889
|
} else {
|
|
@@ -48453,7 +48892,7 @@ ${codeText}
|
|
|
48453
48892
|
await requestFullscreen(tools);
|
|
48454
48893
|
resetMindmap();
|
|
48455
48894
|
} catch (err) {
|
|
48456
|
-
logger$
|
|
48895
|
+
logger$1_.error(err);
|
|
48457
48896
|
}
|
|
48458
48897
|
exitFullscreenButton.innerHTML = ExitFullScreenIcon;
|
|
48459
48898
|
exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
|
|
@@ -48734,7 +49173,7 @@ ${codeText}
|
|
|
48734
49173
|
if (!svg) {
|
|
48735
49174
|
return;
|
|
48736
49175
|
}
|
|
48737
|
-
assert(logger$
|
|
49176
|
+
assert(logger$1_, svg, "no mindmap svg");
|
|
48738
49177
|
svg.remove();
|
|
48739
49178
|
editor.domEvents.removeAllListeners(svg);
|
|
48740
49179
|
destroyMindmapButtons(editor, block);
|
|
@@ -48786,7 +49225,7 @@ ${codeText}
|
|
|
48786
49225
|
});
|
|
48787
49226
|
__publicField(this, "handleMouseEnter", () => {
|
|
48788
49227
|
const block = getParentBlock(this.toMindmapButton);
|
|
48789
|
-
assert(logger$
|
|
49228
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48790
49229
|
highlightEntireList(this.editor, block, true);
|
|
48791
49230
|
this.currentBlock = block;
|
|
48792
49231
|
});
|
|
@@ -48798,7 +49237,7 @@ ${codeText}
|
|
|
48798
49237
|
});
|
|
48799
49238
|
__publicField(this, "handleClick", () => {
|
|
48800
49239
|
const block = getParentBlock(this.toMindmapButton);
|
|
48801
|
-
assert(logger$
|
|
49240
|
+
assert(logger$1_, block && isListBlock(block), "no parent list");
|
|
48802
49241
|
toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
|
|
48803
49242
|
});
|
|
48804
49243
|
this.editor = editor;
|
|
@@ -48926,11 +49365,11 @@ ${codeText}
|
|
|
48926
49365
|
}
|
|
48927
49366
|
}
|
|
48928
49367
|
function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
|
|
48929
|
-
logger$
|
|
49368
|
+
logger$1_.debug("drag a block on a list block");
|
|
48930
49369
|
if (!isTextKindBlock(editor, draggedBlock)) {
|
|
48931
49370
|
return false;
|
|
48932
49371
|
}
|
|
48933
|
-
assert(logger$
|
|
49372
|
+
assert(logger$1_, isListBlock(targetListBlock), "target is not a list block");
|
|
48934
49373
|
const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
|
|
48935
49374
|
const newStart = insertPos === "after" ? start + 1 : start;
|
|
48936
49375
|
const oldData = editor.getBlockData(draggedBlock);
|
|
@@ -48963,7 +49402,7 @@ ${codeText}
|
|
|
48963
49402
|
return true;
|
|
48964
49403
|
}
|
|
48965
49404
|
function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
|
|
48966
|
-
logger$
|
|
49405
|
+
logger$1_.debug("drag a list between text blocks");
|
|
48967
49406
|
if (insertPos === "after") {
|
|
48968
49407
|
const nextBlock = getNextBlock(targetBlock);
|
|
48969
49408
|
if (nextBlock && isListBlock(nextBlock)) {
|
|
@@ -49000,11 +49439,11 @@ ${codeText}
|
|
|
49000
49439
|
}
|
|
49001
49440
|
const { blockId } = dragData;
|
|
49002
49441
|
const draggedBlock = editor.getBlockById(blockId);
|
|
49003
|
-
assert(logger$
|
|
49442
|
+
assert(logger$1_, draggedBlock, "no dragged block");
|
|
49004
49443
|
const { isSourceBlock, targetBlock } = options;
|
|
49005
49444
|
if (!isSourceBlock && targetBlock) {
|
|
49006
|
-
assert(logger$
|
|
49007
|
-
assert(logger$
|
|
49445
|
+
assert(logger$1_, block === targetBlock, "block !== target block");
|
|
49446
|
+
assert(logger$1_, isListBlock(targetBlock), "target is not a list block");
|
|
49008
49447
|
return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
|
|
49009
49448
|
}
|
|
49010
49449
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
@@ -49506,7 +49945,7 @@ ${codeText}
|
|
|
49506
49945
|
}
|
|
49507
49946
|
const nextBrother = getListNextBrother(block);
|
|
49508
49947
|
while (nextBlock !== nextBrother) {
|
|
49509
|
-
assert(logger$
|
|
49948
|
+
assert(logger$1_, nextBlock, "no next block");
|
|
49510
49949
|
if (isListBlock(nextBlock)) {
|
|
49511
49950
|
if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
|
|
49512
49951
|
return nextBlock;
|
|
@@ -49605,9 +50044,9 @@ ${codeText}
|
|
|
49605
50044
|
}
|
|
49606
50045
|
return true;
|
|
49607
50046
|
}
|
|
49608
|
-
const logger$
|
|
50047
|
+
const logger$1Y = getLogger("list-block");
|
|
49609
50048
|
function cloneListData(editor, block, options) {
|
|
49610
|
-
assert(logger$
|
|
50049
|
+
assert(logger$1Y, isListBlock(block), "not a list block");
|
|
49611
50050
|
const blockData = {
|
|
49612
50051
|
...editor.getBlockData(block),
|
|
49613
50052
|
id: genId()
|
|
@@ -49682,7 +50121,7 @@ ${codeText}
|
|
|
49682
50121
|
return true;
|
|
49683
50122
|
}
|
|
49684
50123
|
function findPrevBrotherAsParent(block) {
|
|
49685
|
-
assert(logger$
|
|
50124
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
49686
50125
|
const { level } = getListBlockProperties(block);
|
|
49687
50126
|
let prevBlock = getPrevBlock(block);
|
|
49688
50127
|
while (prevBlock) {
|
|
@@ -49709,7 +50148,7 @@ ${codeText}
|
|
|
49709
50148
|
}
|
|
49710
50149
|
function findPrevBrother(editor, fromBlock, toParentBlock) {
|
|
49711
50150
|
let prevBlock = getPrevBlock(fromBlock);
|
|
49712
|
-
assert(logger$
|
|
50151
|
+
assert(logger$1_, prevBlock, "no prev brother");
|
|
49713
50152
|
const parentLevel = getListBlockLevel(toParentBlock);
|
|
49714
50153
|
while (prevBlock) {
|
|
49715
50154
|
if (prevBlock === toParentBlock) {
|
|
@@ -49730,7 +50169,7 @@ ${codeText}
|
|
|
49730
50169
|
}
|
|
49731
50170
|
ensureIsListBlock(block);
|
|
49732
50171
|
const prevBrother = findPrevBrotherAsParent(block);
|
|
49733
|
-
assert(logger$
|
|
50172
|
+
assert(logger$1_, prevBrother, "no list prev brother");
|
|
49734
50173
|
const newParent = prevBrother;
|
|
49735
50174
|
const newBrother = findPrevBrother(editor, block, newParent);
|
|
49736
50175
|
const level = getListBlockLevel(newParent) + 1;
|
|
@@ -49929,14 +50368,14 @@ ${codeText}
|
|
|
49929
50368
|
this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
|
|
49930
50369
|
}
|
|
49931
50370
|
}
|
|
49932
|
-
const logger$
|
|
50371
|
+
const logger$1X = getLogger("customize-list-start-menu");
|
|
49933
50372
|
class CustomizeListStartDialog {
|
|
49934
50373
|
constructor(editor) {
|
|
49935
50374
|
__publicField(this, "popup");
|
|
49936
50375
|
__publicField(this, "block", null);
|
|
49937
50376
|
__publicField(this, "show", (editor, block) => {
|
|
49938
50377
|
const listBlockMarker = block.querySelector("div.list-container");
|
|
49939
|
-
assert(logger$
|
|
50378
|
+
assert(logger$1X, listBlockMarker, "list-block mark does not exist");
|
|
49940
50379
|
this.block = block;
|
|
49941
50380
|
this.popup.manualShow(listBlockMarker, {
|
|
49942
50381
|
theme: "light"
|
|
@@ -50094,7 +50533,7 @@ ${codeText}
|
|
|
50094
50533
|
const listContainer = findTarget(event, "div.list-container");
|
|
50095
50534
|
if (listContainer && this.editor.isWritable()) {
|
|
50096
50535
|
const block = getParentBlock(listContainer);
|
|
50097
|
-
assert(logger$
|
|
50536
|
+
assert(logger$1_, block, "no parent block");
|
|
50098
50537
|
ensureIsListBlock(block);
|
|
50099
50538
|
const blockData = editor.getBlockData(block);
|
|
50100
50539
|
if (blockData && blockData.checkbox) {
|
|
@@ -50234,7 +50673,7 @@ ${codeText}
|
|
|
50234
50673
|
}
|
|
50235
50674
|
return blockContent;
|
|
50236
50675
|
}
|
|
50237
|
-
const zhCN$
|
|
50676
|
+
const zhCN$s = {
|
|
50238
50677
|
list: {
|
|
50239
50678
|
confirm: "\u786E\u5B9A",
|
|
50240
50679
|
setStart: "\u8BBE\u7F6E\u7F16\u53F7",
|
|
@@ -50254,7 +50693,7 @@ ${codeText}
|
|
|
50254
50693
|
exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
|
|
50255
50694
|
}
|
|
50256
50695
|
};
|
|
50257
|
-
const enUS$
|
|
50696
|
+
const enUS$s = {
|
|
50258
50697
|
list: {
|
|
50259
50698
|
confirm: "Confirm",
|
|
50260
50699
|
setStart: "Set number",
|
|
@@ -50274,7 +50713,7 @@ ${codeText}
|
|
|
50274
50713
|
exitFullscreen: "Exit full screen"
|
|
50275
50714
|
}
|
|
50276
50715
|
};
|
|
50277
|
-
const jaJP$
|
|
50716
|
+
const jaJP$s = {
|
|
50278
50717
|
list: {
|
|
50279
50718
|
confirm: "OK",
|
|
50280
50719
|
setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
|
|
@@ -50295,12 +50734,12 @@ ${codeText}
|
|
|
50295
50734
|
}
|
|
50296
50735
|
};
|
|
50297
50736
|
i18n$1.mergeLang({
|
|
50298
|
-
"zh-CN": zhCN$
|
|
50299
|
-
"en-US": enUS$
|
|
50300
|
-
"ja-JP": jaJP$
|
|
50737
|
+
"zh-CN": zhCN$s,
|
|
50738
|
+
"en-US": enUS$s,
|
|
50739
|
+
"ja-JP": jaJP$s
|
|
50301
50740
|
});
|
|
50302
|
-
const style$
|
|
50303
|
-
const logger$
|
|
50741
|
+
const style$8 = "";
|
|
50742
|
+
const logger$1W = getLogger("list-block:paste-handler");
|
|
50304
50743
|
class ListPasteHandler {
|
|
50305
50744
|
constructor() {
|
|
50306
50745
|
__publicField(this, "fixStartByList", null);
|
|
@@ -50354,7 +50793,7 @@ ${codeText}
|
|
|
50354
50793
|
startIds.set(newGroupId, 1);
|
|
50355
50794
|
} else {
|
|
50356
50795
|
const start = startIds.get(groupId);
|
|
50357
|
-
assert(logger$
|
|
50796
|
+
assert(logger$1W, start, "start is null");
|
|
50358
50797
|
block.start = start + 1;
|
|
50359
50798
|
block.groupId = groupId;
|
|
50360
50799
|
startIds.set(groupId, start + 1);
|
|
@@ -50374,7 +50813,7 @@ ${codeText}
|
|
|
50374
50813
|
return false;
|
|
50375
50814
|
}
|
|
50376
50815
|
}
|
|
50377
|
-
const logger$
|
|
50816
|
+
const logger$1V = getLogger("list selection to doc");
|
|
50378
50817
|
function convertListToText(data2) {
|
|
50379
50818
|
const textData = { type: "text" };
|
|
50380
50819
|
Object.entries(data2).forEach(([key, value]) => {
|
|
@@ -50389,7 +50828,7 @@ ${codeText}
|
|
|
50389
50828
|
const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
|
|
50390
50829
|
const start = selectedBlock.start;
|
|
50391
50830
|
const end = selectedBlock.end;
|
|
50392
|
-
assert(logger$
|
|
50831
|
+
assert(logger$1V, data2.text, "no block text");
|
|
50393
50832
|
const len = getBlockTextLength$6(editor, selectedBlock.block);
|
|
50394
50833
|
if (end.offset - start.offset === len) {
|
|
50395
50834
|
return {
|
|
@@ -50965,7 +51404,7 @@ ${codeText}
|
|
|
50965
51404
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
50966
51405
|
}, 300);
|
|
50967
51406
|
};
|
|
50968
|
-
const logger$
|
|
51407
|
+
const logger$1U = getLogger("inline-box-items");
|
|
50969
51408
|
function insertEmptyBlockLink(editor, containerId, blockIndex) {
|
|
50970
51409
|
let block = editor.findBlockByIndex(containerId, blockIndex);
|
|
50971
51410
|
let placement = "bottom-start";
|
|
@@ -50976,7 +51415,7 @@ ${codeText}
|
|
|
50976
51415
|
const onFinished = (linkText, linkUrl) => {
|
|
50977
51416
|
editor.undoManager.runInGroup(() => {
|
|
50978
51417
|
try {
|
|
50979
|
-
assert(logger$
|
|
51418
|
+
assert(logger$1U, block, "block not found");
|
|
50980
51419
|
if (!isEmptyTextBlock(editor, block)) {
|
|
50981
51420
|
block = editor.insertTextBlock([], containerId, blockIndex);
|
|
50982
51421
|
}
|
|
@@ -50987,7 +51426,7 @@ ${codeText}
|
|
|
50987
51426
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
50988
51427
|
editor.focus();
|
|
50989
51428
|
} catch (error2) {
|
|
50990
|
-
logger$
|
|
51429
|
+
logger$1U.error(error2);
|
|
50991
51430
|
}
|
|
50992
51431
|
});
|
|
50993
51432
|
};
|
|
@@ -51007,7 +51446,7 @@ ${codeText}
|
|
|
51007
51446
|
function insertLink(editor, containerId, blockIndex) {
|
|
51008
51447
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
51009
51448
|
const range = editor.selection.range;
|
|
51010
|
-
assert(logger$
|
|
51449
|
+
assert(logger$1U, isSimpleBlockPosition(range.start), "invalid block position");
|
|
51011
51450
|
const rects = getBlockClientRects(editor, block, range);
|
|
51012
51451
|
if (rects.length === 0) {
|
|
51013
51452
|
return;
|
|
@@ -51033,7 +51472,7 @@ ${codeText}
|
|
|
51033
51472
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
51034
51473
|
editor.focus();
|
|
51035
51474
|
} catch (error2) {
|
|
51036
|
-
logger$
|
|
51475
|
+
logger$1U.error(error2);
|
|
51037
51476
|
}
|
|
51038
51477
|
});
|
|
51039
51478
|
};
|
|
@@ -51251,7 +51690,7 @@ ${codeText}
|
|
|
51251
51690
|
function getToolbar(editor) {
|
|
51252
51691
|
return editor.findCustom("toolbar-handler");
|
|
51253
51692
|
}
|
|
51254
|
-
const logger$
|
|
51693
|
+
const logger$1T = getLogger("link-popup");
|
|
51255
51694
|
function getLinkHref(child) {
|
|
51256
51695
|
var _a, _b;
|
|
51257
51696
|
return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
|
|
@@ -51289,7 +51728,7 @@ ${codeText}
|
|
|
51289
51728
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
51290
51729
|
editor.focus();
|
|
51291
51730
|
} catch (error2) {
|
|
51292
|
-
logger$
|
|
51731
|
+
logger$1T.error(error2);
|
|
51293
51732
|
}
|
|
51294
51733
|
};
|
|
51295
51734
|
const onClose = () => {
|
|
@@ -51528,7 +51967,7 @@ ${codeText}
|
|
|
51528
51967
|
this.editProvider = new EditLinkProvider();
|
|
51529
51968
|
}
|
|
51530
51969
|
}
|
|
51531
|
-
const logger$
|
|
51970
|
+
const logger$1S = getLogger("readonly-toolbar");
|
|
51532
51971
|
const SEP = {
|
|
51533
51972
|
id: "",
|
|
51534
51973
|
name: "",
|
|
@@ -51591,7 +52030,7 @@ ${codeText}
|
|
|
51591
52030
|
});
|
|
51592
52031
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51593
52032
|
var _a;
|
|
51594
|
-
assert(logger$
|
|
52033
|
+
assert(logger$1S, editor === this.editor, "editor mismatch");
|
|
51595
52034
|
if (!editor.readonly) {
|
|
51596
52035
|
this.toolbar.close("selectionChange");
|
|
51597
52036
|
return;
|
|
@@ -51777,7 +52216,7 @@ ${codeText}
|
|
|
51777
52216
|
return visible;
|
|
51778
52217
|
}
|
|
51779
52218
|
}
|
|
51780
|
-
const logger$
|
|
52219
|
+
const logger$1R = getLogger("toolbar-handler");
|
|
51781
52220
|
class OnesEditorToolbar {
|
|
51782
52221
|
constructor(editor) {
|
|
51783
52222
|
__publicField(this, "id", "editor-toolbar");
|
|
@@ -51864,7 +52303,7 @@ ${codeText}
|
|
|
51864
52303
|
});
|
|
51865
52304
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51866
52305
|
var _a;
|
|
51867
|
-
assert(logger$
|
|
52306
|
+
assert(logger$1R, editor === this.editor, "editor mismatch");
|
|
51868
52307
|
if (editor.selection.range.isCollapsed() || this.mouseDown) {
|
|
51869
52308
|
if (this.toolbarType === "object") {
|
|
51870
52309
|
const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
|
|
@@ -52084,8 +52523,15 @@ ${codeText}
|
|
|
52084
52523
|
}
|
|
52085
52524
|
}
|
|
52086
52525
|
const getReferenceClientRectByCaret = () => {
|
|
52526
|
+
if (!this.hoveringBlock) {
|
|
52527
|
+
return new DOMRect();
|
|
52528
|
+
}
|
|
52529
|
+
const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
|
|
52530
|
+
if (!element2) {
|
|
52531
|
+
return new DOMRect();
|
|
52532
|
+
}
|
|
52087
52533
|
let rect;
|
|
52088
|
-
const clientRects =
|
|
52534
|
+
const clientRects = element2.getClientRects();
|
|
52089
52535
|
const lineRects = [];
|
|
52090
52536
|
Array.from(clientRects).forEach((clientRect) => {
|
|
52091
52537
|
const { y } = clientRect;
|
|
@@ -52095,7 +52541,7 @@ ${codeText}
|
|
|
52095
52541
|
lineRects.push(y);
|
|
52096
52542
|
});
|
|
52097
52543
|
if (lineRects.length > 1) {
|
|
52098
|
-
rect =
|
|
52544
|
+
rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
|
|
52099
52545
|
if (event) {
|
|
52100
52546
|
for (let i = 0; i < clientRects.length; i++) {
|
|
52101
52547
|
const clientRect = clientRects[i];
|
|
@@ -52107,21 +52553,15 @@ ${codeText}
|
|
|
52107
52553
|
}
|
|
52108
52554
|
}
|
|
52109
52555
|
} else {
|
|
52110
|
-
rect =
|
|
52111
|
-
if (
|
|
52112
|
-
const childRect =
|
|
52556
|
+
rect = element2.getBoundingClientRect();
|
|
52557
|
+
if (!isBlock$1(element2)) {
|
|
52558
|
+
const childRect = element2.getBoundingClientRect();
|
|
52113
52559
|
return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
|
|
52114
52560
|
}
|
|
52115
52561
|
if (clientRects.length === 1) {
|
|
52116
52562
|
return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
|
|
52117
52563
|
}
|
|
52118
52564
|
}
|
|
52119
|
-
if (this.hoveringBlock) {
|
|
52120
|
-
const blockContent = getBlockContent(this.hoveringBlock);
|
|
52121
|
-
if (blockContent !== element) {
|
|
52122
|
-
return blockContent.getBoundingClientRect();
|
|
52123
|
-
}
|
|
52124
|
-
}
|
|
52125
52565
|
if (event) {
|
|
52126
52566
|
const y = rect.y;
|
|
52127
52567
|
const x = event.clientX;
|
|
@@ -52131,8 +52571,9 @@ ${codeText}
|
|
|
52131
52571
|
};
|
|
52132
52572
|
this.toolbar.updateItems(commands);
|
|
52133
52573
|
if (!this.toolbar.isVisible) {
|
|
52574
|
+
const isText = element === child && !isTextBlockContentBoxChild(element);
|
|
52134
52575
|
this.toolbar.manualShow(element, {
|
|
52135
|
-
placement:
|
|
52576
|
+
placement: isText && !clientType.isMobile ? "bottom" : "top",
|
|
52136
52577
|
getReferenceClientRect: getReferenceClientRectByCaret
|
|
52137
52578
|
});
|
|
52138
52579
|
if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
|
|
@@ -52183,7 +52624,7 @@ ${codeText}
|
|
|
52183
52624
|
this.texWidth = [tex, width];
|
|
52184
52625
|
}
|
|
52185
52626
|
}
|
|
52186
|
-
const logger$
|
|
52627
|
+
const logger$1Q = getLogger("mathjax-converter");
|
|
52187
52628
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
52188
52629
|
const MATHJAX_BUFFER = 30;
|
|
52189
52630
|
const REDUCED_UNIT = 8;
|
|
@@ -52232,7 +52673,7 @@ ${codeText}
|
|
|
52232
52673
|
const svg = result.querySelector("svg");
|
|
52233
52674
|
return svg.outerHTML;
|
|
52234
52675
|
} catch (err) {
|
|
52235
|
-
logger$
|
|
52676
|
+
logger$1Q.error(err);
|
|
52236
52677
|
throw err;
|
|
52237
52678
|
} finally {
|
|
52238
52679
|
lockers.release(lockId);
|
|
@@ -52280,12 +52721,13 @@ ${codeText}
|
|
|
52280
52721
|
...perfectState
|
|
52281
52722
|
};
|
|
52282
52723
|
}
|
|
52283
|
-
const logger$
|
|
52724
|
+
const logger$1P = getLogger("edit-mathjax");
|
|
52284
52725
|
class MathjaxEditor {
|
|
52285
52726
|
constructor() {
|
|
52286
52727
|
__publicField(this, "editMathjaxPopup", null);
|
|
52287
52728
|
__publicField(this, "onChange", null);
|
|
52288
52729
|
__publicField(this, "tex", "");
|
|
52730
|
+
__publicField(this, "oldTex", "");
|
|
52289
52731
|
__publicField(this, "observer", null);
|
|
52290
52732
|
__publicField(this, "handleClose", (commandBar2) => {
|
|
52291
52733
|
var _a;
|
|
@@ -52309,6 +52751,10 @@ ${codeText}
|
|
|
52309
52751
|
});
|
|
52310
52752
|
__publicField(this, "handleChange", debounce__default.default((text2) => {
|
|
52311
52753
|
var _a;
|
|
52754
|
+
if (text2 === this.oldTex) {
|
|
52755
|
+
return;
|
|
52756
|
+
}
|
|
52757
|
+
this.oldTex = text2;
|
|
52312
52758
|
(_a = this.onChange) == null ? void 0 : _a.call(this, text2, false);
|
|
52313
52759
|
}, 300));
|
|
52314
52760
|
}
|
|
@@ -52321,6 +52767,7 @@ ${codeText}
|
|
|
52321
52767
|
const textarea2 = this.getTextarea();
|
|
52322
52768
|
textarea2.value = tex;
|
|
52323
52769
|
}
|
|
52770
|
+
this.oldTex = tex;
|
|
52324
52771
|
this.tex = tex;
|
|
52325
52772
|
this.editMathjaxPopup.manualShow(elem, { theme: "light", placement: options == null ? void 0 : options.placement });
|
|
52326
52773
|
this.editMathjaxPopup.removeAllListeners("close");
|
|
@@ -52351,9 +52798,9 @@ ${codeText}
|
|
|
52351
52798
|
this.observer.observe(textarea2);
|
|
52352
52799
|
}
|
|
52353
52800
|
getTextarea() {
|
|
52354
|
-
assert(logger$
|
|
52801
|
+
assert(logger$1P, this.editMathjaxPopup, "no exists mathjax editor popup");
|
|
52355
52802
|
const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
|
|
52356
|
-
assert(logger$
|
|
52803
|
+
assert(logger$1P, textarea2, "no textarea");
|
|
52357
52804
|
return textarea2;
|
|
52358
52805
|
}
|
|
52359
52806
|
destroy() {
|
|
@@ -52423,7 +52870,7 @@ ${codeText}
|
|
|
52423
52870
|
};
|
|
52424
52871
|
editMathjax(editor, box, data2.tex, update2);
|
|
52425
52872
|
}
|
|
52426
|
-
const logger$
|
|
52873
|
+
const logger$1O = getLogger("mathjax-box");
|
|
52427
52874
|
function updateCaret(editor, event) {
|
|
52428
52875
|
editor.selection.updateSelection(null);
|
|
52429
52876
|
const target = event.target;
|
|
@@ -52528,7 +52975,7 @@ ${codeText}
|
|
|
52528
52975
|
};
|
|
52529
52976
|
editor.updateBoxData(newData);
|
|
52530
52977
|
}).catch((err) => {
|
|
52531
|
-
logger$
|
|
52978
|
+
logger$1O.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
|
|
52532
52979
|
});
|
|
52533
52980
|
return data2;
|
|
52534
52981
|
}
|
|
@@ -52547,7 +52994,7 @@ ${codeText}
|
|
|
52547
52994
|
}
|
|
52548
52995
|
function handleClickBox$3(editor, box, event) {
|
|
52549
52996
|
const parentBlock = getParentBlock(box);
|
|
52550
|
-
assert(logger$
|
|
52997
|
+
assert(logger$1O, parentBlock, "failed to get block");
|
|
52551
52998
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
52552
52999
|
return;
|
|
52553
53000
|
}
|
|
@@ -52616,7 +53063,7 @@ ${codeText}
|
|
|
52616
53063
|
}
|
|
52617
53064
|
const data2 = editor.getBlockData(block);
|
|
52618
53065
|
const embedData = data2.embedData;
|
|
52619
|
-
editMathjax(editor,
|
|
53066
|
+
editMathjax(editor, block, embedData.mathjaxText, async (tex) => {
|
|
52620
53067
|
const { resourceId: src, width, height } = await convertAndUploadMathjaxForEmbed(editor, tex);
|
|
52621
53068
|
const newData = {
|
|
52622
53069
|
mathjaxText: tex,
|
|
@@ -52744,28 +53191,28 @@ $$${mathData.mathjaxText}$$
|
|
|
52744
53191
|
getBlockProperties: getBlockProperties$b
|
|
52745
53192
|
};
|
|
52746
53193
|
const mathjaxStyle = "";
|
|
52747
|
-
const zhCN$
|
|
53194
|
+
const zhCN$r = {
|
|
52748
53195
|
mathjax: {
|
|
52749
53196
|
emptyText: "\u7A7A\u7684\u516C\u5F0F",
|
|
52750
53197
|
abstract: "\u516C\u5F0F"
|
|
52751
53198
|
}
|
|
52752
53199
|
};
|
|
52753
|
-
const enUS$
|
|
53200
|
+
const enUS$r = {
|
|
52754
53201
|
mathjax: {
|
|
52755
53202
|
emptyText: "Empty formula",
|
|
52756
53203
|
abstract: "Formula"
|
|
52757
53204
|
}
|
|
52758
53205
|
};
|
|
52759
|
-
const jaJP$
|
|
53206
|
+
const jaJP$r = {
|
|
52760
53207
|
mathjax: {
|
|
52761
53208
|
emptyText: "\u6570\u5F0F\u306A\u3057",
|
|
52762
53209
|
abstract: "\u6570\u5F0F"
|
|
52763
53210
|
}
|
|
52764
53211
|
};
|
|
52765
53212
|
i18n$1.mergeLang({
|
|
52766
|
-
"zh-CN": zhCN$
|
|
52767
|
-
"en-US": enUS$
|
|
52768
|
-
"ja-JP": jaJP$
|
|
53213
|
+
"zh-CN": zhCN$r,
|
|
53214
|
+
"en-US": enUS$r,
|
|
53215
|
+
"ja-JP": jaJP$r
|
|
52769
53216
|
});
|
|
52770
53217
|
function convertToMath(editor, containerId, blockIndex, offset) {
|
|
52771
53218
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -58299,7 +58746,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58299
58746
|
const docBlockText = { insert: " ", attributes: data2 };
|
|
58300
58747
|
return docBlockText;
|
|
58301
58748
|
}
|
|
58302
|
-
const logger$
|
|
58749
|
+
const logger$1N = getLogger("StatusBoxEditor");
|
|
58303
58750
|
class StatusBoxEditor {
|
|
58304
58751
|
constructor(editor) {
|
|
58305
58752
|
__publicField(this, "linkPopup", null);
|
|
@@ -58322,10 +58769,10 @@ $$${mathData.mathjaxText}$$
|
|
|
58322
58769
|
});
|
|
58323
58770
|
__publicField(this, "handClose", () => {
|
|
58324
58771
|
var _a;
|
|
58325
|
-
assert(logger$
|
|
58772
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58326
58773
|
const boxData = this.editor.getBoxData(this.boxElement);
|
|
58327
58774
|
const block = getParentBlock(this.boxElement);
|
|
58328
|
-
assert(logger$
|
|
58775
|
+
assert(logger$1N, block, "block not found");
|
|
58329
58776
|
if (!boxData.title) {
|
|
58330
58777
|
const offset = getChildOffset(block, this.boxElement);
|
|
58331
58778
|
this.editor.deleteTextFromBlock(block, offset.start, 1);
|
|
@@ -58363,7 +58810,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58363
58810
|
return;
|
|
58364
58811
|
}
|
|
58365
58812
|
const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
|
|
58366
|
-
assert(logger$
|
|
58813
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58367
58814
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58368
58815
|
this.statusPalette.changeColor(color);
|
|
58369
58816
|
const newData = { ...data2, color };
|
|
@@ -58380,7 +58827,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58380
58827
|
});
|
|
58381
58828
|
__publicField(this, "onTitleChange", (e2) => {
|
|
58382
58829
|
const title = e2.target.value;
|
|
58383
|
-
assert(logger$
|
|
58830
|
+
assert(logger$1N, this.boxElement, "boxElement not found");
|
|
58384
58831
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58385
58832
|
const newData = { ...data2, title: title.trim() };
|
|
58386
58833
|
this.editor.updateBoxData(newData, { noFocus: true });
|
|
@@ -58493,7 +58940,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58493
58940
|
toStandardText: toStandardText$1,
|
|
58494
58941
|
matchText: matchText$1
|
|
58495
58942
|
};
|
|
58496
|
-
const logger$
|
|
58943
|
+
const logger$1M = getLogger("status-box-command");
|
|
58497
58944
|
class StatusBoxCommand {
|
|
58498
58945
|
static get commands() {
|
|
58499
58946
|
return [
|
|
@@ -58512,7 +58959,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58512
58959
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58513
58960
|
const boxOp = createEmptyStatusBox();
|
|
58514
58961
|
const { start } = editor.selection.range;
|
|
58515
|
-
assert(logger$
|
|
58962
|
+
assert(logger$1M, isSimpleBlockPosition(start), "invalid block position");
|
|
58516
58963
|
editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
|
|
58517
58964
|
const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
|
|
58518
58965
|
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
|
|
@@ -58531,7 +58978,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58531
58978
|
}
|
|
58532
58979
|
}
|
|
58533
58980
|
__publicField(StatusBoxCommand, "id", "insert-status");
|
|
58534
|
-
const enUS$
|
|
58981
|
+
const enUS$q = {
|
|
58535
58982
|
status: {
|
|
58536
58983
|
empty: "Set status",
|
|
58537
58984
|
command: {
|
|
@@ -58555,7 +59002,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58555
59002
|
}
|
|
58556
59003
|
}
|
|
58557
59004
|
};
|
|
58558
|
-
const zhCN$
|
|
59005
|
+
const zhCN$q = {
|
|
58559
59006
|
status: {
|
|
58560
59007
|
empty: "\u8BBE\u7F6E\u72B6\u6001",
|
|
58561
59008
|
command: {
|
|
@@ -58579,7 +59026,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58579
59026
|
}
|
|
58580
59027
|
}
|
|
58581
59028
|
};
|
|
58582
|
-
const jaJP$
|
|
59029
|
+
const jaJP$q = {
|
|
58583
59030
|
status: {
|
|
58584
59031
|
empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
|
|
58585
59032
|
command: {
|
|
@@ -58604,12 +59051,12 @@ $$${mathData.mathjaxText}$$
|
|
|
58604
59051
|
}
|
|
58605
59052
|
};
|
|
58606
59053
|
const langs$2 = {
|
|
58607
|
-
"en-US": enUS$
|
|
58608
|
-
"zh-CN": zhCN$
|
|
58609
|
-
"ja-JP": jaJP$
|
|
59054
|
+
"en-US": enUS$q,
|
|
59055
|
+
"zh-CN": zhCN$q,
|
|
59056
|
+
"ja-JP": jaJP$q
|
|
58610
59057
|
};
|
|
58611
59058
|
i18n$1.mergeLang(langs$2);
|
|
58612
|
-
const logger$
|
|
59059
|
+
const logger$1L = getLogger("inline-box-items");
|
|
58613
59060
|
function insertEmptyBlockMath(editor, containerId, blockIndex) {
|
|
58614
59061
|
return editor.undoManager.runInGroup(() => {
|
|
58615
59062
|
var _a;
|
|
@@ -58620,7 +59067,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58620
59067
|
const boxOp = createEmptyMathjaxBox();
|
|
58621
59068
|
editor.setBlockText(block, [boxOp]);
|
|
58622
59069
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58623
|
-
assert(logger$
|
|
59070
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58624
59071
|
setTimeout(() => {
|
|
58625
59072
|
const box = editor.getBoxById(boxId);
|
|
58626
59073
|
editMathjaxBox(editor, box);
|
|
@@ -58633,11 +59080,11 @@ $$${mathData.mathjaxText}$$
|
|
|
58633
59080
|
var _a;
|
|
58634
59081
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58635
59082
|
const range = editor.selection.range;
|
|
58636
|
-
assert(logger$
|
|
59083
|
+
assert(logger$1L, isSimpleBlockPosition(range.start), "invalid block position");
|
|
58637
59084
|
const boxOp = createEmptyMathjaxBox();
|
|
58638
59085
|
editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
|
|
58639
59086
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58640
|
-
assert(logger$
|
|
59087
|
+
assert(logger$1L, boxId, "mathjax box id is empty");
|
|
58641
59088
|
setTimeout(() => {
|
|
58642
59089
|
const box = editor.getBoxById(boxId);
|
|
58643
59090
|
editMathjaxBox(editor, box);
|
|
@@ -58804,7 +59251,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58804
59251
|
}
|
|
58805
59252
|
}
|
|
58806
59253
|
};
|
|
58807
|
-
const logger$
|
|
59254
|
+
const logger$1K = getLogger("insert-menu");
|
|
58808
59255
|
const injectGroup = (commands, group, startIndex) => {
|
|
58809
59256
|
commands.forEach((command, index2) => {
|
|
58810
59257
|
command.group = group;
|
|
@@ -58943,7 +59390,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58943
59390
|
return true;
|
|
58944
59391
|
}
|
|
58945
59392
|
const blockId = getBlockId(block);
|
|
58946
|
-
assert(logger$
|
|
59393
|
+
assert(logger$1K, range.isSimple(), "invalid range");
|
|
58947
59394
|
const offset = range.start.offset;
|
|
58948
59395
|
if (quickItem.commandProvider) {
|
|
58949
59396
|
const params2 = { from: "quick-menu", blockId, offset };
|
|
@@ -58979,7 +59426,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58979
59426
|
});
|
|
58980
59427
|
}
|
|
58981
59428
|
}
|
|
58982
|
-
const logger$
|
|
59429
|
+
const logger$1J = getLogger("quick-command-providers");
|
|
58983
59430
|
class QuickCommandProviders extends AbstractProvider {
|
|
58984
59431
|
constructor(editor) {
|
|
58985
59432
|
super(editor);
|
|
@@ -58999,7 +59446,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58999
59446
|
}
|
|
59000
59447
|
getCommands(range) {
|
|
59001
59448
|
var _a, _b;
|
|
59002
|
-
assert(logger$
|
|
59449
|
+
assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
|
|
59003
59450
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59004
59451
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59005
59452
|
const container = getParentContainer(block);
|
|
@@ -59404,7 +59851,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59404
59851
|
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
59405
59852
|
...headingShortcut()
|
|
59406
59853
|
};
|
|
59407
|
-
const zhCN$
|
|
59854
|
+
const zhCN$p = {
|
|
59408
59855
|
quickMenu: {
|
|
59409
59856
|
basic: {
|
|
59410
59857
|
heading: {
|
|
@@ -59460,7 +59907,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59460
59907
|
selectBlock: "\u9009\u62E9\u533A\u5757"
|
|
59461
59908
|
}
|
|
59462
59909
|
};
|
|
59463
|
-
const enUS$
|
|
59910
|
+
const enUS$p = {
|
|
59464
59911
|
quickMenu: {
|
|
59465
59912
|
basic: {
|
|
59466
59913
|
heading: {
|
|
@@ -59516,7 +59963,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59516
59963
|
selectBlock: "Select Block"
|
|
59517
59964
|
}
|
|
59518
59965
|
};
|
|
59519
|
-
const jaJP$
|
|
59966
|
+
const jaJP$p = {
|
|
59520
59967
|
quickMenu: {
|
|
59521
59968
|
basic: {
|
|
59522
59969
|
heading: {
|
|
@@ -59573,9 +60020,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59573
60020
|
}
|
|
59574
60021
|
};
|
|
59575
60022
|
i18n$1.mergeLang({
|
|
59576
|
-
"zh-CN": zhCN$
|
|
59577
|
-
"en-US": enUS$
|
|
59578
|
-
"ja-JP": jaJP$
|
|
60023
|
+
"zh-CN": zhCN$p,
|
|
60024
|
+
"en-US": enUS$p,
|
|
60025
|
+
"ja-JP": jaJP$p
|
|
59579
60026
|
});
|
|
59580
60027
|
class TextStylesFixedProvider extends ProxyProvider {
|
|
59581
60028
|
constructor(editor, afterCommandCallback) {
|
|
@@ -59780,7 +60227,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59780
60227
|
return false;
|
|
59781
60228
|
}
|
|
59782
60229
|
}
|
|
59783
|
-
const logger$
|
|
60230
|
+
const logger$1I = getLogger("block-command-providers");
|
|
59784
60231
|
class BlockCommandProviders extends AbstractProvider {
|
|
59785
60232
|
constructor(editor, afterCommandCallback) {
|
|
59786
60233
|
super(editor);
|
|
@@ -59801,7 +60248,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59801
60248
|
this.registerCommandProvider(new InsertGroupProvider(editor));
|
|
59802
60249
|
}
|
|
59803
60250
|
getCommands(range) {
|
|
59804
|
-
assert(logger$
|
|
60251
|
+
assert(logger$1I, range.start.blockId === range.end.blockId, "invalid range");
|
|
59805
60252
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59806
60253
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59807
60254
|
let startIndex = 100;
|
|
@@ -59815,7 +60262,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59815
60262
|
return this.filterItems(range, commands);
|
|
59816
60263
|
}
|
|
59817
60264
|
}
|
|
59818
|
-
const logger$
|
|
60265
|
+
const logger$1H = getLogger("standard-block-actions");
|
|
59819
60266
|
class StandardBlockActionHook {
|
|
59820
60267
|
constructor() {
|
|
59821
60268
|
__publicField(this, "executeCommand", (editor, bloockElement, item) => {
|
|
@@ -59834,7 +60281,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59834
60281
|
this.deleteBlock(editor, block);
|
|
59835
60282
|
}
|
|
59836
60283
|
} catch (err) {
|
|
59837
|
-
logger$
|
|
60284
|
+
logger$1H.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
59838
60285
|
}
|
|
59839
60286
|
});
|
|
59840
60287
|
}
|
|
@@ -59902,7 +60349,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59902
60349
|
}
|
|
59903
60350
|
}
|
|
59904
60351
|
}
|
|
59905
|
-
const logger$
|
|
60352
|
+
const logger$1G = getLogger("block-menu");
|
|
59906
60353
|
class BlockMenu {
|
|
59907
60354
|
constructor(editor) {
|
|
59908
60355
|
__publicField(this, "menu");
|
|
@@ -59910,7 +60357,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59910
60357
|
__publicField(this, "commandBlock", null);
|
|
59911
60358
|
__publicField(this, "blockCommandProviders");
|
|
59912
60359
|
__publicField(this, "handleShow", () => {
|
|
59913
|
-
assert(logger$
|
|
60360
|
+
assert(logger$1G, this.currentBlock, "no target block before show block menu");
|
|
59914
60361
|
const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
|
|
59915
60362
|
this.menu.updateItems(items);
|
|
59916
60363
|
this.commandBlock = this.currentBlock;
|
|
@@ -59921,7 +60368,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59921
60368
|
}
|
|
59922
60369
|
});
|
|
59923
60370
|
__publicField(this, "handleItemClick", (bar2, item) => {
|
|
59924
|
-
assert(logger$
|
|
60371
|
+
assert(logger$1G, this.commandBlock, "no command block before show block menu");
|
|
59925
60372
|
this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
|
|
59926
60373
|
if (!item.element) {
|
|
59927
60374
|
this.close();
|
|
@@ -59964,7 +60411,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59964
60411
|
this.menu.destroy();
|
|
59965
60412
|
}
|
|
59966
60413
|
}
|
|
59967
|
-
const logger$
|
|
60414
|
+
const logger$1F = getLogger("text-styles");
|
|
59968
60415
|
function getIntersectionStyles(text2) {
|
|
59969
60416
|
const getOpStyle = (op) => {
|
|
59970
60417
|
if (!op.attributes) {
|
|
@@ -59998,10 +60445,10 @@ $$${mathData.mathjaxText}$$
|
|
|
59998
60445
|
return new Map(Object.entries(attributes));
|
|
59999
60446
|
}
|
|
60000
60447
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
60001
|
-
assert(logger$
|
|
60448
|
+
assert(logger$1F, range.isSimple(), "invalid range");
|
|
60002
60449
|
const { start, end } = range;
|
|
60003
|
-
assert(logger$
|
|
60004
|
-
assert(logger$
|
|
60450
|
+
assert(logger$1F, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
60451
|
+
assert(logger$1F, style2.startsWith("style-"), "invalid style");
|
|
60005
60452
|
const oldText = editor.getBlockText(block);
|
|
60006
60453
|
let newText = oldText;
|
|
60007
60454
|
if (style2 === "style-sub") {
|
|
@@ -60047,13 +60494,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60047
60494
|
return standardItems;
|
|
60048
60495
|
}
|
|
60049
60496
|
function getSubText(editor, block, range) {
|
|
60050
|
-
assert(logger$
|
|
60497
|
+
assert(logger$1F, range.isSimple(), "nor a simple range");
|
|
60051
60498
|
const { start, end } = range;
|
|
60052
|
-
assert(logger$
|
|
60053
|
-
assert(logger$
|
|
60054
|
-
assert(logger$
|
|
60499
|
+
assert(logger$1F, start.isSimple(), "is not a simple block position");
|
|
60500
|
+
assert(logger$1F, end.isSimple(), "is not a simple block position");
|
|
60501
|
+
assert(logger$1F, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
|
|
60055
60502
|
const blockId = getBlockId(block);
|
|
60056
|
-
assert(logger$
|
|
60503
|
+
assert(logger$1F, start.blockId === blockId && end.blockId === blockId, "invalid range");
|
|
60057
60504
|
const text2 = editor.getBlockText(block);
|
|
60058
60505
|
let subText2 = [];
|
|
60059
60506
|
if (start.offset === end.offset) {
|
|
@@ -60065,7 +60512,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60065
60512
|
}
|
|
60066
60513
|
return subText2;
|
|
60067
60514
|
}
|
|
60068
|
-
const logger$
|
|
60515
|
+
const logger$1E = getLogger("text-commands");
|
|
60069
60516
|
function getCommands$1(editor, text2) {
|
|
60070
60517
|
const StandardTextStyles = {
|
|
60071
60518
|
"style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
|
|
@@ -60083,13 +60530,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60083
60530
|
}
|
|
60084
60531
|
function executeStyleCommand(editor, block, range, command, params, result) {
|
|
60085
60532
|
if (!command.startsWith("style-")) {
|
|
60086
|
-
logger$
|
|
60533
|
+
logger$1E.warn(`unknown command: ${command}`);
|
|
60087
60534
|
return false;
|
|
60088
60535
|
}
|
|
60089
60536
|
const value = params == null ? void 0 : params.value;
|
|
60090
60537
|
const type = typeof value;
|
|
60091
60538
|
if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
|
|
60092
|
-
logger$
|
|
60539
|
+
logger$1E.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
|
|
60093
60540
|
return false;
|
|
60094
60541
|
}
|
|
60095
60542
|
const newText = applyTextStyle(editor, block, range, command, value);
|
|
@@ -60314,7 +60761,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60314
60761
|
this.providers = [new TextScriptProvider(editor)];
|
|
60315
60762
|
}
|
|
60316
60763
|
}
|
|
60317
|
-
const logger$
|
|
60764
|
+
const logger$1D = getLogger("text-command-provider");
|
|
60318
60765
|
class TextCommandProvider {
|
|
60319
60766
|
constructor(editor, options) {
|
|
60320
60767
|
__publicField(this, "id", "TextCommandProvider");
|
|
@@ -60434,7 +60881,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60434
60881
|
}
|
|
60435
60882
|
static fromTextCommandId(id) {
|
|
60436
60883
|
const prefix = "text/";
|
|
60437
|
-
assert(logger$
|
|
60884
|
+
assert(logger$1D, id.startsWith(prefix), `invalid item id: ${id}`);
|
|
60438
60885
|
return id.substring(prefix.length);
|
|
60439
60886
|
}
|
|
60440
60887
|
}
|
|
@@ -60550,7 +60997,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60550
60997
|
};
|
|
60551
60998
|
editor.updateBlockData(block, newData);
|
|
60552
60999
|
}
|
|
60553
|
-
function addCommentToBlock
|
|
61000
|
+
function addCommentToBlock(editor, block, provider) {
|
|
60554
61001
|
const abstract = getCommentAbstract(editor, [block]);
|
|
60555
61002
|
const comment = createComment({
|
|
60556
61003
|
editor,
|
|
@@ -60561,7 +61008,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60561
61008
|
provider.localCreateComment(comment, doc2);
|
|
60562
61009
|
return comment;
|
|
60563
61010
|
}
|
|
60564
|
-
const logger$
|
|
61011
|
+
const logger$1C = getLogger("standard-block-actions");
|
|
60565
61012
|
class CommentBlockHook {
|
|
60566
61013
|
constructor(provider, editorComments) {
|
|
60567
61014
|
__publicField(this, "executeCommand", (editor, block, item) => {
|
|
@@ -60569,9 +61016,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60569
61016
|
try {
|
|
60570
61017
|
this.editorComments.showCommentList();
|
|
60571
61018
|
const block2 = editor.getBlockById(blockId);
|
|
60572
|
-
addCommentToBlock
|
|
61019
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
60573
61020
|
} catch (err) {
|
|
60574
|
-
logger$
|
|
61021
|
+
logger$1C.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
60575
61022
|
}
|
|
60576
61023
|
});
|
|
60577
61024
|
this.provider = provider;
|
|
@@ -60675,7 +61122,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60675
61122
|
const attributes = Array.from(element.attributes).map((c) => c.name);
|
|
60676
61123
|
return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
|
|
60677
61124
|
}
|
|
60678
|
-
const logger$
|
|
61125
|
+
const logger$1B = getLogger("doc-comments");
|
|
60679
61126
|
function addBlockComments(doc2, block, result, resultSet) {
|
|
60680
61127
|
if (block.comments) {
|
|
60681
61128
|
const blockComments = block.comments;
|
|
@@ -60770,8 +61217,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60770
61217
|
const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
|
|
60771
61218
|
const index1 = commentsMap.get(group1.groupId);
|
|
60772
61219
|
const index2 = commentsMap.get(group2.groupId);
|
|
60773
|
-
assert(logger$
|
|
60774
|
-
assert(logger$
|
|
61220
|
+
assert(logger$1B, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
|
|
61221
|
+
assert(logger$1B, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
|
|
60775
61222
|
return index1 - index2;
|
|
60776
61223
|
});
|
|
60777
61224
|
return result;
|
|
@@ -60832,7 +61279,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60832
61279
|
const commentIds = intersection__default.default(comments1, comments2);
|
|
60833
61280
|
return commentIds;
|
|
60834
61281
|
}
|
|
60835
|
-
const logger$
|
|
61282
|
+
const logger$1A = getLogger("active-comments");
|
|
60836
61283
|
function inactiveComment(editor, commentId) {
|
|
60837
61284
|
const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
|
|
60838
61285
|
activeCommentElements.forEach((el) => {
|
|
@@ -60868,13 +61315,12 @@ $$${mathData.mathjaxText}$$
|
|
|
60868
61315
|
const commentIds = getCommentsFromSelection(editor);
|
|
60869
61316
|
if (commentIds.indexOf(commentId) === -1) {
|
|
60870
61317
|
const block = getParentBlock(targetElement);
|
|
60871
|
-
assert(logger$
|
|
61318
|
+
assert(logger$1A, block, "block not found");
|
|
60872
61319
|
const offset = getChildOffset(block, targetElement);
|
|
60873
61320
|
const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
|
|
60874
61321
|
editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
|
|
60875
61322
|
}
|
|
60876
61323
|
}
|
|
60877
|
-
editor.focus();
|
|
60878
61324
|
if (direction === "next") {
|
|
60879
61325
|
const targetElementRect = targetElement.getBoundingClientRect();
|
|
60880
61326
|
const clientHeight = editor.scrollContainer.clientHeight;
|
|
@@ -60911,7 +61357,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60911
61357
|
function isValidSize(size) {
|
|
60912
61358
|
return typeof size === "number";
|
|
60913
61359
|
}
|
|
60914
|
-
const logger$
|
|
61360
|
+
const logger$1z = getLogger("image-data");
|
|
60915
61361
|
const md5Cache = /* @__PURE__ */ new Map();
|
|
60916
61362
|
const DEFAULT_WIDTH$1 = 1e3;
|
|
60917
61363
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -61043,7 +61489,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61043
61489
|
if (heightKey && isValidSize(image.height)) {
|
|
61044
61490
|
result[heightKey] = image.height;
|
|
61045
61491
|
}
|
|
61046
|
-
assert(logger$
|
|
61492
|
+
assert(logger$1z, image.flex, "no image flex");
|
|
61047
61493
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
61048
61494
|
result[flexKey] = image.flex;
|
|
61049
61495
|
});
|
|
@@ -61099,224 +61545,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61099
61545
|
const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
|
|
61100
61546
|
return totalFlex;
|
|
61101
61547
|
}
|
|
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");
|
|
61548
|
+
const logger$1y = getLogger("image-dom");
|
|
61320
61549
|
function getExistsProgressMask(imageContainer) {
|
|
61321
61550
|
return imageContainer.querySelector(".uploading-progress-mask");
|
|
61322
61551
|
}
|
|
@@ -61333,7 +61562,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61333
61562
|
function getImageUploadingProgressValueElement(imageContainer) {
|
|
61334
61563
|
const bar2 = getImageUploadingProgressMask(imageContainer);
|
|
61335
61564
|
const value = bar2.querySelector(".uploading-progress-bar-value");
|
|
61336
|
-
assert(logger$
|
|
61565
|
+
assert(logger$1y, value, "no progress value");
|
|
61337
61566
|
return value;
|
|
61338
61567
|
}
|
|
61339
61568
|
function setImageUploading(imageContainer, progress) {
|
|
@@ -61423,7 +61652,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61423
61652
|
const images = Array.from(block.querySelectorAll(".image-container"));
|
|
61424
61653
|
return images;
|
|
61425
61654
|
}
|
|
61426
|
-
const logger$
|
|
61655
|
+
const logger$1x = getLogger("table-resize-drag-drop");
|
|
61427
61656
|
class ImageSplitterResizer {
|
|
61428
61657
|
constructor(editor, elem, data2, mouseDownEvent) {
|
|
61429
61658
|
__publicField(this, "cursor", "col-resize");
|
|
@@ -61436,7 +61665,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61436
61665
|
const imageObject = getImageObject(this.editor, block);
|
|
61437
61666
|
const images = imageObject.getImages();
|
|
61438
61667
|
const splitterIndex = this.data.splitterIndex;
|
|
61439
|
-
assert(logger$
|
|
61668
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61440
61669
|
const imageContainers = getImageContainersByBlock(block);
|
|
61441
61670
|
const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
|
|
61442
61671
|
this.initWidths = initWidths;
|
|
@@ -61454,7 +61683,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61454
61683
|
const imageObject = getImageObject(this.editor, block);
|
|
61455
61684
|
const images = cloneDeep__default.default(imageObject.getImages());
|
|
61456
61685
|
const splitterIndex = this.data.splitterIndex;
|
|
61457
|
-
assert(logger$
|
|
61686
|
+
assert(logger$1x, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61458
61687
|
const width1 = this.initWidths[splitterIndex];
|
|
61459
61688
|
const width2 = this.initWidths[splitterIndex + 1];
|
|
61460
61689
|
if (width1 + width2 < 100) {
|
|
@@ -61473,7 +61702,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61473
61702
|
newWidths[splitterIndex] += delta;
|
|
61474
61703
|
newWidths[splitterIndex + 1] -= delta;
|
|
61475
61704
|
const imageContainers = getImageContainersByBlock(block);
|
|
61476
|
-
assert(logger$
|
|
61705
|
+
assert(logger$1x, imageContainers.length === images.length, "invalid image data");
|
|
61477
61706
|
const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
61478
61707
|
for (let i = 0; i < images.length; i++) {
|
|
61479
61708
|
const flex = newWidths[i] / totalWidth;
|
|
@@ -61546,7 +61775,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61546
61775
|
editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
|
|
61547
61776
|
editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
|
|
61548
61777
|
}
|
|
61549
|
-
const logger$
|
|
61778
|
+
const logger$1w = getLogger("image-item");
|
|
61550
61779
|
function getParentImageBlock(eventTarget) {
|
|
61551
61780
|
if (!eventTarget) {
|
|
61552
61781
|
return null;
|
|
@@ -61625,7 +61854,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61625
61854
|
if (file2) {
|
|
61626
61855
|
imageObject.replaceImage(index2, file2);
|
|
61627
61856
|
} else {
|
|
61628
|
-
logger$
|
|
61857
|
+
logger$1w.warn(`failed to download image: ${imageData.src}`);
|
|
61629
61858
|
}
|
|
61630
61859
|
}
|
|
61631
61860
|
function createLoadErrorElement(editor, imageContainer, imageData) {
|
|
@@ -61848,7 +62077,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61848
62077
|
function isImageFile(fileType) {
|
|
61849
62078
|
return fileType.startsWith("image/");
|
|
61850
62079
|
}
|
|
61851
|
-
const logger$
|
|
62080
|
+
const logger$1v = getLogger("image-object");
|
|
61852
62081
|
class ImageObject {
|
|
61853
62082
|
constructor(editor, blockData) {
|
|
61854
62083
|
__publicField(this, "images", []);
|
|
@@ -62139,7 +62368,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62139
62368
|
this.editor.updateEmbedData(block2, embedData);
|
|
62140
62369
|
return true;
|
|
62141
62370
|
} catch (err) {
|
|
62142
|
-
logger$
|
|
62371
|
+
logger$1v.error(err);
|
|
62143
62372
|
const block2 = this.editor.findBlockById(this.blockData.id);
|
|
62144
62373
|
if (!block2) {
|
|
62145
62374
|
return false;
|
|
@@ -62156,7 +62385,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62156
62385
|
if (!block) {
|
|
62157
62386
|
return;
|
|
62158
62387
|
}
|
|
62159
|
-
assert(logger$
|
|
62388
|
+
assert(logger$1v, flex.length === this.images.length, "invalid flex");
|
|
62160
62389
|
for (let i = 0; i < this.images.length; i++) {
|
|
62161
62390
|
this.images[i].flex = flex[i];
|
|
62162
62391
|
}
|
|
@@ -62205,7 +62434,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62205
62434
|
}
|
|
62206
62435
|
}
|
|
62207
62436
|
const imageEmbedStyle = "";
|
|
62208
|
-
const logger$
|
|
62437
|
+
const logger$1u = getLogger("drop-indicator");
|
|
62209
62438
|
const INDICATOR_SIZE$1 = 2;
|
|
62210
62439
|
class DropIndicator {
|
|
62211
62440
|
constructor(editor) {
|
|
@@ -62250,7 +62479,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62250
62479
|
if (insertPos === "before") {
|
|
62251
62480
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
62252
62481
|
if (!beforeBlock) {
|
|
62253
|
-
assert(logger$
|
|
62482
|
+
assert(logger$1u, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
62254
62483
|
const rect = block.getBoundingClientRect();
|
|
62255
62484
|
const viewRect2 = this.getViewRect(block);
|
|
62256
62485
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -62276,14 +62505,14 @@ $$${mathData.mathjaxText}$$
|
|
|
62276
62505
|
const PADDING = 5;
|
|
62277
62506
|
if (insertPos.pos === "left") {
|
|
62278
62507
|
const parent = getParentContainer(block);
|
|
62279
|
-
assert(logger$
|
|
62508
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62280
62509
|
const rect = block.getBoundingClientRect();
|
|
62281
62510
|
const viewRect = this.getViewRect(block);
|
|
62282
62511
|
return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
|
|
62283
62512
|
}
|
|
62284
62513
|
if (insertPos.pos === "right") {
|
|
62285
62514
|
const parent = getParentContainer(block);
|
|
62286
|
-
assert(logger$
|
|
62515
|
+
assert(logger$1u, parent, "block does not in a container");
|
|
62287
62516
|
const rect = block.getBoundingClientRect();
|
|
62288
62517
|
let viewRect;
|
|
62289
62518
|
if (isEmbedBlock(block)) {
|
|
@@ -62380,7 +62609,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62380
62609
|
}
|
|
62381
62610
|
return void 0;
|
|
62382
62611
|
}
|
|
62383
|
-
const logger$
|
|
62612
|
+
const logger$1t = getLogger("code-dom");
|
|
62384
62613
|
function isCodeBlock(block) {
|
|
62385
62614
|
return getBlockType(block) === "code";
|
|
62386
62615
|
}
|
|
@@ -62398,8 +62627,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62398
62627
|
}
|
|
62399
62628
|
function getParentCodeBlock(elem) {
|
|
62400
62629
|
const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
|
|
62401
|
-
assert(logger$
|
|
62402
|
-
assert(logger$
|
|
62630
|
+
assert(logger$1t, codeBlock2, "no parent code block");
|
|
62631
|
+
assert(logger$1t, isCodeBlock(codeBlock2), "not a code block");
|
|
62403
62632
|
return codeBlock2;
|
|
62404
62633
|
}
|
|
62405
62634
|
const SUPPORTED_LANGUAGES = () => ({
|
|
@@ -62490,7 +62719,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62490
62719
|
function setDefaultLanguage(editor, lang) {
|
|
62491
62720
|
return editor.settingsProvider.setItem("editor-code-lang", lang);
|
|
62492
62721
|
}
|
|
62493
|
-
const logger$
|
|
62722
|
+
const logger$1s = getLogger("convert-to-code");
|
|
62494
62723
|
function convertToCode(editor, srcBlock) {
|
|
62495
62724
|
if (!isTextKindBlock(editor, srcBlock)) {
|
|
62496
62725
|
return null;
|
|
@@ -62503,7 +62732,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62503
62732
|
const textContainerId = genId();
|
|
62504
62733
|
editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
|
|
62505
62734
|
const text2 = editor.getBlockData(srcBlock).text;
|
|
62506
|
-
assert(logger$
|
|
62735
|
+
assert(logger$1s, text2, "no text");
|
|
62507
62736
|
let alias = toPlainText(text2);
|
|
62508
62737
|
if (alias.startsWith("```")) {
|
|
62509
62738
|
alias = alias.substring(3);
|
|
@@ -62521,16 +62750,16 @@ $$${mathData.mathjaxText}$$
|
|
|
62521
62750
|
};
|
|
62522
62751
|
}
|
|
62523
62752
|
const codeBlock = "";
|
|
62524
|
-
const logger$
|
|
62753
|
+
const logger$1r = getLogger("code-block-child-container");
|
|
62525
62754
|
function getTextContainer(codeBlock2) {
|
|
62526
|
-
assert(logger$
|
|
62755
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62527
62756
|
const content = getBlockContent(codeBlock2);
|
|
62528
62757
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
|
|
62529
|
-
assert(logger$
|
|
62758
|
+
assert(logger$1r, textContainer, "no code text container");
|
|
62530
62759
|
return textContainer;
|
|
62531
62760
|
}
|
|
62532
62761
|
function getCaptionContainer(codeBlock2) {
|
|
62533
|
-
assert(logger$
|
|
62762
|
+
assert(logger$1r, isCodeBlock(codeBlock2), "not a code block");
|
|
62534
62763
|
const content = getBlockContent(codeBlock2);
|
|
62535
62764
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
|
|
62536
62765
|
if (!textContainer)
|
|
@@ -62559,7 +62788,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62559
62788
|
}
|
|
62560
62789
|
return getBlockType(block) === "code";
|
|
62561
62790
|
}
|
|
62562
|
-
const logger$
|
|
62791
|
+
const logger$1q = getLogger("code-caption");
|
|
62563
62792
|
function toggleCodeCaption(editor, codeBlock2) {
|
|
62564
62793
|
if (editor.readonly) {
|
|
62565
62794
|
return;
|
|
@@ -62572,7 +62801,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62572
62801
|
}
|
|
62573
62802
|
const captionContainerId = createEmptyContainer(editor.doc);
|
|
62574
62803
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62575
|
-
assert(logger$
|
|
62804
|
+
assert(logger$1q, oldData.children.length === 1, "code block should have only one child");
|
|
62576
62805
|
const newData = {
|
|
62577
62806
|
...oldData,
|
|
62578
62807
|
children: [oldData.children[0], captionContainerId]
|
|
@@ -62588,7 +62817,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62588
62817
|
return false;
|
|
62589
62818
|
}
|
|
62590
62819
|
const parentBlock = getParentBlock(parentContainer);
|
|
62591
|
-
assert(logger$
|
|
62820
|
+
assert(logger$1q, parentBlock, "no parent block");
|
|
62592
62821
|
if (!isCodeBlock(parentBlock)) {
|
|
62593
62822
|
return false;
|
|
62594
62823
|
}
|
|
@@ -62608,7 +62837,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62608
62837
|
const lastBlock2 = getLastChildBlock(textContainer);
|
|
62609
62838
|
editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
|
|
62610
62839
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62611
|
-
assert(logger$
|
|
62840
|
+
assert(logger$1q, oldData.children.length === 2, "code block should have only one child");
|
|
62612
62841
|
const captionContainerId = oldData.children[1];
|
|
62613
62842
|
const newData = {
|
|
62614
62843
|
...oldData,
|
|
@@ -62617,7 +62846,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62617
62846
|
editor.updateBlockData(codeBlock2, newData);
|
|
62618
62847
|
editor.deleteChildContainers([captionContainerId]);
|
|
62619
62848
|
}
|
|
62620
|
-
const logger$
|
|
62849
|
+
const logger$1p = getLogger("paste-in-table-block");
|
|
62621
62850
|
class PasteEventHandler {
|
|
62622
62851
|
constructor(editor) {
|
|
62623
62852
|
this.editor = editor;
|
|
@@ -62638,7 +62867,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62638
62867
|
return false;
|
|
62639
62868
|
}
|
|
62640
62869
|
const parentBlock = getParentBlock(parentContainer);
|
|
62641
|
-
assert(logger$
|
|
62870
|
+
assert(logger$1p, parentBlock, "no parent block");
|
|
62642
62871
|
if (!isCodeBlock(parentBlock)) {
|
|
62643
62872
|
return false;
|
|
62644
62873
|
}
|
|
@@ -62702,7 +62931,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62702
62931
|
function registerCodeBlockCommandProvider(editor) {
|
|
62703
62932
|
editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
|
|
62704
62933
|
}
|
|
62705
|
-
const logger$
|
|
62934
|
+
const logger$1o = getLogger("code-caption-input-handler");
|
|
62706
62935
|
function getCurrentCaptionBlock(editor) {
|
|
62707
62936
|
if (!editor.selection.range.isSimple()) {
|
|
62708
62937
|
return null;
|
|
@@ -62815,7 +63044,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62815
63044
|
editor.undoManager.runInGroup(() => {
|
|
62816
63045
|
editor.clearSelectedContents();
|
|
62817
63046
|
const start = editor.selection.range.start;
|
|
62818
|
-
assert(logger$
|
|
63047
|
+
assert(logger$1o, start.isSimple(), "not simple position");
|
|
62819
63048
|
editor.insertTextToBlock(block, start.offset, text2);
|
|
62820
63049
|
});
|
|
62821
63050
|
return true;
|
|
@@ -62860,9 +63089,9 @@ $$${mathData.mathjaxText}$$
|
|
|
62860
63089
|
};
|
|
62861
63090
|
editor.updateBlockData(codeBlock2, newData);
|
|
62862
63091
|
}
|
|
62863
|
-
const logger$
|
|
63092
|
+
const logger$1n = getLogger("code-block-header");
|
|
62864
63093
|
function selectCodeBlock(editor, block, options) {
|
|
62865
|
-
assert(logger$
|
|
63094
|
+
assert(logger$1n, isCodeBlock(block), "not a code block");
|
|
62866
63095
|
const firstBlock = getFirstChildBlock(getTextContainer(block));
|
|
62867
63096
|
editor.selection.selectBlock(firstBlock, 0);
|
|
62868
63097
|
if (options.focusToEditor) {
|
|
@@ -62904,14 +63133,15 @@ $$${mathData.mathjaxText}$$
|
|
|
62904
63133
|
const target = event.target;
|
|
62905
63134
|
const select2 = target.closest(".language-select");
|
|
62906
63135
|
const block = getParentBlock(select2);
|
|
62907
|
-
assert(logger$
|
|
62908
|
-
assert(logger$
|
|
63136
|
+
assert(logger$1n, block, "no parent block");
|
|
63137
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62909
63138
|
const codeData = editor2.getBlockData(block);
|
|
62910
63139
|
const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
|
|
62911
63140
|
dropdown2.custom = { codeBlock: block, editor: editor2 };
|
|
62912
63141
|
dropdown2.setSelectedId(codeData.language);
|
|
62913
63142
|
selectCodeBlock(editor2, block, { focusToEditor: false });
|
|
62914
63143
|
setTimeout(() => {
|
|
63144
|
+
CommandBar.hideAll();
|
|
62915
63145
|
dropdown2.show(select2);
|
|
62916
63146
|
});
|
|
62917
63147
|
addClass(codeBlock2, "editing-language");
|
|
@@ -62927,11 +63157,11 @@ $$${mathData.mathjaxText}$$
|
|
|
62927
63157
|
function handleCodeHeaderButtonClick(editor, event) {
|
|
62928
63158
|
const target = event.target;
|
|
62929
63159
|
const button2 = target.closest(".code-header-button");
|
|
62930
|
-
assert(logger$
|
|
63160
|
+
assert(logger$1n, button2, "no button");
|
|
62931
63161
|
const block = getParentBlock(target);
|
|
62932
|
-
assert(logger$
|
|
63162
|
+
assert(logger$1n, block, "no parent block");
|
|
62933
63163
|
const id = button2.getAttribute("data-id");
|
|
62934
|
-
assert(logger$
|
|
63164
|
+
assert(logger$1n, getBlockType(block) === "code", "not a code block");
|
|
62935
63165
|
if (id === "wrap") {
|
|
62936
63166
|
const old = editor.getBlockData(block);
|
|
62937
63167
|
changeCodeBlockWrap(editor, block, !old.nowrap);
|
|
@@ -62957,7 +63187,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62957
63187
|
}
|
|
62958
63188
|
});
|
|
62959
63189
|
}).catch((err) => {
|
|
62960
|
-
logger$
|
|
63190
|
+
logger$1n.error(err.message);
|
|
62961
63191
|
});
|
|
62962
63192
|
return;
|
|
62963
63193
|
}
|
|
@@ -63008,7 +63238,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63008
63238
|
}
|
|
63009
63239
|
function getCodeBlockHeader(block) {
|
|
63010
63240
|
const header = block.querySelector(".code-block-header");
|
|
63011
|
-
assert(logger$
|
|
63241
|
+
assert(logger$1n, header, "no code block header");
|
|
63012
63242
|
return header;
|
|
63013
63243
|
}
|
|
63014
63244
|
function handleCodeScroll(editor, event) {
|
|
@@ -63057,7 +63287,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63057
63287
|
focusBlockId: textBlock.id
|
|
63058
63288
|
};
|
|
63059
63289
|
}
|
|
63060
|
-
const logger$
|
|
63290
|
+
const logger$1m = getLogger("code-block");
|
|
63061
63291
|
function getPaddingNum(index2) {
|
|
63062
63292
|
if (index2 <= 2) {
|
|
63063
63293
|
return 32;
|
|
@@ -63084,10 +63314,10 @@ $$${mathData.mathjaxText}$$
|
|
|
63084
63314
|
handlePasteInTableEvent(editor);
|
|
63085
63315
|
registerCodeBlockCommandProvider(editor);
|
|
63086
63316
|
trackChildBlockEvent(editor, handleDebounceUpdate);
|
|
63087
|
-
assert(logger$
|
|
63317
|
+
assert(logger$1m, blockData.type === "code", "invalid block data type");
|
|
63088
63318
|
const codeData = blockData;
|
|
63089
|
-
assert(logger$
|
|
63090
|
-
assert(logger$
|
|
63319
|
+
assert(logger$1m, codeData.children, "invalid block data children");
|
|
63320
|
+
assert(logger$1m, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
|
|
63091
63321
|
setTimeout(() => {
|
|
63092
63322
|
if (isNodeRemoved(blockElement))
|
|
63093
63323
|
return;
|
|
@@ -63138,15 +63368,15 @@ $$${mathData.mathjaxText}$$
|
|
|
63138
63368
|
}
|
|
63139
63369
|
function updateSelection$3(editor, block, from, to) {
|
|
63140
63370
|
if (from.isSimple()) {
|
|
63141
|
-
assert(logger$
|
|
63142
|
-
logger$
|
|
63371
|
+
assert(logger$1m, to.isSimple(), "from is simple position but to is not simple position");
|
|
63372
|
+
logger$1m.debug("full select list");
|
|
63143
63373
|
addClass(block, "full-selected");
|
|
63144
63374
|
return;
|
|
63145
63375
|
}
|
|
63146
|
-
assert(logger$
|
|
63376
|
+
assert(logger$1m, !to.isSimple(), "from is complex position but end is simple position");
|
|
63147
63377
|
const f = from;
|
|
63148
63378
|
const t2 = to;
|
|
63149
|
-
assert(logger$
|
|
63379
|
+
assert(logger$1m, f.blockId === t2.blockId, "only allow update one table selection");
|
|
63150
63380
|
const containers = getCodeChildContainers(block);
|
|
63151
63381
|
containers.forEach((container) => {
|
|
63152
63382
|
const containerId = getContainerId(container);
|
|
@@ -63181,8 +63411,8 @@ $$${mathData.mathjaxText}$$
|
|
|
63181
63411
|
const containersIds = childContainers.map(getContainerId);
|
|
63182
63412
|
const startIndex = containersIds.indexOf(start.childContainerId);
|
|
63183
63413
|
const endIndex = containersIds.indexOf(end.childContainerId);
|
|
63184
|
-
assert(logger$
|
|
63185
|
-
assert(logger$
|
|
63414
|
+
assert(logger$1m, startIndex !== -1, "invalid start pos");
|
|
63415
|
+
assert(logger$1m, endIndex !== -1, "invalid end pos");
|
|
63186
63416
|
const ret = [childContainers[startIndex]];
|
|
63187
63417
|
if (startIndex !== endIndex) {
|
|
63188
63418
|
ret.push(childContainers[endIndex]);
|
|
@@ -63190,7 +63420,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63190
63420
|
return ret;
|
|
63191
63421
|
}
|
|
63192
63422
|
function handleBlockElementUpdated(editor, block, blockData) {
|
|
63193
|
-
assert(logger$
|
|
63423
|
+
assert(logger$1m, isCodeBlock(block), "invalid block type");
|
|
63194
63424
|
const codeData = blockData;
|
|
63195
63425
|
updateCodeBlockElementStyles(editor, block, codeData);
|
|
63196
63426
|
}
|
|
@@ -63382,10 +63612,10 @@ ${codeText}
|
|
|
63382
63612
|
"Shift+Tab": handleShiftTab$1,
|
|
63383
63613
|
"CtrlOrCmd+A": selectCode
|
|
63384
63614
|
};
|
|
63385
|
-
const logger$
|
|
63615
|
+
const logger$1l = getLogger("code-text-decorate");
|
|
63386
63616
|
class CodeTextDecorator {
|
|
63387
63617
|
decorateText(editor, path, blockText) {
|
|
63388
|
-
assert(logger$
|
|
63618
|
+
assert(logger$1l, path.length > 0, "invalid path");
|
|
63389
63619
|
if (path.length === 1) {
|
|
63390
63620
|
return {};
|
|
63391
63621
|
}
|
|
@@ -63410,7 +63640,7 @@ ${codeText}
|
|
|
63410
63640
|
const grammar = getProsmGrammar(codeData.language);
|
|
63411
63641
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63412
63642
|
const tokenToText = (token, attributes) => {
|
|
63413
|
-
assert(logger$
|
|
63643
|
+
assert(logger$1l, token, "no token");
|
|
63414
63644
|
if (typeof token === "string") {
|
|
63415
63645
|
const ret = {
|
|
63416
63646
|
insert: token,
|
|
@@ -63418,7 +63648,7 @@ ${codeText}
|
|
|
63418
63648
|
};
|
|
63419
63649
|
return [ret];
|
|
63420
63650
|
}
|
|
63421
|
-
assert(logger$
|
|
63651
|
+
assert(logger$1l, token instanceof Prism__default.default.Token, "invalid token type");
|
|
63422
63652
|
const content = token.content;
|
|
63423
63653
|
const newAttributes = cloneDeep__default.default(attributes);
|
|
63424
63654
|
newAttributes[`style-code-${token.type}`] = true;
|
|
@@ -63434,18 +63664,18 @@ ${codeText}
|
|
|
63434
63664
|
const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
|
|
63435
63665
|
return ret;
|
|
63436
63666
|
}
|
|
63437
|
-
assert(logger$
|
|
63667
|
+
assert(logger$1l, content instanceof Prism__default.default.Token, "invalid token");
|
|
63438
63668
|
return tokenToText(content, newAttributes);
|
|
63439
63669
|
};
|
|
63440
63670
|
const ops = tokens.map((token) => tokenToText(token, {}));
|
|
63441
63671
|
const newText = ops.flat();
|
|
63442
|
-
assert(logger$
|
|
63672
|
+
assert(logger$1l, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
|
|
63443
63673
|
return {
|
|
63444
63674
|
text: newText
|
|
63445
63675
|
};
|
|
63446
63676
|
}
|
|
63447
63677
|
}
|
|
63448
|
-
const zhCN$
|
|
63678
|
+
const zhCN$o = {
|
|
63449
63679
|
code: {
|
|
63450
63680
|
title: "\u4EE3\u7801",
|
|
63451
63681
|
abstract: "\u4EE3\u7801",
|
|
@@ -63457,7 +63687,7 @@ ${codeText}
|
|
|
63457
63687
|
plainText: "Plain Text"
|
|
63458
63688
|
}
|
|
63459
63689
|
};
|
|
63460
|
-
const enUS$
|
|
63690
|
+
const enUS$o = {
|
|
63461
63691
|
code: {
|
|
63462
63692
|
title: "Code",
|
|
63463
63693
|
abstract: "Code",
|
|
@@ -63469,7 +63699,7 @@ ${codeText}
|
|
|
63469
63699
|
plainText: "Plain Text"
|
|
63470
63700
|
}
|
|
63471
63701
|
};
|
|
63472
|
-
const jaJP$
|
|
63702
|
+
const jaJP$o = {
|
|
63473
63703
|
code: {
|
|
63474
63704
|
title: "\u30B3\u30FC\u30C9",
|
|
63475
63705
|
abstract: "\u30B3\u30FC\u30C9",
|
|
@@ -63482,9 +63712,9 @@ ${codeText}
|
|
|
63482
63712
|
}
|
|
63483
63713
|
};
|
|
63484
63714
|
i18n$1.mergeLang({
|
|
63485
|
-
"zh-CN": zhCN$
|
|
63486
|
-
"en-US": enUS$
|
|
63487
|
-
"ja-JP": jaJP$
|
|
63715
|
+
"zh-CN": zhCN$o,
|
|
63716
|
+
"en-US": enUS$o,
|
|
63717
|
+
"ja-JP": jaJP$o
|
|
63488
63718
|
});
|
|
63489
63719
|
function convertToTable(editor, containerId, blockIndex, offset) {
|
|
63490
63720
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -63745,7 +63975,7 @@ ${codeText}
|
|
|
63745
63975
|
}
|
|
63746
63976
|
return false;
|
|
63747
63977
|
}
|
|
63748
|
-
const logger$
|
|
63978
|
+
const logger$1k = getLogger("match-text-style");
|
|
63749
63979
|
function matchTextPair(text2, find) {
|
|
63750
63980
|
if (text2.length < find.length * 2 + 1) {
|
|
63751
63981
|
return -1;
|
|
@@ -63815,7 +64045,7 @@ ${codeText}
|
|
|
63815
64045
|
editor.insertBoxToBlock(block, start, boxData);
|
|
63816
64046
|
});
|
|
63817
64047
|
} catch (err) {
|
|
63818
|
-
logger$
|
|
64048
|
+
logger$1k.warn(`failed to convert to box, ${err.message}`);
|
|
63819
64049
|
continue;
|
|
63820
64050
|
}
|
|
63821
64051
|
}
|
|
@@ -63878,7 +64108,7 @@ ${codeText}
|
|
|
63878
64108
|
return false;
|
|
63879
64109
|
}
|
|
63880
64110
|
}
|
|
63881
|
-
const enUS$
|
|
64111
|
+
const enUS$n = {
|
|
63882
64112
|
placeholder: {
|
|
63883
64113
|
default: "Type / for commands",
|
|
63884
64114
|
heading: "Heading {heading}",
|
|
@@ -63889,7 +64119,7 @@ ${codeText}
|
|
|
63889
64119
|
mobileDefault: "Type to add content"
|
|
63890
64120
|
}
|
|
63891
64121
|
};
|
|
63892
|
-
const zhCN$
|
|
64122
|
+
const zhCN$n = {
|
|
63893
64123
|
placeholder: {
|
|
63894
64124
|
default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
|
|
63895
64125
|
heading: "\u6807\u9898{heading}",
|
|
@@ -63900,7 +64130,7 @@ ${codeText}
|
|
|
63900
64130
|
mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
|
|
63901
64131
|
}
|
|
63902
64132
|
};
|
|
63903
|
-
const jaJP$
|
|
64133
|
+
const jaJP$n = {
|
|
63904
64134
|
placeholder: {
|
|
63905
64135
|
default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
|
|
63906
64136
|
heading: "\u898B\u51FA\u3057{heading}",
|
|
@@ -63912,9 +64142,9 @@ ${codeText}
|
|
|
63912
64142
|
}
|
|
63913
64143
|
};
|
|
63914
64144
|
const langs$1 = {
|
|
63915
|
-
"en-US": enUS$
|
|
63916
|
-
"zh-CN": zhCN$
|
|
63917
|
-
"ja-JP": jaJP$
|
|
64145
|
+
"en-US": enUS$n,
|
|
64146
|
+
"zh-CN": zhCN$n,
|
|
64147
|
+
"ja-JP": jaJP$n
|
|
63918
64148
|
};
|
|
63919
64149
|
i18n$1.mergeLang(langs$1);
|
|
63920
64150
|
function isEmptyTextBlockWithoutCompositionText(editor, block) {
|
|
@@ -64081,7 +64311,7 @@ ${codeText}
|
|
|
64081
64311
|
}
|
|
64082
64312
|
return false;
|
|
64083
64313
|
}
|
|
64084
|
-
const logger$
|
|
64314
|
+
const logger$1j = getLogger("enforce-title");
|
|
64085
64315
|
class EnforceWithDocumentTitleHandler {
|
|
64086
64316
|
constructor(editor, options = {
|
|
64087
64317
|
headingLevel: 1
|
|
@@ -64153,7 +64383,7 @@ ${codeText}
|
|
|
64153
64383
|
var _a, _b;
|
|
64154
64384
|
try {
|
|
64155
64385
|
const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
|
|
64156
|
-
assert(logger$
|
|
64386
|
+
assert(logger$1j, blocks.length > 0, "root container is empty");
|
|
64157
64387
|
const firstBlock = blocks[0];
|
|
64158
64388
|
if (firstBlock.type !== "text" && !this.options.hideTitle) {
|
|
64159
64389
|
const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
|
|
@@ -64162,7 +64392,7 @@ ${codeText}
|
|
|
64162
64392
|
return;
|
|
64163
64393
|
}
|
|
64164
64394
|
if (!this.options.hideTitle) {
|
|
64165
|
-
assert(logger$
|
|
64395
|
+
assert(logger$1j, firstBlock.text, "invalid text block");
|
|
64166
64396
|
const block = editor.getBlockById(firstBlock.id);
|
|
64167
64397
|
if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
|
|
64168
64398
|
const text2 = editor.getBlockString(block);
|
|
@@ -64247,7 +64477,7 @@ ${codeText}
|
|
|
64247
64477
|
});
|
|
64248
64478
|
return orgDataUrl;
|
|
64249
64479
|
}
|
|
64250
|
-
const logger$
|
|
64480
|
+
const logger$1i = getLogger("drag-preview-image");
|
|
64251
64481
|
class DragPreviewImage {
|
|
64252
64482
|
constructor(editor) {
|
|
64253
64483
|
__publicField(this, "startPosition", null);
|
|
@@ -64255,7 +64485,7 @@ ${codeText}
|
|
|
64255
64485
|
__publicField(this, "handleDragStart", async (e2, preview) => {
|
|
64256
64486
|
var _a, _b, _c, _d, _e, _f;
|
|
64257
64487
|
const target = e2.target;
|
|
64258
|
-
assert(logger$
|
|
64488
|
+
assert(logger$1i, target instanceof Element, `Invalid Drag target:${target}`);
|
|
64259
64489
|
const { x: startX, y: startY } = e2;
|
|
64260
64490
|
this.startPosition = {
|
|
64261
64491
|
x: startX,
|
|
@@ -64341,7 +64571,7 @@ ${codeText}
|
|
|
64341
64571
|
}
|
|
64342
64572
|
return block;
|
|
64343
64573
|
}
|
|
64344
|
-
const logger$
|
|
64574
|
+
const logger$1h = getLogger("block-menu-drag-handler");
|
|
64345
64575
|
function createDragEventFromMouseEvent$2(event, type) {
|
|
64346
64576
|
const dragEvent = new DragEvent(type, {
|
|
64347
64577
|
bubbles: true,
|
|
@@ -64362,7 +64592,7 @@ ${codeText}
|
|
|
64362
64592
|
__publicField(this, "oldPos", { x: 0, y: 0 });
|
|
64363
64593
|
__publicField(this, "handleMouseDown", (event) => {
|
|
64364
64594
|
const block = this.button.blockMenu.currentBlock;
|
|
64365
|
-
assert(logger$
|
|
64595
|
+
assert(logger$1h, block, "no dragged block");
|
|
64366
64596
|
if (event.button !== 0) {
|
|
64367
64597
|
return;
|
|
64368
64598
|
}
|
|
@@ -64390,7 +64620,7 @@ ${codeText}
|
|
|
64390
64620
|
});
|
|
64391
64621
|
}
|
|
64392
64622
|
const block = this.button.blockMenu.currentBlock;
|
|
64393
|
-
assert(logger$
|
|
64623
|
+
assert(logger$1h, block, "no dragged block");
|
|
64394
64624
|
(_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
|
|
64395
64625
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
|
|
64396
64626
|
registerStandardDraggedObject(this.editor, dragEvent, block);
|
|
@@ -64410,7 +64640,7 @@ ${codeText}
|
|
|
64410
64640
|
this.handleDragStart(event);
|
|
64411
64641
|
}
|
|
64412
64642
|
this.oldPos = { x, y };
|
|
64413
|
-
assert(logger$
|
|
64643
|
+
assert(logger$1h, target instanceof Element, "target is invalid");
|
|
64414
64644
|
this.dragPreview.handleDrag(event);
|
|
64415
64645
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
|
|
64416
64646
|
this.editor.contentElement.dispatchEvent(dragEvent);
|
|
@@ -64418,7 +64648,7 @@ ${codeText}
|
|
|
64418
64648
|
__publicField(this, "handleDragEnd", (event) => {
|
|
64419
64649
|
var _a;
|
|
64420
64650
|
const block = this.button.blockMenu.currentBlock;
|
|
64421
|
-
assert(logger$
|
|
64651
|
+
assert(logger$1h, block, "no dragged block");
|
|
64422
64652
|
window.isDragging = false;
|
|
64423
64653
|
this.dragPreview.handleDragEnd();
|
|
64424
64654
|
(_a = this.autoScroll) == null ? void 0 : _a.inactive();
|
|
@@ -64641,7 +64871,7 @@ ${codeText}
|
|
|
64641
64871
|
this.rootButton.destroy();
|
|
64642
64872
|
}
|
|
64643
64873
|
}
|
|
64644
|
-
const zhCN$
|
|
64874
|
+
const zhCN$m = {
|
|
64645
64875
|
blockMenu: {
|
|
64646
64876
|
section: {
|
|
64647
64877
|
basics: "\u57FA\u7840",
|
|
@@ -64665,7 +64895,7 @@ ${codeText}
|
|
|
64665
64895
|
}
|
|
64666
64896
|
}
|
|
64667
64897
|
};
|
|
64668
|
-
const enUS$
|
|
64898
|
+
const enUS$m = {
|
|
64669
64899
|
blockMenu: {
|
|
64670
64900
|
section: {
|
|
64671
64901
|
basics: "Basic",
|
|
@@ -64689,7 +64919,7 @@ ${codeText}
|
|
|
64689
64919
|
}
|
|
64690
64920
|
}
|
|
64691
64921
|
};
|
|
64692
|
-
const jaJP$
|
|
64922
|
+
const jaJP$m = {
|
|
64693
64923
|
blockMenu: {
|
|
64694
64924
|
section: {
|
|
64695
64925
|
basics: "\u4E00\u822C",
|
|
@@ -64714,9 +64944,9 @@ ${codeText}
|
|
|
64714
64944
|
}
|
|
64715
64945
|
};
|
|
64716
64946
|
i18n$1.mergeLang({
|
|
64717
|
-
"zh-CN": zhCN$
|
|
64718
|
-
"en-US": enUS$
|
|
64719
|
-
"ja-JP": jaJP$
|
|
64947
|
+
"zh-CN": zhCN$m,
|
|
64948
|
+
"en-US": enUS$m,
|
|
64949
|
+
"ja-JP": jaJP$m
|
|
64720
64950
|
});
|
|
64721
64951
|
const style$6 = "";
|
|
64722
64952
|
class DragData {
|
|
@@ -64796,7 +65026,7 @@ ${codeText}
|
|
|
64796
65026
|
function clearDraggedObject(editor) {
|
|
64797
65027
|
getDragData(editor).clearData();
|
|
64798
65028
|
}
|
|
64799
|
-
const logger$
|
|
65029
|
+
const logger$1g = getLogger("find-drop-target");
|
|
64800
65030
|
function childContainerFromPoint(x, y) {
|
|
64801
65031
|
const elem = getElementFromPoint(x, y);
|
|
64802
65032
|
if (!elem) {
|
|
@@ -64909,13 +65139,13 @@ ${codeText}
|
|
|
64909
65139
|
return true;
|
|
64910
65140
|
}
|
|
64911
65141
|
const parentBlock = getParentBlock(container);
|
|
64912
|
-
assert(logger$
|
|
65142
|
+
assert(logger$1g, parentBlock, "no parent block");
|
|
64913
65143
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
64914
65144
|
return false;
|
|
64915
65145
|
}
|
|
64916
65146
|
return canInsertAsSibling(editor, parentBlock);
|
|
64917
65147
|
}
|
|
64918
|
-
const logger$
|
|
65148
|
+
const logger$1f = getLogger("drop-target");
|
|
64919
65149
|
function getEmbedClassByFile(editor, file2) {
|
|
64920
65150
|
let embedClass = {};
|
|
64921
65151
|
if (/image/.test(file2.type)) {
|
|
@@ -64925,7 +65155,7 @@ ${codeText}
|
|
|
64925
65155
|
} else if (/video/.test(file2.type)) {
|
|
64926
65156
|
embedClass = editor.editorEmbeds.getEmbedClass("video");
|
|
64927
65157
|
}
|
|
64928
|
-
assert(logger$
|
|
65158
|
+
assert(logger$1f, embedClass, `unSupport file type ${file2.type}`);
|
|
64929
65159
|
return embedClass;
|
|
64930
65160
|
}
|
|
64931
65161
|
async function patchInsertFile(editor, files, containerId, blockIndex) {
|
|
@@ -65672,7 +65902,7 @@ ${codeText}
|
|
|
65672
65902
|
}
|
|
65673
65903
|
}
|
|
65674
65904
|
}
|
|
65675
|
-
const zhCN$
|
|
65905
|
+
const zhCN$l = {
|
|
65676
65906
|
image: {
|
|
65677
65907
|
title: "\u56FE\u7247",
|
|
65678
65908
|
upload: {
|
|
@@ -65688,7 +65918,7 @@ ${codeText}
|
|
|
65688
65918
|
abstract: "\u56FE\u7247"
|
|
65689
65919
|
}
|
|
65690
65920
|
};
|
|
65691
|
-
const enUS$
|
|
65921
|
+
const enUS$l = {
|
|
65692
65922
|
image: {
|
|
65693
65923
|
title: "Image",
|
|
65694
65924
|
upload: {
|
|
@@ -65704,7 +65934,7 @@ ${codeText}
|
|
|
65704
65934
|
abstract: "Image"
|
|
65705
65935
|
}
|
|
65706
65936
|
};
|
|
65707
|
-
const jaJP$
|
|
65937
|
+
const jaJP$l = {
|
|
65708
65938
|
image: {
|
|
65709
65939
|
title: "\u753B\u50CF",
|
|
65710
65940
|
upload: {
|
|
@@ -65721,9 +65951,9 @@ ${codeText}
|
|
|
65721
65951
|
}
|
|
65722
65952
|
};
|
|
65723
65953
|
i18n$1.mergeLang({
|
|
65724
|
-
"zh-CN": zhCN$
|
|
65725
|
-
"en-US": enUS$
|
|
65726
|
-
"ja-JP": jaJP$
|
|
65954
|
+
"zh-CN": zhCN$l,
|
|
65955
|
+
"en-US": enUS$l,
|
|
65956
|
+
"ja-JP": jaJP$l
|
|
65727
65957
|
});
|
|
65728
65958
|
function convertToImage(editor, containerId, blockIndex, offset) {
|
|
65729
65959
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -65777,7 +66007,7 @@ ${codeText}
|
|
|
65777
66007
|
return false;
|
|
65778
66008
|
}
|
|
65779
66009
|
}
|
|
65780
|
-
const logger$
|
|
66010
|
+
const logger$1e = getLogger("copy-image");
|
|
65781
66011
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
65782
66012
|
const imageData = imageObject.getImages()[index2];
|
|
65783
66013
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
@@ -65818,7 +66048,7 @@ ${codeText}
|
|
|
65818
66048
|
});
|
|
65819
66049
|
clipboardData["image/png"] = fileBlob;
|
|
65820
66050
|
} catch (error2) {
|
|
65821
|
-
logger$
|
|
66051
|
+
logger$1e.error(error2);
|
|
65822
66052
|
}
|
|
65823
66053
|
addMetaToDoc(editor, doc2);
|
|
65824
66054
|
const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
|
|
@@ -66091,195 +66321,6 @@ ${codeText}
|
|
|
66091
66321
|
}
|
|
66092
66322
|
return getDragInsertPos(editor, block, images, x);
|
|
66093
66323
|
}
|
|
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
66324
|
class ImageHoveringToolbarCommands$1 {
|
|
66284
66325
|
constructor(editor, block) {
|
|
66285
66326
|
__publicField(this, "group", "hovering-toolbar");
|
|
@@ -66351,7 +66392,7 @@ ${codeText}
|
|
|
66351
66392
|
executeCommand(editor, block, item) {
|
|
66352
66393
|
switch (item.id) {
|
|
66353
66394
|
case "addComment":
|
|
66354
|
-
addCommentToBlock(editor, block);
|
|
66395
|
+
addCommentToBlock$1(editor, block);
|
|
66355
66396
|
break;
|
|
66356
66397
|
case "left":
|
|
66357
66398
|
case "center":
|
|
@@ -67668,7 +67709,7 @@ ${codeText}
|
|
|
67668
67709
|
});
|
|
67669
67710
|
});
|
|
67670
67711
|
__publicField(this, "handleEditorResize", () => {
|
|
67671
|
-
this.updateItemsLayout();
|
|
67712
|
+
this.updateItemsLayout(false);
|
|
67672
67713
|
});
|
|
67673
67714
|
__publicField(this, "handleDocChanged", () => {
|
|
67674
67715
|
this.updateComments();
|
|
@@ -67731,7 +67772,7 @@ ${codeText}
|
|
|
67731
67772
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
67732
67773
|
this.editor.addListener("resize", this.handleEditorResize);
|
|
67733
67774
|
this.editor.addListener("docChanged", this.handleDocChanged);
|
|
67734
|
-
this.editor.
|
|
67775
|
+
this.editor.domEvents.addEventListener(this.editor.scrollContainer, "wheel", (ed, e2) => this.handleScroll(e2), { passive: false });
|
|
67735
67776
|
this.items.forEach((item) => item.addListener("resize", this.handleItemResize));
|
|
67736
67777
|
this.groupItemHandlers = new CommentGroupItemHandlers(this, commentsProvider);
|
|
67737
67778
|
document.addEventListener("click", this.handleDocumentClick);
|
|
@@ -67740,15 +67781,16 @@ ${codeText}
|
|
|
67740
67781
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
67741
67782
|
this.editor.removeListener("resize", this.handleEditorResize);
|
|
67742
67783
|
this.editor.removeListener("docChanged", this.handleDocChanged);
|
|
67743
|
-
this.editor.scrollContainer.removeEventListener("wheel", this.handleScroll);
|
|
67744
67784
|
super.destroy();
|
|
67745
67785
|
this.unbindEvents();
|
|
67746
67786
|
this.removeAllListeners();
|
|
67747
67787
|
document.removeEventListener("click", this.handleDocumentClick);
|
|
67748
67788
|
}
|
|
67749
|
-
updateItemsLayout() {
|
|
67789
|
+
updateItemsLayout(dispatchScroll = true) {
|
|
67750
67790
|
arrangeItems(this.editor, this.items, this.activeItem);
|
|
67751
|
-
|
|
67791
|
+
if (dispatchScroll) {
|
|
67792
|
+
this.dispatchScroll();
|
|
67793
|
+
}
|
|
67752
67794
|
}
|
|
67753
67795
|
bindEvents() {
|
|
67754
67796
|
this.container.addEventListener("click", this.handleContainerClick);
|
|
@@ -68615,7 +68657,7 @@ ${codeText}
|
|
|
68615
68657
|
const types2 = ["table", "layout"];
|
|
68616
68658
|
if (types2.includes(getBlockType(block))) {
|
|
68617
68659
|
editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
|
|
68618
|
-
comment = addCommentToBlock
|
|
68660
|
+
comment = addCommentToBlock(editor, block, this.provider);
|
|
68619
68661
|
}
|
|
68620
68662
|
}
|
|
68621
68663
|
comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
|
|
@@ -68636,7 +68678,7 @@ ${codeText}
|
|
|
68636
68678
|
try {
|
|
68637
68679
|
this.editorComments.showCommentList();
|
|
68638
68680
|
const block2 = editor.getBlockById(blockId);
|
|
68639
|
-
addCommentToBlock
|
|
68681
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
68640
68682
|
} catch (err) {
|
|
68641
68683
|
logger$13.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
68642
68684
|
}
|
|
@@ -68972,11 +69014,11 @@ ${codeText}
|
|
|
68972
69014
|
const { containerId } = path[path.length - 1];
|
|
68973
69015
|
const targetBlock = getParentBlock(getContainerById(editor, containerId));
|
|
68974
69016
|
if (targetBlock && getBlockType(targetBlock) === "code") {
|
|
68975
|
-
addCommentToBlock
|
|
69017
|
+
addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
|
|
68976
69018
|
return;
|
|
68977
69019
|
}
|
|
68978
69020
|
}
|
|
68979
|
-
addCommentToBlock
|
|
69021
|
+
addCommentToBlock(editor, block, editorComments.commentProvider);
|
|
68980
69022
|
return;
|
|
68981
69023
|
}
|
|
68982
69024
|
const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
|
|
@@ -69213,7 +69255,7 @@ ${codeText}
|
|
|
69213
69255
|
editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
|
|
69214
69256
|
const editorComments = editor2.getCustom("editor-comments");
|
|
69215
69257
|
editorComments.showCommentList();
|
|
69216
|
-
addCommentToBlock
|
|
69258
|
+
addCommentToBlock(editor2, block, editorComments.commentProvider);
|
|
69217
69259
|
}
|
|
69218
69260
|
}
|
|
69219
69261
|
};
|
|
@@ -69247,7 +69289,7 @@ ${codeText}
|
|
|
69247
69289
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
69248
69290
|
if (selectedBlock) {
|
|
69249
69291
|
const editorComments = editor.getCustom("editor-comments");
|
|
69250
|
-
addCommentToBlock
|
|
69292
|
+
addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
|
|
69251
69293
|
}
|
|
69252
69294
|
return;
|
|
69253
69295
|
}
|
|
@@ -76508,7 +76550,7 @@ ${content}
|
|
|
76508
76550
|
} else if (item.id === "download") {
|
|
76509
76551
|
downloadFile$1(editor, box);
|
|
76510
76552
|
} else if (item.id === "add-comment") {
|
|
76511
|
-
addCommentToBlock(editor, block);
|
|
76553
|
+
addCommentToBlock$1(editor, block);
|
|
76512
76554
|
}
|
|
76513
76555
|
}
|
|
76514
76556
|
}
|
|
@@ -76800,7 +76842,7 @@ ${content}
|
|
|
76800
76842
|
} else if (item.id === "download") {
|
|
76801
76843
|
downloadFile(editor, block);
|
|
76802
76844
|
} else if (item.id === "add-comment") {
|
|
76803
|
-
addCommentToBlock(editor, block);
|
|
76845
|
+
addCommentToBlock$1(editor, block);
|
|
76804
76846
|
}
|
|
76805
76847
|
}
|
|
76806
76848
|
}
|
|
@@ -79558,6 +79600,7 @@ ${content}
|
|
|
79558
79600
|
}
|
|
79559
79601
|
destroy() {
|
|
79560
79602
|
this.editor.doc.unregisterCallback(this);
|
|
79603
|
+
this.removeAllListeners();
|
|
79561
79604
|
}
|
|
79562
79605
|
isHeadingBlock(blockData) {
|
|
79563
79606
|
return !!blockData.heading;
|
|
@@ -80319,22 +80362,22 @@ ${content}
|
|
|
80319
80362
|
const image = createElement("img", ["editor-template-thumb"], imageContaniner);
|
|
80320
80363
|
image.src = imageSrc;
|
|
80321
80364
|
image.style.display = "none";
|
|
80322
|
-
image
|
|
80365
|
+
editor.domEvents.addEventListener(image, "error", () => {
|
|
80323
80366
|
var _a2;
|
|
80324
80367
|
const placeholder2 = (_a2 = options == null ? void 0 : options.placeHolderImageSrc) != null ? _a2 : TEMPLATE_PLACEHOLDER;
|
|
80325
80368
|
if (image.src !== placeholder2) {
|
|
80326
80369
|
image.src = placeholder2;
|
|
80327
80370
|
}
|
|
80328
|
-
};
|
|
80329
|
-
image
|
|
80371
|
+
});
|
|
80372
|
+
editor.domEvents.addEventListener(image, "load", () => {
|
|
80330
80373
|
image.style.display = "";
|
|
80331
|
-
};
|
|
80374
|
+
});
|
|
80332
80375
|
const nameDiv = createElement("div", ["editor-template-name"], card);
|
|
80333
80376
|
const span = createElement("span", [], nameDiv, name);
|
|
80334
80377
|
if (options == null ? void 0 : options.showTemplateTitleAttr) {
|
|
80335
80378
|
span.setAttribute("title", name);
|
|
80336
80379
|
}
|
|
80337
|
-
card
|
|
80380
|
+
editor.domEvents.addEventListener(card, "click", () => clickHandler(card));
|
|
80338
80381
|
return card;
|
|
80339
80382
|
}
|
|
80340
80383
|
function getDocThumbImage(editor, template) {
|
|
@@ -86306,7 +86349,7 @@ ${data2.flowchartText}
|
|
|
86306
86349
|
executeCommand(editor, block, item) {
|
|
86307
86350
|
switch (item.id) {
|
|
86308
86351
|
case "addComment":
|
|
86309
|
-
addCommentToBlock(editor, block);
|
|
86352
|
+
addCommentToBlock$1(editor, block);
|
|
86310
86353
|
break;
|
|
86311
86354
|
case "left":
|
|
86312
86355
|
case "center":
|
|
@@ -88076,20 +88119,32 @@ ${data2.flowchartText}
|
|
|
88076
88119
|
return docx.Packer.toBlob(doc2);
|
|
88077
88120
|
}
|
|
88078
88121
|
}
|
|
88122
|
+
class ExportImageError extends Error {
|
|
88123
|
+
constructor(message) {
|
|
88124
|
+
super(message);
|
|
88125
|
+
this.name = this.constructor.name;
|
|
88126
|
+
}
|
|
88127
|
+
}
|
|
88079
88128
|
const logger$1 = getLogger("editor-to-docx");
|
|
88129
|
+
const ERROR_MESSAGE = "editor-to-docx: read image error";
|
|
88080
88130
|
async function readImage(editor, _appId, _docId, _src) {
|
|
88081
|
-
|
|
88082
|
-
|
|
88083
|
-
|
|
88084
|
-
|
|
88085
|
-
|
|
88086
|
-
|
|
88087
|
-
if (
|
|
88088
|
-
|
|
88131
|
+
try {
|
|
88132
|
+
const url = editor.doc.buildResourceUrl(_src, { withToken: true });
|
|
88133
|
+
let file2 = await downloadImageToFile$1(url);
|
|
88134
|
+
if (!file2) {
|
|
88135
|
+
throw new Error(ERROR_MESSAGE);
|
|
88136
|
+
}
|
|
88137
|
+
if (file2.type.indexOf("/svg") !== -1) {
|
|
88138
|
+
const pngFile = await convertImageFileToPng(file2);
|
|
88139
|
+
if (pngFile) {
|
|
88140
|
+
file2 = new File([pngFile], file2.name);
|
|
88141
|
+
}
|
|
88089
88142
|
}
|
|
88143
|
+
const arrayBuffer = await file2.arrayBuffer();
|
|
88144
|
+
return [arrayBuffer, url];
|
|
88145
|
+
} catch (error2) {
|
|
88146
|
+
throw new ExportImageError(error2.message || ERROR_MESSAGE);
|
|
88090
88147
|
}
|
|
88091
|
-
const arrayBuffer = await file2.arrayBuffer();
|
|
88092
|
-
return [arrayBuffer, url];
|
|
88093
88148
|
}
|
|
88094
88149
|
async function getDocByBlock(editor, doc2, block) {
|
|
88095
88150
|
const blockClass = editor.editorBlocks.getBlockClass(block.type);
|
|
@@ -88323,13 +88378,7 @@ ${data2.flowchartText}
|
|
|
88323
88378
|
}
|
|
88324
88379
|
}
|
|
88325
88380
|
});
|
|
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
|
-
}
|
|
88381
|
+
editor.version = "2.2.8-beta.12";
|
|
88333
88382
|
return editor;
|
|
88334
88383
|
}
|
|
88335
88384
|
function isDoc(doc2) {
|
|
@@ -88424,7 +88473,7 @@ ${data2.flowchartText}
|
|
|
88424
88473
|
});
|
|
88425
88474
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88426
88475
|
OnesEditorToolbar.register(editor);
|
|
88427
|
-
editor.version = "2.2.8-beta.
|
|
88476
|
+
editor.version = "2.2.8-beta.12";
|
|
88428
88477
|
return editor;
|
|
88429
88478
|
}
|
|
88430
88479
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134203,6 +134252,7 @@ ${data2.flowchartText}
|
|
|
134203
134252
|
exports2.EmbedBlockResizer = EmbedBlockResizer;
|
|
134204
134253
|
exports2.EnforceWithDocumentTitleHandler = EnforceWithDocumentTitleHandler;
|
|
134205
134254
|
exports2.EventCallbacks = EventCallbacks;
|
|
134255
|
+
exports2.ExportImageError = ExportImageError;
|
|
134206
134256
|
exports2.FILL_CHAR = FILL_CHAR;
|
|
134207
134257
|
exports2.FileExtError = FileExtError;
|
|
134208
134258
|
exports2.FixedToolbar = FixedToolbar;
|
|
@@ -134266,6 +134316,7 @@ ${data2.flowchartText}
|
|
|
134266
134316
|
exports2.ShareDBLocalDoc = ShareDBLocalDoc;
|
|
134267
134317
|
exports2.ShareDBServer = ShareDBServer;
|
|
134268
134318
|
exports2.SimpleCache = SimpleCache;
|
|
134319
|
+
exports2.StandardBoxCommands = StandardBoxCommands;
|
|
134269
134320
|
exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
|
|
134270
134321
|
exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
|
|
134271
134322
|
exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
|
|
@@ -134284,7 +134335,7 @@ ${data2.flowchartText}
|
|
|
134284
134335
|
exports2.addAttribute = addAttribute;
|
|
134285
134336
|
exports2.addClass = addClass;
|
|
134286
134337
|
exports2.addColor = addColor;
|
|
134287
|
-
exports2.addCommentToBlock = addCommentToBlock;
|
|
134338
|
+
exports2.addCommentToBlock = addCommentToBlock$1;
|
|
134288
134339
|
exports2.addDays = addDays;
|
|
134289
134340
|
exports2.addMetaToDoc = addMetaToDoc;
|
|
134290
134341
|
exports2.addMonths = addMonths;
|