@ones-editor/editor 2.2.15-beta.2 → 2.2.15-beta.3
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/blocks/text-blocks/base/text-range.d.ts +1 -1
- package/@ones-editor/core/src/core/editor/editor-dom/editor-dom.d.ts +2 -3
- package/@ones-editor/core/src/core/selection/range-from-point.d.ts +1 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -1
- 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 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/ui-base/src/locale/zh-cn.d.ts +1 -0
- package/dist/index.js +880 -811
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -859,10 +859,10 @@ div.tippy-box[data-theme=menu] .tippy-arrow::after {
|
|
|
859
859
|
transform: rotate(45deg);
|
|
860
860
|
}
|
|
861
861
|
div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar-root, div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
|
|
862
|
-
box-shadow: 0px 0px
|
|
862
|
+
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;
|
|
863
863
|
}
|
|
864
864
|
div.tippy-box[data-theme=toolbar] .tippy-content .editor-command-bar-root {
|
|
865
|
-
|
|
865
|
+
border-radius: 3px;
|
|
866
866
|
}
|
|
867
867
|
div.tippy-box button {
|
|
868
868
|
outline: none;
|
|
@@ -880,8 +880,7 @@ div.tippy-box button {
|
|
|
880
880
|
overflow-y: auto;
|
|
881
881
|
}
|
|
882
882
|
.editor-command-bar.toolbar {
|
|
883
|
-
|
|
884
|
-
overflow-x: auto;
|
|
883
|
+
width: max-content;
|
|
885
884
|
}
|
|
886
885
|
.editor-command-bar.fixed.mobile, .editor-command-bar.toolbar.mobile {
|
|
887
886
|
gap: 16px;
|
|
@@ -902,7 +901,7 @@ div.tippy-box button {
|
|
|
902
901
|
}
|
|
903
902
|
.editor-command-bar.fixed.mobile .command-item.checked, .editor-command-bar.toolbar.mobile .command-item.checked {
|
|
904
903
|
border-radius: 3px;
|
|
905
|
-
background: #
|
|
904
|
+
background: #f0f6ff;
|
|
906
905
|
}
|
|
907
906
|
.editor-command-bar {
|
|
908
907
|
pointer-events: all;
|
|
@@ -1020,8 +1019,6 @@ div.tippy-box button {
|
|
|
1020
1019
|
gap: 5px;
|
|
1021
1020
|
padding: 5px 10px;
|
|
1022
1021
|
background: #ffffff;
|
|
1023
|
-
box-shadow: 0px 0px 1px rgba(48, 48, 48, 0.2), 0px 8px 16px rgba(48, 48, 48, 0.15);
|
|
1024
|
-
border-radius: 3px;
|
|
1025
1022
|
}
|
|
1026
1023
|
.editor-command-bar.toolbar .command-item {
|
|
1027
1024
|
background: transparent;
|
|
@@ -1114,6 +1111,7 @@ div.tippy-box button {
|
|
|
1114
1111
|
.editor-command-bar.footer {
|
|
1115
1112
|
width: 100%;
|
|
1116
1113
|
}
|
|
1114
|
+
.reference-hidden[data-tippy-hidden],
|
|
1117
1115
|
.reference-hidden .tippy-box[data-reference-hidden] {
|
|
1118
1116
|
opacity: 0;
|
|
1119
1117
|
pointer-events: none;
|
|
@@ -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;
|
|
@@ -5180,6 +5173,7 @@ div.editor-root:not(.mobile) div.editor-content div[data-type=editor-container]
|
|
|
5180
5173
|
background-color: var(--op-selected-color);
|
|
5181
5174
|
border-radius: 3px;
|
|
5182
5175
|
pointer-events: none;
|
|
5176
|
+
z-index: 1;
|
|
5183
5177
|
}
|
|
5184
5178
|
.editor-root.history .table-block.history-inserted-block table .child {
|
|
5185
5179
|
pointer-events: none;
|
|
@@ -6597,7 +6591,6 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6597
6591
|
border-radius: 3px;
|
|
6598
6592
|
}
|
|
6599
6593
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner {
|
|
6600
|
-
cursor: pointer;
|
|
6601
6594
|
display: flex;
|
|
6602
6595
|
align-items: center;
|
|
6603
6596
|
justify-content: center;
|
|
@@ -6608,11 +6601,16 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6608
6601
|
font-size: 22px;
|
|
6609
6602
|
line-height: 1;
|
|
6610
6603
|
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
|
6604
|
+
cursor: pointer;
|
|
6611
6605
|
}
|
|
6612
6606
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner:hover {
|
|
6613
6607
|
border-radius: 3px;
|
|
6614
6608
|
background-color: rgba(0, 36, 90, 0.04);
|
|
6615
6609
|
}
|
|
6610
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon.readonly-inner {
|
|
6611
|
+
cursor: text;
|
|
6612
|
+
pointer-events: none;
|
|
6613
|
+
}
|
|
6616
6614
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content {
|
|
6617
6615
|
flex: 1;
|
|
6618
6616
|
min-width: 0;
|
|
@@ -13099,7 +13097,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13099
13097
|
return createEditorSelectionRange(editor, { anchor: anchor2, focus });
|
|
13100
13098
|
}
|
|
13101
13099
|
const logger$4a = getLogger("range-from-point");
|
|
13102
|
-
function getBlockRangeFromPoint(editor, pointX, pointY) {
|
|
13100
|
+
function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
|
|
13103
13101
|
const yOffsets = [0, -12, 12];
|
|
13104
13102
|
let x = pointX;
|
|
13105
13103
|
const y = pointY;
|
|
@@ -13147,7 +13145,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13147
13145
|
if (!editor.contains(block)) {
|
|
13148
13146
|
continue;
|
|
13149
13147
|
}
|
|
13150
|
-
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i]);
|
|
13148
|
+
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i], dragging);
|
|
13151
13149
|
if (range) {
|
|
13152
13150
|
return range;
|
|
13153
13151
|
}
|
|
@@ -23743,7 +23741,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23743
23741
|
});
|
|
23744
23742
|
return ret;
|
|
23745
23743
|
}
|
|
23746
|
-
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign) {
|
|
23744
|
+
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign, dragging) {
|
|
23747
23745
|
const elem = getElementFromPoint(xOrign, yOrign);
|
|
23748
23746
|
if (!elem)
|
|
23749
23747
|
return null;
|
|
@@ -23798,7 +23796,12 @@ var __publicField = (obj, key, value) => {
|
|
|
23798
23796
|
offset = start;
|
|
23799
23797
|
length = 0;
|
|
23800
23798
|
} else if (isTextBlockContentBoxChild(child)) {
|
|
23801
|
-
|
|
23799
|
+
const blockRect2 = child.getBoundingClientRect();
|
|
23800
|
+
if (!dragging) {
|
|
23801
|
+
offset = start + (blockRect2.x + 10 > x ? 0 : 1);
|
|
23802
|
+
} else {
|
|
23803
|
+
offset = start + (blockRect2.x + blockRect2.width / 2 > x ? 0 : 1);
|
|
23804
|
+
}
|
|
23802
23805
|
length = 0;
|
|
23803
23806
|
} else {
|
|
23804
23807
|
assert(logger$3X, child.firstChild instanceof Text, "child is not text");
|
|
@@ -25679,7 +25682,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25679
25682
|
if (enableHorizontal) {
|
|
25680
25683
|
animateScrollTo(target, {
|
|
25681
25684
|
elementToScroll: getScrollContainer$1(target, { horizontal: true }),
|
|
25682
|
-
disableHorizontal: false
|
|
25685
|
+
disableHorizontal: false,
|
|
25686
|
+
speed: options.speed
|
|
25683
25687
|
});
|
|
25684
25688
|
}
|
|
25685
25689
|
const mobileClient = editor.options.componentsOptions.mobile;
|
|
@@ -25687,7 +25691,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25687
25691
|
elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
|
|
25688
25692
|
disableHorizontal: true,
|
|
25689
25693
|
verticalOffset: options == null ? void 0 : options.verticalOffset,
|
|
25690
|
-
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
|
|
25694
|
+
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0,
|
|
25695
|
+
speed: options.speed
|
|
25691
25696
|
});
|
|
25692
25697
|
} else if (target.scrollIntoView) {
|
|
25693
25698
|
target.scrollIntoView({
|
|
@@ -28088,7 +28093,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28088
28093
|
if (Math.abs(this.mouseDownEvent.x - event.x) < 3 && Math.abs(this.mouseDownEvent.y - event.y) < 3) {
|
|
28089
28094
|
return;
|
|
28090
28095
|
}
|
|
28091
|
-
const range = getBlockRangeFromPoint(this.editor, event.x, event.y);
|
|
28096
|
+
const range = getBlockRangeFromPoint(this.editor, event.x, event.y, true);
|
|
28092
28097
|
if (!range) {
|
|
28093
28098
|
return;
|
|
28094
28099
|
}
|
|
@@ -39433,7 +39438,8 @@ ${codeText}
|
|
|
39433
39438
|
}
|
|
39434
39439
|
},
|
|
39435
39440
|
search: {
|
|
39436
|
-
emptyTips: "\u6682\u65E0\u641C\u7D22\u7ED3\u679C"
|
|
39441
|
+
emptyTips: "\u6682\u65E0\u641C\u7D22\u7ED3\u679C",
|
|
39442
|
+
loading: "\u52A0\u8F7D\u4E2D..."
|
|
39437
39443
|
}
|
|
39438
39444
|
};
|
|
39439
39445
|
const enUS$w = {
|
|
@@ -39465,7 +39471,8 @@ ${codeText}
|
|
|
39465
39471
|
}
|
|
39466
39472
|
},
|
|
39467
39473
|
search: {
|
|
39468
|
-
emptyTips: "No results found"
|
|
39474
|
+
emptyTips: "No results found",
|
|
39475
|
+
loading: "Loading..."
|
|
39469
39476
|
}
|
|
39470
39477
|
};
|
|
39471
39478
|
const jaJP$w = {
|
|
@@ -39497,7 +39504,8 @@ ${codeText}
|
|
|
39497
39504
|
}
|
|
39498
39505
|
},
|
|
39499
39506
|
search: {
|
|
39500
|
-
emptyTips: "\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093"
|
|
39507
|
+
emptyTips: "\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
39508
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
39501
39509
|
}
|
|
39502
39510
|
};
|
|
39503
39511
|
i18n$1.mergeLang({
|
|
@@ -40080,24 +40088,51 @@ ${codeText}
|
|
|
40080
40088
|
click(item, target) {
|
|
40081
40089
|
this.emit("click", this, item, target);
|
|
40082
40090
|
}
|
|
40083
|
-
createPopperOptions() {
|
|
40084
|
-
var _a, _b;
|
|
40091
|
+
createPopperOptions(flip = false) {
|
|
40092
|
+
var _a, _b, _c, _d;
|
|
40085
40093
|
const popperOptions = { modifiers: [] };
|
|
40086
40094
|
const overflowBoundary = this.options.overflowBoundary;
|
|
40095
|
+
const padding = this.options.padding;
|
|
40087
40096
|
if (overflowBoundary) {
|
|
40088
|
-
(
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40092
|
-
|
|
40093
|
-
|
|
40094
|
-
|
|
40097
|
+
if (flip) {
|
|
40098
|
+
(_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
|
|
40099
|
+
name: "flip",
|
|
40100
|
+
options: {
|
|
40101
|
+
boundary: overflowBoundary,
|
|
40102
|
+
fallbackPlacements: ["top", "bottom"]
|
|
40103
|
+
}
|
|
40104
|
+
});
|
|
40105
|
+
} else {
|
|
40106
|
+
(_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
|
|
40107
|
+
name: "hide",
|
|
40108
|
+
enabled: true,
|
|
40109
|
+
phase: "main",
|
|
40110
|
+
fn: debounce__default.default(({ state }) => {
|
|
40111
|
+
const popper = state.elements.popper;
|
|
40112
|
+
const popperRect = popper.getBoundingClientRect();
|
|
40113
|
+
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40114
|
+
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40115
|
+
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40116
|
+
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40117
|
+
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40118
|
+
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40119
|
+
popper.setAttribute("data-tippy-hidden", "");
|
|
40120
|
+
} else {
|
|
40121
|
+
popper.removeAttribute("data-tippy-hidden");
|
|
40122
|
+
}
|
|
40123
|
+
}, 10)
|
|
40124
|
+
});
|
|
40125
|
+
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40126
|
+
name: "flip",
|
|
40127
|
+
enabled: false
|
|
40128
|
+
});
|
|
40129
|
+
}
|
|
40095
40130
|
}
|
|
40096
|
-
if (
|
|
40097
|
-
(
|
|
40131
|
+
if (padding) {
|
|
40132
|
+
(_d = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _d.push({
|
|
40098
40133
|
name: "preventOverflow",
|
|
40099
40134
|
options: {
|
|
40100
|
-
padding
|
|
40135
|
+
padding
|
|
40101
40136
|
}
|
|
40102
40137
|
});
|
|
40103
40138
|
}
|
|
@@ -40464,7 +40499,7 @@ ${codeText}
|
|
|
40464
40499
|
});
|
|
40465
40500
|
}
|
|
40466
40501
|
manualShow(target, options) {
|
|
40467
|
-
var _a, _b, _c;
|
|
40502
|
+
var _a, _b, _c, _d;
|
|
40468
40503
|
if (this.isVisible) {
|
|
40469
40504
|
return;
|
|
40470
40505
|
}
|
|
@@ -40479,15 +40514,15 @@ ${codeText}
|
|
|
40479
40514
|
triggerTarget: null,
|
|
40480
40515
|
hideOnClick: false,
|
|
40481
40516
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
40482
|
-
maxWidth: 650,
|
|
40483
|
-
arrow: (
|
|
40517
|
+
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
40518
|
+
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
40484
40519
|
appendTo: document.body,
|
|
40485
40520
|
onShow: this.handleShow,
|
|
40486
40521
|
onHidden: this.handleHidden,
|
|
40487
40522
|
onShown: this.handleShown,
|
|
40488
40523
|
theme: options == null ? void 0 : options.theme,
|
|
40489
40524
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
40490
|
-
offset: (
|
|
40525
|
+
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
40491
40526
|
popperOptions: this.createPopperOptions()
|
|
40492
40527
|
});
|
|
40493
40528
|
if (options == null ? void 0 : options.point) {
|
|
@@ -40974,6 +41009,7 @@ ${codeText}
|
|
|
40974
41009
|
super(items, closeable, {
|
|
40975
41010
|
itemElementTag: "button",
|
|
40976
41011
|
tippyArrow: false,
|
|
41012
|
+
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
40977
41013
|
...options
|
|
40978
41014
|
});
|
|
40979
41015
|
}
|
|
@@ -41238,7 +41274,7 @@ ${codeText}
|
|
|
41238
41274
|
theme: options == null ? void 0 : options.theme,
|
|
41239
41275
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
41240
41276
|
offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
|
|
41241
|
-
popperOptions: this.createPopperOptions()
|
|
41277
|
+
popperOptions: this.createPopperOptions(true)
|
|
41242
41278
|
});
|
|
41243
41279
|
this.clearSelectedItem();
|
|
41244
41280
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
@@ -41342,7 +41378,7 @@ ${codeText}
|
|
|
41342
41378
|
this.menu.addListener("show", this.handleShow);
|
|
41343
41379
|
this.menu.addListener("shown", this.handleShown);
|
|
41344
41380
|
if (this.options.wait) {
|
|
41345
|
-
this.handleSearchText = debounce__default.default(
|
|
41381
|
+
this.handleSearchText = debounce__default.default((text2) => {
|
|
41346
41382
|
this.handleSearchTextPure(text2);
|
|
41347
41383
|
}, this.options.wait);
|
|
41348
41384
|
} else {
|
|
@@ -41375,9 +41411,7 @@ ${codeText}
|
|
|
41375
41411
|
if (this.options.placeholder) {
|
|
41376
41412
|
this.showPlaceholder();
|
|
41377
41413
|
}
|
|
41378
|
-
|
|
41379
|
-
this.highlightText("", items);
|
|
41380
|
-
this.setItems(items);
|
|
41414
|
+
this.handleSearchTextPure("");
|
|
41381
41415
|
}
|
|
41382
41416
|
showLoading() {
|
|
41383
41417
|
if (!this.options.showLoading) {
|
|
@@ -41393,7 +41427,7 @@ ${codeText}
|
|
|
41393
41427
|
} else {
|
|
41394
41428
|
this.setItems([{
|
|
41395
41429
|
id: "loading",
|
|
41396
|
-
name: "loading",
|
|
41430
|
+
name: i18n$1.t("search.loading"),
|
|
41397
41431
|
states: ["disabled"]
|
|
41398
41432
|
}]);
|
|
41399
41433
|
}
|
|
@@ -41442,14 +41476,11 @@ ${codeText}
|
|
|
41442
41476
|
}
|
|
41443
41477
|
async handleSearchTextPure(text2) {
|
|
41444
41478
|
this.currentText = text2;
|
|
41445
|
-
const key = "auto-suggest";
|
|
41446
41479
|
try {
|
|
41447
|
-
await lockers.lock(key);
|
|
41448
41480
|
this.showLoading();
|
|
41449
|
-
const searchingText = this.currentText;
|
|
41450
41481
|
const items = await this.options.queryItems(this, text2);
|
|
41451
|
-
if (this.currentText
|
|
41452
|
-
|
|
41482
|
+
if (this.currentText !== text2) {
|
|
41483
|
+
return;
|
|
41453
41484
|
}
|
|
41454
41485
|
if (items.length === 0) {
|
|
41455
41486
|
this.showNoResultMessage(text2);
|
|
@@ -41457,10 +41488,9 @@ ${codeText}
|
|
|
41457
41488
|
}
|
|
41458
41489
|
this.setItems(items);
|
|
41459
41490
|
if (this.options.highlight) {
|
|
41460
|
-
this.highlightText(
|
|
41491
|
+
this.highlightText(text2.replace(/^\s+|\s+$/g, ""), items);
|
|
41461
41492
|
}
|
|
41462
41493
|
} finally {
|
|
41463
|
-
lockers.release(key);
|
|
41464
41494
|
}
|
|
41465
41495
|
}
|
|
41466
41496
|
highlightText(search, items) {
|
|
@@ -46978,7 +47008,413 @@ ${codeText}
|
|
|
46978
47008
|
}
|
|
46979
47009
|
return rects[0];
|
|
46980
47010
|
}
|
|
46981
|
-
const
|
|
47011
|
+
const zhCN$v = {
|
|
47012
|
+
embedProperties: {
|
|
47013
|
+
edit: "\u7F16\u8F91",
|
|
47014
|
+
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
47015
|
+
}
|
|
47016
|
+
};
|
|
47017
|
+
const enUS$v = {
|
|
47018
|
+
embedProperties: {
|
|
47019
|
+
edit: "Edit",
|
|
47020
|
+
addComment: "Add annotation"
|
|
47021
|
+
}
|
|
47022
|
+
};
|
|
47023
|
+
const jaJP$v = {
|
|
47024
|
+
embedProperties: {
|
|
47025
|
+
edit: "\u7DE8\u96C6",
|
|
47026
|
+
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
47027
|
+
}
|
|
47028
|
+
};
|
|
47029
|
+
i18n$1.mergeLang({
|
|
47030
|
+
"zh-CN": zhCN$v,
|
|
47031
|
+
"en-US": enUS$v,
|
|
47032
|
+
"ja-JP": jaJP$v
|
|
47033
|
+
});
|
|
47034
|
+
const logger$25 = getLogger("embed-block-properties");
|
|
47035
|
+
function addCommentToBlock$1(editor, block) {
|
|
47036
|
+
var _a;
|
|
47037
|
+
for (const hook of editor.blockHooks) {
|
|
47038
|
+
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
47039
|
+
if (!commands) {
|
|
47040
|
+
continue;
|
|
47041
|
+
}
|
|
47042
|
+
if (commands.group === "block-comment-actions") {
|
|
47043
|
+
const command = commands.commands[0];
|
|
47044
|
+
if (!command) {
|
|
47045
|
+
continue;
|
|
47046
|
+
}
|
|
47047
|
+
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
47048
|
+
return true;
|
|
47049
|
+
}
|
|
47050
|
+
}
|
|
47051
|
+
return false;
|
|
47052
|
+
}
|
|
47053
|
+
class StandardEmbedBlockCommands {
|
|
47054
|
+
constructor(editor, block, properties) {
|
|
47055
|
+
__publicField(this, "group", "hovering-toolbar");
|
|
47056
|
+
__publicField(this, "_commands", [{
|
|
47057
|
+
id: "edit",
|
|
47058
|
+
name: i18n$1.t("embedProperties.edit"),
|
|
47059
|
+
icon: EditIcon
|
|
47060
|
+
}, {
|
|
47061
|
+
id: "separator",
|
|
47062
|
+
name: "",
|
|
47063
|
+
type: "separator"
|
|
47064
|
+
}]);
|
|
47065
|
+
this.editor = editor;
|
|
47066
|
+
this.block = block;
|
|
47067
|
+
this.properties = properties;
|
|
47068
|
+
}
|
|
47069
|
+
get commands() {
|
|
47070
|
+
var _a, _b, _c, _d;
|
|
47071
|
+
if (clientType.isMobile) {
|
|
47072
|
+
return [];
|
|
47073
|
+
}
|
|
47074
|
+
let standardCommands = [];
|
|
47075
|
+
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
47076
|
+
this.properties.presetIds.forEach((id) => {
|
|
47077
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47078
|
+
if (command) {
|
|
47079
|
+
standardCommands.push(command);
|
|
47080
|
+
}
|
|
47081
|
+
});
|
|
47082
|
+
}
|
|
47083
|
+
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
47084
|
+
standardCommands.push(...this.properties.extCommands);
|
|
47085
|
+
}
|
|
47086
|
+
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
47087
|
+
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
47088
|
+
}
|
|
47089
|
+
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
47090
|
+
this.properties.extIds.forEach((id) => {
|
|
47091
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47092
|
+
if (command) {
|
|
47093
|
+
standardCommands.push(command);
|
|
47094
|
+
}
|
|
47095
|
+
});
|
|
47096
|
+
}
|
|
47097
|
+
const { enableComments = true } = this.editor.options;
|
|
47098
|
+
if (!enableComments || this.editor.readonly) {
|
|
47099
|
+
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
47100
|
+
}
|
|
47101
|
+
if (this.editor.readonly) {
|
|
47102
|
+
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
47103
|
+
}
|
|
47104
|
+
standardCommands.forEach((item) => {
|
|
47105
|
+
if (item.id === "add-comment" || item.id === "edit") {
|
|
47106
|
+
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
47107
|
+
}
|
|
47108
|
+
});
|
|
47109
|
+
return standardCommands;
|
|
47110
|
+
}
|
|
47111
|
+
executeCommand(editor, block, item) {
|
|
47112
|
+
var _a, _b;
|
|
47113
|
+
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
47114
|
+
return;
|
|
47115
|
+
}
|
|
47116
|
+
if (item.id === "add-comment") {
|
|
47117
|
+
if (!addCommentToBlock$1(editor, block)) {
|
|
47118
|
+
logger$25.error("failed to add comment to block");
|
|
47119
|
+
}
|
|
47120
|
+
return;
|
|
47121
|
+
}
|
|
47122
|
+
logger$25.error(`unknown command: ${JSON.stringify(item)}`);
|
|
47123
|
+
}
|
|
47124
|
+
}
|
|
47125
|
+
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
47126
|
+
return {
|
|
47127
|
+
blockCommands: {
|
|
47128
|
+
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
47129
|
+
}
|
|
47130
|
+
};
|
|
47131
|
+
}
|
|
47132
|
+
function createResizeGripper(parent, type) {
|
|
47133
|
+
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
47134
|
+
elem.setAttribute("data-resize-type", type);
|
|
47135
|
+
}
|
|
47136
|
+
function getExistsResizer(block) {
|
|
47137
|
+
const tools = getBlockTools(block);
|
|
47138
|
+
return tools.querySelector(".block-resizer");
|
|
47139
|
+
}
|
|
47140
|
+
function hideResizer(block) {
|
|
47141
|
+
const exists = getExistsResizer(block);
|
|
47142
|
+
if (exists) {
|
|
47143
|
+
removeClass(exists, "active");
|
|
47144
|
+
}
|
|
47145
|
+
}
|
|
47146
|
+
function updateSize(block, element, resizer) {
|
|
47147
|
+
const blockRect = block.getBoundingClientRect();
|
|
47148
|
+
const elementRect = element.getBoundingClientRect();
|
|
47149
|
+
const top = elementRect.top - blockRect.top;
|
|
47150
|
+
const left = elementRect.left - blockRect.left;
|
|
47151
|
+
const width = elementRect.width;
|
|
47152
|
+
const height = elementRect.height;
|
|
47153
|
+
resizer.style.top = `${top}px`;
|
|
47154
|
+
resizer.style.left = `${left}px`;
|
|
47155
|
+
resizer.style.width = `${width}px`;
|
|
47156
|
+
resizer.style.height = `${height}px`;
|
|
47157
|
+
}
|
|
47158
|
+
function createResizer(block, element, options, mouseDownEvent) {
|
|
47159
|
+
const exists = getExistsResizer(block);
|
|
47160
|
+
if (exists) {
|
|
47161
|
+
addClass(exists, "active");
|
|
47162
|
+
updateSize(block, element, exists);
|
|
47163
|
+
return exists;
|
|
47164
|
+
}
|
|
47165
|
+
const tools = getBlockTools(block);
|
|
47166
|
+
const resizer = createElement("div", ["block-resizer"], tools);
|
|
47167
|
+
updateSize(block, element, resizer);
|
|
47168
|
+
options.resize.forEach((type) => {
|
|
47169
|
+
createResizeGripper(resizer, type);
|
|
47170
|
+
});
|
|
47171
|
+
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
47172
|
+
addClass(resizer, "active");
|
|
47173
|
+
return resizer;
|
|
47174
|
+
}
|
|
47175
|
+
function updateResizer(block, element) {
|
|
47176
|
+
const resizer = getExistsResizer(block);
|
|
47177
|
+
if (!resizer) {
|
|
47178
|
+
return;
|
|
47179
|
+
}
|
|
47180
|
+
if (!isChildNode(block, element)) {
|
|
47181
|
+
return;
|
|
47182
|
+
}
|
|
47183
|
+
const blockRect = block.getBoundingClientRect();
|
|
47184
|
+
const elementRect = element.getBoundingClientRect();
|
|
47185
|
+
const top = elementRect.top - blockRect.top;
|
|
47186
|
+
const left = elementRect.left - blockRect.left;
|
|
47187
|
+
const width = elementRect.width;
|
|
47188
|
+
const height = elementRect.height;
|
|
47189
|
+
resizer.style.top = `${top}px`;
|
|
47190
|
+
resizer.style.left = `${left}px`;
|
|
47191
|
+
resizer.style.width = `${width}px`;
|
|
47192
|
+
resizer.style.height = `${height}px`;
|
|
47193
|
+
}
|
|
47194
|
+
const style$a = "";
|
|
47195
|
+
const logger$24 = getLogger("block-resizer");
|
|
47196
|
+
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
47197
|
+
constructor(editor, options) {
|
|
47198
|
+
super();
|
|
47199
|
+
__publicField(this, "resizableElement");
|
|
47200
|
+
__publicField(this, "block", null);
|
|
47201
|
+
__publicField(this, "startRect", null);
|
|
47202
|
+
__publicField(this, "startPos", null);
|
|
47203
|
+
__publicField(this, "resizeType", null);
|
|
47204
|
+
__publicField(this, "enabled", false);
|
|
47205
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47206
|
+
if (this.block) {
|
|
47207
|
+
this.updateResizer();
|
|
47208
|
+
}
|
|
47209
|
+
});
|
|
47210
|
+
__publicField(this, "handleMouseDown", (event) => {
|
|
47211
|
+
event.preventDefault();
|
|
47212
|
+
event.stopPropagation();
|
|
47213
|
+
const element = this.getResizableElement();
|
|
47214
|
+
if (!element) {
|
|
47215
|
+
return;
|
|
47216
|
+
}
|
|
47217
|
+
if (event.button !== 0) {
|
|
47218
|
+
return;
|
|
47219
|
+
}
|
|
47220
|
+
const gripper = event.target;
|
|
47221
|
+
if (!gripper) {
|
|
47222
|
+
return;
|
|
47223
|
+
}
|
|
47224
|
+
if (!(gripper instanceof HTMLElement)) {
|
|
47225
|
+
return;
|
|
47226
|
+
}
|
|
47227
|
+
const resizeType = gripper.getAttribute("data-resize-type");
|
|
47228
|
+
if (!resizeType) {
|
|
47229
|
+
return;
|
|
47230
|
+
}
|
|
47231
|
+
this.bindEvents();
|
|
47232
|
+
this.startRect = element.getBoundingClientRect();
|
|
47233
|
+
this.startPos = event;
|
|
47234
|
+
this.resizeType = resizeType;
|
|
47235
|
+
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
47236
|
+
if (this.block) {
|
|
47237
|
+
this.editor.selection.selectBlock(this.block, 0);
|
|
47238
|
+
}
|
|
47239
|
+
});
|
|
47240
|
+
__publicField(this, "handleMouseMove", (event) => {
|
|
47241
|
+
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
47242
|
+
return;
|
|
47243
|
+
}
|
|
47244
|
+
const element = this.getResizableElement();
|
|
47245
|
+
if (!element || !this.block) {
|
|
47246
|
+
return;
|
|
47247
|
+
}
|
|
47248
|
+
const deltaX = event.x - this.startPos.x;
|
|
47249
|
+
const deltaY = event.y - this.startPos.y;
|
|
47250
|
+
const oldRect = this.startRect;
|
|
47251
|
+
let { top, left, right, bottom } = oldRect;
|
|
47252
|
+
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
47253
|
+
bottom += deltaY;
|
|
47254
|
+
}
|
|
47255
|
+
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
47256
|
+
top += deltaY;
|
|
47257
|
+
}
|
|
47258
|
+
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
47259
|
+
left += deltaX;
|
|
47260
|
+
}
|
|
47261
|
+
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
47262
|
+
right += deltaX;
|
|
47263
|
+
}
|
|
47264
|
+
const width = right > left ? right - left : 0;
|
|
47265
|
+
const height = bottom > top ? bottom - top : 0;
|
|
47266
|
+
const newRect = new DOMRect(left, top, width, height);
|
|
47267
|
+
this.emit("resizing", this, newRect);
|
|
47268
|
+
const newElement = this.getResizableElement();
|
|
47269
|
+
if (newElement) {
|
|
47270
|
+
updateResizer(this.block, newElement);
|
|
47271
|
+
}
|
|
47272
|
+
});
|
|
47273
|
+
__publicField(this, "handleMouseUp", (event) => {
|
|
47274
|
+
if (event.button !== 0) {
|
|
47275
|
+
return;
|
|
47276
|
+
}
|
|
47277
|
+
setDefaultCursor("");
|
|
47278
|
+
this.unbindEvents();
|
|
47279
|
+
this.emit("resized", this);
|
|
47280
|
+
const element = this.getResizableElement();
|
|
47281
|
+
if (!element || !this.block) {
|
|
47282
|
+
return;
|
|
47283
|
+
}
|
|
47284
|
+
updateResizer(this.block, element);
|
|
47285
|
+
});
|
|
47286
|
+
this.editor = editor;
|
|
47287
|
+
this.options = options;
|
|
47288
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47289
|
+
}
|
|
47290
|
+
enableResize(block, resizableElement) {
|
|
47291
|
+
this.block = block;
|
|
47292
|
+
this.resizableElement = resizableElement;
|
|
47293
|
+
this.createResizer();
|
|
47294
|
+
this.enabled = true;
|
|
47295
|
+
}
|
|
47296
|
+
disableResize() {
|
|
47297
|
+
if (!this.block) {
|
|
47298
|
+
return;
|
|
47299
|
+
}
|
|
47300
|
+
hideResizer(this.block);
|
|
47301
|
+
this.enabled = false;
|
|
47302
|
+
}
|
|
47303
|
+
update(block, resizableElement) {
|
|
47304
|
+
this.block = block;
|
|
47305
|
+
this.resizableElement = resizableElement;
|
|
47306
|
+
const elem = this.getResizableElement();
|
|
47307
|
+
if (elem && this.enabled) {
|
|
47308
|
+
this.createResizer();
|
|
47309
|
+
}
|
|
47310
|
+
}
|
|
47311
|
+
updateResizer() {
|
|
47312
|
+
const newElement = this.getResizableElement();
|
|
47313
|
+
if (newElement && this.block) {
|
|
47314
|
+
updateResizer(this.block, newElement);
|
|
47315
|
+
}
|
|
47316
|
+
}
|
|
47317
|
+
getBlock() {
|
|
47318
|
+
return this.block;
|
|
47319
|
+
}
|
|
47320
|
+
destroy() {
|
|
47321
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47322
|
+
}
|
|
47323
|
+
getResizableElement() {
|
|
47324
|
+
if (this.resizableElement) {
|
|
47325
|
+
return this.resizableElement;
|
|
47326
|
+
}
|
|
47327
|
+
if (!this.block) {
|
|
47328
|
+
return null;
|
|
47329
|
+
}
|
|
47330
|
+
return getBlockContent(this.block);
|
|
47331
|
+
}
|
|
47332
|
+
createResizer() {
|
|
47333
|
+
const element = this.getResizableElement();
|
|
47334
|
+
if (!element || !this.block) {
|
|
47335
|
+
return;
|
|
47336
|
+
}
|
|
47337
|
+
assert(logger$24, isChildNode(this.block, element), "not a block child element");
|
|
47338
|
+
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
47339
|
+
}
|
|
47340
|
+
bindEvents() {
|
|
47341
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
47342
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
47343
|
+
}
|
|
47344
|
+
unbindEvents() {
|
|
47345
|
+
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
47346
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
47347
|
+
}
|
|
47348
|
+
}
|
|
47349
|
+
class EmbedBlockResizer {
|
|
47350
|
+
constructor(editor) {
|
|
47351
|
+
__publicField(this, "resizing", false);
|
|
47352
|
+
__publicField(this, "blockResizer");
|
|
47353
|
+
__publicField(this, "handleResized", () => {
|
|
47354
|
+
this.resizing = false;
|
|
47355
|
+
});
|
|
47356
|
+
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
47357
|
+
var _a, _b;
|
|
47358
|
+
this.resizing = true;
|
|
47359
|
+
const block = resizer.getBlock();
|
|
47360
|
+
if (block) {
|
|
47361
|
+
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
47362
|
+
return;
|
|
47363
|
+
}
|
|
47364
|
+
const blockType = getEmbedType(block);
|
|
47365
|
+
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
47366
|
+
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
47367
|
+
const oldData = this.editor.getBlockData(block);
|
|
47368
|
+
const oldEmbedData = oldData.embedData;
|
|
47369
|
+
const newEmbedData = {
|
|
47370
|
+
...oldEmbedData,
|
|
47371
|
+
height
|
|
47372
|
+
};
|
|
47373
|
+
this.editor.updateEmbedData(block, newEmbedData);
|
|
47374
|
+
}
|
|
47375
|
+
});
|
|
47376
|
+
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
47377
|
+
if (this.resizing) {
|
|
47378
|
+
return;
|
|
47379
|
+
}
|
|
47380
|
+
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
47381
|
+
this.disableResizer();
|
|
47382
|
+
}
|
|
47383
|
+
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
47384
|
+
this.tryEnableResizer(block);
|
|
47385
|
+
}
|
|
47386
|
+
});
|
|
47387
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47388
|
+
this.blockResizer.updateResizer();
|
|
47389
|
+
});
|
|
47390
|
+
this.editor = editor;
|
|
47391
|
+
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
47392
|
+
this.blockResizer = new BlockResizer(this.editor, {
|
|
47393
|
+
resize: ["bottom"]
|
|
47394
|
+
});
|
|
47395
|
+
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
47396
|
+
this.blockResizer.addListener("resized", this.handleResized);
|
|
47397
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47398
|
+
}
|
|
47399
|
+
destroy() {
|
|
47400
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47401
|
+
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
47402
|
+
}
|
|
47403
|
+
tryEnableResizer(block) {
|
|
47404
|
+
this.blockResizer.enableResize(block);
|
|
47405
|
+
}
|
|
47406
|
+
disableResizer() {
|
|
47407
|
+
this.blockResizer.disableResize();
|
|
47408
|
+
}
|
|
47409
|
+
static get(editor) {
|
|
47410
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47411
|
+
}
|
|
47412
|
+
static register(editor, block) {
|
|
47413
|
+
addClass(block, "resizable");
|
|
47414
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47415
|
+
}
|
|
47416
|
+
}
|
|
47417
|
+
const logger$23 = getLogger("exclusive-block");
|
|
46982
47418
|
function addExclusiveStyle(editor, block, userId, displayName) {
|
|
46983
47419
|
var _a;
|
|
46984
47420
|
addClass(block, "block-exclusive");
|
|
@@ -46996,7 +47432,7 @@ ${codeText}
|
|
|
46996
47432
|
block.removeAttribute("data-exclusive-tips");
|
|
46997
47433
|
}
|
|
46998
47434
|
function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
|
|
46999
|
-
logger$
|
|
47435
|
+
logger$23.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
|
|
47000
47436
|
if (exclusive) {
|
|
47001
47437
|
addExclusiveStyle(editor, block, userId, displayName);
|
|
47002
47438
|
} else {
|
|
@@ -47153,28 +47589,28 @@ ${codeText}
|
|
|
47153
47589
|
}
|
|
47154
47590
|
}
|
|
47155
47591
|
const exclusiveBlockStyles = "";
|
|
47156
|
-
const zhCN$
|
|
47592
|
+
const zhCN$u = {
|
|
47157
47593
|
exclusive: {
|
|
47158
47594
|
tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
|
|
47159
47595
|
fallbackAbstract: "\u8BE5 Block"
|
|
47160
47596
|
}
|
|
47161
47597
|
};
|
|
47162
|
-
const enUS$
|
|
47598
|
+
const enUS$u = {
|
|
47163
47599
|
exclusive: {
|
|
47164
47600
|
tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
|
|
47165
47601
|
fallbackAbstract: "This Block"
|
|
47166
47602
|
}
|
|
47167
47603
|
};
|
|
47168
|
-
const jaJP$
|
|
47604
|
+
const jaJP$u = {
|
|
47169
47605
|
exclusive: {
|
|
47170
47606
|
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",
|
|
47171
47607
|
fallbackAbstract: "\u3053\u306E\u8981\u7D20"
|
|
47172
47608
|
}
|
|
47173
47609
|
};
|
|
47174
47610
|
i18n$1.mergeLang({
|
|
47175
|
-
"zh-CN": zhCN$
|
|
47176
|
-
"en-US": enUS$
|
|
47177
|
-
"ja-JP": jaJP$
|
|
47611
|
+
"zh-CN": zhCN$u,
|
|
47612
|
+
"en-US": enUS$u,
|
|
47613
|
+
"ja-JP": jaJP$u
|
|
47178
47614
|
});
|
|
47179
47615
|
function getBlockInfo(editor, block) {
|
|
47180
47616
|
const data2 = editor.getBlockData(block);
|
|
@@ -47350,22 +47786,22 @@ ${codeText}
|
|
|
47350
47786
|
};
|
|
47351
47787
|
}
|
|
47352
47788
|
}
|
|
47353
|
-
const style$
|
|
47354
|
-
const zhCN$
|
|
47789
|
+
const style$9 = "";
|
|
47790
|
+
const zhCN$t = {
|
|
47355
47791
|
locker: {
|
|
47356
47792
|
lock: "\u9501\u5B9A",
|
|
47357
47793
|
unlock: "\u89E3\u9664\u9501\u5B9A",
|
|
47358
47794
|
lockedBy: "\u88AB {name} \u9501\u5B9A"
|
|
47359
47795
|
}
|
|
47360
47796
|
};
|
|
47361
|
-
const enUS$
|
|
47797
|
+
const enUS$t = {
|
|
47362
47798
|
locker: {
|
|
47363
47799
|
lock: "Lock",
|
|
47364
47800
|
unlock: "Unlock",
|
|
47365
47801
|
lockedBy: "Locked by {name}"
|
|
47366
47802
|
}
|
|
47367
47803
|
};
|
|
47368
|
-
const jaJP$
|
|
47804
|
+
const jaJP$t = {
|
|
47369
47805
|
locker: {
|
|
47370
47806
|
lock: "\u30ED\u30C3\u30AF",
|
|
47371
47807
|
unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
|
|
@@ -47373,9 +47809,9 @@ ${codeText}
|
|
|
47373
47809
|
}
|
|
47374
47810
|
};
|
|
47375
47811
|
i18n$1.mergeLang({
|
|
47376
|
-
"zh-CN": zhCN$
|
|
47377
|
-
"en-US": enUS$
|
|
47378
|
-
"ja-JP": jaJP$
|
|
47812
|
+
"zh-CN": zhCN$t,
|
|
47813
|
+
"en-US": enUS$t,
|
|
47814
|
+
"ja-JP": jaJP$t
|
|
47379
47815
|
});
|
|
47380
47816
|
class BlockLockerPasteHandler {
|
|
47381
47817
|
async handleBeforePasteDoc(editor, doc2) {
|
|
@@ -47387,7 +47823,7 @@ ${codeText}
|
|
|
47387
47823
|
return false;
|
|
47388
47824
|
}
|
|
47389
47825
|
}
|
|
47390
|
-
const logger$
|
|
47826
|
+
const logger$22 = getLogger("context-menu-utils");
|
|
47391
47827
|
function blobToString(blob) {
|
|
47392
47828
|
return new Promise((resolve, reject) => {
|
|
47393
47829
|
const reader = new FileReader();
|
|
@@ -47408,7 +47844,7 @@ ${codeText}
|
|
|
47408
47844
|
const types2 = items[0].types;
|
|
47409
47845
|
return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
|
|
47410
47846
|
} catch (error2) {
|
|
47411
|
-
logger$
|
|
47847
|
+
logger$22.warn(`Failed to read clipboard data: ${error2}`);
|
|
47412
47848
|
return true;
|
|
47413
47849
|
}
|
|
47414
47850
|
}
|
|
@@ -47457,7 +47893,7 @@ ${codeText}
|
|
|
47457
47893
|
}
|
|
47458
47894
|
return dataTransfer;
|
|
47459
47895
|
}
|
|
47460
|
-
const logger$
|
|
47896
|
+
const logger$21 = getLogger("ClipboardProvider");
|
|
47461
47897
|
class ClipboardProvider {
|
|
47462
47898
|
constructor(editor, options) {
|
|
47463
47899
|
__publicField(this, "id", "ClipboardProvider");
|
|
@@ -47543,7 +47979,7 @@ ${codeText}
|
|
|
47543
47979
|
}
|
|
47544
47980
|
}).catch((err) => {
|
|
47545
47981
|
this.clipboardPermission.read = "denied";
|
|
47546
|
-
logger$
|
|
47982
|
+
logger$21.log(err);
|
|
47547
47983
|
});
|
|
47548
47984
|
} catch (error2) {
|
|
47549
47985
|
this.clipboardPermission = {
|
|
@@ -47604,13 +48040,14 @@ ${codeText}
|
|
|
47604
48040
|
}
|
|
47605
48041
|
}
|
|
47606
48042
|
class StandardBoxCommands {
|
|
47607
|
-
constructor(editor) {
|
|
48043
|
+
constructor(editor, extIds) {
|
|
47608
48044
|
__publicField(this, "group", "standard-box-commands");
|
|
47609
48045
|
__publicField(this, "providers", []);
|
|
47610
48046
|
this.editor = editor;
|
|
47611
|
-
|
|
47612
|
-
|
|
47613
|
-
|
|
48047
|
+
this.extIds = extIds;
|
|
48048
|
+
}
|
|
48049
|
+
addProvider(provider) {
|
|
48050
|
+
this.providers.push(provider);
|
|
47614
48051
|
}
|
|
47615
48052
|
get commands() {
|
|
47616
48053
|
if (this.editor.readonly) {
|
|
@@ -47618,8 +48055,17 @@ ${codeText}
|
|
|
47618
48055
|
}
|
|
47619
48056
|
const items = [];
|
|
47620
48057
|
const focusedBlock = this.editor.selection.focusedBlock;
|
|
48058
|
+
const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
|
|
47621
48059
|
for (const provider of this.providers) {
|
|
47622
|
-
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
|
|
48060
|
+
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
|
|
48061
|
+
}
|
|
48062
|
+
for (const extId of this.extIds || []) {
|
|
48063
|
+
if (extId === "separator") {
|
|
48064
|
+
items.push({ id: "sep", name: "", type: "separator" });
|
|
48065
|
+
}
|
|
48066
|
+
if (extId === "add-comment") {
|
|
48067
|
+
items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
|
|
48068
|
+
}
|
|
47623
48069
|
}
|
|
47624
48070
|
return items;
|
|
47625
48071
|
}
|
|
@@ -47628,19 +48074,27 @@ ${codeText}
|
|
|
47628
48074
|
const { start, end } = getChildOffset(block, box);
|
|
47629
48075
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
47630
48076
|
for (const provider of this.providers) {
|
|
47631
|
-
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
|
|
48077
|
+
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
|
|
47632
48078
|
return;
|
|
47633
48079
|
}
|
|
47634
|
-
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
|
|
48080
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
|
|
47635
48081
|
return;
|
|
47636
48082
|
}
|
|
47637
48083
|
}
|
|
48084
|
+
if (item.id === "add-comment") {
|
|
48085
|
+
addCommentToBlock$1(editor, block);
|
|
48086
|
+
}
|
|
47638
48087
|
}
|
|
47639
|
-
static create(editor) {
|
|
47640
|
-
return new StandardBoxCommands(editor);
|
|
48088
|
+
static create(editor, extIds) {
|
|
48089
|
+
return new StandardBoxCommands(editor, extIds);
|
|
48090
|
+
}
|
|
48091
|
+
static mobileCreate(editor, extIds) {
|
|
48092
|
+
const instance = new StandardBoxCommands(editor, extIds);
|
|
48093
|
+
instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
|
|
48094
|
+
return instance;
|
|
47641
48095
|
}
|
|
47642
48096
|
}
|
|
47643
|
-
const logger$
|
|
48097
|
+
const logger$20 = getLogger("object-commands");
|
|
47644
48098
|
const SEP$1 = {
|
|
47645
48099
|
id: "",
|
|
47646
48100
|
name: "",
|
|
@@ -47696,7 +48150,7 @@ ${codeText}
|
|
|
47696
48150
|
let element = null;
|
|
47697
48151
|
const commands = [];
|
|
47698
48152
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47699
|
-
boxCommands.push(
|
|
48153
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47700
48154
|
}
|
|
47701
48155
|
if (boxCommands.length > 0) {
|
|
47702
48156
|
element = child;
|
|
@@ -47708,7 +48162,7 @@ ${codeText}
|
|
|
47708
48162
|
if (blockCommands.length > 0) {
|
|
47709
48163
|
for (let i = 0; i < blockCommands.length; i++) {
|
|
47710
48164
|
const blockCommand = blockCommands[i];
|
|
47711
|
-
element = element || targetElement || null;
|
|
48165
|
+
element = blockCommand.element || element || targetElement || null;
|
|
47712
48166
|
commands.push(...blockCommand.commands);
|
|
47713
48167
|
}
|
|
47714
48168
|
}
|
|
@@ -47726,10 +48180,10 @@ ${codeText}
|
|
|
47726
48180
|
const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
|
|
47727
48181
|
const { boxCommands, blockCommands } = result;
|
|
47728
48182
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47729
|
-
boxCommands.push(
|
|
48183
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47730
48184
|
}
|
|
47731
48185
|
if (boxCommands.length > 0) {
|
|
47732
|
-
assert(logger$
|
|
48186
|
+
assert(logger$20, child, "child is null");
|
|
47733
48187
|
for (let i = 0; i < boxCommands.length; i++) {
|
|
47734
48188
|
if (boxCommands[i].commands.find((c) => c.id === item.id)) {
|
|
47735
48189
|
boxCommands[i].executeCommand(editor, block, child, item);
|
|
@@ -47996,18 +48450,18 @@ ${codeText}
|
|
|
47996
48450
|
}
|
|
47997
48451
|
}
|
|
47998
48452
|
const LIST_MAX_LEVEL = 8;
|
|
47999
|
-
const logger$
|
|
48000
|
-
const logger$
|
|
48453
|
+
const logger$1$ = getLogger("list-block");
|
|
48454
|
+
const logger$1_ = getLogger("list-block");
|
|
48001
48455
|
function isListBlock(block) {
|
|
48002
48456
|
return getBlockType(block) === "list";
|
|
48003
48457
|
}
|
|
48004
48458
|
function ensureIsListBlock(block) {
|
|
48005
|
-
assert(logger$
|
|
48459
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
48006
48460
|
}
|
|
48007
48461
|
function getListBlockType(block) {
|
|
48008
48462
|
ensureIsListBlock(block);
|
|
48009
48463
|
const type = block.getAttribute("data-list-type");
|
|
48010
|
-
assert(logger$
|
|
48464
|
+
assert(logger$1_, type, "no list type");
|
|
48011
48465
|
return type;
|
|
48012
48466
|
}
|
|
48013
48467
|
function isTextOnlyListBlock(block) {
|
|
@@ -48026,7 +48480,7 @@ ${codeText}
|
|
|
48026
48480
|
function getListBlockGroupId(block) {
|
|
48027
48481
|
ensureIsListBlock(block);
|
|
48028
48482
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48029
|
-
assert(logger$
|
|
48483
|
+
assert(logger$1_, groupId, "no group id");
|
|
48030
48484
|
return groupId;
|
|
48031
48485
|
}
|
|
48032
48486
|
function getListBlockProperties(block) {
|
|
@@ -48036,7 +48490,7 @@ ${codeText}
|
|
|
48036
48490
|
const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
|
|
48037
48491
|
const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
|
|
48038
48492
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48039
|
-
assert(logger$
|
|
48493
|
+
assert(logger$1_, groupId, "no group id");
|
|
48040
48494
|
return {
|
|
48041
48495
|
type,
|
|
48042
48496
|
start,
|
|
@@ -48305,7 +48759,7 @@ ${codeText}
|
|
|
48305
48759
|
this.nodeMap.set(block, node);
|
|
48306
48760
|
if (parentBlock) {
|
|
48307
48761
|
const parentNode = this.nodeMap.get(parentBlock);
|
|
48308
|
-
assert(logger$
|
|
48762
|
+
assert(logger$1$, parentNode, "no parent node");
|
|
48309
48763
|
parentNode.children.push(node);
|
|
48310
48764
|
} else {
|
|
48311
48765
|
this.rootNodes.push(node);
|
|
@@ -48373,7 +48827,7 @@ ${codeText}
|
|
|
48373
48827
|
return hasClass(block, "editor-in-mindmap-first");
|
|
48374
48828
|
}
|
|
48375
48829
|
function isViewingAsMindmap(block) {
|
|
48376
|
-
assert(logger$
|
|
48830
|
+
assert(logger$1$, isListBlock(block), "not a list block");
|
|
48377
48831
|
if (hasClass(block, "editor-in-mindmap-first")) {
|
|
48378
48832
|
return true;
|
|
48379
48833
|
}
|
|
@@ -48394,12 +48848,12 @@ ${codeText}
|
|
|
48394
48848
|
const container = getParentContainer(from);
|
|
48395
48849
|
if (to) {
|
|
48396
48850
|
const container2 = getParentContainer(to);
|
|
48397
|
-
assert(logger$
|
|
48851
|
+
assert(logger$1$, container === container2, "invalid block container");
|
|
48398
48852
|
}
|
|
48399
48853
|
const fromIndex = getBlockIndex(from);
|
|
48400
48854
|
if (to) {
|
|
48401
48855
|
const toIndex = getBlockIndex(to);
|
|
48402
|
-
assert(logger$
|
|
48856
|
+
assert(logger$1$, fromIndex <= toIndex, "invalid block index");
|
|
48403
48857
|
}
|
|
48404
48858
|
addClass(from, ...styles);
|
|
48405
48859
|
if (!to || to === from) {
|
|
@@ -48407,7 +48861,7 @@ ${codeText}
|
|
|
48407
48861
|
}
|
|
48408
48862
|
let next2 = getNextBlock(from);
|
|
48409
48863
|
while (next2 !== to) {
|
|
48410
|
-
assert(logger$
|
|
48864
|
+
assert(logger$1$, next2, "no next button");
|
|
48411
48865
|
addClass(next2, ...styles);
|
|
48412
48866
|
next2 = getNextBlock(next2);
|
|
48413
48867
|
}
|
|
@@ -48418,7 +48872,7 @@ ${codeText}
|
|
|
48418
48872
|
async function requestMindmapFullscreen(editor, block, mindmapTools) {
|
|
48419
48873
|
const tools = getBlockTools(block);
|
|
48420
48874
|
const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
|
|
48421
|
-
assert(logger$
|
|
48875
|
+
assert(logger$1$, exitFullscreenButton, "no full screen button");
|
|
48422
48876
|
const resetMindmap = () => {
|
|
48423
48877
|
setTimeout(() => {
|
|
48424
48878
|
mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
|
|
@@ -48438,7 +48892,7 @@ ${codeText}
|
|
|
48438
48892
|
try {
|
|
48439
48893
|
await exitFullscreen();
|
|
48440
48894
|
} catch (err) {
|
|
48441
|
-
logger$
|
|
48895
|
+
logger$1$.error(err);
|
|
48442
48896
|
}
|
|
48443
48897
|
onExitFullscreen();
|
|
48444
48898
|
} else {
|
|
@@ -48447,7 +48901,7 @@ ${codeText}
|
|
|
48447
48901
|
await requestFullscreen(tools);
|
|
48448
48902
|
resetMindmap();
|
|
48449
48903
|
} catch (err) {
|
|
48450
|
-
logger$
|
|
48904
|
+
logger$1$.error(err);
|
|
48451
48905
|
}
|
|
48452
48906
|
exitFullscreenButton.innerHTML = ExitFullScreenIcon;
|
|
48453
48907
|
exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
|
|
@@ -48728,7 +49182,7 @@ ${codeText}
|
|
|
48728
49182
|
if (!svg) {
|
|
48729
49183
|
return;
|
|
48730
49184
|
}
|
|
48731
|
-
assert(logger$
|
|
49185
|
+
assert(logger$1$, svg, "no mindmap svg");
|
|
48732
49186
|
svg.remove();
|
|
48733
49187
|
editor.domEvents.removeAllListeners(svg);
|
|
48734
49188
|
destroyMindmapButtons(editor, block);
|
|
@@ -48780,7 +49234,7 @@ ${codeText}
|
|
|
48780
49234
|
});
|
|
48781
49235
|
__publicField(this, "handleMouseEnter", () => {
|
|
48782
49236
|
const block = getParentBlock(this.toMindmapButton);
|
|
48783
|
-
assert(logger$
|
|
49237
|
+
assert(logger$1$, block && isListBlock(block), "no parent list");
|
|
48784
49238
|
highlightEntireList(this.editor, block, true);
|
|
48785
49239
|
this.currentBlock = block;
|
|
48786
49240
|
});
|
|
@@ -48792,7 +49246,7 @@ ${codeText}
|
|
|
48792
49246
|
});
|
|
48793
49247
|
__publicField(this, "handleClick", () => {
|
|
48794
49248
|
const block = getParentBlock(this.toMindmapButton);
|
|
48795
|
-
assert(logger$
|
|
49249
|
+
assert(logger$1$, block && isListBlock(block), "no parent list");
|
|
48796
49250
|
toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
|
|
48797
49251
|
});
|
|
48798
49252
|
this.editor = editor;
|
|
@@ -48920,11 +49374,11 @@ ${codeText}
|
|
|
48920
49374
|
}
|
|
48921
49375
|
}
|
|
48922
49376
|
function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
|
|
48923
|
-
logger$
|
|
49377
|
+
logger$1$.debug("drag a block on a list block");
|
|
48924
49378
|
if (!isTextKindBlock(editor, draggedBlock)) {
|
|
48925
49379
|
return false;
|
|
48926
49380
|
}
|
|
48927
|
-
assert(logger$
|
|
49381
|
+
assert(logger$1$, isListBlock(targetListBlock), "target is not a list block");
|
|
48928
49382
|
const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
|
|
48929
49383
|
const newStart = insertPos === "after" ? start + 1 : start;
|
|
48930
49384
|
const oldData = editor.getBlockData(draggedBlock);
|
|
@@ -48957,7 +49411,7 @@ ${codeText}
|
|
|
48957
49411
|
return true;
|
|
48958
49412
|
}
|
|
48959
49413
|
function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
|
|
48960
|
-
logger$
|
|
49414
|
+
logger$1$.debug("drag a list between text blocks");
|
|
48961
49415
|
if (insertPos === "after") {
|
|
48962
49416
|
const nextBlock = getNextBlock(targetBlock);
|
|
48963
49417
|
if (nextBlock && isListBlock(nextBlock)) {
|
|
@@ -48994,11 +49448,11 @@ ${codeText}
|
|
|
48994
49448
|
}
|
|
48995
49449
|
const { blockId } = dragData;
|
|
48996
49450
|
const draggedBlock = editor.getBlockById(blockId);
|
|
48997
|
-
assert(logger$
|
|
49451
|
+
assert(logger$1$, draggedBlock, "no dragged block");
|
|
48998
49452
|
const { isSourceBlock, targetBlock } = options;
|
|
48999
49453
|
if (!isSourceBlock && targetBlock) {
|
|
49000
|
-
assert(logger$
|
|
49001
|
-
assert(logger$
|
|
49454
|
+
assert(logger$1$, block === targetBlock, "block !== target block");
|
|
49455
|
+
assert(logger$1$, isListBlock(targetBlock), "target is not a list block");
|
|
49002
49456
|
return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
|
|
49003
49457
|
}
|
|
49004
49458
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
@@ -49500,7 +49954,7 @@ ${codeText}
|
|
|
49500
49954
|
}
|
|
49501
49955
|
const nextBrother = getListNextBrother(block);
|
|
49502
49956
|
while (nextBlock !== nextBrother) {
|
|
49503
|
-
assert(logger$
|
|
49957
|
+
assert(logger$1$, nextBlock, "no next block");
|
|
49504
49958
|
if (isListBlock(nextBlock)) {
|
|
49505
49959
|
if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
|
|
49506
49960
|
return nextBlock;
|
|
@@ -49599,9 +50053,9 @@ ${codeText}
|
|
|
49599
50053
|
}
|
|
49600
50054
|
return true;
|
|
49601
50055
|
}
|
|
49602
|
-
const logger$
|
|
50056
|
+
const logger$1Z = getLogger("list-block");
|
|
49603
50057
|
function cloneListData(editor, block, options) {
|
|
49604
|
-
assert(logger$
|
|
50058
|
+
assert(logger$1Z, isListBlock(block), "not a list block");
|
|
49605
50059
|
const blockData = {
|
|
49606
50060
|
...editor.getBlockData(block),
|
|
49607
50061
|
id: genId()
|
|
@@ -49676,7 +50130,7 @@ ${codeText}
|
|
|
49676
50130
|
return true;
|
|
49677
50131
|
}
|
|
49678
50132
|
function findPrevBrotherAsParent(block) {
|
|
49679
|
-
assert(logger$
|
|
50133
|
+
assert(logger$1$, isListBlock(block), "not a list block");
|
|
49680
50134
|
const { level } = getListBlockProperties(block);
|
|
49681
50135
|
let prevBlock = getPrevBlock(block);
|
|
49682
50136
|
while (prevBlock) {
|
|
@@ -49703,7 +50157,7 @@ ${codeText}
|
|
|
49703
50157
|
}
|
|
49704
50158
|
function findPrevBrother(editor, fromBlock, toParentBlock) {
|
|
49705
50159
|
let prevBlock = getPrevBlock(fromBlock);
|
|
49706
|
-
assert(logger$
|
|
50160
|
+
assert(logger$1$, prevBlock, "no prev brother");
|
|
49707
50161
|
const parentLevel = getListBlockLevel(toParentBlock);
|
|
49708
50162
|
while (prevBlock) {
|
|
49709
50163
|
if (prevBlock === toParentBlock) {
|
|
@@ -49724,7 +50178,7 @@ ${codeText}
|
|
|
49724
50178
|
}
|
|
49725
50179
|
ensureIsListBlock(block);
|
|
49726
50180
|
const prevBrother = findPrevBrotherAsParent(block);
|
|
49727
|
-
assert(logger$
|
|
50181
|
+
assert(logger$1$, prevBrother, "no list prev brother");
|
|
49728
50182
|
const newParent = prevBrother;
|
|
49729
50183
|
const newBrother = findPrevBrother(editor, block, newParent);
|
|
49730
50184
|
const level = getListBlockLevel(newParent) + 1;
|
|
@@ -49923,14 +50377,14 @@ ${codeText}
|
|
|
49923
50377
|
this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
|
|
49924
50378
|
}
|
|
49925
50379
|
}
|
|
49926
|
-
const logger$
|
|
50380
|
+
const logger$1Y = getLogger("customize-list-start-menu");
|
|
49927
50381
|
class CustomizeListStartDialog {
|
|
49928
50382
|
constructor(editor) {
|
|
49929
50383
|
__publicField(this, "popup");
|
|
49930
50384
|
__publicField(this, "block", null);
|
|
49931
50385
|
__publicField(this, "show", (editor, block) => {
|
|
49932
50386
|
const listBlockMarker = block.querySelector("div.list-container");
|
|
49933
|
-
assert(logger$
|
|
50387
|
+
assert(logger$1Y, listBlockMarker, "list-block mark does not exist");
|
|
49934
50388
|
this.block = block;
|
|
49935
50389
|
this.popup.manualShow(listBlockMarker, {
|
|
49936
50390
|
theme: "light"
|
|
@@ -50088,7 +50542,7 @@ ${codeText}
|
|
|
50088
50542
|
const listContainer = findTarget(event, "div.list-container");
|
|
50089
50543
|
if (listContainer && this.editor.isWritable()) {
|
|
50090
50544
|
const block = getParentBlock(listContainer);
|
|
50091
|
-
assert(logger$
|
|
50545
|
+
assert(logger$1$, block, "no parent block");
|
|
50092
50546
|
ensureIsListBlock(block);
|
|
50093
50547
|
const blockData = editor.getBlockData(block);
|
|
50094
50548
|
if (blockData && blockData.checkbox) {
|
|
@@ -50228,7 +50682,7 @@ ${codeText}
|
|
|
50228
50682
|
}
|
|
50229
50683
|
return blockContent;
|
|
50230
50684
|
}
|
|
50231
|
-
const zhCN$
|
|
50685
|
+
const zhCN$s = {
|
|
50232
50686
|
list: {
|
|
50233
50687
|
confirm: "\u786E\u5B9A",
|
|
50234
50688
|
setStart: "\u8BBE\u7F6E\u7F16\u53F7",
|
|
@@ -50248,7 +50702,7 @@ ${codeText}
|
|
|
50248
50702
|
exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
|
|
50249
50703
|
}
|
|
50250
50704
|
};
|
|
50251
|
-
const enUS$
|
|
50705
|
+
const enUS$s = {
|
|
50252
50706
|
list: {
|
|
50253
50707
|
confirm: "Confirm",
|
|
50254
50708
|
setStart: "Set number",
|
|
@@ -50268,7 +50722,7 @@ ${codeText}
|
|
|
50268
50722
|
exitFullscreen: "Exit full screen"
|
|
50269
50723
|
}
|
|
50270
50724
|
};
|
|
50271
|
-
const jaJP$
|
|
50725
|
+
const jaJP$s = {
|
|
50272
50726
|
list: {
|
|
50273
50727
|
confirm: "OK",
|
|
50274
50728
|
setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
|
|
@@ -50289,12 +50743,12 @@ ${codeText}
|
|
|
50289
50743
|
}
|
|
50290
50744
|
};
|
|
50291
50745
|
i18n$1.mergeLang({
|
|
50292
|
-
"zh-CN": zhCN$
|
|
50293
|
-
"en-US": enUS$
|
|
50294
|
-
"ja-JP": jaJP$
|
|
50746
|
+
"zh-CN": zhCN$s,
|
|
50747
|
+
"en-US": enUS$s,
|
|
50748
|
+
"ja-JP": jaJP$s
|
|
50295
50749
|
});
|
|
50296
|
-
const style$
|
|
50297
|
-
const logger$
|
|
50750
|
+
const style$8 = "";
|
|
50751
|
+
const logger$1X = getLogger("list-block:paste-handler");
|
|
50298
50752
|
class ListPasteHandler {
|
|
50299
50753
|
constructor() {
|
|
50300
50754
|
__publicField(this, "fixStartByList", null);
|
|
@@ -50348,7 +50802,7 @@ ${codeText}
|
|
|
50348
50802
|
startIds.set(newGroupId, 1);
|
|
50349
50803
|
} else {
|
|
50350
50804
|
const start = startIds.get(groupId);
|
|
50351
|
-
assert(logger$
|
|
50805
|
+
assert(logger$1X, start, "start is null");
|
|
50352
50806
|
block.start = start + 1;
|
|
50353
50807
|
block.groupId = groupId;
|
|
50354
50808
|
startIds.set(groupId, start + 1);
|
|
@@ -50368,7 +50822,7 @@ ${codeText}
|
|
|
50368
50822
|
return false;
|
|
50369
50823
|
}
|
|
50370
50824
|
}
|
|
50371
|
-
const logger$
|
|
50825
|
+
const logger$1W = getLogger("list selection to doc");
|
|
50372
50826
|
function convertListToText(data2) {
|
|
50373
50827
|
const textData = { type: "text" };
|
|
50374
50828
|
Object.entries(data2).forEach(([key, value]) => {
|
|
@@ -50383,7 +50837,7 @@ ${codeText}
|
|
|
50383
50837
|
const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
|
|
50384
50838
|
const start = selectedBlock.start;
|
|
50385
50839
|
const end = selectedBlock.end;
|
|
50386
|
-
assert(logger$
|
|
50840
|
+
assert(logger$1W, data2.text, "no block text");
|
|
50387
50841
|
const len = getBlockTextLength$6(editor, selectedBlock.block);
|
|
50388
50842
|
if (end.offset - start.offset === len) {
|
|
50389
50843
|
return {
|
|
@@ -50959,7 +51413,7 @@ ${codeText}
|
|
|
50959
51413
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
50960
51414
|
}, 300);
|
|
50961
51415
|
};
|
|
50962
|
-
const logger$
|
|
51416
|
+
const logger$1V = getLogger("inline-box-items");
|
|
50963
51417
|
function insertEmptyBlockLink(editor, containerId, blockIndex) {
|
|
50964
51418
|
let block = editor.findBlockByIndex(containerId, blockIndex);
|
|
50965
51419
|
let placement = "bottom-start";
|
|
@@ -50970,7 +51424,7 @@ ${codeText}
|
|
|
50970
51424
|
const onFinished = (linkText, linkUrl) => {
|
|
50971
51425
|
editor.undoManager.runInGroup(() => {
|
|
50972
51426
|
try {
|
|
50973
|
-
assert(logger$
|
|
51427
|
+
assert(logger$1V, block, "block not found");
|
|
50974
51428
|
if (!isEmptyTextBlock(editor, block)) {
|
|
50975
51429
|
block = editor.insertTextBlock([], containerId, blockIndex);
|
|
50976
51430
|
}
|
|
@@ -50981,7 +51435,7 @@ ${codeText}
|
|
|
50981
51435
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
50982
51436
|
editor.focus();
|
|
50983
51437
|
} catch (error2) {
|
|
50984
|
-
logger$
|
|
51438
|
+
logger$1V.error(error2);
|
|
50985
51439
|
}
|
|
50986
51440
|
});
|
|
50987
51441
|
};
|
|
@@ -51001,7 +51455,7 @@ ${codeText}
|
|
|
51001
51455
|
function insertLink(editor, containerId, blockIndex) {
|
|
51002
51456
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
51003
51457
|
const range = editor.selection.range;
|
|
51004
|
-
assert(logger$
|
|
51458
|
+
assert(logger$1V, isSimpleBlockPosition(range.start), "invalid block position");
|
|
51005
51459
|
const rects = getBlockClientRects(editor, block, range);
|
|
51006
51460
|
if (rects.length === 0) {
|
|
51007
51461
|
return;
|
|
@@ -51027,7 +51481,7 @@ ${codeText}
|
|
|
51027
51481
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
51028
51482
|
editor.focus();
|
|
51029
51483
|
} catch (error2) {
|
|
51030
|
-
logger$
|
|
51484
|
+
logger$1V.error(error2);
|
|
51031
51485
|
}
|
|
51032
51486
|
});
|
|
51033
51487
|
};
|
|
@@ -51245,7 +51699,7 @@ ${codeText}
|
|
|
51245
51699
|
function getToolbar(editor) {
|
|
51246
51700
|
return editor.findCustom("toolbar-handler");
|
|
51247
51701
|
}
|
|
51248
|
-
const logger$
|
|
51702
|
+
const logger$1U = getLogger("link-popup");
|
|
51249
51703
|
function getLinkHref(child) {
|
|
51250
51704
|
var _a, _b;
|
|
51251
51705
|
return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
|
|
@@ -51283,7 +51737,7 @@ ${codeText}
|
|
|
51283
51737
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
51284
51738
|
editor.focus();
|
|
51285
51739
|
} catch (error2) {
|
|
51286
|
-
logger$
|
|
51740
|
+
logger$1U.error(error2);
|
|
51287
51741
|
}
|
|
51288
51742
|
};
|
|
51289
51743
|
const onClose = () => {
|
|
@@ -51522,7 +51976,7 @@ ${codeText}
|
|
|
51522
51976
|
this.editProvider = new EditLinkProvider();
|
|
51523
51977
|
}
|
|
51524
51978
|
}
|
|
51525
|
-
const logger$
|
|
51979
|
+
const logger$1T = getLogger("readonly-toolbar");
|
|
51526
51980
|
const SEP = {
|
|
51527
51981
|
id: "",
|
|
51528
51982
|
name: "",
|
|
@@ -51585,7 +52039,7 @@ ${codeText}
|
|
|
51585
52039
|
});
|
|
51586
52040
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51587
52041
|
var _a;
|
|
51588
|
-
assert(logger$
|
|
52042
|
+
assert(logger$1T, editor === this.editor, "editor mismatch");
|
|
51589
52043
|
if (!editor.readonly) {
|
|
51590
52044
|
this.toolbar.close("selectionChange");
|
|
51591
52045
|
return;
|
|
@@ -51767,7 +52221,7 @@ ${codeText}
|
|
|
51767
52221
|
return visible;
|
|
51768
52222
|
}
|
|
51769
52223
|
}
|
|
51770
|
-
const logger$
|
|
52224
|
+
const logger$1S = getLogger("toolbar-handler");
|
|
51771
52225
|
class OnesEditorToolbar {
|
|
51772
52226
|
constructor(editor) {
|
|
51773
52227
|
__publicField(this, "id", "editor-toolbar");
|
|
@@ -51854,7 +52308,7 @@ ${codeText}
|
|
|
51854
52308
|
});
|
|
51855
52309
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51856
52310
|
var _a;
|
|
51857
|
-
assert(logger$
|
|
52311
|
+
assert(logger$1S, editor === this.editor, "editor mismatch");
|
|
51858
52312
|
if (editor.selection.range.isCollapsed() || this.mouseDown) {
|
|
51859
52313
|
if (this.toolbarType === "object") {
|
|
51860
52314
|
const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
|
|
@@ -52074,8 +52528,15 @@ ${codeText}
|
|
|
52074
52528
|
}
|
|
52075
52529
|
}
|
|
52076
52530
|
const getReferenceClientRectByCaret = () => {
|
|
52531
|
+
if (!this.hoveringBlock) {
|
|
52532
|
+
return new DOMRect();
|
|
52533
|
+
}
|
|
52534
|
+
const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
|
|
52535
|
+
if (!element2) {
|
|
52536
|
+
return new DOMRect();
|
|
52537
|
+
}
|
|
52077
52538
|
let rect;
|
|
52078
|
-
const clientRects =
|
|
52539
|
+
const clientRects = element2.getClientRects();
|
|
52079
52540
|
const lineRects = [];
|
|
52080
52541
|
Array.from(clientRects).forEach((clientRect) => {
|
|
52081
52542
|
const { y } = clientRect;
|
|
@@ -52085,7 +52546,7 @@ ${codeText}
|
|
|
52085
52546
|
lineRects.push(y);
|
|
52086
52547
|
});
|
|
52087
52548
|
if (lineRects.length > 1) {
|
|
52088
|
-
rect =
|
|
52549
|
+
rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
|
|
52089
52550
|
if (event) {
|
|
52090
52551
|
for (let i = 0; i < clientRects.length; i++) {
|
|
52091
52552
|
const clientRect = clientRects[i];
|
|
@@ -52097,21 +52558,15 @@ ${codeText}
|
|
|
52097
52558
|
}
|
|
52098
52559
|
}
|
|
52099
52560
|
} else {
|
|
52100
|
-
rect =
|
|
52101
|
-
if (
|
|
52102
|
-
const childRect =
|
|
52561
|
+
rect = element2.getBoundingClientRect();
|
|
52562
|
+
if (!isBlock$1(element2)) {
|
|
52563
|
+
const childRect = element2.getBoundingClientRect();
|
|
52103
52564
|
return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
|
|
52104
52565
|
}
|
|
52105
52566
|
if (clientRects.length === 1) {
|
|
52106
52567
|
return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
|
|
52107
52568
|
}
|
|
52108
52569
|
}
|
|
52109
|
-
if (this.hoveringBlock) {
|
|
52110
|
-
const blockContent = getBlockContent(this.hoveringBlock);
|
|
52111
|
-
if (blockContent !== element) {
|
|
52112
|
-
return blockContent.getBoundingClientRect();
|
|
52113
|
-
}
|
|
52114
|
-
}
|
|
52115
52570
|
if (event) {
|
|
52116
52571
|
const y = rect.y;
|
|
52117
52572
|
const x = event.clientX;
|
|
@@ -52121,8 +52576,9 @@ ${codeText}
|
|
|
52121
52576
|
};
|
|
52122
52577
|
this.toolbar.updateItems(commands);
|
|
52123
52578
|
if (!this.toolbar.isVisible) {
|
|
52579
|
+
const isText = element === child && !isTextBlockContentBoxChild(element);
|
|
52124
52580
|
this.toolbar.manualShow(element, {
|
|
52125
|
-
placement:
|
|
52581
|
+
placement: isText && !clientType.isMobile ? "bottom" : "top",
|
|
52126
52582
|
getReferenceClientRect: getReferenceClientRectByCaret
|
|
52127
52583
|
});
|
|
52128
52584
|
if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
|
|
@@ -52173,7 +52629,7 @@ ${codeText}
|
|
|
52173
52629
|
this.texWidth = [tex, width];
|
|
52174
52630
|
}
|
|
52175
52631
|
}
|
|
52176
|
-
const logger$
|
|
52632
|
+
const logger$1R = getLogger("mathjax-converter");
|
|
52177
52633
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
52178
52634
|
const MATHJAX_BUFFER = 30;
|
|
52179
52635
|
const REDUCED_UNIT = 8;
|
|
@@ -52222,7 +52678,7 @@ ${codeText}
|
|
|
52222
52678
|
const svg = result.querySelector("svg");
|
|
52223
52679
|
return svg.outerHTML;
|
|
52224
52680
|
} catch (err) {
|
|
52225
|
-
logger$
|
|
52681
|
+
logger$1R.error(err);
|
|
52226
52682
|
throw err;
|
|
52227
52683
|
} finally {
|
|
52228
52684
|
lockers.release(lockId);
|
|
@@ -52270,7 +52726,7 @@ ${codeText}
|
|
|
52270
52726
|
...perfectState
|
|
52271
52727
|
};
|
|
52272
52728
|
}
|
|
52273
|
-
const logger$
|
|
52729
|
+
const logger$1Q = getLogger("edit-mathjax");
|
|
52274
52730
|
class MathjaxEditor {
|
|
52275
52731
|
constructor() {
|
|
52276
52732
|
__publicField(this, "editMathjaxPopup", null);
|
|
@@ -52347,9 +52803,9 @@ ${codeText}
|
|
|
52347
52803
|
this.observer.observe(textarea2);
|
|
52348
52804
|
}
|
|
52349
52805
|
getTextarea() {
|
|
52350
|
-
assert(logger$
|
|
52806
|
+
assert(logger$1Q, this.editMathjaxPopup, "no exists mathjax editor popup");
|
|
52351
52807
|
const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
|
|
52352
|
-
assert(logger$
|
|
52808
|
+
assert(logger$1Q, textarea2, "no textarea");
|
|
52353
52809
|
return textarea2;
|
|
52354
52810
|
}
|
|
52355
52811
|
destroy() {
|
|
@@ -52419,7 +52875,7 @@ ${codeText}
|
|
|
52419
52875
|
};
|
|
52420
52876
|
editMathjax(editor, box, data2.tex, update2);
|
|
52421
52877
|
}
|
|
52422
|
-
const logger$
|
|
52878
|
+
const logger$1P = getLogger("mathjax-box");
|
|
52423
52879
|
function updateCaret(editor, event) {
|
|
52424
52880
|
editor.selection.updateSelection(null);
|
|
52425
52881
|
const target = event.target;
|
|
@@ -52524,7 +52980,7 @@ ${codeText}
|
|
|
52524
52980
|
};
|
|
52525
52981
|
editor.updateBoxData(newData);
|
|
52526
52982
|
}).catch((err) => {
|
|
52527
|
-
logger$
|
|
52983
|
+
logger$1P.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
|
|
52528
52984
|
});
|
|
52529
52985
|
return data2;
|
|
52530
52986
|
}
|
|
@@ -52543,7 +52999,7 @@ ${codeText}
|
|
|
52543
52999
|
}
|
|
52544
53000
|
function handleClickBox$3(editor, box, event) {
|
|
52545
53001
|
const parentBlock = getParentBlock(box);
|
|
52546
|
-
assert(logger$
|
|
53002
|
+
assert(logger$1P, parentBlock, "failed to get block");
|
|
52547
53003
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
52548
53004
|
return;
|
|
52549
53005
|
}
|
|
@@ -52740,28 +53196,28 @@ $$${mathData.mathjaxText}$$
|
|
|
52740
53196
|
getBlockProperties: getBlockProperties$b
|
|
52741
53197
|
};
|
|
52742
53198
|
const mathjaxStyle = "";
|
|
52743
|
-
const zhCN$
|
|
53199
|
+
const zhCN$r = {
|
|
52744
53200
|
mathjax: {
|
|
52745
53201
|
emptyText: "\u7A7A\u7684\u516C\u5F0F",
|
|
52746
53202
|
abstract: "\u516C\u5F0F"
|
|
52747
53203
|
}
|
|
52748
53204
|
};
|
|
52749
|
-
const enUS$
|
|
53205
|
+
const enUS$r = {
|
|
52750
53206
|
mathjax: {
|
|
52751
53207
|
emptyText: "Empty formula",
|
|
52752
53208
|
abstract: "Formula"
|
|
52753
53209
|
}
|
|
52754
53210
|
};
|
|
52755
|
-
const jaJP$
|
|
53211
|
+
const jaJP$r = {
|
|
52756
53212
|
mathjax: {
|
|
52757
53213
|
emptyText: "\u6570\u5F0F\u306A\u3057",
|
|
52758
53214
|
abstract: "\u6570\u5F0F"
|
|
52759
53215
|
}
|
|
52760
53216
|
};
|
|
52761
53217
|
i18n$1.mergeLang({
|
|
52762
|
-
"zh-CN": zhCN$
|
|
52763
|
-
"en-US": enUS$
|
|
52764
|
-
"ja-JP": jaJP$
|
|
53218
|
+
"zh-CN": zhCN$r,
|
|
53219
|
+
"en-US": enUS$r,
|
|
53220
|
+
"ja-JP": jaJP$r
|
|
52765
53221
|
});
|
|
52766
53222
|
function convertToMath(editor, containerId, blockIndex, offset) {
|
|
52767
53223
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -58295,7 +58751,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58295
58751
|
const docBlockText = { insert: " ", attributes: data2 };
|
|
58296
58752
|
return docBlockText;
|
|
58297
58753
|
}
|
|
58298
|
-
const logger$
|
|
58754
|
+
const logger$1O = getLogger("StatusBoxEditor");
|
|
58299
58755
|
class StatusBoxEditor {
|
|
58300
58756
|
constructor(editor) {
|
|
58301
58757
|
__publicField(this, "linkPopup", null);
|
|
@@ -58318,10 +58774,10 @@ $$${mathData.mathjaxText}$$
|
|
|
58318
58774
|
});
|
|
58319
58775
|
__publicField(this, "handClose", () => {
|
|
58320
58776
|
var _a;
|
|
58321
|
-
assert(logger$
|
|
58777
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58322
58778
|
const boxData = this.editor.getBoxData(this.boxElement);
|
|
58323
58779
|
const block = getParentBlock(this.boxElement);
|
|
58324
|
-
assert(logger$
|
|
58780
|
+
assert(logger$1O, block, "block not found");
|
|
58325
58781
|
if (!boxData.title) {
|
|
58326
58782
|
const offset = getChildOffset(block, this.boxElement);
|
|
58327
58783
|
this.editor.deleteTextFromBlock(block, offset.start, 1);
|
|
@@ -58359,7 +58815,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58359
58815
|
return;
|
|
58360
58816
|
}
|
|
58361
58817
|
const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
|
|
58362
|
-
assert(logger$
|
|
58818
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58363
58819
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58364
58820
|
this.statusPalette.changeColor(color);
|
|
58365
58821
|
const newData = { ...data2, color };
|
|
@@ -58376,7 +58832,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58376
58832
|
});
|
|
58377
58833
|
__publicField(this, "onTitleChange", (e2) => {
|
|
58378
58834
|
const title = e2.target.value;
|
|
58379
|
-
assert(logger$
|
|
58835
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58380
58836
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58381
58837
|
const newData = { ...data2, title: title.trim() };
|
|
58382
58838
|
this.editor.updateBoxData(newData, { noFocus: true });
|
|
@@ -58457,7 +58913,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58457
58913
|
toStandardText: toStandardText$1,
|
|
58458
58914
|
matchText: matchText$1
|
|
58459
58915
|
};
|
|
58460
|
-
const logger$
|
|
58916
|
+
const logger$1N = getLogger("status-box-command");
|
|
58461
58917
|
class StatusBoxCommand {
|
|
58462
58918
|
static get commands() {
|
|
58463
58919
|
return [
|
|
@@ -58476,7 +58932,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58476
58932
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58477
58933
|
const boxOp = createEmptyStatusBox();
|
|
58478
58934
|
const { start } = editor.selection.range;
|
|
58479
|
-
assert(logger$
|
|
58935
|
+
assert(logger$1N, isSimpleBlockPosition(start), "invalid block position");
|
|
58480
58936
|
editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
|
|
58481
58937
|
const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
|
|
58482
58938
|
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
|
|
@@ -58495,7 +58951,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58495
58951
|
}
|
|
58496
58952
|
}
|
|
58497
58953
|
__publicField(StatusBoxCommand, "id", "insert-status");
|
|
58498
|
-
const enUS$
|
|
58954
|
+
const enUS$q = {
|
|
58499
58955
|
status: {
|
|
58500
58956
|
empty: "Set status",
|
|
58501
58957
|
command: {
|
|
@@ -58519,7 +58975,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58519
58975
|
}
|
|
58520
58976
|
}
|
|
58521
58977
|
};
|
|
58522
|
-
const zhCN$
|
|
58978
|
+
const zhCN$q = {
|
|
58523
58979
|
status: {
|
|
58524
58980
|
empty: "\u8BBE\u7F6E\u72B6\u6001",
|
|
58525
58981
|
command: {
|
|
@@ -58543,7 +58999,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58543
58999
|
}
|
|
58544
59000
|
}
|
|
58545
59001
|
};
|
|
58546
|
-
const jaJP$
|
|
59002
|
+
const jaJP$q = {
|
|
58547
59003
|
status: {
|
|
58548
59004
|
empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
|
|
58549
59005
|
command: {
|
|
@@ -58568,12 +59024,12 @@ $$${mathData.mathjaxText}$$
|
|
|
58568
59024
|
}
|
|
58569
59025
|
};
|
|
58570
59026
|
const langs$2 = {
|
|
58571
|
-
"en-US": enUS$
|
|
58572
|
-
"zh-CN": zhCN$
|
|
58573
|
-
"ja-JP": jaJP$
|
|
59027
|
+
"en-US": enUS$q,
|
|
59028
|
+
"zh-CN": zhCN$q,
|
|
59029
|
+
"ja-JP": jaJP$q
|
|
58574
59030
|
};
|
|
58575
59031
|
i18n$1.mergeLang(langs$2);
|
|
58576
|
-
const logger$
|
|
59032
|
+
const logger$1M = getLogger("inline-box-items");
|
|
58577
59033
|
function insertEmptyBlockMath(editor, containerId, blockIndex) {
|
|
58578
59034
|
return editor.undoManager.runInGroup(() => {
|
|
58579
59035
|
var _a;
|
|
@@ -58584,7 +59040,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58584
59040
|
const boxOp = createEmptyMathjaxBox();
|
|
58585
59041
|
editor.setBlockText(block, [boxOp]);
|
|
58586
59042
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58587
|
-
assert(logger$
|
|
59043
|
+
assert(logger$1M, boxId, "mathjax box id is empty");
|
|
58588
59044
|
setTimeout(() => {
|
|
58589
59045
|
const box = editor.getBoxById(boxId);
|
|
58590
59046
|
editMathjaxBox(editor, box);
|
|
@@ -58597,11 +59053,11 @@ $$${mathData.mathjaxText}$$
|
|
|
58597
59053
|
var _a;
|
|
58598
59054
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58599
59055
|
const range = editor.selection.range;
|
|
58600
|
-
assert(logger$
|
|
59056
|
+
assert(logger$1M, isSimpleBlockPosition(range.start), "invalid block position");
|
|
58601
59057
|
const boxOp = createEmptyMathjaxBox();
|
|
58602
59058
|
editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
|
|
58603
59059
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58604
|
-
assert(logger$
|
|
59060
|
+
assert(logger$1M, boxId, "mathjax box id is empty");
|
|
58605
59061
|
setTimeout(() => {
|
|
58606
59062
|
const box = editor.getBoxById(boxId);
|
|
58607
59063
|
editMathjaxBox(editor, box);
|
|
@@ -58768,7 +59224,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58768
59224
|
}
|
|
58769
59225
|
}
|
|
58770
59226
|
};
|
|
58771
|
-
const logger$
|
|
59227
|
+
const logger$1L = getLogger("insert-menu");
|
|
58772
59228
|
const injectGroup = (commands, group, startIndex) => {
|
|
58773
59229
|
commands.forEach((command, index2) => {
|
|
58774
59230
|
command.group = group;
|
|
@@ -58907,7 +59363,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58907
59363
|
return true;
|
|
58908
59364
|
}
|
|
58909
59365
|
const blockId = getBlockId(block);
|
|
58910
|
-
assert(logger$
|
|
59366
|
+
assert(logger$1L, range.isSimple(), "invalid range");
|
|
58911
59367
|
const offset = range.start.offset;
|
|
58912
59368
|
if (quickItem.commandProvider) {
|
|
58913
59369
|
const params2 = { from: "quick-menu", blockId, offset };
|
|
@@ -58943,7 +59399,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58943
59399
|
});
|
|
58944
59400
|
}
|
|
58945
59401
|
}
|
|
58946
|
-
const logger$
|
|
59402
|
+
const logger$1K = getLogger("quick-command-providers");
|
|
58947
59403
|
class QuickCommandProviders extends AbstractProvider {
|
|
58948
59404
|
constructor(editor) {
|
|
58949
59405
|
super(editor);
|
|
@@ -58963,7 +59419,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58963
59419
|
}
|
|
58964
59420
|
getCommands(range) {
|
|
58965
59421
|
var _a, _b;
|
|
58966
|
-
assert(logger$
|
|
59422
|
+
assert(logger$1K, range.start.blockId === range.end.blockId, "invalid range");
|
|
58967
59423
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
58968
59424
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
58969
59425
|
const container = getParentContainer(block);
|
|
@@ -59032,7 +59488,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59032
59488
|
});
|
|
59033
59489
|
__publicField(this, "onClose", () => {
|
|
59034
59490
|
this.firstEmptyOffset = -1;
|
|
59035
|
-
if (shouldFocusToEditor(this.editor)
|
|
59491
|
+
if (shouldFocusToEditor(this.editor)) {
|
|
59036
59492
|
this.editor.focus({ preventScroll: true });
|
|
59037
59493
|
}
|
|
59038
59494
|
});
|
|
@@ -59308,9 +59764,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59308
59764
|
if (target.hasAttribute("data-editor-overflow-tooltip")) {
|
|
59309
59765
|
if (this.check(target)) {
|
|
59310
59766
|
const title = target.getAttribute("data-editor-overflow-tooltip");
|
|
59311
|
-
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
|
|
59767
|
+
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`, title);
|
|
59312
59768
|
} else {
|
|
59313
|
-
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
|
|
59769
|
+
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);
|
|
59314
59770
|
}
|
|
59315
59771
|
}
|
|
59316
59772
|
});
|
|
@@ -59400,7 +59856,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59400
59856
|
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
59401
59857
|
...headingShortcut()
|
|
59402
59858
|
};
|
|
59403
|
-
const zhCN$
|
|
59859
|
+
const zhCN$p = {
|
|
59404
59860
|
quickMenu: {
|
|
59405
59861
|
basic: {
|
|
59406
59862
|
heading: {
|
|
@@ -59456,7 +59912,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59456
59912
|
selectBlock: "\u9009\u62E9\u533A\u5757"
|
|
59457
59913
|
}
|
|
59458
59914
|
};
|
|
59459
|
-
const enUS$
|
|
59915
|
+
const enUS$p = {
|
|
59460
59916
|
quickMenu: {
|
|
59461
59917
|
basic: {
|
|
59462
59918
|
heading: {
|
|
@@ -59512,7 +59968,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59512
59968
|
selectBlock: "Select Block"
|
|
59513
59969
|
}
|
|
59514
59970
|
};
|
|
59515
|
-
const jaJP$
|
|
59971
|
+
const jaJP$p = {
|
|
59516
59972
|
quickMenu: {
|
|
59517
59973
|
basic: {
|
|
59518
59974
|
heading: {
|
|
@@ -59569,9 +60025,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59569
60025
|
}
|
|
59570
60026
|
};
|
|
59571
60027
|
i18n$1.mergeLang({
|
|
59572
|
-
"zh-CN": zhCN$
|
|
59573
|
-
"en-US": enUS$
|
|
59574
|
-
"ja-JP": jaJP$
|
|
60028
|
+
"zh-CN": zhCN$p,
|
|
60029
|
+
"en-US": enUS$p,
|
|
60030
|
+
"ja-JP": jaJP$p
|
|
59575
60031
|
});
|
|
59576
60032
|
class TextStylesFixedProvider extends ProxyProvider {
|
|
59577
60033
|
constructor(editor, afterCommandCallback) {
|
|
@@ -59776,7 +60232,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59776
60232
|
return false;
|
|
59777
60233
|
}
|
|
59778
60234
|
}
|
|
59779
|
-
const logger$
|
|
60235
|
+
const logger$1J = getLogger("block-command-providers");
|
|
59780
60236
|
class BlockCommandProviders extends AbstractProvider {
|
|
59781
60237
|
constructor(editor, afterCommandCallback) {
|
|
59782
60238
|
super(editor);
|
|
@@ -59797,7 +60253,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59797
60253
|
this.registerCommandProvider(new InsertGroupProvider(editor));
|
|
59798
60254
|
}
|
|
59799
60255
|
getCommands(range) {
|
|
59800
|
-
assert(logger$
|
|
60256
|
+
assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
|
|
59801
60257
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59802
60258
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59803
60259
|
let startIndex = 100;
|
|
@@ -59811,7 +60267,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59811
60267
|
return this.filterItems(range, commands);
|
|
59812
60268
|
}
|
|
59813
60269
|
}
|
|
59814
|
-
const logger$
|
|
60270
|
+
const logger$1I = getLogger("standard-block-actions");
|
|
59815
60271
|
class StandardBlockActionHook {
|
|
59816
60272
|
constructor() {
|
|
59817
60273
|
__publicField(this, "executeCommand", (editor, bloockElement, item) => {
|
|
@@ -59830,7 +60286,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59830
60286
|
this.deleteBlock(editor, block);
|
|
59831
60287
|
}
|
|
59832
60288
|
} catch (err) {
|
|
59833
|
-
logger$
|
|
60289
|
+
logger$1I.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
59834
60290
|
}
|
|
59835
60291
|
});
|
|
59836
60292
|
}
|
|
@@ -59898,7 +60354,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59898
60354
|
}
|
|
59899
60355
|
}
|
|
59900
60356
|
}
|
|
59901
|
-
const logger$
|
|
60357
|
+
const logger$1H = getLogger("block-menu");
|
|
59902
60358
|
class BlockMenu {
|
|
59903
60359
|
constructor(editor) {
|
|
59904
60360
|
__publicField(this, "menu");
|
|
@@ -59906,7 +60362,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59906
60362
|
__publicField(this, "commandBlock", null);
|
|
59907
60363
|
__publicField(this, "blockCommandProviders");
|
|
59908
60364
|
__publicField(this, "handleShow", () => {
|
|
59909
|
-
assert(logger$
|
|
60365
|
+
assert(logger$1H, this.currentBlock, "no target block before show block menu");
|
|
59910
60366
|
const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
|
|
59911
60367
|
this.menu.updateItems(items);
|
|
59912
60368
|
this.commandBlock = this.currentBlock;
|
|
@@ -59917,7 +60373,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59917
60373
|
}
|
|
59918
60374
|
});
|
|
59919
60375
|
__publicField(this, "handleItemClick", (bar2, item) => {
|
|
59920
|
-
assert(logger$
|
|
60376
|
+
assert(logger$1H, this.commandBlock, "no command block before show block menu");
|
|
59921
60377
|
this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
|
|
59922
60378
|
if (!item.element) {
|
|
59923
60379
|
this.close();
|
|
@@ -59960,7 +60416,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59960
60416
|
this.menu.destroy();
|
|
59961
60417
|
}
|
|
59962
60418
|
}
|
|
59963
|
-
const logger$
|
|
60419
|
+
const logger$1G = getLogger("text-styles");
|
|
59964
60420
|
function getIntersectionStyles(text2) {
|
|
59965
60421
|
const getOpStyle = (op) => {
|
|
59966
60422
|
if (!op.attributes) {
|
|
@@ -59994,10 +60450,10 @@ $$${mathData.mathjaxText}$$
|
|
|
59994
60450
|
return new Map(Object.entries(attributes));
|
|
59995
60451
|
}
|
|
59996
60452
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
59997
|
-
assert(logger$
|
|
60453
|
+
assert(logger$1G, range.isSimple(), "invalid range");
|
|
59998
60454
|
const { start, end } = range;
|
|
59999
|
-
assert(logger$
|
|
60000
|
-
assert(logger$
|
|
60455
|
+
assert(logger$1G, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
60456
|
+
assert(logger$1G, style2.startsWith("style-"), "invalid style");
|
|
60001
60457
|
const oldText = editor.getBlockText(block);
|
|
60002
60458
|
let newText = oldText;
|
|
60003
60459
|
if (style2 === "style-sub") {
|
|
@@ -60043,13 +60499,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60043
60499
|
return standardItems;
|
|
60044
60500
|
}
|
|
60045
60501
|
function getSubText(editor, block, range) {
|
|
60046
|
-
assert(logger$
|
|
60502
|
+
assert(logger$1G, range.isSimple(), "nor a simple range");
|
|
60047
60503
|
const { start, end } = range;
|
|
60048
|
-
assert(logger$
|
|
60049
|
-
assert(logger$
|
|
60050
|
-
assert(logger$
|
|
60504
|
+
assert(logger$1G, start.isSimple(), "is not a simple block position");
|
|
60505
|
+
assert(logger$1G, end.isSimple(), "is not a simple block position");
|
|
60506
|
+
assert(logger$1G, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
|
|
60051
60507
|
const blockId = getBlockId(block);
|
|
60052
|
-
assert(logger$
|
|
60508
|
+
assert(logger$1G, start.blockId === blockId && end.blockId === blockId, "invalid range");
|
|
60053
60509
|
const text2 = editor.getBlockText(block);
|
|
60054
60510
|
let subText2 = [];
|
|
60055
60511
|
if (start.offset === end.offset) {
|
|
@@ -60061,7 +60517,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60061
60517
|
}
|
|
60062
60518
|
return subText2;
|
|
60063
60519
|
}
|
|
60064
|
-
const logger$
|
|
60520
|
+
const logger$1F = getLogger("text-commands");
|
|
60065
60521
|
function getCommands$1(editor, text2) {
|
|
60066
60522
|
const StandardTextStyles = {
|
|
60067
60523
|
"style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
|
|
@@ -60079,13 +60535,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60079
60535
|
}
|
|
60080
60536
|
function executeStyleCommand(editor, block, range, command, params, result) {
|
|
60081
60537
|
if (!command.startsWith("style-")) {
|
|
60082
|
-
logger$
|
|
60538
|
+
logger$1F.warn(`unknown command: ${command}`);
|
|
60083
60539
|
return false;
|
|
60084
60540
|
}
|
|
60085
60541
|
const value = params == null ? void 0 : params.value;
|
|
60086
60542
|
const type = typeof value;
|
|
60087
60543
|
if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
|
|
60088
|
-
logger$
|
|
60544
|
+
logger$1F.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
|
|
60089
60545
|
return false;
|
|
60090
60546
|
}
|
|
60091
60547
|
const newText = applyTextStyle(editor, block, range, command, value);
|
|
@@ -60310,7 +60766,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60310
60766
|
this.providers = [new TextScriptProvider(editor)];
|
|
60311
60767
|
}
|
|
60312
60768
|
}
|
|
60313
|
-
const logger$
|
|
60769
|
+
const logger$1E = getLogger("text-command-provider");
|
|
60314
60770
|
class TextCommandProvider {
|
|
60315
60771
|
constructor(editor, options) {
|
|
60316
60772
|
__publicField(this, "id", "TextCommandProvider");
|
|
@@ -60430,7 +60886,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60430
60886
|
}
|
|
60431
60887
|
static fromTextCommandId(id) {
|
|
60432
60888
|
const prefix = "text/";
|
|
60433
|
-
assert(logger$
|
|
60889
|
+
assert(logger$1E, id.startsWith(prefix), `invalid item id: ${id}`);
|
|
60434
60890
|
return id.substring(prefix.length);
|
|
60435
60891
|
}
|
|
60436
60892
|
}
|
|
@@ -60535,7 +60991,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60535
60991
|
};
|
|
60536
60992
|
editor.updateBlockData(block, newData);
|
|
60537
60993
|
}
|
|
60538
|
-
function addCommentToBlock
|
|
60994
|
+
function addCommentToBlock(editor, block, provider) {
|
|
60539
60995
|
const { start, end } = createBlockSimpleRange(editor, block, 0, getBlockTextLength$6(editor, block));
|
|
60540
60996
|
const selectedBlock = { block, start, end };
|
|
60541
60997
|
const abstract = getCommentAbstractFromSelectedBlocks(editor, [selectedBlock]);
|
|
@@ -60548,7 +61004,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60548
61004
|
provider.localCreateComment(comment, doc2);
|
|
60549
61005
|
return comment;
|
|
60550
61006
|
}
|
|
60551
|
-
const logger$
|
|
61007
|
+
const logger$1D = getLogger("standard-block-actions");
|
|
60552
61008
|
class CommentBlockHook {
|
|
60553
61009
|
constructor(provider, editorComments) {
|
|
60554
61010
|
__publicField(this, "executeCommand", (editor, block, item) => {
|
|
@@ -60556,9 +61012,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60556
61012
|
try {
|
|
60557
61013
|
this.editorComments.showCommentList();
|
|
60558
61014
|
const block2 = editor.getBlockById(blockId);
|
|
60559
|
-
addCommentToBlock
|
|
61015
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
60560
61016
|
} catch (err) {
|
|
60561
|
-
logger$
|
|
61017
|
+
logger$1D.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
60562
61018
|
}
|
|
60563
61019
|
});
|
|
60564
61020
|
this.provider = provider;
|
|
@@ -60662,7 +61118,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60662
61118
|
const attributes = Array.from(element.attributes).map((c) => c.name);
|
|
60663
61119
|
return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
|
|
60664
61120
|
}
|
|
60665
|
-
const logger$
|
|
61121
|
+
const logger$1C = getLogger("doc-comments");
|
|
60666
61122
|
function addBlockComments(doc2, block, result, resultSet) {
|
|
60667
61123
|
if (block.comments) {
|
|
60668
61124
|
const blockComments = block.comments;
|
|
@@ -60757,8 +61213,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60757
61213
|
const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
|
|
60758
61214
|
const index1 = commentsMap.get(group1.groupId);
|
|
60759
61215
|
const index2 = commentsMap.get(group2.groupId);
|
|
60760
|
-
assert(logger$
|
|
60761
|
-
assert(logger$
|
|
61216
|
+
assert(logger$1C, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
|
|
61217
|
+
assert(logger$1C, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
|
|
60762
61218
|
return index1 - index2;
|
|
60763
61219
|
});
|
|
60764
61220
|
return result;
|
|
@@ -60819,7 +61275,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60819
61275
|
const commentIds = intersection__default.default(comments1, comments2);
|
|
60820
61276
|
return commentIds;
|
|
60821
61277
|
}
|
|
60822
|
-
const logger$
|
|
61278
|
+
const logger$1B = getLogger("active-comments");
|
|
60823
61279
|
function inactiveComment(editor, commentId) {
|
|
60824
61280
|
const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
|
|
60825
61281
|
activeCommentElements.forEach((el) => {
|
|
@@ -60855,7 +61311,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60855
61311
|
const commentIds = getCommentsFromSelection(editor);
|
|
60856
61312
|
if (commentIds.indexOf(commentId) === -1) {
|
|
60857
61313
|
const block = getParentBlock(targetElement);
|
|
60858
|
-
assert(logger$
|
|
61314
|
+
assert(logger$1B, block, "block not found");
|
|
60859
61315
|
const offset = getChildOffset(block, targetElement);
|
|
60860
61316
|
const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
|
|
60861
61317
|
editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
|
|
@@ -60897,7 +61353,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60897
61353
|
function isValidSize(size) {
|
|
60898
61354
|
return typeof size === "number";
|
|
60899
61355
|
}
|
|
60900
|
-
const logger$
|
|
61356
|
+
const logger$1A = getLogger("image-data");
|
|
60901
61357
|
const md5Cache = /* @__PURE__ */ new Map();
|
|
60902
61358
|
const DEFAULT_WIDTH$1 = 1e3;
|
|
60903
61359
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -61029,7 +61485,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61029
61485
|
if (heightKey && isValidSize(image.height)) {
|
|
61030
61486
|
result[heightKey] = image.height;
|
|
61031
61487
|
}
|
|
61032
|
-
assert(logger$
|
|
61488
|
+
assert(logger$1A, image.flex, "no image flex");
|
|
61033
61489
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
61034
61490
|
result[flexKey] = image.flex;
|
|
61035
61491
|
});
|
|
@@ -61085,224 +61541,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61085
61541
|
const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
|
|
61086
61542
|
return totalFlex;
|
|
61087
61543
|
}
|
|
61088
|
-
|
|
61089
|
-
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
61090
|
-
elem.setAttribute("data-resize-type", type);
|
|
61091
|
-
}
|
|
61092
|
-
function getExistsResizer(block) {
|
|
61093
|
-
const tools = getBlockTools(block);
|
|
61094
|
-
return tools.querySelector(".block-resizer");
|
|
61095
|
-
}
|
|
61096
|
-
function hideResizer(block) {
|
|
61097
|
-
const exists = getExistsResizer(block);
|
|
61098
|
-
if (exists) {
|
|
61099
|
-
removeClass(exists, "active");
|
|
61100
|
-
}
|
|
61101
|
-
}
|
|
61102
|
-
function updateSize(block, element, resizer) {
|
|
61103
|
-
const blockRect = block.getBoundingClientRect();
|
|
61104
|
-
const elementRect = element.getBoundingClientRect();
|
|
61105
|
-
const top = elementRect.top - blockRect.top;
|
|
61106
|
-
const left = elementRect.left - blockRect.left;
|
|
61107
|
-
const width = elementRect.width;
|
|
61108
|
-
const height = elementRect.height;
|
|
61109
|
-
resizer.style.top = `${top}px`;
|
|
61110
|
-
resizer.style.left = `${left}px`;
|
|
61111
|
-
resizer.style.width = `${width}px`;
|
|
61112
|
-
resizer.style.height = `${height}px`;
|
|
61113
|
-
}
|
|
61114
|
-
function createResizer(block, element, options, mouseDownEvent) {
|
|
61115
|
-
const exists = getExistsResizer(block);
|
|
61116
|
-
if (exists) {
|
|
61117
|
-
addClass(exists, "active");
|
|
61118
|
-
updateSize(block, element, exists);
|
|
61119
|
-
return exists;
|
|
61120
|
-
}
|
|
61121
|
-
const tools = getBlockTools(block);
|
|
61122
|
-
const resizer = createElement("div", ["block-resizer"], tools);
|
|
61123
|
-
updateSize(block, element, resizer);
|
|
61124
|
-
options.resize.forEach((type) => {
|
|
61125
|
-
createResizeGripper(resizer, type);
|
|
61126
|
-
});
|
|
61127
|
-
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
61128
|
-
addClass(resizer, "active");
|
|
61129
|
-
return resizer;
|
|
61130
|
-
}
|
|
61131
|
-
function updateResizer(block, element) {
|
|
61132
|
-
const resizer = getExistsResizer(block);
|
|
61133
|
-
if (!resizer) {
|
|
61134
|
-
return;
|
|
61135
|
-
}
|
|
61136
|
-
if (!isChildNode(block, element)) {
|
|
61137
|
-
return;
|
|
61138
|
-
}
|
|
61139
|
-
const blockRect = block.getBoundingClientRect();
|
|
61140
|
-
const elementRect = element.getBoundingClientRect();
|
|
61141
|
-
const top = elementRect.top - blockRect.top;
|
|
61142
|
-
const left = elementRect.left - blockRect.left;
|
|
61143
|
-
const width = elementRect.width;
|
|
61144
|
-
const height = elementRect.height;
|
|
61145
|
-
resizer.style.top = `${top}px`;
|
|
61146
|
-
resizer.style.left = `${left}px`;
|
|
61147
|
-
resizer.style.width = `${width}px`;
|
|
61148
|
-
resizer.style.height = `${height}px`;
|
|
61149
|
-
}
|
|
61150
|
-
const style$8 = "";
|
|
61151
|
-
const logger$1B = getLogger("block-resizer");
|
|
61152
|
-
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
61153
|
-
constructor(editor, options) {
|
|
61154
|
-
super();
|
|
61155
|
-
__publicField(this, "resizableElement");
|
|
61156
|
-
__publicField(this, "block", null);
|
|
61157
|
-
__publicField(this, "startRect", null);
|
|
61158
|
-
__publicField(this, "startPos", null);
|
|
61159
|
-
__publicField(this, "resizeType", null);
|
|
61160
|
-
__publicField(this, "enabled", false);
|
|
61161
|
-
__publicField(this, "handleEditorResize", () => {
|
|
61162
|
-
if (this.block) {
|
|
61163
|
-
this.updateResizer();
|
|
61164
|
-
}
|
|
61165
|
-
});
|
|
61166
|
-
__publicField(this, "handleMouseDown", (event) => {
|
|
61167
|
-
event.preventDefault();
|
|
61168
|
-
event.stopPropagation();
|
|
61169
|
-
const element = this.getResizableElement();
|
|
61170
|
-
if (!element) {
|
|
61171
|
-
return;
|
|
61172
|
-
}
|
|
61173
|
-
if (event.button !== 0) {
|
|
61174
|
-
return;
|
|
61175
|
-
}
|
|
61176
|
-
const gripper = event.target;
|
|
61177
|
-
if (!gripper) {
|
|
61178
|
-
return;
|
|
61179
|
-
}
|
|
61180
|
-
if (!(gripper instanceof HTMLElement)) {
|
|
61181
|
-
return;
|
|
61182
|
-
}
|
|
61183
|
-
const resizeType = gripper.getAttribute("data-resize-type");
|
|
61184
|
-
if (!resizeType) {
|
|
61185
|
-
return;
|
|
61186
|
-
}
|
|
61187
|
-
this.bindEvents();
|
|
61188
|
-
this.startRect = element.getBoundingClientRect();
|
|
61189
|
-
this.startPos = event;
|
|
61190
|
-
this.resizeType = resizeType;
|
|
61191
|
-
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
61192
|
-
if (this.block) {
|
|
61193
|
-
this.editor.selection.selectBlock(this.block, 0);
|
|
61194
|
-
}
|
|
61195
|
-
});
|
|
61196
|
-
__publicField(this, "handleMouseMove", (event) => {
|
|
61197
|
-
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
61198
|
-
return;
|
|
61199
|
-
}
|
|
61200
|
-
const element = this.getResizableElement();
|
|
61201
|
-
if (!element || !this.block) {
|
|
61202
|
-
return;
|
|
61203
|
-
}
|
|
61204
|
-
const deltaX = event.x - this.startPos.x;
|
|
61205
|
-
const deltaY = event.y - this.startPos.y;
|
|
61206
|
-
const oldRect = this.startRect;
|
|
61207
|
-
let { top, left, right, bottom } = oldRect;
|
|
61208
|
-
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
61209
|
-
bottom += deltaY;
|
|
61210
|
-
}
|
|
61211
|
-
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
61212
|
-
top += deltaY;
|
|
61213
|
-
}
|
|
61214
|
-
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
61215
|
-
left += deltaX;
|
|
61216
|
-
}
|
|
61217
|
-
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
61218
|
-
right += deltaX;
|
|
61219
|
-
}
|
|
61220
|
-
const width = right > left ? right - left : 0;
|
|
61221
|
-
const height = bottom > top ? bottom - top : 0;
|
|
61222
|
-
const newRect = new DOMRect(left, top, width, height);
|
|
61223
|
-
this.emit("resizing", this, newRect);
|
|
61224
|
-
const newElement = this.getResizableElement();
|
|
61225
|
-
if (newElement) {
|
|
61226
|
-
updateResizer(this.block, newElement);
|
|
61227
|
-
}
|
|
61228
|
-
});
|
|
61229
|
-
__publicField(this, "handleMouseUp", (event) => {
|
|
61230
|
-
if (event.button !== 0) {
|
|
61231
|
-
return;
|
|
61232
|
-
}
|
|
61233
|
-
setDefaultCursor("");
|
|
61234
|
-
this.unbindEvents();
|
|
61235
|
-
this.emit("resized", this);
|
|
61236
|
-
const element = this.getResizableElement();
|
|
61237
|
-
if (!element || !this.block) {
|
|
61238
|
-
return;
|
|
61239
|
-
}
|
|
61240
|
-
updateResizer(this.block, element);
|
|
61241
|
-
});
|
|
61242
|
-
this.editor = editor;
|
|
61243
|
-
this.options = options;
|
|
61244
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
61245
|
-
}
|
|
61246
|
-
enableResize(block, resizableElement) {
|
|
61247
|
-
this.block = block;
|
|
61248
|
-
this.resizableElement = resizableElement;
|
|
61249
|
-
this.createResizer();
|
|
61250
|
-
this.enabled = true;
|
|
61251
|
-
}
|
|
61252
|
-
disableResize() {
|
|
61253
|
-
if (!this.block) {
|
|
61254
|
-
return;
|
|
61255
|
-
}
|
|
61256
|
-
hideResizer(this.block);
|
|
61257
|
-
this.enabled = false;
|
|
61258
|
-
}
|
|
61259
|
-
update(block, resizableElement) {
|
|
61260
|
-
this.block = block;
|
|
61261
|
-
this.resizableElement = resizableElement;
|
|
61262
|
-
const elem = this.getResizableElement();
|
|
61263
|
-
if (elem && this.enabled) {
|
|
61264
|
-
this.createResizer();
|
|
61265
|
-
}
|
|
61266
|
-
}
|
|
61267
|
-
updateResizer() {
|
|
61268
|
-
const newElement = this.getResizableElement();
|
|
61269
|
-
if (newElement && this.block) {
|
|
61270
|
-
updateResizer(this.block, newElement);
|
|
61271
|
-
}
|
|
61272
|
-
}
|
|
61273
|
-
getBlock() {
|
|
61274
|
-
return this.block;
|
|
61275
|
-
}
|
|
61276
|
-
destroy() {
|
|
61277
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
61278
|
-
}
|
|
61279
|
-
getResizableElement() {
|
|
61280
|
-
if (this.resizableElement) {
|
|
61281
|
-
return this.resizableElement;
|
|
61282
|
-
}
|
|
61283
|
-
if (!this.block) {
|
|
61284
|
-
return null;
|
|
61285
|
-
}
|
|
61286
|
-
return getBlockContent(this.block);
|
|
61287
|
-
}
|
|
61288
|
-
createResizer() {
|
|
61289
|
-
const element = this.getResizableElement();
|
|
61290
|
-
if (!element || !this.block) {
|
|
61291
|
-
return;
|
|
61292
|
-
}
|
|
61293
|
-
assert(logger$1B, isChildNode(this.block, element), "not a block child element");
|
|
61294
|
-
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
61295
|
-
}
|
|
61296
|
-
bindEvents() {
|
|
61297
|
-
document.addEventListener("mousemove", this.handleMouseMove);
|
|
61298
|
-
document.addEventListener("mouseup", this.handleMouseUp);
|
|
61299
|
-
}
|
|
61300
|
-
unbindEvents() {
|
|
61301
|
-
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
61302
|
-
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
61303
|
-
}
|
|
61304
|
-
}
|
|
61305
|
-
const logger$1A = getLogger("image-dom");
|
|
61544
|
+
const logger$1z = getLogger("image-dom");
|
|
61306
61545
|
function getExistsProgressMask(imageContainer) {
|
|
61307
61546
|
return imageContainer.querySelector(".uploading-progress-mask");
|
|
61308
61547
|
}
|
|
@@ -61319,7 +61558,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61319
61558
|
function getImageUploadingProgressValueElement(imageContainer) {
|
|
61320
61559
|
const bar2 = getImageUploadingProgressMask(imageContainer);
|
|
61321
61560
|
const value = bar2.querySelector(".uploading-progress-bar-value");
|
|
61322
|
-
assert(logger$
|
|
61561
|
+
assert(logger$1z, value, "no progress value");
|
|
61323
61562
|
return value;
|
|
61324
61563
|
}
|
|
61325
61564
|
function setImageUploading(imageContainer, progress) {
|
|
@@ -61409,7 +61648,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61409
61648
|
const images = Array.from(block.querySelectorAll(".image-container"));
|
|
61410
61649
|
return images;
|
|
61411
61650
|
}
|
|
61412
|
-
const logger$
|
|
61651
|
+
const logger$1y = getLogger("table-resize-drag-drop");
|
|
61413
61652
|
class ImageSplitterResizer {
|
|
61414
61653
|
constructor(editor, elem, data2, mouseDownEvent) {
|
|
61415
61654
|
__publicField(this, "cursor", "col-resize");
|
|
@@ -61422,7 +61661,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61422
61661
|
const imageObject = getImageObject(this.editor, block);
|
|
61423
61662
|
const images = imageObject.getImages();
|
|
61424
61663
|
const splitterIndex = this.data.splitterIndex;
|
|
61425
|
-
assert(logger$
|
|
61664
|
+
assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61426
61665
|
const imageContainers = getImageContainersByBlock(block);
|
|
61427
61666
|
const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
|
|
61428
61667
|
this.initWidths = initWidths;
|
|
@@ -61440,7 +61679,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61440
61679
|
const imageObject = getImageObject(this.editor, block);
|
|
61441
61680
|
const images = cloneDeep__default.default(imageObject.getImages());
|
|
61442
61681
|
const splitterIndex = this.data.splitterIndex;
|
|
61443
|
-
assert(logger$
|
|
61682
|
+
assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61444
61683
|
const width1 = this.initWidths[splitterIndex];
|
|
61445
61684
|
const width2 = this.initWidths[splitterIndex + 1];
|
|
61446
61685
|
if (width1 + width2 < 100) {
|
|
@@ -61459,7 +61698,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61459
61698
|
newWidths[splitterIndex] += delta;
|
|
61460
61699
|
newWidths[splitterIndex + 1] -= delta;
|
|
61461
61700
|
const imageContainers = getImageContainersByBlock(block);
|
|
61462
|
-
assert(logger$
|
|
61701
|
+
assert(logger$1y, imageContainers.length === images.length, "invalid image data");
|
|
61463
61702
|
const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
61464
61703
|
for (let i = 0; i < images.length; i++) {
|
|
61465
61704
|
const flex = newWidths[i] / totalWidth;
|
|
@@ -61532,7 +61771,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61532
61771
|
editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
|
|
61533
61772
|
editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
|
|
61534
61773
|
}
|
|
61535
|
-
const logger$
|
|
61774
|
+
const logger$1x = getLogger("image-item");
|
|
61536
61775
|
function getParentImageBlock(eventTarget) {
|
|
61537
61776
|
if (!eventTarget) {
|
|
61538
61777
|
return null;
|
|
@@ -61611,7 +61850,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61611
61850
|
if (file2) {
|
|
61612
61851
|
imageObject.replaceImage(index2, file2);
|
|
61613
61852
|
} else {
|
|
61614
|
-
logger$
|
|
61853
|
+
logger$1x.warn(`failed to download image: ${imageData.src}`);
|
|
61615
61854
|
}
|
|
61616
61855
|
}
|
|
61617
61856
|
function createLoadErrorElement(editor, imageContainer, imageData) {
|
|
@@ -61834,7 +62073,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61834
62073
|
function isImageFile(fileType) {
|
|
61835
62074
|
return fileType.startsWith("image/");
|
|
61836
62075
|
}
|
|
61837
|
-
const logger$
|
|
62076
|
+
const logger$1w = getLogger("image-object");
|
|
61838
62077
|
class ImageObject {
|
|
61839
62078
|
constructor(editor, blockData) {
|
|
61840
62079
|
__publicField(this, "images", []);
|
|
@@ -62125,7 +62364,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62125
62364
|
this.editor.updateEmbedData(block2, embedData);
|
|
62126
62365
|
return true;
|
|
62127
62366
|
} catch (err) {
|
|
62128
|
-
logger$
|
|
62367
|
+
logger$1w.error(err);
|
|
62129
62368
|
const block2 = this.editor.findBlockById(this.blockData.id);
|
|
62130
62369
|
if (!block2) {
|
|
62131
62370
|
return false;
|
|
@@ -62142,7 +62381,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62142
62381
|
if (!block) {
|
|
62143
62382
|
return;
|
|
62144
62383
|
}
|
|
62145
|
-
assert(logger$
|
|
62384
|
+
assert(logger$1w, flex.length === this.images.length, "invalid flex");
|
|
62146
62385
|
for (let i = 0; i < this.images.length; i++) {
|
|
62147
62386
|
this.images[i].flex = flex[i];
|
|
62148
62387
|
}
|
|
@@ -62191,7 +62430,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62191
62430
|
}
|
|
62192
62431
|
}
|
|
62193
62432
|
const imageEmbedStyle = "";
|
|
62194
|
-
const logger$
|
|
62433
|
+
const logger$1v = getLogger("drop-indicator");
|
|
62195
62434
|
const INDICATOR_SIZE$1 = 2;
|
|
62196
62435
|
class DropIndicator {
|
|
62197
62436
|
constructor(editor) {
|
|
@@ -62236,7 +62475,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62236
62475
|
if (insertPos === "before") {
|
|
62237
62476
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
62238
62477
|
if (!beforeBlock) {
|
|
62239
|
-
assert(logger$
|
|
62478
|
+
assert(logger$1v, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
62240
62479
|
const rect = block.getBoundingClientRect();
|
|
62241
62480
|
const viewRect2 = this.getViewRect(block);
|
|
62242
62481
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -62262,14 +62501,14 @@ $$${mathData.mathjaxText}$$
|
|
|
62262
62501
|
const PADDING = 5;
|
|
62263
62502
|
if (insertPos.pos === "left") {
|
|
62264
62503
|
const parent = getParentContainer(block);
|
|
62265
|
-
assert(logger$
|
|
62504
|
+
assert(logger$1v, parent, "block does not in a container");
|
|
62266
62505
|
const rect = block.getBoundingClientRect();
|
|
62267
62506
|
const viewRect = this.getViewRect(block);
|
|
62268
62507
|
return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
|
|
62269
62508
|
}
|
|
62270
62509
|
if (insertPos.pos === "right") {
|
|
62271
62510
|
const parent = getParentContainer(block);
|
|
62272
|
-
assert(logger$
|
|
62511
|
+
assert(logger$1v, parent, "block does not in a container");
|
|
62273
62512
|
const rect = block.getBoundingClientRect();
|
|
62274
62513
|
let viewRect;
|
|
62275
62514
|
if (isEmbedBlock(block)) {
|
|
@@ -62366,7 +62605,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62366
62605
|
}
|
|
62367
62606
|
return void 0;
|
|
62368
62607
|
}
|
|
62369
|
-
const logger$
|
|
62608
|
+
const logger$1u = getLogger("code-dom");
|
|
62370
62609
|
function isCodeBlock(block) {
|
|
62371
62610
|
return getBlockType(block) === "code";
|
|
62372
62611
|
}
|
|
@@ -62384,8 +62623,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62384
62623
|
}
|
|
62385
62624
|
function getParentCodeBlock(elem) {
|
|
62386
62625
|
const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
|
|
62387
|
-
assert(logger$
|
|
62388
|
-
assert(logger$
|
|
62626
|
+
assert(logger$1u, codeBlock2, "no parent code block");
|
|
62627
|
+
assert(logger$1u, isCodeBlock(codeBlock2), "not a code block");
|
|
62389
62628
|
return codeBlock2;
|
|
62390
62629
|
}
|
|
62391
62630
|
const SUPPORTED_LANGUAGES = () => ({
|
|
@@ -62476,7 +62715,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62476
62715
|
function setDefaultLanguage(editor, lang) {
|
|
62477
62716
|
return editor.settingsProvider.setItem("editor-code-lang", lang);
|
|
62478
62717
|
}
|
|
62479
|
-
const logger$
|
|
62718
|
+
const logger$1t = getLogger("convert-to-code");
|
|
62480
62719
|
function convertToCode(editor, srcBlock) {
|
|
62481
62720
|
if (!isTextKindBlock(editor, srcBlock)) {
|
|
62482
62721
|
return null;
|
|
@@ -62489,7 +62728,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62489
62728
|
const textContainerId = genId();
|
|
62490
62729
|
editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
|
|
62491
62730
|
const text2 = editor.getBlockData(srcBlock).text;
|
|
62492
|
-
assert(logger$
|
|
62731
|
+
assert(logger$1t, text2, "no text");
|
|
62493
62732
|
let alias = toPlainText(text2);
|
|
62494
62733
|
if (alias.startsWith("```")) {
|
|
62495
62734
|
alias = alias.substring(3);
|
|
@@ -62507,16 +62746,16 @@ $$${mathData.mathjaxText}$$
|
|
|
62507
62746
|
};
|
|
62508
62747
|
}
|
|
62509
62748
|
const codeBlock = "";
|
|
62510
|
-
const logger$
|
|
62749
|
+
const logger$1s = getLogger("code-block-child-container");
|
|
62511
62750
|
function getTextContainer(codeBlock2) {
|
|
62512
|
-
assert(logger$
|
|
62751
|
+
assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
|
|
62513
62752
|
const content = getBlockContent(codeBlock2);
|
|
62514
62753
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
|
|
62515
|
-
assert(logger$
|
|
62754
|
+
assert(logger$1s, textContainer, "no code text container");
|
|
62516
62755
|
return textContainer;
|
|
62517
62756
|
}
|
|
62518
62757
|
function getCaptionContainer(codeBlock2) {
|
|
62519
|
-
assert(logger$
|
|
62758
|
+
assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
|
|
62520
62759
|
const content = getBlockContent(codeBlock2);
|
|
62521
62760
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
|
|
62522
62761
|
if (!textContainer)
|
|
@@ -62545,7 +62784,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62545
62784
|
}
|
|
62546
62785
|
return getBlockType(block) === "code";
|
|
62547
62786
|
}
|
|
62548
|
-
const logger$
|
|
62787
|
+
const logger$1r = getLogger("code-caption");
|
|
62549
62788
|
function toggleCodeCaption(editor, codeBlock2) {
|
|
62550
62789
|
if (editor.readonly) {
|
|
62551
62790
|
return;
|
|
@@ -62558,7 +62797,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62558
62797
|
}
|
|
62559
62798
|
const captionContainerId = createEmptyContainer(editor.doc);
|
|
62560
62799
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62561
|
-
assert(logger$
|
|
62800
|
+
assert(logger$1r, oldData.children.length === 1, "code block should have only one child");
|
|
62562
62801
|
const newData = {
|
|
62563
62802
|
...oldData,
|
|
62564
62803
|
children: [oldData.children[0], captionContainerId]
|
|
@@ -62574,7 +62813,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62574
62813
|
return false;
|
|
62575
62814
|
}
|
|
62576
62815
|
const parentBlock = getParentBlock(parentContainer);
|
|
62577
|
-
assert(logger$
|
|
62816
|
+
assert(logger$1r, parentBlock, "no parent block");
|
|
62578
62817
|
if (!isCodeBlock(parentBlock)) {
|
|
62579
62818
|
return false;
|
|
62580
62819
|
}
|
|
@@ -62594,7 +62833,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62594
62833
|
const lastBlock2 = getLastChildBlock(textContainer);
|
|
62595
62834
|
editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
|
|
62596
62835
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62597
|
-
assert(logger$
|
|
62836
|
+
assert(logger$1r, oldData.children.length === 2, "code block should have only one child");
|
|
62598
62837
|
const captionContainerId = oldData.children[1];
|
|
62599
62838
|
const newData = {
|
|
62600
62839
|
...oldData,
|
|
@@ -62603,7 +62842,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62603
62842
|
editor.updateBlockData(codeBlock2, newData);
|
|
62604
62843
|
editor.deleteChildContainers([captionContainerId]);
|
|
62605
62844
|
}
|
|
62606
|
-
const logger$
|
|
62845
|
+
const logger$1q = getLogger("paste-in-table-block");
|
|
62607
62846
|
class PasteEventHandler {
|
|
62608
62847
|
constructor(editor) {
|
|
62609
62848
|
this.editor = editor;
|
|
@@ -62624,7 +62863,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62624
62863
|
return false;
|
|
62625
62864
|
}
|
|
62626
62865
|
const parentBlock = getParentBlock(parentContainer);
|
|
62627
|
-
assert(logger$
|
|
62866
|
+
assert(logger$1q, parentBlock, "no parent block");
|
|
62628
62867
|
if (!isCodeBlock(parentBlock)) {
|
|
62629
62868
|
return false;
|
|
62630
62869
|
}
|
|
@@ -62688,7 +62927,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62688
62927
|
function registerCodeBlockCommandProvider(editor) {
|
|
62689
62928
|
editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
|
|
62690
62929
|
}
|
|
62691
|
-
const logger$
|
|
62930
|
+
const logger$1p = getLogger("code-caption-input-handler");
|
|
62692
62931
|
function getCurrentCaptionBlock(editor) {
|
|
62693
62932
|
if (!editor.selection.range.isSimple()) {
|
|
62694
62933
|
return null;
|
|
@@ -62801,7 +63040,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62801
63040
|
editor.undoManager.runInGroup(() => {
|
|
62802
63041
|
editor.clearSelectedContents();
|
|
62803
63042
|
const start = editor.selection.range.start;
|
|
62804
|
-
assert(logger$
|
|
63043
|
+
assert(logger$1p, start.isSimple(), "not simple position");
|
|
62805
63044
|
editor.insertTextToBlock(block, start.offset, text2);
|
|
62806
63045
|
});
|
|
62807
63046
|
return true;
|
|
@@ -62846,9 +63085,9 @@ $$${mathData.mathjaxText}$$
|
|
|
62846
63085
|
};
|
|
62847
63086
|
editor.updateBlockData(codeBlock2, newData);
|
|
62848
63087
|
}
|
|
62849
|
-
const logger$
|
|
63088
|
+
const logger$1o = getLogger("code-block-header");
|
|
62850
63089
|
function selectCodeBlock(editor, block, options) {
|
|
62851
|
-
assert(logger$
|
|
63090
|
+
assert(logger$1o, isCodeBlock(block), "not a code block");
|
|
62852
63091
|
const firstBlock = getFirstChildBlock(getTextContainer(block));
|
|
62853
63092
|
editor.selection.selectBlock(firstBlock, 0);
|
|
62854
63093
|
if (options.focusToEditor) {
|
|
@@ -62890,8 +63129,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62890
63129
|
const target = event.target;
|
|
62891
63130
|
const select2 = target.closest(".language-select");
|
|
62892
63131
|
const block = getParentBlock(select2);
|
|
62893
|
-
assert(logger$
|
|
62894
|
-
assert(logger$
|
|
63132
|
+
assert(logger$1o, block, "no parent block");
|
|
63133
|
+
assert(logger$1o, getBlockType(block) === "code", "not a code block");
|
|
62895
63134
|
const codeData = editor2.getBlockData(block);
|
|
62896
63135
|
const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
|
|
62897
63136
|
dropdown2.custom = { codeBlock: block, editor: editor2 };
|
|
@@ -62914,11 +63153,11 @@ $$${mathData.mathjaxText}$$
|
|
|
62914
63153
|
function handleCodeHeaderButtonClick(editor, event) {
|
|
62915
63154
|
const target = event.target;
|
|
62916
63155
|
const button2 = target.closest(".code-header-button");
|
|
62917
|
-
assert(logger$
|
|
63156
|
+
assert(logger$1o, button2, "no button");
|
|
62918
63157
|
const block = getParentBlock(target);
|
|
62919
|
-
assert(logger$
|
|
63158
|
+
assert(logger$1o, block, "no parent block");
|
|
62920
63159
|
const id = button2.getAttribute("data-id");
|
|
62921
|
-
assert(logger$
|
|
63160
|
+
assert(logger$1o, getBlockType(block) === "code", "not a code block");
|
|
62922
63161
|
if (id === "wrap") {
|
|
62923
63162
|
const old = editor.getBlockData(block);
|
|
62924
63163
|
changeCodeBlockWrap(editor, block, !old.nowrap);
|
|
@@ -62944,7 +63183,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62944
63183
|
}
|
|
62945
63184
|
});
|
|
62946
63185
|
}).catch((err) => {
|
|
62947
|
-
logger$
|
|
63186
|
+
logger$1o.error(err.message);
|
|
62948
63187
|
});
|
|
62949
63188
|
return;
|
|
62950
63189
|
}
|
|
@@ -62995,7 +63234,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62995
63234
|
}
|
|
62996
63235
|
function getCodeBlockHeader(block) {
|
|
62997
63236
|
const header = block.querySelector(".code-block-header");
|
|
62998
|
-
assert(logger$
|
|
63237
|
+
assert(logger$1o, header, "no code block header");
|
|
62999
63238
|
return header;
|
|
63000
63239
|
}
|
|
63001
63240
|
function handleCodeScroll(editor, event) {
|
|
@@ -63044,7 +63283,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63044
63283
|
focusBlockId: textBlock.id
|
|
63045
63284
|
};
|
|
63046
63285
|
}
|
|
63047
|
-
const logger$
|
|
63286
|
+
const logger$1n = getLogger("code-block");
|
|
63048
63287
|
function getPaddingNum(index2) {
|
|
63049
63288
|
if (index2 <= 2) {
|
|
63050
63289
|
return 32;
|
|
@@ -63071,10 +63310,10 @@ $$${mathData.mathjaxText}$$
|
|
|
63071
63310
|
handlePasteInTableEvent(editor);
|
|
63072
63311
|
registerCodeBlockCommandProvider(editor);
|
|
63073
63312
|
trackChildBlockEvent(editor, handleDebounceUpdate);
|
|
63074
|
-
assert(logger$
|
|
63313
|
+
assert(logger$1n, blockData.type === "code", "invalid block data type");
|
|
63075
63314
|
const codeData = blockData;
|
|
63076
|
-
assert(logger$
|
|
63077
|
-
assert(logger$
|
|
63315
|
+
assert(logger$1n, codeData.children, "invalid block data children");
|
|
63316
|
+
assert(logger$1n, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
|
|
63078
63317
|
setTimeout(() => {
|
|
63079
63318
|
if (isNodeRemoved(blockElement))
|
|
63080
63319
|
return;
|
|
@@ -63125,15 +63364,15 @@ $$${mathData.mathjaxText}$$
|
|
|
63125
63364
|
}
|
|
63126
63365
|
function updateSelection$3(editor, block, from, to) {
|
|
63127
63366
|
if (from.isSimple()) {
|
|
63128
|
-
assert(logger$
|
|
63129
|
-
logger$
|
|
63367
|
+
assert(logger$1n, to.isSimple(), "from is simple position but to is not simple position");
|
|
63368
|
+
logger$1n.debug("full select list");
|
|
63130
63369
|
addClass(block, "full-selected");
|
|
63131
63370
|
return;
|
|
63132
63371
|
}
|
|
63133
|
-
assert(logger$
|
|
63372
|
+
assert(logger$1n, !to.isSimple(), "from is complex position but end is simple position");
|
|
63134
63373
|
const f = from;
|
|
63135
63374
|
const t2 = to;
|
|
63136
|
-
assert(logger$
|
|
63375
|
+
assert(logger$1n, f.blockId === t2.blockId, "only allow update one table selection");
|
|
63137
63376
|
const containers = getCodeChildContainers(block);
|
|
63138
63377
|
containers.forEach((container) => {
|
|
63139
63378
|
const containerId = getContainerId(container);
|
|
@@ -63168,8 +63407,8 @@ $$${mathData.mathjaxText}$$
|
|
|
63168
63407
|
const containersIds = childContainers.map(getContainerId);
|
|
63169
63408
|
const startIndex = containersIds.indexOf(start.childContainerId);
|
|
63170
63409
|
const endIndex = containersIds.indexOf(end.childContainerId);
|
|
63171
|
-
assert(logger$
|
|
63172
|
-
assert(logger$
|
|
63410
|
+
assert(logger$1n, startIndex !== -1, "invalid start pos");
|
|
63411
|
+
assert(logger$1n, endIndex !== -1, "invalid end pos");
|
|
63173
63412
|
const ret = [childContainers[startIndex]];
|
|
63174
63413
|
if (startIndex !== endIndex) {
|
|
63175
63414
|
ret.push(childContainers[endIndex]);
|
|
@@ -63177,7 +63416,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63177
63416
|
return ret;
|
|
63178
63417
|
}
|
|
63179
63418
|
function handleBlockElementUpdated(editor, block, blockData) {
|
|
63180
|
-
assert(logger$
|
|
63419
|
+
assert(logger$1n, isCodeBlock(block), "invalid block type");
|
|
63181
63420
|
const codeData = blockData;
|
|
63182
63421
|
updateCodeBlockElementStyles(editor, block, codeData);
|
|
63183
63422
|
}
|
|
@@ -63369,10 +63608,10 @@ ${codeText}
|
|
|
63369
63608
|
"Shift+Tab": handleShiftTab$1,
|
|
63370
63609
|
"CtrlOrCmd+A": selectCode
|
|
63371
63610
|
};
|
|
63372
|
-
const logger$
|
|
63611
|
+
const logger$1m = getLogger("code-text-decorate");
|
|
63373
63612
|
class CodeTextDecorator {
|
|
63374
63613
|
decorateText(editor, path, blockText) {
|
|
63375
|
-
assert(logger$
|
|
63614
|
+
assert(logger$1m, path.length > 0, "invalid path");
|
|
63376
63615
|
if (path.length === 1) {
|
|
63377
63616
|
return {};
|
|
63378
63617
|
}
|
|
@@ -63397,7 +63636,7 @@ ${codeText}
|
|
|
63397
63636
|
const grammar = getPrismGrammar(codeData.language);
|
|
63398
63637
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63399
63638
|
const tokenToText = (token, attributes) => {
|
|
63400
|
-
assert(logger$
|
|
63639
|
+
assert(logger$1m, token, "no token");
|
|
63401
63640
|
if (typeof token === "string") {
|
|
63402
63641
|
const ret = {
|
|
63403
63642
|
insert: token,
|
|
@@ -63405,7 +63644,7 @@ ${codeText}
|
|
|
63405
63644
|
};
|
|
63406
63645
|
return [ret];
|
|
63407
63646
|
}
|
|
63408
|
-
assert(logger$
|
|
63647
|
+
assert(logger$1m, token instanceof Prism__default.default.Token, "invalid token type");
|
|
63409
63648
|
const content = token.content;
|
|
63410
63649
|
const newAttributes = cloneDeep__default.default(attributes);
|
|
63411
63650
|
newAttributes[`style-code-${token.type}`] = true;
|
|
@@ -63421,18 +63660,18 @@ ${codeText}
|
|
|
63421
63660
|
const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
|
|
63422
63661
|
return ret;
|
|
63423
63662
|
}
|
|
63424
|
-
assert(logger$
|
|
63663
|
+
assert(logger$1m, content instanceof Prism__default.default.Token, "invalid token");
|
|
63425
63664
|
return tokenToText(content, newAttributes);
|
|
63426
63665
|
};
|
|
63427
63666
|
const ops = tokens.map((token) => tokenToText(token, {}));
|
|
63428
63667
|
const newText = ops.flat();
|
|
63429
|
-
assert(logger$
|
|
63668
|
+
assert(logger$1m, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
|
|
63430
63669
|
return {
|
|
63431
63670
|
text: newText
|
|
63432
63671
|
};
|
|
63433
63672
|
}
|
|
63434
63673
|
}
|
|
63435
|
-
const zhCN$
|
|
63674
|
+
const zhCN$o = {
|
|
63436
63675
|
code: {
|
|
63437
63676
|
title: "\u4EE3\u7801",
|
|
63438
63677
|
abstract: "\u4EE3\u7801",
|
|
@@ -63444,7 +63683,7 @@ ${codeText}
|
|
|
63444
63683
|
plainText: "Plain Text"
|
|
63445
63684
|
}
|
|
63446
63685
|
};
|
|
63447
|
-
const enUS$
|
|
63686
|
+
const enUS$o = {
|
|
63448
63687
|
code: {
|
|
63449
63688
|
title: "Code",
|
|
63450
63689
|
abstract: "Code",
|
|
@@ -63456,7 +63695,7 @@ ${codeText}
|
|
|
63456
63695
|
plainText: "Plain Text"
|
|
63457
63696
|
}
|
|
63458
63697
|
};
|
|
63459
|
-
const jaJP$
|
|
63698
|
+
const jaJP$o = {
|
|
63460
63699
|
code: {
|
|
63461
63700
|
title: "\u30B3\u30FC\u30C9",
|
|
63462
63701
|
abstract: "\u30B3\u30FC\u30C9",
|
|
@@ -63469,9 +63708,9 @@ ${codeText}
|
|
|
63469
63708
|
}
|
|
63470
63709
|
};
|
|
63471
63710
|
i18n$1.mergeLang({
|
|
63472
|
-
"zh-CN": zhCN$
|
|
63473
|
-
"en-US": enUS$
|
|
63474
|
-
"ja-JP": jaJP$
|
|
63711
|
+
"zh-CN": zhCN$o,
|
|
63712
|
+
"en-US": enUS$o,
|
|
63713
|
+
"ja-JP": jaJP$o
|
|
63475
63714
|
});
|
|
63476
63715
|
function convertToTable(editor, containerId, blockIndex, offset) {
|
|
63477
63716
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -63732,7 +63971,7 @@ ${codeText}
|
|
|
63732
63971
|
}
|
|
63733
63972
|
return false;
|
|
63734
63973
|
}
|
|
63735
|
-
const logger$
|
|
63974
|
+
const logger$1l = getLogger("match-text-style");
|
|
63736
63975
|
function matchTextPair(text2, find) {
|
|
63737
63976
|
if (text2.length < find.length * 2 + 1) {
|
|
63738
63977
|
return -1;
|
|
@@ -63802,7 +64041,7 @@ ${codeText}
|
|
|
63802
64041
|
editor.insertBoxToBlock(block, start, boxData);
|
|
63803
64042
|
});
|
|
63804
64043
|
} catch (err) {
|
|
63805
|
-
logger$
|
|
64044
|
+
logger$1l.warn(`failed to convert to box, ${err.message}`);
|
|
63806
64045
|
continue;
|
|
63807
64046
|
}
|
|
63808
64047
|
}
|
|
@@ -63865,7 +64104,7 @@ ${codeText}
|
|
|
63865
64104
|
return false;
|
|
63866
64105
|
}
|
|
63867
64106
|
}
|
|
63868
|
-
const enUS$
|
|
64107
|
+
const enUS$n = {
|
|
63869
64108
|
placeholder: {
|
|
63870
64109
|
default: "Type / for commands",
|
|
63871
64110
|
heading: "Heading {heading}",
|
|
@@ -63876,7 +64115,7 @@ ${codeText}
|
|
|
63876
64115
|
mobileDefault: "Type to add content"
|
|
63877
64116
|
}
|
|
63878
64117
|
};
|
|
63879
|
-
const zhCN$
|
|
64118
|
+
const zhCN$n = {
|
|
63880
64119
|
placeholder: {
|
|
63881
64120
|
default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
|
|
63882
64121
|
heading: "\u6807\u9898{heading}",
|
|
@@ -63887,7 +64126,7 @@ ${codeText}
|
|
|
63887
64126
|
mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
|
|
63888
64127
|
}
|
|
63889
64128
|
};
|
|
63890
|
-
const jaJP$
|
|
64129
|
+
const jaJP$n = {
|
|
63891
64130
|
placeholder: {
|
|
63892
64131
|
default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
|
|
63893
64132
|
heading: "\u898B\u51FA\u3057{heading}",
|
|
@@ -63899,9 +64138,9 @@ ${codeText}
|
|
|
63899
64138
|
}
|
|
63900
64139
|
};
|
|
63901
64140
|
const langs$1 = {
|
|
63902
|
-
"en-US": enUS$
|
|
63903
|
-
"zh-CN": zhCN$
|
|
63904
|
-
"ja-JP": jaJP$
|
|
64141
|
+
"en-US": enUS$n,
|
|
64142
|
+
"zh-CN": zhCN$n,
|
|
64143
|
+
"ja-JP": jaJP$n
|
|
63905
64144
|
};
|
|
63906
64145
|
i18n$1.mergeLang(langs$1);
|
|
63907
64146
|
function isEmptyTextBlockWithoutCompositionText(editor, block) {
|
|
@@ -64068,7 +64307,7 @@ ${codeText}
|
|
|
64068
64307
|
}
|
|
64069
64308
|
return false;
|
|
64070
64309
|
}
|
|
64071
|
-
const logger$
|
|
64310
|
+
const logger$1k = getLogger("enforce-title");
|
|
64072
64311
|
class EnforceWithDocumentTitleHandler {
|
|
64073
64312
|
constructor(editor, options = {
|
|
64074
64313
|
headingLevel: 1
|
|
@@ -64140,7 +64379,7 @@ ${codeText}
|
|
|
64140
64379
|
var _a, _b;
|
|
64141
64380
|
try {
|
|
64142
64381
|
const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
|
|
64143
|
-
assert(logger$
|
|
64382
|
+
assert(logger$1k, blocks.length > 0, "root container is empty");
|
|
64144
64383
|
const firstBlock = blocks[0];
|
|
64145
64384
|
if (firstBlock.type !== "text" && !this.options.hideTitle) {
|
|
64146
64385
|
const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
|
|
@@ -64149,7 +64388,7 @@ ${codeText}
|
|
|
64149
64388
|
return;
|
|
64150
64389
|
}
|
|
64151
64390
|
if (!this.options.hideTitle) {
|
|
64152
|
-
assert(logger$
|
|
64391
|
+
assert(logger$1k, firstBlock.text, "invalid text block");
|
|
64153
64392
|
const block = editor.getBlockById(firstBlock.id);
|
|
64154
64393
|
if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
|
|
64155
64394
|
const text2 = editor.getBlockString(block);
|
|
@@ -64234,7 +64473,7 @@ ${codeText}
|
|
|
64234
64473
|
});
|
|
64235
64474
|
return orgDataUrl;
|
|
64236
64475
|
}
|
|
64237
|
-
const logger$
|
|
64476
|
+
const logger$1j = getLogger("drag-preview-image");
|
|
64238
64477
|
class DragPreviewImage {
|
|
64239
64478
|
constructor(editor) {
|
|
64240
64479
|
__publicField(this, "startPosition", null);
|
|
@@ -64242,7 +64481,7 @@ ${codeText}
|
|
|
64242
64481
|
__publicField(this, "handleDragStart", async (e2, preview) => {
|
|
64243
64482
|
var _a, _b, _c, _d, _e, _f;
|
|
64244
64483
|
const target = e2.target;
|
|
64245
|
-
assert(logger$
|
|
64484
|
+
assert(logger$1j, target instanceof Element, `Invalid Drag target:${target}`);
|
|
64246
64485
|
const { x: startX, y: startY } = e2;
|
|
64247
64486
|
this.startPosition = {
|
|
64248
64487
|
x: startX,
|
|
@@ -64328,7 +64567,7 @@ ${codeText}
|
|
|
64328
64567
|
}
|
|
64329
64568
|
return block;
|
|
64330
64569
|
}
|
|
64331
|
-
const logger$
|
|
64570
|
+
const logger$1i = getLogger("block-menu-drag-handler");
|
|
64332
64571
|
const MIN_DISTANCE_THRESHOLD$1 = 3;
|
|
64333
64572
|
function createDragEventFromMouseEvent$2(event, type) {
|
|
64334
64573
|
const dragEvent = new DragEvent(type, {
|
|
@@ -64350,7 +64589,7 @@ ${codeText}
|
|
|
64350
64589
|
__publicField(this, "startPos", { x: 0, y: 0 });
|
|
64351
64590
|
__publicField(this, "handleMouseDown", (event) => {
|
|
64352
64591
|
const block = this.button.blockMenu.currentBlock;
|
|
64353
|
-
assert(logger$
|
|
64592
|
+
assert(logger$1i, block, "no dragged block");
|
|
64354
64593
|
if (event.button !== 0) {
|
|
64355
64594
|
return;
|
|
64356
64595
|
}
|
|
@@ -64378,7 +64617,7 @@ ${codeText}
|
|
|
64378
64617
|
});
|
|
64379
64618
|
}
|
|
64380
64619
|
const block = this.button.blockMenu.currentBlock;
|
|
64381
|
-
assert(logger$
|
|
64620
|
+
assert(logger$1i, block, "no dragged block");
|
|
64382
64621
|
(_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
|
|
64383
64622
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
|
|
64384
64623
|
registerStandardDraggedObject(this.editor, dragEvent, block);
|
|
@@ -64399,7 +64638,7 @@ ${codeText}
|
|
|
64399
64638
|
if (!window.isDragging) {
|
|
64400
64639
|
this.handleDragStart(event);
|
|
64401
64640
|
}
|
|
64402
|
-
assert(logger$
|
|
64641
|
+
assert(logger$1i, target instanceof Element, "target is invalid");
|
|
64403
64642
|
this.dragPreview.handleDrag(event);
|
|
64404
64643
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
|
|
64405
64644
|
this.editor.contentElement.dispatchEvent(dragEvent);
|
|
@@ -64407,7 +64646,7 @@ ${codeText}
|
|
|
64407
64646
|
__publicField(this, "handleDragEnd", (event) => {
|
|
64408
64647
|
var _a;
|
|
64409
64648
|
const block = this.button.blockMenu.currentBlock;
|
|
64410
|
-
assert(logger$
|
|
64649
|
+
assert(logger$1i, block, "no dragged block");
|
|
64411
64650
|
window.isDragging = false;
|
|
64412
64651
|
this.dragPreview.handleDragEnd();
|
|
64413
64652
|
(_a = this.autoScroll) == null ? void 0 : _a.inactive();
|
|
@@ -64630,7 +64869,7 @@ ${codeText}
|
|
|
64630
64869
|
this.rootButton.destroy();
|
|
64631
64870
|
}
|
|
64632
64871
|
}
|
|
64633
|
-
const zhCN$
|
|
64872
|
+
const zhCN$m = {
|
|
64634
64873
|
blockMenu: {
|
|
64635
64874
|
section: {
|
|
64636
64875
|
basics: "\u57FA\u7840",
|
|
@@ -64654,7 +64893,7 @@ ${codeText}
|
|
|
64654
64893
|
}
|
|
64655
64894
|
}
|
|
64656
64895
|
};
|
|
64657
|
-
const enUS$
|
|
64896
|
+
const enUS$m = {
|
|
64658
64897
|
blockMenu: {
|
|
64659
64898
|
section: {
|
|
64660
64899
|
basics: "Basic",
|
|
@@ -64678,7 +64917,7 @@ ${codeText}
|
|
|
64678
64917
|
}
|
|
64679
64918
|
}
|
|
64680
64919
|
};
|
|
64681
|
-
const jaJP$
|
|
64920
|
+
const jaJP$m = {
|
|
64682
64921
|
blockMenu: {
|
|
64683
64922
|
section: {
|
|
64684
64923
|
basics: "\u4E00\u822C",
|
|
@@ -64703,9 +64942,9 @@ ${codeText}
|
|
|
64703
64942
|
}
|
|
64704
64943
|
};
|
|
64705
64944
|
i18n$1.mergeLang({
|
|
64706
|
-
"zh-CN": zhCN$
|
|
64707
|
-
"en-US": enUS$
|
|
64708
|
-
"ja-JP": jaJP$
|
|
64945
|
+
"zh-CN": zhCN$m,
|
|
64946
|
+
"en-US": enUS$m,
|
|
64947
|
+
"ja-JP": jaJP$m
|
|
64709
64948
|
});
|
|
64710
64949
|
const style$6 = "";
|
|
64711
64950
|
class DragData {
|
|
@@ -64785,7 +65024,7 @@ ${codeText}
|
|
|
64785
65024
|
function clearDraggedObject(editor) {
|
|
64786
65025
|
getDragData(editor).clearData();
|
|
64787
65026
|
}
|
|
64788
|
-
const logger$
|
|
65027
|
+
const logger$1h = getLogger("find-drop-target");
|
|
64789
65028
|
function childContainerFromPoint(x, y) {
|
|
64790
65029
|
const elem = getElementFromPoint(x, y);
|
|
64791
65030
|
if (!elem) {
|
|
@@ -64898,13 +65137,13 @@ ${codeText}
|
|
|
64898
65137
|
return true;
|
|
64899
65138
|
}
|
|
64900
65139
|
const parentBlock = getParentBlock(container);
|
|
64901
|
-
assert(logger$
|
|
65140
|
+
assert(logger$1h, parentBlock, "no parent block");
|
|
64902
65141
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
64903
65142
|
return false;
|
|
64904
65143
|
}
|
|
64905
65144
|
return canInsertAsSibling(editor, parentBlock);
|
|
64906
65145
|
}
|
|
64907
|
-
const logger$
|
|
65146
|
+
const logger$1g = getLogger("drop-target");
|
|
64908
65147
|
function getEmbedClassByFile(editor, file2) {
|
|
64909
65148
|
let embedClass = {};
|
|
64910
65149
|
if (/image/.test(file2.type)) {
|
|
@@ -64914,7 +65153,7 @@ ${codeText}
|
|
|
64914
65153
|
} else if (/video/.test(file2.type)) {
|
|
64915
65154
|
embedClass = editor.editorEmbeds.getEmbedClass("video");
|
|
64916
65155
|
}
|
|
64917
|
-
assert(logger$
|
|
65156
|
+
assert(logger$1g, embedClass, `unSupport file type ${file2.type}`);
|
|
64918
65157
|
return embedClass;
|
|
64919
65158
|
}
|
|
64920
65159
|
async function patchInsertFile(editor, files, containerId, blockIndex) {
|
|
@@ -65664,7 +65903,7 @@ ${codeText}
|
|
|
65664
65903
|
}
|
|
65665
65904
|
}
|
|
65666
65905
|
}
|
|
65667
|
-
const zhCN$
|
|
65906
|
+
const zhCN$l = {
|
|
65668
65907
|
image: {
|
|
65669
65908
|
title: "\u56FE\u7247",
|
|
65670
65909
|
upload: {
|
|
@@ -65680,7 +65919,7 @@ ${codeText}
|
|
|
65680
65919
|
abstract: "\u56FE\u7247"
|
|
65681
65920
|
}
|
|
65682
65921
|
};
|
|
65683
|
-
const enUS$
|
|
65922
|
+
const enUS$l = {
|
|
65684
65923
|
image: {
|
|
65685
65924
|
title: "Image",
|
|
65686
65925
|
upload: {
|
|
@@ -65696,7 +65935,7 @@ ${codeText}
|
|
|
65696
65935
|
abstract: "Image"
|
|
65697
65936
|
}
|
|
65698
65937
|
};
|
|
65699
|
-
const jaJP$
|
|
65938
|
+
const jaJP$l = {
|
|
65700
65939
|
image: {
|
|
65701
65940
|
title: "\u753B\u50CF",
|
|
65702
65941
|
upload: {
|
|
@@ -65713,9 +65952,9 @@ ${codeText}
|
|
|
65713
65952
|
}
|
|
65714
65953
|
};
|
|
65715
65954
|
i18n$1.mergeLang({
|
|
65716
|
-
"zh-CN": zhCN$
|
|
65717
|
-
"en-US": enUS$
|
|
65718
|
-
"ja-JP": jaJP$
|
|
65955
|
+
"zh-CN": zhCN$l,
|
|
65956
|
+
"en-US": enUS$l,
|
|
65957
|
+
"ja-JP": jaJP$l
|
|
65719
65958
|
});
|
|
65720
65959
|
function convertToImage(editor, containerId, blockIndex, offset) {
|
|
65721
65960
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -65769,7 +66008,7 @@ ${codeText}
|
|
|
65769
66008
|
return false;
|
|
65770
66009
|
}
|
|
65771
66010
|
}
|
|
65772
|
-
const logger$
|
|
66011
|
+
const logger$1f = getLogger("copy-image");
|
|
65773
66012
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
65774
66013
|
const imageData = imageObject.getImages()[index2];
|
|
65775
66014
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
@@ -65810,7 +66049,7 @@ ${codeText}
|
|
|
65810
66049
|
});
|
|
65811
66050
|
clipboardData["image/png"] = fileBlob;
|
|
65812
66051
|
} catch (error2) {
|
|
65813
|
-
logger$
|
|
66052
|
+
logger$1f.error(error2);
|
|
65814
66053
|
}
|
|
65815
66054
|
addMetaToDoc(editor, doc2);
|
|
65816
66055
|
const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
|
|
@@ -66083,195 +66322,6 @@ ${codeText}
|
|
|
66083
66322
|
}
|
|
66084
66323
|
return getDragInsertPos(editor, block, images, x);
|
|
66085
66324
|
}
|
|
66086
|
-
const zhCN$l = {
|
|
66087
|
-
embedProperties: {
|
|
66088
|
-
edit: "\u7F16\u8F91",
|
|
66089
|
-
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
66090
|
-
}
|
|
66091
|
-
};
|
|
66092
|
-
const enUS$l = {
|
|
66093
|
-
embedProperties: {
|
|
66094
|
-
edit: "Edit",
|
|
66095
|
-
addComment: "Add annotation"
|
|
66096
|
-
}
|
|
66097
|
-
};
|
|
66098
|
-
const jaJP$l = {
|
|
66099
|
-
embedProperties: {
|
|
66100
|
-
edit: "\u7DE8\u96C6",
|
|
66101
|
-
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
66102
|
-
}
|
|
66103
|
-
};
|
|
66104
|
-
i18n$1.mergeLang({
|
|
66105
|
-
"zh-CN": zhCN$l,
|
|
66106
|
-
"en-US": enUS$l,
|
|
66107
|
-
"ja-JP": jaJP$l
|
|
66108
|
-
});
|
|
66109
|
-
const logger$1f = getLogger("embed-block-properties");
|
|
66110
|
-
function addCommentToBlock(editor, block) {
|
|
66111
|
-
var _a;
|
|
66112
|
-
for (const hook of editor.blockHooks) {
|
|
66113
|
-
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
66114
|
-
if (!commands) {
|
|
66115
|
-
continue;
|
|
66116
|
-
}
|
|
66117
|
-
if (commands.group === "block-comment-actions") {
|
|
66118
|
-
const command = commands.commands[0];
|
|
66119
|
-
if (!command) {
|
|
66120
|
-
continue;
|
|
66121
|
-
}
|
|
66122
|
-
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
66123
|
-
return true;
|
|
66124
|
-
}
|
|
66125
|
-
}
|
|
66126
|
-
return false;
|
|
66127
|
-
}
|
|
66128
|
-
class StandardEmbedBlockCommands {
|
|
66129
|
-
constructor(editor, block, properties) {
|
|
66130
|
-
__publicField(this, "group", "hovering-toolbar");
|
|
66131
|
-
__publicField(this, "_commands", [{
|
|
66132
|
-
id: "edit",
|
|
66133
|
-
name: i18n$1.t("embedProperties.edit"),
|
|
66134
|
-
icon: EditIcon
|
|
66135
|
-
}, {
|
|
66136
|
-
id: "separator",
|
|
66137
|
-
name: "",
|
|
66138
|
-
type: "separator"
|
|
66139
|
-
}]);
|
|
66140
|
-
this.editor = editor;
|
|
66141
|
-
this.block = block;
|
|
66142
|
-
this.properties = properties;
|
|
66143
|
-
}
|
|
66144
|
-
get commands() {
|
|
66145
|
-
var _a, _b, _c, _d;
|
|
66146
|
-
if (clientType.isMobile) {
|
|
66147
|
-
return [];
|
|
66148
|
-
}
|
|
66149
|
-
let standardCommands = [];
|
|
66150
|
-
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
66151
|
-
this.properties.presetIds.forEach((id) => {
|
|
66152
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66153
|
-
if (command) {
|
|
66154
|
-
standardCommands.push(command);
|
|
66155
|
-
}
|
|
66156
|
-
});
|
|
66157
|
-
}
|
|
66158
|
-
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
66159
|
-
standardCommands.push(...this.properties.extCommands);
|
|
66160
|
-
}
|
|
66161
|
-
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
66162
|
-
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
66163
|
-
}
|
|
66164
|
-
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
66165
|
-
this.properties.extIds.forEach((id) => {
|
|
66166
|
-
const command = this._commands.find((item) => item.id === id);
|
|
66167
|
-
if (command) {
|
|
66168
|
-
standardCommands.push(command);
|
|
66169
|
-
}
|
|
66170
|
-
});
|
|
66171
|
-
}
|
|
66172
|
-
const { enableComments = true } = this.editor.options;
|
|
66173
|
-
if (!enableComments || this.editor.readonly) {
|
|
66174
|
-
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
66175
|
-
}
|
|
66176
|
-
if (this.editor.readonly) {
|
|
66177
|
-
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
66178
|
-
}
|
|
66179
|
-
standardCommands.forEach((item) => {
|
|
66180
|
-
if (item.id === "add-comment" || item.id === "edit") {
|
|
66181
|
-
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
66182
|
-
}
|
|
66183
|
-
});
|
|
66184
|
-
return standardCommands;
|
|
66185
|
-
}
|
|
66186
|
-
executeCommand(editor, block, item) {
|
|
66187
|
-
var _a, _b;
|
|
66188
|
-
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
66189
|
-
return;
|
|
66190
|
-
}
|
|
66191
|
-
if (item.id === "add-comment") {
|
|
66192
|
-
if (!addCommentToBlock(editor, block)) {
|
|
66193
|
-
logger$1f.error("failed to add comment to block");
|
|
66194
|
-
}
|
|
66195
|
-
return;
|
|
66196
|
-
}
|
|
66197
|
-
logger$1f.error(`unknown command: ${JSON.stringify(item)}`);
|
|
66198
|
-
}
|
|
66199
|
-
}
|
|
66200
|
-
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
66201
|
-
return {
|
|
66202
|
-
blockCommands: {
|
|
66203
|
-
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
66204
|
-
}
|
|
66205
|
-
};
|
|
66206
|
-
}
|
|
66207
|
-
class EmbedBlockResizer {
|
|
66208
|
-
constructor(editor) {
|
|
66209
|
-
__publicField(this, "resizing", false);
|
|
66210
|
-
__publicField(this, "blockResizer");
|
|
66211
|
-
__publicField(this, "handleResized", () => {
|
|
66212
|
-
this.resizing = false;
|
|
66213
|
-
});
|
|
66214
|
-
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
66215
|
-
var _a, _b;
|
|
66216
|
-
this.resizing = true;
|
|
66217
|
-
const block = resizer.getBlock();
|
|
66218
|
-
if (block) {
|
|
66219
|
-
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
66220
|
-
return;
|
|
66221
|
-
}
|
|
66222
|
-
const blockType = getEmbedType(block);
|
|
66223
|
-
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
66224
|
-
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
66225
|
-
const oldData = this.editor.getBlockData(block);
|
|
66226
|
-
const oldEmbedData = oldData.embedData;
|
|
66227
|
-
const newEmbedData = {
|
|
66228
|
-
...oldEmbedData,
|
|
66229
|
-
height
|
|
66230
|
-
};
|
|
66231
|
-
this.editor.updateEmbedData(block, newEmbedData);
|
|
66232
|
-
}
|
|
66233
|
-
});
|
|
66234
|
-
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
66235
|
-
if (this.resizing) {
|
|
66236
|
-
return;
|
|
66237
|
-
}
|
|
66238
|
-
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
66239
|
-
this.disableResizer();
|
|
66240
|
-
}
|
|
66241
|
-
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
66242
|
-
this.tryEnableResizer(block);
|
|
66243
|
-
}
|
|
66244
|
-
});
|
|
66245
|
-
__publicField(this, "handleEditorResize", () => {
|
|
66246
|
-
this.blockResizer.updateResizer();
|
|
66247
|
-
});
|
|
66248
|
-
this.editor = editor;
|
|
66249
|
-
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
66250
|
-
this.blockResizer = new BlockResizer(this.editor, {
|
|
66251
|
-
resize: ["bottom"]
|
|
66252
|
-
});
|
|
66253
|
-
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
66254
|
-
this.blockResizer.addListener("resized", this.handleResized);
|
|
66255
|
-
this.editor.addListener("resize", this.handleEditorResize);
|
|
66256
|
-
}
|
|
66257
|
-
destroy() {
|
|
66258
|
-
this.editor.removeListener("resize", this.handleEditorResize);
|
|
66259
|
-
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
66260
|
-
}
|
|
66261
|
-
tryEnableResizer(block) {
|
|
66262
|
-
this.blockResizer.enableResize(block);
|
|
66263
|
-
}
|
|
66264
|
-
disableResizer() {
|
|
66265
|
-
this.blockResizer.disableResize();
|
|
66266
|
-
}
|
|
66267
|
-
static get(editor) {
|
|
66268
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66269
|
-
}
|
|
66270
|
-
static register(editor, block) {
|
|
66271
|
-
addClass(block, "resizable");
|
|
66272
|
-
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
66273
|
-
}
|
|
66274
|
-
}
|
|
66275
66325
|
class ImageHoveringToolbarCommands$1 {
|
|
66276
66326
|
constructor(editor, block) {
|
|
66277
66327
|
__publicField(this, "group", "hovering-toolbar");
|
|
@@ -66343,7 +66393,7 @@ ${codeText}
|
|
|
66343
66393
|
executeCommand(editor, block, item) {
|
|
66344
66394
|
switch (item.id) {
|
|
66345
66395
|
case "addComment":
|
|
66346
|
-
addCommentToBlock(editor, block);
|
|
66396
|
+
addCommentToBlock$1(editor, block);
|
|
66347
66397
|
break;
|
|
66348
66398
|
case "left":
|
|
66349
66399
|
case "center":
|
|
@@ -67266,7 +67316,7 @@ ${codeText}
|
|
|
67266
67316
|
const { comment } = this;
|
|
67267
67317
|
const head = createElement("div", ["comment-item-head"], this.root);
|
|
67268
67318
|
const quote2 = createElement("span", ["item-head-quote"], head);
|
|
67269
|
-
quote2.
|
|
67319
|
+
quote2.textContent = comment.abstract;
|
|
67270
67320
|
const switchContainer = createElement("span", ["item-head-switch"], head);
|
|
67271
67321
|
const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
|
|
67272
67322
|
const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
|
|
@@ -67659,7 +67709,7 @@ ${codeText}
|
|
|
67659
67709
|
});
|
|
67660
67710
|
});
|
|
67661
67711
|
__publicField(this, "handleEditorResize", () => {
|
|
67662
|
-
this.updateItemsLayout();
|
|
67712
|
+
this.updateItemsLayout(false);
|
|
67663
67713
|
});
|
|
67664
67714
|
__publicField(this, "handleDocChanged", () => {
|
|
67665
67715
|
this.updateComments();
|
|
@@ -67736,9 +67786,11 @@ ${codeText}
|
|
|
67736
67786
|
this.removeAllListeners();
|
|
67737
67787
|
document.removeEventListener("click", this.handleDocumentClick);
|
|
67738
67788
|
}
|
|
67739
|
-
updateItemsLayout() {
|
|
67789
|
+
updateItemsLayout(dispatchScroll = true) {
|
|
67740
67790
|
arrangeItems(this.editor, this.items, this.activeItem);
|
|
67741
|
-
|
|
67791
|
+
if (dispatchScroll) {
|
|
67792
|
+
this.dispatchScroll();
|
|
67793
|
+
}
|
|
67742
67794
|
}
|
|
67743
67795
|
bindEvents() {
|
|
67744
67796
|
this.container.addEventListener("click", this.handleContainerClick);
|
|
@@ -68605,7 +68657,7 @@ ${codeText}
|
|
|
68605
68657
|
const types2 = ["table", "layout"];
|
|
68606
68658
|
if (types2.includes(getBlockType(block))) {
|
|
68607
68659
|
editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
|
|
68608
|
-
comment = addCommentToBlock
|
|
68660
|
+
comment = addCommentToBlock(editor, block, this.provider);
|
|
68609
68661
|
}
|
|
68610
68662
|
}
|
|
68611
68663
|
comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
|
|
@@ -68626,7 +68678,7 @@ ${codeText}
|
|
|
68626
68678
|
try {
|
|
68627
68679
|
this.editorComments.showCommentList();
|
|
68628
68680
|
const block2 = editor.getBlockById(blockId);
|
|
68629
|
-
addCommentToBlock
|
|
68681
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
68630
68682
|
} catch (err) {
|
|
68631
68683
|
logger$14.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
68632
68684
|
}
|
|
@@ -68635,14 +68687,24 @@ ${codeText}
|
|
|
68635
68687
|
this.editorComments = editorComments;
|
|
68636
68688
|
}
|
|
68637
68689
|
commands(editor, blockElement, child) {
|
|
68638
|
-
|
|
68639
|
-
if (editor.readonly) {
|
|
68690
|
+
if (editor.readonly || clientType.isMobile) {
|
|
68640
68691
|
return void 0;
|
|
68641
68692
|
}
|
|
68642
68693
|
const data2 = getBlockId(blockElement);
|
|
68643
68694
|
if (child) {
|
|
68644
|
-
const
|
|
68645
|
-
|
|
68695
|
+
const showCommandsBar = (child2) => {
|
|
68696
|
+
var _a, _b, _c;
|
|
68697
|
+
if (!child2 || !isTextBlockContentBoxChild(child2)) {
|
|
68698
|
+
return false;
|
|
68699
|
+
}
|
|
68700
|
+
const box = child2;
|
|
68701
|
+
const boxCommands = (_b = (_a = editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.getBoxProperties) == null ? void 0 : _b.call(_a, editor, box).boxCommands;
|
|
68702
|
+
if (!boxCommands) {
|
|
68703
|
+
return false;
|
|
68704
|
+
}
|
|
68705
|
+
return ((_c = boxCommands["hovering-toolbar"]) == null ? void 0 : _c.commands.length) > 0;
|
|
68706
|
+
};
|
|
68707
|
+
if (showCommandsBar(child)) {
|
|
68646
68708
|
return {
|
|
68647
68709
|
group: "hovering-toolbar",
|
|
68648
68710
|
commands: [
|
|
@@ -68962,11 +69024,11 @@ ${codeText}
|
|
|
68962
69024
|
const { containerId } = path[path.length - 1];
|
|
68963
69025
|
const targetBlock = getParentBlock(getContainerById(editor, containerId));
|
|
68964
69026
|
if (targetBlock && getBlockType(targetBlock) === "code") {
|
|
68965
|
-
addCommentToBlock
|
|
69027
|
+
addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
|
|
68966
69028
|
return;
|
|
68967
69029
|
}
|
|
68968
69030
|
}
|
|
68969
|
-
addCommentToBlock
|
|
69031
|
+
addCommentToBlock(editor, block, editorComments.commentProvider);
|
|
68970
69032
|
return;
|
|
68971
69033
|
}
|
|
68972
69034
|
const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
|
|
@@ -69202,7 +69264,7 @@ ${codeText}
|
|
|
69202
69264
|
editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
|
|
69203
69265
|
const editorComments = editor2.getCustom("editor-comments");
|
|
69204
69266
|
editorComments.showCommentList();
|
|
69205
|
-
addCommentToBlock
|
|
69267
|
+
addCommentToBlock(editor2, block, editorComments.commentProvider);
|
|
69206
69268
|
}
|
|
69207
69269
|
}
|
|
69208
69270
|
};
|
|
@@ -69239,7 +69301,7 @@ ${codeText}
|
|
|
69239
69301
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
69240
69302
|
if (selectedBlock) {
|
|
69241
69303
|
const editorComments = editor.getCustom("editor-comments");
|
|
69242
|
-
addCommentToBlock
|
|
69304
|
+
addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
|
|
69243
69305
|
}
|
|
69244
69306
|
return;
|
|
69245
69307
|
}
|
|
@@ -76497,7 +76559,7 @@ ${content}
|
|
|
76497
76559
|
} else if (item.id === "download") {
|
|
76498
76560
|
downloadFile$1(editor, box);
|
|
76499
76561
|
} else if (item.id === "add-comment") {
|
|
76500
|
-
addCommentToBlock(editor, block);
|
|
76562
|
+
addCommentToBlock$1(editor, block);
|
|
76501
76563
|
}
|
|
76502
76564
|
}
|
|
76503
76565
|
}
|
|
@@ -76789,7 +76851,7 @@ ${content}
|
|
|
76789
76851
|
} else if (item.id === "download") {
|
|
76790
76852
|
downloadFile(editor, block);
|
|
76791
76853
|
} else if (item.id === "add-comment") {
|
|
76792
|
-
addCommentToBlock(editor, block);
|
|
76854
|
+
addCommentToBlock$1(editor, block);
|
|
76793
76855
|
}
|
|
76794
76856
|
}
|
|
76795
76857
|
}
|
|
@@ -80897,10 +80959,16 @@ ${content}
|
|
|
80897
80959
|
this.blockId = blockId;
|
|
80898
80960
|
const calloutIcon = createElement("div", ["callout-icon"], null);
|
|
80899
80961
|
this.iconElement = calloutIcon;
|
|
80900
|
-
calloutIcon.setAttribute("data-editor-tooltip-common", i18n$1.t("callout.icon.toggleIcon"));
|
|
80901
|
-
this.editor.domEvents.addEventListener(this.iconElement, "click", this.handleIconClick);
|
|
80902
80962
|
this.emojiPopup = EmojiPopup.get(this.editor, blockId);
|
|
80903
80963
|
this.emojiPopup.emojiPalette.on("onSelectEmoji", this.handleSelectEmoji);
|
|
80964
|
+
setTimeout(() => {
|
|
80965
|
+
if (editor.isWritable()) {
|
|
80966
|
+
calloutIcon.setAttribute("data-editor-tooltip-common", i18n$1.t("callout.icon.toggleIcon"));
|
|
80967
|
+
this.editor.domEvents.addEventListener(this.iconElement, "click", this.handleIconClick);
|
|
80968
|
+
} else {
|
|
80969
|
+
calloutIcon.classList.add("readonly");
|
|
80970
|
+
}
|
|
80971
|
+
}, 50);
|
|
80904
80972
|
}
|
|
80905
80973
|
render(parent, icon) {
|
|
80906
80974
|
this.updateIcon(icon);
|
|
@@ -86411,7 +86479,7 @@ ${data2.flowchartText}
|
|
|
86411
86479
|
executeCommand(editor, block, item) {
|
|
86412
86480
|
switch (item.id) {
|
|
86413
86481
|
case "addComment":
|
|
86414
|
-
addCommentToBlock(editor, block);
|
|
86482
|
+
addCommentToBlock$1(editor, block);
|
|
86415
86483
|
break;
|
|
86416
86484
|
case "left":
|
|
86417
86485
|
case "center":
|
|
@@ -88443,7 +88511,7 @@ ${data2.flowchartText}
|
|
|
88443
88511
|
}
|
|
88444
88512
|
}
|
|
88445
88513
|
});
|
|
88446
|
-
editor.version = "2.2.15-beta.
|
|
88514
|
+
editor.version = "2.2.15-beta.3";
|
|
88447
88515
|
return editor;
|
|
88448
88516
|
}
|
|
88449
88517
|
function isDoc(doc2) {
|
|
@@ -88538,7 +88606,7 @@ ${data2.flowchartText}
|
|
|
88538
88606
|
});
|
|
88539
88607
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88540
88608
|
OnesEditorToolbar.register(editor);
|
|
88541
|
-
editor.version = "2.2.15-beta.
|
|
88609
|
+
editor.version = "2.2.15-beta.3";
|
|
88542
88610
|
return editor;
|
|
88543
88611
|
}
|
|
88544
88612
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134382,6 +134450,7 @@ ${data2.flowchartText}
|
|
|
134382
134450
|
exports2.ShareDBLocalDoc = ShareDBLocalDoc;
|
|
134383
134451
|
exports2.ShareDBServer = ShareDBServer;
|
|
134384
134452
|
exports2.SimpleCache = SimpleCache;
|
|
134453
|
+
exports2.StandardBoxCommands = StandardBoxCommands;
|
|
134385
134454
|
exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
|
|
134386
134455
|
exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
|
|
134387
134456
|
exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
|
|
@@ -134400,7 +134469,7 @@ ${data2.flowchartText}
|
|
|
134400
134469
|
exports2.addAttribute = addAttribute;
|
|
134401
134470
|
exports2.addClass = addClass;
|
|
134402
134471
|
exports2.addColor = addColor;
|
|
134403
|
-
exports2.addCommentToBlock = addCommentToBlock;
|
|
134472
|
+
exports2.addCommentToBlock = addCommentToBlock$1;
|
|
134404
134473
|
exports2.addDays = addDays;
|
|
134405
134474
|
exports2.addMetaToDoc = addMetaToDoc;
|
|
134406
134475
|
exports2.addMonths = addMonths;
|