@ones-editor/editor 2.2.15-beta.2 → 2.2.15-beta.4
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 +886 -815
- 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;
|
|
@@ -6596,23 +6590,29 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6596
6590
|
padding: 10px;
|
|
6597
6591
|
border-radius: 3px;
|
|
6598
6592
|
}
|
|
6593
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon {
|
|
6594
|
+
flex-shrink: 0;
|
|
6595
|
+
margin-right: 10px;
|
|
6596
|
+
}
|
|
6599
6597
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner {
|
|
6600
|
-
cursor: pointer;
|
|
6601
6598
|
display: flex;
|
|
6602
6599
|
align-items: center;
|
|
6603
6600
|
justify-content: center;
|
|
6604
|
-
flex-shrink: 0;
|
|
6605
6601
|
width: 24px;
|
|
6606
6602
|
height: 24px;
|
|
6607
|
-
margin-right: 10px;
|
|
6608
6603
|
font-size: 22px;
|
|
6609
6604
|
line-height: 1;
|
|
6610
6605
|
font-family: Apple Color Emoji, Segoe UI Emoji, NotoColorEmoji, Noto Color Emoji, Segoe UI Symbol, Android Emoji, EmojiSymbols;
|
|
6606
|
+
cursor: pointer;
|
|
6611
6607
|
}
|
|
6612
6608
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon-inner:hover {
|
|
6613
6609
|
border-radius: 3px;
|
|
6614
6610
|
background-color: rgba(0, 36, 90, 0.04);
|
|
6615
6611
|
}
|
|
6612
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-icon.readonly .callout-icon-inner {
|
|
6613
|
+
cursor: text;
|
|
6614
|
+
pointer-events: none;
|
|
6615
|
+
}
|
|
6616
6616
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content {
|
|
6617
6617
|
flex: 1;
|
|
6618
6618
|
min-width: 0;
|
|
@@ -13099,7 +13099,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13099
13099
|
return createEditorSelectionRange(editor, { anchor: anchor2, focus });
|
|
13100
13100
|
}
|
|
13101
13101
|
const logger$4a = getLogger("range-from-point");
|
|
13102
|
-
function getBlockRangeFromPoint(editor, pointX, pointY) {
|
|
13102
|
+
function getBlockRangeFromPoint(editor, pointX, pointY, dragging) {
|
|
13103
13103
|
const yOffsets = [0, -12, 12];
|
|
13104
13104
|
let x = pointX;
|
|
13105
13105
|
const y = pointY;
|
|
@@ -13147,7 +13147,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13147
13147
|
if (!editor.contains(block)) {
|
|
13148
13148
|
continue;
|
|
13149
13149
|
}
|
|
13150
|
-
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i]);
|
|
13150
|
+
const range = getBlockClass(editor, block).getRangeFromPoint(editor, block, x, y + yOffsets[i], dragging);
|
|
13151
13151
|
if (range) {
|
|
13152
13152
|
return range;
|
|
13153
13153
|
}
|
|
@@ -23743,7 +23743,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23743
23743
|
});
|
|
23744
23744
|
return ret;
|
|
23745
23745
|
}
|
|
23746
|
-
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign) {
|
|
23746
|
+
function getTextBlockRangeFromPoint(editor, block, xOrign, yOrign, dragging) {
|
|
23747
23747
|
const elem = getElementFromPoint(xOrign, yOrign);
|
|
23748
23748
|
if (!elem)
|
|
23749
23749
|
return null;
|
|
@@ -23798,7 +23798,12 @@ var __publicField = (obj, key, value) => {
|
|
|
23798
23798
|
offset = start;
|
|
23799
23799
|
length = 0;
|
|
23800
23800
|
} else if (isTextBlockContentBoxChild(child)) {
|
|
23801
|
-
|
|
23801
|
+
const blockRect2 = child.getBoundingClientRect();
|
|
23802
|
+
if (!dragging) {
|
|
23803
|
+
offset = start + (blockRect2.x + 10 > x ? 0 : 1);
|
|
23804
|
+
} else {
|
|
23805
|
+
offset = start + (blockRect2.x + blockRect2.width / 2 > x ? 0 : 1);
|
|
23806
|
+
}
|
|
23802
23807
|
length = 0;
|
|
23803
23808
|
} else {
|
|
23804
23809
|
assert(logger$3X, child.firstChild instanceof Text, "child is not text");
|
|
@@ -25679,7 +25684,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25679
25684
|
if (enableHorizontal) {
|
|
25680
25685
|
animateScrollTo(target, {
|
|
25681
25686
|
elementToScroll: getScrollContainer$1(target, { horizontal: true }),
|
|
25682
|
-
disableHorizontal: false
|
|
25687
|
+
disableHorizontal: false,
|
|
25688
|
+
speed: options.speed
|
|
25683
25689
|
});
|
|
25684
25690
|
}
|
|
25685
25691
|
const mobileClient = editor.options.componentsOptions.mobile;
|
|
@@ -25687,7 +25693,8 @@ var __publicField = (obj, key, value) => {
|
|
|
25687
25693
|
elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
|
|
25688
25694
|
disableHorizontal: true,
|
|
25689
25695
|
verticalOffset: options == null ? void 0 : options.verticalOffset,
|
|
25690
|
-
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
|
|
25696
|
+
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0,
|
|
25697
|
+
speed: options.speed
|
|
25691
25698
|
});
|
|
25692
25699
|
} else if (target.scrollIntoView) {
|
|
25693
25700
|
target.scrollIntoView({
|
|
@@ -28088,7 +28095,7 @@ var __publicField = (obj, key, value) => {
|
|
|
28088
28095
|
if (Math.abs(this.mouseDownEvent.x - event.x) < 3 && Math.abs(this.mouseDownEvent.y - event.y) < 3) {
|
|
28089
28096
|
return;
|
|
28090
28097
|
}
|
|
28091
|
-
const range = getBlockRangeFromPoint(this.editor, event.x, event.y);
|
|
28098
|
+
const range = getBlockRangeFromPoint(this.editor, event.x, event.y, true);
|
|
28092
28099
|
if (!range) {
|
|
28093
28100
|
return;
|
|
28094
28101
|
}
|
|
@@ -39433,7 +39440,8 @@ ${codeText}
|
|
|
39433
39440
|
}
|
|
39434
39441
|
},
|
|
39435
39442
|
search: {
|
|
39436
|
-
emptyTips: "\u6682\u65E0\u641C\u7D22\u7ED3\u679C"
|
|
39443
|
+
emptyTips: "\u6682\u65E0\u641C\u7D22\u7ED3\u679C",
|
|
39444
|
+
loading: "\u52A0\u8F7D\u4E2D..."
|
|
39437
39445
|
}
|
|
39438
39446
|
};
|
|
39439
39447
|
const enUS$w = {
|
|
@@ -39465,7 +39473,8 @@ ${codeText}
|
|
|
39465
39473
|
}
|
|
39466
39474
|
},
|
|
39467
39475
|
search: {
|
|
39468
|
-
emptyTips: "No results found"
|
|
39476
|
+
emptyTips: "No results found",
|
|
39477
|
+
loading: "Loading..."
|
|
39469
39478
|
}
|
|
39470
39479
|
};
|
|
39471
39480
|
const jaJP$w = {
|
|
@@ -39497,7 +39506,8 @@ ${codeText}
|
|
|
39497
39506
|
}
|
|
39498
39507
|
},
|
|
39499
39508
|
search: {
|
|
39500
|
-
emptyTips: "\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093"
|
|
39509
|
+
emptyTips: "\u691C\u7D22\u7D50\u679C\u304C\u3042\u308A\u307E\u305B\u3093",
|
|
39510
|
+
loading: "\u8AAD\u307F\u8FBC\u307F\u4E2D..."
|
|
39501
39511
|
}
|
|
39502
39512
|
};
|
|
39503
39513
|
i18n$1.mergeLang({
|
|
@@ -40080,24 +40090,51 @@ ${codeText}
|
|
|
40080
40090
|
click(item, target) {
|
|
40081
40091
|
this.emit("click", this, item, target);
|
|
40082
40092
|
}
|
|
40083
|
-
createPopperOptions() {
|
|
40084
|
-
var _a, _b;
|
|
40093
|
+
createPopperOptions(flip = false) {
|
|
40094
|
+
var _a, _b, _c, _d;
|
|
40085
40095
|
const popperOptions = { modifiers: [] };
|
|
40086
40096
|
const overflowBoundary = this.options.overflowBoundary;
|
|
40097
|
+
const padding = this.options.padding;
|
|
40087
40098
|
if (overflowBoundary) {
|
|
40088
|
-
(
|
|
40089
|
-
|
|
40090
|
-
|
|
40091
|
-
|
|
40092
|
-
|
|
40093
|
-
|
|
40094
|
-
|
|
40099
|
+
if (flip) {
|
|
40100
|
+
(_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
|
|
40101
|
+
name: "flip",
|
|
40102
|
+
options: {
|
|
40103
|
+
boundary: overflowBoundary,
|
|
40104
|
+
fallbackPlacements: ["top", "bottom"]
|
|
40105
|
+
}
|
|
40106
|
+
});
|
|
40107
|
+
} else {
|
|
40108
|
+
(_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
|
|
40109
|
+
name: "hide",
|
|
40110
|
+
enabled: true,
|
|
40111
|
+
phase: "main",
|
|
40112
|
+
fn: debounce__default.default(({ state }) => {
|
|
40113
|
+
const popper = state.elements.popper;
|
|
40114
|
+
const popperRect = popper.getBoundingClientRect();
|
|
40115
|
+
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40116
|
+
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40117
|
+
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40118
|
+
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40119
|
+
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40120
|
+
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40121
|
+
popper.setAttribute("data-tippy-hidden", "");
|
|
40122
|
+
} else {
|
|
40123
|
+
popper.removeAttribute("data-tippy-hidden");
|
|
40124
|
+
}
|
|
40125
|
+
}, 10)
|
|
40126
|
+
});
|
|
40127
|
+
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40128
|
+
name: "flip",
|
|
40129
|
+
enabled: false
|
|
40130
|
+
});
|
|
40131
|
+
}
|
|
40095
40132
|
}
|
|
40096
|
-
if (
|
|
40097
|
-
(
|
|
40133
|
+
if (padding) {
|
|
40134
|
+
(_d = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _d.push({
|
|
40098
40135
|
name: "preventOverflow",
|
|
40099
40136
|
options: {
|
|
40100
|
-
padding
|
|
40137
|
+
padding
|
|
40101
40138
|
}
|
|
40102
40139
|
});
|
|
40103
40140
|
}
|
|
@@ -40464,7 +40501,7 @@ ${codeText}
|
|
|
40464
40501
|
});
|
|
40465
40502
|
}
|
|
40466
40503
|
manualShow(target, options) {
|
|
40467
|
-
var _a, _b, _c;
|
|
40504
|
+
var _a, _b, _c, _d;
|
|
40468
40505
|
if (this.isVisible) {
|
|
40469
40506
|
return;
|
|
40470
40507
|
}
|
|
@@ -40479,15 +40516,15 @@ ${codeText}
|
|
|
40479
40516
|
triggerTarget: null,
|
|
40480
40517
|
hideOnClick: false,
|
|
40481
40518
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
40482
|
-
maxWidth: 650,
|
|
40483
|
-
arrow: (
|
|
40519
|
+
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
40520
|
+
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
40484
40521
|
appendTo: document.body,
|
|
40485
40522
|
onShow: this.handleShow,
|
|
40486
40523
|
onHidden: this.handleHidden,
|
|
40487
40524
|
onShown: this.handleShown,
|
|
40488
40525
|
theme: options == null ? void 0 : options.theme,
|
|
40489
40526
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
40490
|
-
offset: (
|
|
40527
|
+
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
40491
40528
|
popperOptions: this.createPopperOptions()
|
|
40492
40529
|
});
|
|
40493
40530
|
if (options == null ? void 0 : options.point) {
|
|
@@ -40974,6 +41011,7 @@ ${codeText}
|
|
|
40974
41011
|
super(items, closeable, {
|
|
40975
41012
|
itemElementTag: "button",
|
|
40976
41013
|
tippyArrow: false,
|
|
41014
|
+
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
40977
41015
|
...options
|
|
40978
41016
|
});
|
|
40979
41017
|
}
|
|
@@ -41238,7 +41276,7 @@ ${codeText}
|
|
|
41238
41276
|
theme: options == null ? void 0 : options.theme,
|
|
41239
41277
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
41240
41278
|
offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
|
|
41241
|
-
popperOptions: this.createPopperOptions()
|
|
41279
|
+
popperOptions: this.createPopperOptions(true)
|
|
41242
41280
|
});
|
|
41243
41281
|
this.clearSelectedItem();
|
|
41244
41282
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
@@ -41342,7 +41380,7 @@ ${codeText}
|
|
|
41342
41380
|
this.menu.addListener("show", this.handleShow);
|
|
41343
41381
|
this.menu.addListener("shown", this.handleShown);
|
|
41344
41382
|
if (this.options.wait) {
|
|
41345
|
-
this.handleSearchText = debounce__default.default(
|
|
41383
|
+
this.handleSearchText = debounce__default.default((text2) => {
|
|
41346
41384
|
this.handleSearchTextPure(text2);
|
|
41347
41385
|
}, this.options.wait);
|
|
41348
41386
|
} else {
|
|
@@ -41375,9 +41413,7 @@ ${codeText}
|
|
|
41375
41413
|
if (this.options.placeholder) {
|
|
41376
41414
|
this.showPlaceholder();
|
|
41377
41415
|
}
|
|
41378
|
-
|
|
41379
|
-
this.highlightText("", items);
|
|
41380
|
-
this.setItems(items);
|
|
41416
|
+
this.handleSearchTextPure("");
|
|
41381
41417
|
}
|
|
41382
41418
|
showLoading() {
|
|
41383
41419
|
if (!this.options.showLoading) {
|
|
@@ -41393,7 +41429,7 @@ ${codeText}
|
|
|
41393
41429
|
} else {
|
|
41394
41430
|
this.setItems([{
|
|
41395
41431
|
id: "loading",
|
|
41396
|
-
name: "loading",
|
|
41432
|
+
name: i18n$1.t("search.loading"),
|
|
41397
41433
|
states: ["disabled"]
|
|
41398
41434
|
}]);
|
|
41399
41435
|
}
|
|
@@ -41442,14 +41478,11 @@ ${codeText}
|
|
|
41442
41478
|
}
|
|
41443
41479
|
async handleSearchTextPure(text2) {
|
|
41444
41480
|
this.currentText = text2;
|
|
41445
|
-
const key = "auto-suggest";
|
|
41446
41481
|
try {
|
|
41447
|
-
await lockers.lock(key);
|
|
41448
41482
|
this.showLoading();
|
|
41449
|
-
const searchingText = this.currentText;
|
|
41450
41483
|
const items = await this.options.queryItems(this, text2);
|
|
41451
|
-
if (this.currentText
|
|
41452
|
-
|
|
41484
|
+
if (this.currentText !== text2) {
|
|
41485
|
+
return;
|
|
41453
41486
|
}
|
|
41454
41487
|
if (items.length === 0) {
|
|
41455
41488
|
this.showNoResultMessage(text2);
|
|
@@ -41457,10 +41490,9 @@ ${codeText}
|
|
|
41457
41490
|
}
|
|
41458
41491
|
this.setItems(items);
|
|
41459
41492
|
if (this.options.highlight) {
|
|
41460
|
-
this.highlightText(
|
|
41493
|
+
this.highlightText(text2.replace(/^\s+|\s+$/g, ""), items);
|
|
41461
41494
|
}
|
|
41462
41495
|
} finally {
|
|
41463
|
-
lockers.release(key);
|
|
41464
41496
|
}
|
|
41465
41497
|
}
|
|
41466
41498
|
highlightText(search, items) {
|
|
@@ -46978,7 +47010,413 @@ ${codeText}
|
|
|
46978
47010
|
}
|
|
46979
47011
|
return rects[0];
|
|
46980
47012
|
}
|
|
46981
|
-
const
|
|
47013
|
+
const zhCN$v = {
|
|
47014
|
+
embedProperties: {
|
|
47015
|
+
edit: "\u7F16\u8F91",
|
|
47016
|
+
addComment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
47017
|
+
}
|
|
47018
|
+
};
|
|
47019
|
+
const enUS$v = {
|
|
47020
|
+
embedProperties: {
|
|
47021
|
+
edit: "Edit",
|
|
47022
|
+
addComment: "Add annotation"
|
|
47023
|
+
}
|
|
47024
|
+
};
|
|
47025
|
+
const jaJP$v = {
|
|
47026
|
+
embedProperties: {
|
|
47027
|
+
edit: "\u7DE8\u96C6",
|
|
47028
|
+
addComment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
47029
|
+
}
|
|
47030
|
+
};
|
|
47031
|
+
i18n$1.mergeLang({
|
|
47032
|
+
"zh-CN": zhCN$v,
|
|
47033
|
+
"en-US": enUS$v,
|
|
47034
|
+
"ja-JP": jaJP$v
|
|
47035
|
+
});
|
|
47036
|
+
const logger$25 = getLogger("embed-block-properties");
|
|
47037
|
+
function addCommentToBlock$1(editor, block) {
|
|
47038
|
+
var _a;
|
|
47039
|
+
for (const hook of editor.blockHooks) {
|
|
47040
|
+
const commands = (_a = hook.commands) == null ? void 0 : _a.call(hook, editor, block, null);
|
|
47041
|
+
if (!commands) {
|
|
47042
|
+
continue;
|
|
47043
|
+
}
|
|
47044
|
+
if (commands.group === "block-comment-actions") {
|
|
47045
|
+
const command = commands.commands[0];
|
|
47046
|
+
if (!command) {
|
|
47047
|
+
continue;
|
|
47048
|
+
}
|
|
47049
|
+
commands.executeCommand(editor, block, commands.commands[0], null);
|
|
47050
|
+
return true;
|
|
47051
|
+
}
|
|
47052
|
+
}
|
|
47053
|
+
return false;
|
|
47054
|
+
}
|
|
47055
|
+
class StandardEmbedBlockCommands {
|
|
47056
|
+
constructor(editor, block, properties) {
|
|
47057
|
+
__publicField(this, "group", "hovering-toolbar");
|
|
47058
|
+
__publicField(this, "_commands", [{
|
|
47059
|
+
id: "edit",
|
|
47060
|
+
name: i18n$1.t("embedProperties.edit"),
|
|
47061
|
+
icon: EditIcon
|
|
47062
|
+
}, {
|
|
47063
|
+
id: "separator",
|
|
47064
|
+
name: "",
|
|
47065
|
+
type: "separator"
|
|
47066
|
+
}]);
|
|
47067
|
+
this.editor = editor;
|
|
47068
|
+
this.block = block;
|
|
47069
|
+
this.properties = properties;
|
|
47070
|
+
}
|
|
47071
|
+
get commands() {
|
|
47072
|
+
var _a, _b, _c, _d;
|
|
47073
|
+
if (clientType.isMobile) {
|
|
47074
|
+
return [];
|
|
47075
|
+
}
|
|
47076
|
+
let standardCommands = [];
|
|
47077
|
+
if ((_a = this.properties) == null ? void 0 : _a.presetIds) {
|
|
47078
|
+
this.properties.presetIds.forEach((id) => {
|
|
47079
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47080
|
+
if (command) {
|
|
47081
|
+
standardCommands.push(command);
|
|
47082
|
+
}
|
|
47083
|
+
});
|
|
47084
|
+
}
|
|
47085
|
+
if (((_b = this.properties) == null ? void 0 : _b.extCommands) && Array.isArray(this.properties.extCommands)) {
|
|
47086
|
+
standardCommands.push(...this.properties.extCommands);
|
|
47087
|
+
}
|
|
47088
|
+
if (typeof ((_c = this.properties) == null ? void 0 : _c.extCommands) === "function") {
|
|
47089
|
+
standardCommands.push(...this.properties.extCommands(this.editor, this.block));
|
|
47090
|
+
}
|
|
47091
|
+
if ((_d = this.properties) == null ? void 0 : _d.extIds) {
|
|
47092
|
+
this.properties.extIds.forEach((id) => {
|
|
47093
|
+
const command = this._commands.find((item) => item.id === id);
|
|
47094
|
+
if (command) {
|
|
47095
|
+
standardCommands.push(command);
|
|
47096
|
+
}
|
|
47097
|
+
});
|
|
47098
|
+
}
|
|
47099
|
+
const { enableComments = true } = this.editor.options;
|
|
47100
|
+
if (!enableComments || this.editor.readonly) {
|
|
47101
|
+
standardCommands = standardCommands.filter((command) => command.id !== "add-comment");
|
|
47102
|
+
}
|
|
47103
|
+
if (this.editor.readonly) {
|
|
47104
|
+
standardCommands = standardCommands.filter((command) => command.id !== "edit");
|
|
47105
|
+
}
|
|
47106
|
+
standardCommands.forEach((item) => {
|
|
47107
|
+
if (item.id === "add-comment" || item.id === "edit") {
|
|
47108
|
+
item.states = this.editor.isBlockWritable(this.block) ? [] : ["disabled"];
|
|
47109
|
+
}
|
|
47110
|
+
});
|
|
47111
|
+
return standardCommands;
|
|
47112
|
+
}
|
|
47113
|
+
executeCommand(editor, block, item) {
|
|
47114
|
+
var _a, _b;
|
|
47115
|
+
if ((_b = (_a = this.properties) == null ? void 0 : _a.handleExecuteCommand) == null ? void 0 : _b.call(_a, editor, block, item)) {
|
|
47116
|
+
return;
|
|
47117
|
+
}
|
|
47118
|
+
if (item.id === "add-comment") {
|
|
47119
|
+
if (!addCommentToBlock$1(editor, block)) {
|
|
47120
|
+
logger$25.error("failed to add comment to block");
|
|
47121
|
+
}
|
|
47122
|
+
return;
|
|
47123
|
+
}
|
|
47124
|
+
logger$25.error(`unknown command: ${JSON.stringify(item)}`);
|
|
47125
|
+
}
|
|
47126
|
+
}
|
|
47127
|
+
function getStandardEmbedBlockProperties(editor, block, properties) {
|
|
47128
|
+
return {
|
|
47129
|
+
blockCommands: {
|
|
47130
|
+
"hovering-toolbar": new StandardEmbedBlockCommands(editor, block, properties)
|
|
47131
|
+
}
|
|
47132
|
+
};
|
|
47133
|
+
}
|
|
47134
|
+
function createResizeGripper(parent, type) {
|
|
47135
|
+
const elem = createElement("div", ["resize-gripper", type], parent);
|
|
47136
|
+
elem.setAttribute("data-resize-type", type);
|
|
47137
|
+
}
|
|
47138
|
+
function getExistsResizer(block) {
|
|
47139
|
+
const tools = getBlockTools(block);
|
|
47140
|
+
return tools.querySelector(".block-resizer");
|
|
47141
|
+
}
|
|
47142
|
+
function hideResizer(block) {
|
|
47143
|
+
const exists = getExistsResizer(block);
|
|
47144
|
+
if (exists) {
|
|
47145
|
+
removeClass(exists, "active");
|
|
47146
|
+
}
|
|
47147
|
+
}
|
|
47148
|
+
function updateSize(block, element, resizer) {
|
|
47149
|
+
const blockRect = block.getBoundingClientRect();
|
|
47150
|
+
const elementRect = element.getBoundingClientRect();
|
|
47151
|
+
const top = elementRect.top - blockRect.top;
|
|
47152
|
+
const left = elementRect.left - blockRect.left;
|
|
47153
|
+
const width = elementRect.width;
|
|
47154
|
+
const height = elementRect.height;
|
|
47155
|
+
resizer.style.top = `${top}px`;
|
|
47156
|
+
resizer.style.left = `${left}px`;
|
|
47157
|
+
resizer.style.width = `${width}px`;
|
|
47158
|
+
resizer.style.height = `${height}px`;
|
|
47159
|
+
}
|
|
47160
|
+
function createResizer(block, element, options, mouseDownEvent) {
|
|
47161
|
+
const exists = getExistsResizer(block);
|
|
47162
|
+
if (exists) {
|
|
47163
|
+
addClass(exists, "active");
|
|
47164
|
+
updateSize(block, element, exists);
|
|
47165
|
+
return exists;
|
|
47166
|
+
}
|
|
47167
|
+
const tools = getBlockTools(block);
|
|
47168
|
+
const resizer = createElement("div", ["block-resizer"], tools);
|
|
47169
|
+
updateSize(block, element, resizer);
|
|
47170
|
+
options.resize.forEach((type) => {
|
|
47171
|
+
createResizeGripper(resizer, type);
|
|
47172
|
+
});
|
|
47173
|
+
resizer.addEventListener("mousedown", mouseDownEvent);
|
|
47174
|
+
addClass(resizer, "active");
|
|
47175
|
+
return resizer;
|
|
47176
|
+
}
|
|
47177
|
+
function updateResizer(block, element) {
|
|
47178
|
+
const resizer = getExistsResizer(block);
|
|
47179
|
+
if (!resizer) {
|
|
47180
|
+
return;
|
|
47181
|
+
}
|
|
47182
|
+
if (!isChildNode(block, element)) {
|
|
47183
|
+
return;
|
|
47184
|
+
}
|
|
47185
|
+
const blockRect = block.getBoundingClientRect();
|
|
47186
|
+
const elementRect = element.getBoundingClientRect();
|
|
47187
|
+
const top = elementRect.top - blockRect.top;
|
|
47188
|
+
const left = elementRect.left - blockRect.left;
|
|
47189
|
+
const width = elementRect.width;
|
|
47190
|
+
const height = elementRect.height;
|
|
47191
|
+
resizer.style.top = `${top}px`;
|
|
47192
|
+
resizer.style.left = `${left}px`;
|
|
47193
|
+
resizer.style.width = `${width}px`;
|
|
47194
|
+
resizer.style.height = `${height}px`;
|
|
47195
|
+
}
|
|
47196
|
+
const style$a = "";
|
|
47197
|
+
const logger$24 = getLogger("block-resizer");
|
|
47198
|
+
class BlockResizer extends tinyTypedEmitter.TypedEmitter {
|
|
47199
|
+
constructor(editor, options) {
|
|
47200
|
+
super();
|
|
47201
|
+
__publicField(this, "resizableElement");
|
|
47202
|
+
__publicField(this, "block", null);
|
|
47203
|
+
__publicField(this, "startRect", null);
|
|
47204
|
+
__publicField(this, "startPos", null);
|
|
47205
|
+
__publicField(this, "resizeType", null);
|
|
47206
|
+
__publicField(this, "enabled", false);
|
|
47207
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47208
|
+
if (this.block) {
|
|
47209
|
+
this.updateResizer();
|
|
47210
|
+
}
|
|
47211
|
+
});
|
|
47212
|
+
__publicField(this, "handleMouseDown", (event) => {
|
|
47213
|
+
event.preventDefault();
|
|
47214
|
+
event.stopPropagation();
|
|
47215
|
+
const element = this.getResizableElement();
|
|
47216
|
+
if (!element) {
|
|
47217
|
+
return;
|
|
47218
|
+
}
|
|
47219
|
+
if (event.button !== 0) {
|
|
47220
|
+
return;
|
|
47221
|
+
}
|
|
47222
|
+
const gripper = event.target;
|
|
47223
|
+
if (!gripper) {
|
|
47224
|
+
return;
|
|
47225
|
+
}
|
|
47226
|
+
if (!(gripper instanceof HTMLElement)) {
|
|
47227
|
+
return;
|
|
47228
|
+
}
|
|
47229
|
+
const resizeType = gripper.getAttribute("data-resize-type");
|
|
47230
|
+
if (!resizeType) {
|
|
47231
|
+
return;
|
|
47232
|
+
}
|
|
47233
|
+
this.bindEvents();
|
|
47234
|
+
this.startRect = element.getBoundingClientRect();
|
|
47235
|
+
this.startPos = event;
|
|
47236
|
+
this.resizeType = resizeType;
|
|
47237
|
+
setDefaultCursor(window.getComputedStyle(gripper).cursor);
|
|
47238
|
+
if (this.block) {
|
|
47239
|
+
this.editor.selection.selectBlock(this.block, 0);
|
|
47240
|
+
}
|
|
47241
|
+
});
|
|
47242
|
+
__publicField(this, "handleMouseMove", (event) => {
|
|
47243
|
+
if (!this.startPos || !this.startRect || !this.resizeType) {
|
|
47244
|
+
return;
|
|
47245
|
+
}
|
|
47246
|
+
const element = this.getResizableElement();
|
|
47247
|
+
if (!element || !this.block) {
|
|
47248
|
+
return;
|
|
47249
|
+
}
|
|
47250
|
+
const deltaX = event.x - this.startPos.x;
|
|
47251
|
+
const deltaY = event.y - this.startPos.y;
|
|
47252
|
+
const oldRect = this.startRect;
|
|
47253
|
+
let { top, left, right, bottom } = oldRect;
|
|
47254
|
+
if (this.resizeType === "bottom" || this.resizeType === "bottom-left" || this.resizeType === "bottom-right") {
|
|
47255
|
+
bottom += deltaY;
|
|
47256
|
+
}
|
|
47257
|
+
if (this.resizeType === "top" || this.resizeType === "top-left" || this.resizeType === "top-right") {
|
|
47258
|
+
top += deltaY;
|
|
47259
|
+
}
|
|
47260
|
+
if (this.resizeType === "left" || this.resizeType === "top-left" || this.resizeType === "bottom-left") {
|
|
47261
|
+
left += deltaX;
|
|
47262
|
+
}
|
|
47263
|
+
if (this.resizeType === "right" || this.resizeType === "top-right" || this.resizeType === "bottom-right") {
|
|
47264
|
+
right += deltaX;
|
|
47265
|
+
}
|
|
47266
|
+
const width = right > left ? right - left : 0;
|
|
47267
|
+
const height = bottom > top ? bottom - top : 0;
|
|
47268
|
+
const newRect = new DOMRect(left, top, width, height);
|
|
47269
|
+
this.emit("resizing", this, newRect);
|
|
47270
|
+
const newElement = this.getResizableElement();
|
|
47271
|
+
if (newElement) {
|
|
47272
|
+
updateResizer(this.block, newElement);
|
|
47273
|
+
}
|
|
47274
|
+
});
|
|
47275
|
+
__publicField(this, "handleMouseUp", (event) => {
|
|
47276
|
+
if (event.button !== 0) {
|
|
47277
|
+
return;
|
|
47278
|
+
}
|
|
47279
|
+
setDefaultCursor("");
|
|
47280
|
+
this.unbindEvents();
|
|
47281
|
+
this.emit("resized", this);
|
|
47282
|
+
const element = this.getResizableElement();
|
|
47283
|
+
if (!element || !this.block) {
|
|
47284
|
+
return;
|
|
47285
|
+
}
|
|
47286
|
+
updateResizer(this.block, element);
|
|
47287
|
+
});
|
|
47288
|
+
this.editor = editor;
|
|
47289
|
+
this.options = options;
|
|
47290
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47291
|
+
}
|
|
47292
|
+
enableResize(block, resizableElement) {
|
|
47293
|
+
this.block = block;
|
|
47294
|
+
this.resizableElement = resizableElement;
|
|
47295
|
+
this.createResizer();
|
|
47296
|
+
this.enabled = true;
|
|
47297
|
+
}
|
|
47298
|
+
disableResize() {
|
|
47299
|
+
if (!this.block) {
|
|
47300
|
+
return;
|
|
47301
|
+
}
|
|
47302
|
+
hideResizer(this.block);
|
|
47303
|
+
this.enabled = false;
|
|
47304
|
+
}
|
|
47305
|
+
update(block, resizableElement) {
|
|
47306
|
+
this.block = block;
|
|
47307
|
+
this.resizableElement = resizableElement;
|
|
47308
|
+
const elem = this.getResizableElement();
|
|
47309
|
+
if (elem && this.enabled) {
|
|
47310
|
+
this.createResizer();
|
|
47311
|
+
}
|
|
47312
|
+
}
|
|
47313
|
+
updateResizer() {
|
|
47314
|
+
const newElement = this.getResizableElement();
|
|
47315
|
+
if (newElement && this.block) {
|
|
47316
|
+
updateResizer(this.block, newElement);
|
|
47317
|
+
}
|
|
47318
|
+
}
|
|
47319
|
+
getBlock() {
|
|
47320
|
+
return this.block;
|
|
47321
|
+
}
|
|
47322
|
+
destroy() {
|
|
47323
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47324
|
+
}
|
|
47325
|
+
getResizableElement() {
|
|
47326
|
+
if (this.resizableElement) {
|
|
47327
|
+
return this.resizableElement;
|
|
47328
|
+
}
|
|
47329
|
+
if (!this.block) {
|
|
47330
|
+
return null;
|
|
47331
|
+
}
|
|
47332
|
+
return getBlockContent(this.block);
|
|
47333
|
+
}
|
|
47334
|
+
createResizer() {
|
|
47335
|
+
const element = this.getResizableElement();
|
|
47336
|
+
if (!element || !this.block) {
|
|
47337
|
+
return;
|
|
47338
|
+
}
|
|
47339
|
+
assert(logger$24, isChildNode(this.block, element), "not a block child element");
|
|
47340
|
+
createResizer(this.block, element, this.options, this.handleMouseDown);
|
|
47341
|
+
}
|
|
47342
|
+
bindEvents() {
|
|
47343
|
+
document.addEventListener("mousemove", this.handleMouseMove);
|
|
47344
|
+
document.addEventListener("mouseup", this.handleMouseUp);
|
|
47345
|
+
}
|
|
47346
|
+
unbindEvents() {
|
|
47347
|
+
document.removeEventListener("mousemove", this.handleMouseMove);
|
|
47348
|
+
document.removeEventListener("mouseup", this.handleMouseUp);
|
|
47349
|
+
}
|
|
47350
|
+
}
|
|
47351
|
+
class EmbedBlockResizer {
|
|
47352
|
+
constructor(editor) {
|
|
47353
|
+
__publicField(this, "resizing", false);
|
|
47354
|
+
__publicField(this, "blockResizer");
|
|
47355
|
+
__publicField(this, "handleResized", () => {
|
|
47356
|
+
this.resizing = false;
|
|
47357
|
+
});
|
|
47358
|
+
__publicField(this, "handleResizing", (resizer, rect) => {
|
|
47359
|
+
var _a, _b;
|
|
47360
|
+
this.resizing = true;
|
|
47361
|
+
const block = resizer.getBlock();
|
|
47362
|
+
if (block) {
|
|
47363
|
+
if (((_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "resize", { block, rect })) === true) {
|
|
47364
|
+
return;
|
|
47365
|
+
}
|
|
47366
|
+
const blockType = getEmbedType(block);
|
|
47367
|
+
const { adjustableMinHeight } = getEmbedClassByType(this.editor, blockType);
|
|
47368
|
+
const height = Math.max(rect.height, adjustableMinHeight || 100);
|
|
47369
|
+
const oldData = this.editor.getBlockData(block);
|
|
47370
|
+
const oldEmbedData = oldData.embedData;
|
|
47371
|
+
const newEmbedData = {
|
|
47372
|
+
...oldEmbedData,
|
|
47373
|
+
height
|
|
47374
|
+
};
|
|
47375
|
+
this.editor.updateEmbedData(block, newEmbedData);
|
|
47376
|
+
}
|
|
47377
|
+
});
|
|
47378
|
+
__publicField(this, "handleHoveringBlockChange", (block, old) => {
|
|
47379
|
+
if (this.resizing) {
|
|
47380
|
+
return;
|
|
47381
|
+
}
|
|
47382
|
+
if (old && isEmbedBlock(old) && hasClass(old, "resizable")) {
|
|
47383
|
+
this.disableResizer();
|
|
47384
|
+
}
|
|
47385
|
+
if (block && isEmbedBlock(block) && hasClass(block, "resizable") && this.editor.isBlockWritable(block)) {
|
|
47386
|
+
this.tryEnableResizer(block);
|
|
47387
|
+
}
|
|
47388
|
+
});
|
|
47389
|
+
__publicField(this, "handleEditorResize", () => {
|
|
47390
|
+
this.blockResizer.updateResizer();
|
|
47391
|
+
});
|
|
47392
|
+
this.editor = editor;
|
|
47393
|
+
OnesEditorHoveringBlock.get(editor).addListener("change", this.handleHoveringBlockChange);
|
|
47394
|
+
this.blockResizer = new BlockResizer(this.editor, {
|
|
47395
|
+
resize: ["bottom"]
|
|
47396
|
+
});
|
|
47397
|
+
this.blockResizer.addListener("resizing", this.handleResizing);
|
|
47398
|
+
this.blockResizer.addListener("resized", this.handleResized);
|
|
47399
|
+
this.editor.addListener("resize", this.handleEditorResize);
|
|
47400
|
+
}
|
|
47401
|
+
destroy() {
|
|
47402
|
+
this.editor.removeListener("resize", this.handleEditorResize);
|
|
47403
|
+
OnesEditorHoveringBlock.get(this.editor).removeListener("change", this.handleHoveringBlockChange);
|
|
47404
|
+
}
|
|
47405
|
+
tryEnableResizer(block) {
|
|
47406
|
+
this.blockResizer.enableResize(block);
|
|
47407
|
+
}
|
|
47408
|
+
disableResizer() {
|
|
47409
|
+
this.blockResizer.disableResize();
|
|
47410
|
+
}
|
|
47411
|
+
static get(editor) {
|
|
47412
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47413
|
+
}
|
|
47414
|
+
static register(editor, block) {
|
|
47415
|
+
addClass(block, "resizable");
|
|
47416
|
+
return editor.addCustom("EmbedBlockResizer", () => new EmbedBlockResizer(editor));
|
|
47417
|
+
}
|
|
47418
|
+
}
|
|
47419
|
+
const logger$23 = getLogger("exclusive-block");
|
|
46982
47420
|
function addExclusiveStyle(editor, block, userId, displayName) {
|
|
46983
47421
|
var _a;
|
|
46984
47422
|
addClass(block, "block-exclusive");
|
|
@@ -46996,7 +47434,7 @@ ${codeText}
|
|
|
46996
47434
|
block.removeAttribute("data-exclusive-tips");
|
|
46997
47435
|
}
|
|
46998
47436
|
function updateBlockExclusive(editor, block, exclusive, userId, displayName) {
|
|
46999
|
-
logger$
|
|
47437
|
+
logger$23.debug(`block ${getBlockId(block)} ${exclusive ? "exclusive" : "unexclusive"}, ${userId}, ${displayName}`);
|
|
47000
47438
|
if (exclusive) {
|
|
47001
47439
|
addExclusiveStyle(editor, block, userId, displayName);
|
|
47002
47440
|
} else {
|
|
@@ -47153,28 +47591,28 @@ ${codeText}
|
|
|
47153
47591
|
}
|
|
47154
47592
|
}
|
|
47155
47593
|
const exclusiveBlockStyles = "";
|
|
47156
|
-
const zhCN$
|
|
47594
|
+
const zhCN$u = {
|
|
47157
47595
|
exclusive: {
|
|
47158
47596
|
tips: "\u300C{editor}\u300D\u6B63\u5728\u7F16\u8F91\uFF0C\u300C{embedType}\u300D\u4E0D\u652F\u6301\u591A\u4EBA\u7F16\u8F91",
|
|
47159
47597
|
fallbackAbstract: "\u8BE5 Block"
|
|
47160
47598
|
}
|
|
47161
47599
|
};
|
|
47162
|
-
const enUS$
|
|
47600
|
+
const enUS$u = {
|
|
47163
47601
|
exclusive: {
|
|
47164
47602
|
tips: "\u300C{editor}\u300Dis editing\uFF0C\u300C{embedType}\u300Ddoes not support multi-person editing",
|
|
47165
47603
|
fallbackAbstract: "This Block"
|
|
47166
47604
|
}
|
|
47167
47605
|
};
|
|
47168
|
-
const jaJP$
|
|
47606
|
+
const jaJP$u = {
|
|
47169
47607
|
exclusive: {
|
|
47170
47608
|
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
47609
|
fallbackAbstract: "\u3053\u306E\u8981\u7D20"
|
|
47172
47610
|
}
|
|
47173
47611
|
};
|
|
47174
47612
|
i18n$1.mergeLang({
|
|
47175
|
-
"zh-CN": zhCN$
|
|
47176
|
-
"en-US": enUS$
|
|
47177
|
-
"ja-JP": jaJP$
|
|
47613
|
+
"zh-CN": zhCN$u,
|
|
47614
|
+
"en-US": enUS$u,
|
|
47615
|
+
"ja-JP": jaJP$u
|
|
47178
47616
|
});
|
|
47179
47617
|
function getBlockInfo(editor, block) {
|
|
47180
47618
|
const data2 = editor.getBlockData(block);
|
|
@@ -47350,22 +47788,22 @@ ${codeText}
|
|
|
47350
47788
|
};
|
|
47351
47789
|
}
|
|
47352
47790
|
}
|
|
47353
|
-
const style$
|
|
47354
|
-
const zhCN$
|
|
47791
|
+
const style$9 = "";
|
|
47792
|
+
const zhCN$t = {
|
|
47355
47793
|
locker: {
|
|
47356
47794
|
lock: "\u9501\u5B9A",
|
|
47357
47795
|
unlock: "\u89E3\u9664\u9501\u5B9A",
|
|
47358
47796
|
lockedBy: "\u88AB {name} \u9501\u5B9A"
|
|
47359
47797
|
}
|
|
47360
47798
|
};
|
|
47361
|
-
const enUS$
|
|
47799
|
+
const enUS$t = {
|
|
47362
47800
|
locker: {
|
|
47363
47801
|
lock: "Lock",
|
|
47364
47802
|
unlock: "Unlock",
|
|
47365
47803
|
lockedBy: "Locked by {name}"
|
|
47366
47804
|
}
|
|
47367
47805
|
};
|
|
47368
|
-
const jaJP$
|
|
47806
|
+
const jaJP$t = {
|
|
47369
47807
|
locker: {
|
|
47370
47808
|
lock: "\u30ED\u30C3\u30AF",
|
|
47371
47809
|
unlock: "\u30ED\u30C3\u30AF\u89E3\u9664",
|
|
@@ -47373,9 +47811,9 @@ ${codeText}
|
|
|
47373
47811
|
}
|
|
47374
47812
|
};
|
|
47375
47813
|
i18n$1.mergeLang({
|
|
47376
|
-
"zh-CN": zhCN$
|
|
47377
|
-
"en-US": enUS$
|
|
47378
|
-
"ja-JP": jaJP$
|
|
47814
|
+
"zh-CN": zhCN$t,
|
|
47815
|
+
"en-US": enUS$t,
|
|
47816
|
+
"ja-JP": jaJP$t
|
|
47379
47817
|
});
|
|
47380
47818
|
class BlockLockerPasteHandler {
|
|
47381
47819
|
async handleBeforePasteDoc(editor, doc2) {
|
|
@@ -47387,7 +47825,7 @@ ${codeText}
|
|
|
47387
47825
|
return false;
|
|
47388
47826
|
}
|
|
47389
47827
|
}
|
|
47390
|
-
const logger$
|
|
47828
|
+
const logger$22 = getLogger("context-menu-utils");
|
|
47391
47829
|
function blobToString(blob) {
|
|
47392
47830
|
return new Promise((resolve, reject) => {
|
|
47393
47831
|
const reader = new FileReader();
|
|
@@ -47408,7 +47846,7 @@ ${codeText}
|
|
|
47408
47846
|
const types2 = items[0].types;
|
|
47409
47847
|
return !data2.trim() && types2.length === 1 && types2.includes("text/plain");
|
|
47410
47848
|
} catch (error2) {
|
|
47411
|
-
logger$
|
|
47849
|
+
logger$22.warn(`Failed to read clipboard data: ${error2}`);
|
|
47412
47850
|
return true;
|
|
47413
47851
|
}
|
|
47414
47852
|
}
|
|
@@ -47457,7 +47895,7 @@ ${codeText}
|
|
|
47457
47895
|
}
|
|
47458
47896
|
return dataTransfer;
|
|
47459
47897
|
}
|
|
47460
|
-
const logger$
|
|
47898
|
+
const logger$21 = getLogger("ClipboardProvider");
|
|
47461
47899
|
class ClipboardProvider {
|
|
47462
47900
|
constructor(editor, options) {
|
|
47463
47901
|
__publicField(this, "id", "ClipboardProvider");
|
|
@@ -47543,7 +47981,7 @@ ${codeText}
|
|
|
47543
47981
|
}
|
|
47544
47982
|
}).catch((err) => {
|
|
47545
47983
|
this.clipboardPermission.read = "denied";
|
|
47546
|
-
logger$
|
|
47984
|
+
logger$21.log(err);
|
|
47547
47985
|
});
|
|
47548
47986
|
} catch (error2) {
|
|
47549
47987
|
this.clipboardPermission = {
|
|
@@ -47604,13 +48042,14 @@ ${codeText}
|
|
|
47604
48042
|
}
|
|
47605
48043
|
}
|
|
47606
48044
|
class StandardBoxCommands {
|
|
47607
|
-
constructor(editor) {
|
|
48045
|
+
constructor(editor, extIds) {
|
|
47608
48046
|
__publicField(this, "group", "standard-box-commands");
|
|
47609
48047
|
__publicField(this, "providers", []);
|
|
47610
48048
|
this.editor = editor;
|
|
47611
|
-
|
|
47612
|
-
|
|
47613
|
-
|
|
48049
|
+
this.extIds = extIds;
|
|
48050
|
+
}
|
|
48051
|
+
addProvider(provider) {
|
|
48052
|
+
this.providers.push(provider);
|
|
47614
48053
|
}
|
|
47615
48054
|
get commands() {
|
|
47616
48055
|
if (this.editor.readonly) {
|
|
@@ -47618,8 +48057,17 @@ ${codeText}
|
|
|
47618
48057
|
}
|
|
47619
48058
|
const items = [];
|
|
47620
48059
|
const focusedBlock = this.editor.selection.focusedBlock;
|
|
48060
|
+
const hoveringTextChild = OnesEditorHoveringBlock.get(this.editor).hoveringTextChild;
|
|
47621
48061
|
for (const provider of this.providers) {
|
|
47622
|
-
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range));
|
|
48062
|
+
items.push(...provider.getAvailableCommands(this.editor, focusedBlock, this.editor.selection.range, { child: hoveringTextChild }));
|
|
48063
|
+
}
|
|
48064
|
+
for (const extId of this.extIds || []) {
|
|
48065
|
+
if (extId === "separator") {
|
|
48066
|
+
items.push({ id: "sep", name: "", type: "separator" });
|
|
48067
|
+
}
|
|
48068
|
+
if (extId === "add-comment") {
|
|
48069
|
+
items.push({ id: "add-comment", name: i18n$1.t("comment.comment"), icon: CommentIcon$1 });
|
|
48070
|
+
}
|
|
47623
48071
|
}
|
|
47624
48072
|
return items;
|
|
47625
48073
|
}
|
|
@@ -47628,19 +48076,27 @@ ${codeText}
|
|
|
47628
48076
|
const { start, end } = getChildOffset(block, box);
|
|
47629
48077
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
47630
48078
|
for (const provider of this.providers) {
|
|
47631
|
-
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
|
|
48079
|
+
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, { child: box })) {
|
|
47632
48080
|
return;
|
|
47633
48081
|
}
|
|
47634
|
-
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
|
|
48082
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, { child: box })) {
|
|
47635
48083
|
return;
|
|
47636
48084
|
}
|
|
47637
48085
|
}
|
|
48086
|
+
if (item.id === "add-comment") {
|
|
48087
|
+
addCommentToBlock$1(editor, block);
|
|
48088
|
+
}
|
|
47638
48089
|
}
|
|
47639
|
-
static create(editor) {
|
|
47640
|
-
return new StandardBoxCommands(editor);
|
|
48090
|
+
static create(editor, extIds) {
|
|
48091
|
+
return new StandardBoxCommands(editor, extIds);
|
|
48092
|
+
}
|
|
48093
|
+
static mobileCreate(editor, extIds) {
|
|
48094
|
+
const instance = new StandardBoxCommands(editor, extIds);
|
|
48095
|
+
instance.addProvider(new ClipboardProvider(editor, { withPaste: false }));
|
|
48096
|
+
return instance;
|
|
47641
48097
|
}
|
|
47642
48098
|
}
|
|
47643
|
-
const logger$
|
|
48099
|
+
const logger$20 = getLogger("object-commands");
|
|
47644
48100
|
const SEP$1 = {
|
|
47645
48101
|
id: "",
|
|
47646
48102
|
name: "",
|
|
@@ -47696,7 +48152,7 @@ ${codeText}
|
|
|
47696
48152
|
let element = null;
|
|
47697
48153
|
const commands = [];
|
|
47698
48154
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47699
|
-
boxCommands.push(
|
|
48155
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47700
48156
|
}
|
|
47701
48157
|
if (boxCommands.length > 0) {
|
|
47702
48158
|
element = child;
|
|
@@ -47708,7 +48164,7 @@ ${codeText}
|
|
|
47708
48164
|
if (blockCommands.length > 0) {
|
|
47709
48165
|
for (let i = 0; i < blockCommands.length; i++) {
|
|
47710
48166
|
const blockCommand = blockCommands[i];
|
|
47711
|
-
element = element || targetElement || null;
|
|
48167
|
+
element = blockCommand.element || element || targetElement || null;
|
|
47712
48168
|
commands.push(...blockCommand.commands);
|
|
47713
48169
|
}
|
|
47714
48170
|
}
|
|
@@ -47726,10 +48182,10 @@ ${codeText}
|
|
|
47726
48182
|
const result = getSpecialBlockCommands(editor, block, child, "hovering-toolbar");
|
|
47727
48183
|
const { boxCommands, blockCommands } = result;
|
|
47728
48184
|
if (clientType.isMobile && child && isBox(child)) {
|
|
47729
|
-
boxCommands.push(
|
|
48185
|
+
boxCommands.push(StandardBoxCommands.mobileCreate(editor));
|
|
47730
48186
|
}
|
|
47731
48187
|
if (boxCommands.length > 0) {
|
|
47732
|
-
assert(logger$
|
|
48188
|
+
assert(logger$20, child, "child is null");
|
|
47733
48189
|
for (let i = 0; i < boxCommands.length; i++) {
|
|
47734
48190
|
if (boxCommands[i].commands.find((c) => c.id === item.id)) {
|
|
47735
48191
|
boxCommands[i].executeCommand(editor, block, child, item);
|
|
@@ -47996,18 +48452,18 @@ ${codeText}
|
|
|
47996
48452
|
}
|
|
47997
48453
|
}
|
|
47998
48454
|
const LIST_MAX_LEVEL = 8;
|
|
47999
|
-
const logger$
|
|
48000
|
-
const logger$
|
|
48455
|
+
const logger$1$ = getLogger("list-block");
|
|
48456
|
+
const logger$1_ = getLogger("list-block");
|
|
48001
48457
|
function isListBlock(block) {
|
|
48002
48458
|
return getBlockType(block) === "list";
|
|
48003
48459
|
}
|
|
48004
48460
|
function ensureIsListBlock(block) {
|
|
48005
|
-
assert(logger$
|
|
48461
|
+
assert(logger$1_, isListBlock(block), "not a list block");
|
|
48006
48462
|
}
|
|
48007
48463
|
function getListBlockType(block) {
|
|
48008
48464
|
ensureIsListBlock(block);
|
|
48009
48465
|
const type = block.getAttribute("data-list-type");
|
|
48010
|
-
assert(logger$
|
|
48466
|
+
assert(logger$1_, type, "no list type");
|
|
48011
48467
|
return type;
|
|
48012
48468
|
}
|
|
48013
48469
|
function isTextOnlyListBlock(block) {
|
|
@@ -48026,7 +48482,7 @@ ${codeText}
|
|
|
48026
48482
|
function getListBlockGroupId(block) {
|
|
48027
48483
|
ensureIsListBlock(block);
|
|
48028
48484
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48029
|
-
assert(logger$
|
|
48485
|
+
assert(logger$1_, groupId, "no group id");
|
|
48030
48486
|
return groupId;
|
|
48031
48487
|
}
|
|
48032
48488
|
function getListBlockProperties(block) {
|
|
@@ -48036,7 +48492,7 @@ ${codeText}
|
|
|
48036
48492
|
const start = (_c = Number.parseInt((_b = block.getAttribute("data-list-start")) != null ? _b : "1", 10)) != null ? _c : 1;
|
|
48037
48493
|
const level = (_e = Number.parseInt((_d = block.getAttribute("data-list-level")) != null ? _d : "1", 10)) != null ? _e : 1;
|
|
48038
48494
|
const groupId = block.getAttribute("data-list-group-id");
|
|
48039
|
-
assert(logger$
|
|
48495
|
+
assert(logger$1_, groupId, "no group id");
|
|
48040
48496
|
return {
|
|
48041
48497
|
type,
|
|
48042
48498
|
start,
|
|
@@ -48305,7 +48761,7 @@ ${codeText}
|
|
|
48305
48761
|
this.nodeMap.set(block, node);
|
|
48306
48762
|
if (parentBlock) {
|
|
48307
48763
|
const parentNode = this.nodeMap.get(parentBlock);
|
|
48308
|
-
assert(logger$
|
|
48764
|
+
assert(logger$1$, parentNode, "no parent node");
|
|
48309
48765
|
parentNode.children.push(node);
|
|
48310
48766
|
} else {
|
|
48311
48767
|
this.rootNodes.push(node);
|
|
@@ -48373,7 +48829,7 @@ ${codeText}
|
|
|
48373
48829
|
return hasClass(block, "editor-in-mindmap-first");
|
|
48374
48830
|
}
|
|
48375
48831
|
function isViewingAsMindmap(block) {
|
|
48376
|
-
assert(logger$
|
|
48832
|
+
assert(logger$1$, isListBlock(block), "not a list block");
|
|
48377
48833
|
if (hasClass(block, "editor-in-mindmap-first")) {
|
|
48378
48834
|
return true;
|
|
48379
48835
|
}
|
|
@@ -48394,12 +48850,12 @@ ${codeText}
|
|
|
48394
48850
|
const container = getParentContainer(from);
|
|
48395
48851
|
if (to) {
|
|
48396
48852
|
const container2 = getParentContainer(to);
|
|
48397
|
-
assert(logger$
|
|
48853
|
+
assert(logger$1$, container === container2, "invalid block container");
|
|
48398
48854
|
}
|
|
48399
48855
|
const fromIndex = getBlockIndex(from);
|
|
48400
48856
|
if (to) {
|
|
48401
48857
|
const toIndex = getBlockIndex(to);
|
|
48402
|
-
assert(logger$
|
|
48858
|
+
assert(logger$1$, fromIndex <= toIndex, "invalid block index");
|
|
48403
48859
|
}
|
|
48404
48860
|
addClass(from, ...styles);
|
|
48405
48861
|
if (!to || to === from) {
|
|
@@ -48407,7 +48863,7 @@ ${codeText}
|
|
|
48407
48863
|
}
|
|
48408
48864
|
let next2 = getNextBlock(from);
|
|
48409
48865
|
while (next2 !== to) {
|
|
48410
|
-
assert(logger$
|
|
48866
|
+
assert(logger$1$, next2, "no next button");
|
|
48411
48867
|
addClass(next2, ...styles);
|
|
48412
48868
|
next2 = getNextBlock(next2);
|
|
48413
48869
|
}
|
|
@@ -48418,7 +48874,7 @@ ${codeText}
|
|
|
48418
48874
|
async function requestMindmapFullscreen(editor, block, mindmapTools) {
|
|
48419
48875
|
const tools = getBlockTools(block);
|
|
48420
48876
|
const exitFullscreenButton = tools.querySelector('[data-button-id="mindmap-fullscreen"]');
|
|
48421
|
-
assert(logger$
|
|
48877
|
+
assert(logger$1$, exitFullscreenButton, "no full screen button");
|
|
48422
48878
|
const resetMindmap = () => {
|
|
48423
48879
|
setTimeout(() => {
|
|
48424
48880
|
mindmapTools.toMindmap(editor, block, {}, { reset: true, mindmapTools });
|
|
@@ -48438,7 +48894,7 @@ ${codeText}
|
|
|
48438
48894
|
try {
|
|
48439
48895
|
await exitFullscreen();
|
|
48440
48896
|
} catch (err) {
|
|
48441
|
-
logger$
|
|
48897
|
+
logger$1$.error(err);
|
|
48442
48898
|
}
|
|
48443
48899
|
onExitFullscreen();
|
|
48444
48900
|
} else {
|
|
@@ -48447,7 +48903,7 @@ ${codeText}
|
|
|
48447
48903
|
await requestFullscreen(tools);
|
|
48448
48904
|
resetMindmap();
|
|
48449
48905
|
} catch (err) {
|
|
48450
|
-
logger$
|
|
48906
|
+
logger$1$.error(err);
|
|
48451
48907
|
}
|
|
48452
48908
|
exitFullscreenButton.innerHTML = ExitFullScreenIcon;
|
|
48453
48909
|
exitFullscreenButton.setAttribute(`data-editor-tooltip-${editor.clientId}-dynamic`, i18n$1.t("mindmap.exitFullscreen"));
|
|
@@ -48728,7 +49184,7 @@ ${codeText}
|
|
|
48728
49184
|
if (!svg) {
|
|
48729
49185
|
return;
|
|
48730
49186
|
}
|
|
48731
|
-
assert(logger$
|
|
49187
|
+
assert(logger$1$, svg, "no mindmap svg");
|
|
48732
49188
|
svg.remove();
|
|
48733
49189
|
editor.domEvents.removeAllListeners(svg);
|
|
48734
49190
|
destroyMindmapButtons(editor, block);
|
|
@@ -48780,7 +49236,7 @@ ${codeText}
|
|
|
48780
49236
|
});
|
|
48781
49237
|
__publicField(this, "handleMouseEnter", () => {
|
|
48782
49238
|
const block = getParentBlock(this.toMindmapButton);
|
|
48783
|
-
assert(logger$
|
|
49239
|
+
assert(logger$1$, block && isListBlock(block), "no parent list");
|
|
48784
49240
|
highlightEntireList(this.editor, block, true);
|
|
48785
49241
|
this.currentBlock = block;
|
|
48786
49242
|
});
|
|
@@ -48792,7 +49248,7 @@ ${codeText}
|
|
|
48792
49248
|
});
|
|
48793
49249
|
__publicField(this, "handleClick", () => {
|
|
48794
49250
|
const block = getParentBlock(this.toMindmapButton);
|
|
48795
|
-
assert(logger$
|
|
49251
|
+
assert(logger$1$, block && isListBlock(block), "no parent list");
|
|
48796
49252
|
toMindmap(this.editor, block, {}, { saveData: true, selectBlock: true, mindmapTools: Mindmap });
|
|
48797
49253
|
});
|
|
48798
49254
|
this.editor = editor;
|
|
@@ -48920,11 +49376,11 @@ ${codeText}
|
|
|
48920
49376
|
}
|
|
48921
49377
|
}
|
|
48922
49378
|
function handleDropOnList(editor, draggedBlock, targetListBlock, insertPos) {
|
|
48923
|
-
logger$
|
|
49379
|
+
logger$1$.debug("drag a block on a list block");
|
|
48924
49380
|
if (!isTextKindBlock(editor, draggedBlock)) {
|
|
48925
49381
|
return false;
|
|
48926
49382
|
}
|
|
48927
|
-
assert(logger$
|
|
49383
|
+
assert(logger$1$, isListBlock(targetListBlock), "target is not a list block");
|
|
48928
49384
|
const { type, start, level, groupId } = getListBlockProperties(targetListBlock);
|
|
48929
49385
|
const newStart = insertPos === "after" ? start + 1 : start;
|
|
48930
49386
|
const oldData = editor.getBlockData(draggedBlock);
|
|
@@ -48957,7 +49413,7 @@ ${codeText}
|
|
|
48957
49413
|
return true;
|
|
48958
49414
|
}
|
|
48959
49415
|
function handleDragList(editor, draggedBlock, targetBlock, insertPos) {
|
|
48960
|
-
logger$
|
|
49416
|
+
logger$1$.debug("drag a list between text blocks");
|
|
48961
49417
|
if (insertPos === "after") {
|
|
48962
49418
|
const nextBlock = getNextBlock(targetBlock);
|
|
48963
49419
|
if (nextBlock && isListBlock(nextBlock)) {
|
|
@@ -48994,11 +49450,11 @@ ${codeText}
|
|
|
48994
49450
|
}
|
|
48995
49451
|
const { blockId } = dragData;
|
|
48996
49452
|
const draggedBlock = editor.getBlockById(blockId);
|
|
48997
|
-
assert(logger$
|
|
49453
|
+
assert(logger$1$, draggedBlock, "no dragged block");
|
|
48998
49454
|
const { isSourceBlock, targetBlock } = options;
|
|
48999
49455
|
if (!isSourceBlock && targetBlock) {
|
|
49000
|
-
assert(logger$
|
|
49001
|
-
assert(logger$
|
|
49456
|
+
assert(logger$1$, block === targetBlock, "block !== target block");
|
|
49457
|
+
assert(logger$1$, isListBlock(targetBlock), "target is not a list block");
|
|
49002
49458
|
return handleDropOnList(editor, draggedBlock, targetBlock, insertPos);
|
|
49003
49459
|
}
|
|
49004
49460
|
return handleDragList(editor, draggedBlock, targetBlock, insertPos);
|
|
@@ -49500,7 +49956,7 @@ ${codeText}
|
|
|
49500
49956
|
}
|
|
49501
49957
|
const nextBrother = getListNextBrother(block);
|
|
49502
49958
|
while (nextBlock !== nextBrother) {
|
|
49503
|
-
assert(logger$
|
|
49959
|
+
assert(logger$1$, nextBlock, "no next block");
|
|
49504
49960
|
if (isListBlock(nextBlock)) {
|
|
49505
49961
|
if (getListBlockLevel(nextBlock) > getListBlockLevel(block)) {
|
|
49506
49962
|
return nextBlock;
|
|
@@ -49599,9 +50055,9 @@ ${codeText}
|
|
|
49599
50055
|
}
|
|
49600
50056
|
return true;
|
|
49601
50057
|
}
|
|
49602
|
-
const logger$
|
|
50058
|
+
const logger$1Z = getLogger("list-block");
|
|
49603
50059
|
function cloneListData(editor, block, options) {
|
|
49604
|
-
assert(logger$
|
|
50060
|
+
assert(logger$1Z, isListBlock(block), "not a list block");
|
|
49605
50061
|
const blockData = {
|
|
49606
50062
|
...editor.getBlockData(block),
|
|
49607
50063
|
id: genId()
|
|
@@ -49676,7 +50132,7 @@ ${codeText}
|
|
|
49676
50132
|
return true;
|
|
49677
50133
|
}
|
|
49678
50134
|
function findPrevBrotherAsParent(block) {
|
|
49679
|
-
assert(logger$
|
|
50135
|
+
assert(logger$1$, isListBlock(block), "not a list block");
|
|
49680
50136
|
const { level } = getListBlockProperties(block);
|
|
49681
50137
|
let prevBlock = getPrevBlock(block);
|
|
49682
50138
|
while (prevBlock) {
|
|
@@ -49703,7 +50159,7 @@ ${codeText}
|
|
|
49703
50159
|
}
|
|
49704
50160
|
function findPrevBrother(editor, fromBlock, toParentBlock) {
|
|
49705
50161
|
let prevBlock = getPrevBlock(fromBlock);
|
|
49706
|
-
assert(logger$
|
|
50162
|
+
assert(logger$1$, prevBlock, "no prev brother");
|
|
49707
50163
|
const parentLevel = getListBlockLevel(toParentBlock);
|
|
49708
50164
|
while (prevBlock) {
|
|
49709
50165
|
if (prevBlock === toParentBlock) {
|
|
@@ -49724,7 +50180,7 @@ ${codeText}
|
|
|
49724
50180
|
}
|
|
49725
50181
|
ensureIsListBlock(block);
|
|
49726
50182
|
const prevBrother = findPrevBrotherAsParent(block);
|
|
49727
|
-
assert(logger$
|
|
50183
|
+
assert(logger$1$, prevBrother, "no list prev brother");
|
|
49728
50184
|
const newParent = prevBrother;
|
|
49729
50185
|
const newBrother = findPrevBrother(editor, block, newParent);
|
|
49730
50186
|
const level = getListBlockLevel(newParent) + 1;
|
|
@@ -49923,14 +50379,14 @@ ${codeText}
|
|
|
49923
50379
|
this.editor.removeListener("afterClearSelection", this.handleAfterClearSelection);
|
|
49924
50380
|
}
|
|
49925
50381
|
}
|
|
49926
|
-
const logger$
|
|
50382
|
+
const logger$1Y = getLogger("customize-list-start-menu");
|
|
49927
50383
|
class CustomizeListStartDialog {
|
|
49928
50384
|
constructor(editor) {
|
|
49929
50385
|
__publicField(this, "popup");
|
|
49930
50386
|
__publicField(this, "block", null);
|
|
49931
50387
|
__publicField(this, "show", (editor, block) => {
|
|
49932
50388
|
const listBlockMarker = block.querySelector("div.list-container");
|
|
49933
|
-
assert(logger$
|
|
50389
|
+
assert(logger$1Y, listBlockMarker, "list-block mark does not exist");
|
|
49934
50390
|
this.block = block;
|
|
49935
50391
|
this.popup.manualShow(listBlockMarker, {
|
|
49936
50392
|
theme: "light"
|
|
@@ -50088,7 +50544,7 @@ ${codeText}
|
|
|
50088
50544
|
const listContainer = findTarget(event, "div.list-container");
|
|
50089
50545
|
if (listContainer && this.editor.isWritable()) {
|
|
50090
50546
|
const block = getParentBlock(listContainer);
|
|
50091
|
-
assert(logger$
|
|
50547
|
+
assert(logger$1$, block, "no parent block");
|
|
50092
50548
|
ensureIsListBlock(block);
|
|
50093
50549
|
const blockData = editor.getBlockData(block);
|
|
50094
50550
|
if (blockData && blockData.checkbox) {
|
|
@@ -50228,7 +50684,7 @@ ${codeText}
|
|
|
50228
50684
|
}
|
|
50229
50685
|
return blockContent;
|
|
50230
50686
|
}
|
|
50231
|
-
const zhCN$
|
|
50687
|
+
const zhCN$s = {
|
|
50232
50688
|
list: {
|
|
50233
50689
|
confirm: "\u786E\u5B9A",
|
|
50234
50690
|
setStart: "\u8BBE\u7F6E\u7F16\u53F7",
|
|
@@ -50248,7 +50704,7 @@ ${codeText}
|
|
|
50248
50704
|
exitFullscreen: "\u9000\u51FA\u5168\u5C4F"
|
|
50249
50705
|
}
|
|
50250
50706
|
};
|
|
50251
|
-
const enUS$
|
|
50707
|
+
const enUS$s = {
|
|
50252
50708
|
list: {
|
|
50253
50709
|
confirm: "Confirm",
|
|
50254
50710
|
setStart: "Set number",
|
|
@@ -50268,7 +50724,7 @@ ${codeText}
|
|
|
50268
50724
|
exitFullscreen: "Exit full screen"
|
|
50269
50725
|
}
|
|
50270
50726
|
};
|
|
50271
|
-
const jaJP$
|
|
50727
|
+
const jaJP$s = {
|
|
50272
50728
|
list: {
|
|
50273
50729
|
confirm: "OK",
|
|
50274
50730
|
setStart: "\u756A\u53F7\u3092\u8A2D\u5B9A",
|
|
@@ -50289,12 +50745,12 @@ ${codeText}
|
|
|
50289
50745
|
}
|
|
50290
50746
|
};
|
|
50291
50747
|
i18n$1.mergeLang({
|
|
50292
|
-
"zh-CN": zhCN$
|
|
50293
|
-
"en-US": enUS$
|
|
50294
|
-
"ja-JP": jaJP$
|
|
50748
|
+
"zh-CN": zhCN$s,
|
|
50749
|
+
"en-US": enUS$s,
|
|
50750
|
+
"ja-JP": jaJP$s
|
|
50295
50751
|
});
|
|
50296
|
-
const style$
|
|
50297
|
-
const logger$
|
|
50752
|
+
const style$8 = "";
|
|
50753
|
+
const logger$1X = getLogger("list-block:paste-handler");
|
|
50298
50754
|
class ListPasteHandler {
|
|
50299
50755
|
constructor() {
|
|
50300
50756
|
__publicField(this, "fixStartByList", null);
|
|
@@ -50348,7 +50804,7 @@ ${codeText}
|
|
|
50348
50804
|
startIds.set(newGroupId, 1);
|
|
50349
50805
|
} else {
|
|
50350
50806
|
const start = startIds.get(groupId);
|
|
50351
|
-
assert(logger$
|
|
50807
|
+
assert(logger$1X, start, "start is null");
|
|
50352
50808
|
block.start = start + 1;
|
|
50353
50809
|
block.groupId = groupId;
|
|
50354
50810
|
startIds.set(groupId, start + 1);
|
|
@@ -50368,7 +50824,7 @@ ${codeText}
|
|
|
50368
50824
|
return false;
|
|
50369
50825
|
}
|
|
50370
50826
|
}
|
|
50371
|
-
const logger$
|
|
50827
|
+
const logger$1W = getLogger("list selection to doc");
|
|
50372
50828
|
function convertListToText(data2) {
|
|
50373
50829
|
const textData = { type: "text" };
|
|
50374
50830
|
Object.entries(data2).forEach(([key, value]) => {
|
|
@@ -50383,7 +50839,7 @@ ${codeText}
|
|
|
50383
50839
|
const data2 = cloneDeep__default.default(editorGetBlockData(editor, selectedBlock.block));
|
|
50384
50840
|
const start = selectedBlock.start;
|
|
50385
50841
|
const end = selectedBlock.end;
|
|
50386
|
-
assert(logger$
|
|
50842
|
+
assert(logger$1W, data2.text, "no block text");
|
|
50387
50843
|
const len = getBlockTextLength$6(editor, selectedBlock.block);
|
|
50388
50844
|
if (end.offset - start.offset === len) {
|
|
50389
50845
|
return {
|
|
@@ -50959,7 +51415,7 @@ ${codeText}
|
|
|
50959
51415
|
toolbar2 == null ? void 0 : toolbar2.enableTextToolbar();
|
|
50960
51416
|
}, 300);
|
|
50961
51417
|
};
|
|
50962
|
-
const logger$
|
|
51418
|
+
const logger$1V = getLogger("inline-box-items");
|
|
50963
51419
|
function insertEmptyBlockLink(editor, containerId, blockIndex) {
|
|
50964
51420
|
let block = editor.findBlockByIndex(containerId, blockIndex);
|
|
50965
51421
|
let placement = "bottom-start";
|
|
@@ -50970,7 +51426,7 @@ ${codeText}
|
|
|
50970
51426
|
const onFinished = (linkText, linkUrl) => {
|
|
50971
51427
|
editor.undoManager.runInGroup(() => {
|
|
50972
51428
|
try {
|
|
50973
|
-
assert(logger$
|
|
51429
|
+
assert(logger$1V, block, "block not found");
|
|
50974
51430
|
if (!isEmptyTextBlock(editor, block)) {
|
|
50975
51431
|
block = editor.insertTextBlock([], containerId, blockIndex);
|
|
50976
51432
|
}
|
|
@@ -50981,7 +51437,7 @@ ${codeText}
|
|
|
50981
51437
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
50982
51438
|
editor.focus();
|
|
50983
51439
|
} catch (error2) {
|
|
50984
|
-
logger$
|
|
51440
|
+
logger$1V.error(error2);
|
|
50985
51441
|
}
|
|
50986
51442
|
});
|
|
50987
51443
|
};
|
|
@@ -51001,7 +51457,7 @@ ${codeText}
|
|
|
51001
51457
|
function insertLink(editor, containerId, blockIndex) {
|
|
51002
51458
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
51003
51459
|
const range = editor.selection.range;
|
|
51004
|
-
assert(logger$
|
|
51460
|
+
assert(logger$1V, isSimpleBlockPosition(range.start), "invalid block position");
|
|
51005
51461
|
const rects = getBlockClientRects(editor, block, range);
|
|
51006
51462
|
if (rects.length === 0) {
|
|
51007
51463
|
return;
|
|
@@ -51027,7 +51483,7 @@ ${codeText}
|
|
|
51027
51483
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
51028
51484
|
editor.focus();
|
|
51029
51485
|
} catch (error2) {
|
|
51030
|
-
logger$
|
|
51486
|
+
logger$1V.error(error2);
|
|
51031
51487
|
}
|
|
51032
51488
|
});
|
|
51033
51489
|
};
|
|
@@ -51245,7 +51701,7 @@ ${codeText}
|
|
|
51245
51701
|
function getToolbar(editor) {
|
|
51246
51702
|
return editor.findCustom("toolbar-handler");
|
|
51247
51703
|
}
|
|
51248
|
-
const logger$
|
|
51704
|
+
const logger$1U = getLogger("link-popup");
|
|
51249
51705
|
function getLinkHref(child) {
|
|
51250
51706
|
var _a, _b;
|
|
51251
51707
|
return (_b = (_a = child.getAttribute("link")) != null ? _a : child.textContent) != null ? _b : "";
|
|
@@ -51283,7 +51739,7 @@ ${codeText}
|
|
|
51283
51739
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
51284
51740
|
editor.focus();
|
|
51285
51741
|
} catch (error2) {
|
|
51286
|
-
logger$
|
|
51742
|
+
logger$1U.error(error2);
|
|
51287
51743
|
}
|
|
51288
51744
|
};
|
|
51289
51745
|
const onClose = () => {
|
|
@@ -51522,7 +51978,7 @@ ${codeText}
|
|
|
51522
51978
|
this.editProvider = new EditLinkProvider();
|
|
51523
51979
|
}
|
|
51524
51980
|
}
|
|
51525
|
-
const logger$
|
|
51981
|
+
const logger$1T = getLogger("readonly-toolbar");
|
|
51526
51982
|
const SEP = {
|
|
51527
51983
|
id: "",
|
|
51528
51984
|
name: "",
|
|
@@ -51585,7 +52041,7 @@ ${codeText}
|
|
|
51585
52041
|
});
|
|
51586
52042
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51587
52043
|
var _a;
|
|
51588
|
-
assert(logger$
|
|
52044
|
+
assert(logger$1T, editor === this.editor, "editor mismatch");
|
|
51589
52045
|
if (!editor.readonly) {
|
|
51590
52046
|
this.toolbar.close("selectionChange");
|
|
51591
52047
|
return;
|
|
@@ -51767,7 +52223,7 @@ ${codeText}
|
|
|
51767
52223
|
return visible;
|
|
51768
52224
|
}
|
|
51769
52225
|
}
|
|
51770
|
-
const logger$
|
|
52226
|
+
const logger$1S = getLogger("toolbar-handler");
|
|
51771
52227
|
class OnesEditorToolbar {
|
|
51772
52228
|
constructor(editor) {
|
|
51773
52229
|
__publicField(this, "id", "editor-toolbar");
|
|
@@ -51854,7 +52310,7 @@ ${codeText}
|
|
|
51854
52310
|
});
|
|
51855
52311
|
__publicField(this, "handleSelectionChange", debounce__default.default((editor) => {
|
|
51856
52312
|
var _a;
|
|
51857
|
-
assert(logger$
|
|
52313
|
+
assert(logger$1S, editor === this.editor, "editor mismatch");
|
|
51858
52314
|
if (editor.selection.range.isCollapsed() || this.mouseDown) {
|
|
51859
52315
|
if (this.toolbarType === "object") {
|
|
51860
52316
|
const element = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.reference;
|
|
@@ -52074,8 +52530,15 @@ ${codeText}
|
|
|
52074
52530
|
}
|
|
52075
52531
|
}
|
|
52076
52532
|
const getReferenceClientRectByCaret = () => {
|
|
52533
|
+
if (!this.hoveringBlock) {
|
|
52534
|
+
return new DOMRect();
|
|
52535
|
+
}
|
|
52536
|
+
const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
|
|
52537
|
+
if (!element2) {
|
|
52538
|
+
return new DOMRect();
|
|
52539
|
+
}
|
|
52077
52540
|
let rect;
|
|
52078
|
-
const clientRects =
|
|
52541
|
+
const clientRects = element2.getClientRects();
|
|
52079
52542
|
const lineRects = [];
|
|
52080
52543
|
Array.from(clientRects).forEach((clientRect) => {
|
|
52081
52544
|
const { y } = clientRect;
|
|
@@ -52085,7 +52548,7 @@ ${codeText}
|
|
|
52085
52548
|
lineRects.push(y);
|
|
52086
52549
|
});
|
|
52087
52550
|
if (lineRects.length > 1) {
|
|
52088
|
-
rect =
|
|
52551
|
+
rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
|
|
52089
52552
|
if (event) {
|
|
52090
52553
|
for (let i = 0; i < clientRects.length; i++) {
|
|
52091
52554
|
const clientRect = clientRects[i];
|
|
@@ -52097,21 +52560,15 @@ ${codeText}
|
|
|
52097
52560
|
}
|
|
52098
52561
|
}
|
|
52099
52562
|
} else {
|
|
52100
|
-
rect =
|
|
52101
|
-
if (
|
|
52102
|
-
const childRect =
|
|
52563
|
+
rect = element2.getBoundingClientRect();
|
|
52564
|
+
if (!isBlock$1(element2)) {
|
|
52565
|
+
const childRect = element2.getBoundingClientRect();
|
|
52103
52566
|
return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
|
|
52104
52567
|
}
|
|
52105
52568
|
if (clientRects.length === 1) {
|
|
52106
52569
|
return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
|
|
52107
52570
|
}
|
|
52108
52571
|
}
|
|
52109
|
-
if (this.hoveringBlock) {
|
|
52110
|
-
const blockContent = getBlockContent(this.hoveringBlock);
|
|
52111
|
-
if (blockContent !== element) {
|
|
52112
|
-
return blockContent.getBoundingClientRect();
|
|
52113
|
-
}
|
|
52114
|
-
}
|
|
52115
52572
|
if (event) {
|
|
52116
52573
|
const y = rect.y;
|
|
52117
52574
|
const x = event.clientX;
|
|
@@ -52121,8 +52578,9 @@ ${codeText}
|
|
|
52121
52578
|
};
|
|
52122
52579
|
this.toolbar.updateItems(commands);
|
|
52123
52580
|
if (!this.toolbar.isVisible) {
|
|
52581
|
+
const isText = element === child && !isTextBlockContentBoxChild(element);
|
|
52124
52582
|
this.toolbar.manualShow(element, {
|
|
52125
|
-
placement:
|
|
52583
|
+
placement: isText && !clientType.isMobile ? "bottom" : "top",
|
|
52126
52584
|
getReferenceClientRect: getReferenceClientRectByCaret
|
|
52127
52585
|
});
|
|
52128
52586
|
if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
|
|
@@ -52173,7 +52631,7 @@ ${codeText}
|
|
|
52173
52631
|
this.texWidth = [tex, width];
|
|
52174
52632
|
}
|
|
52175
52633
|
}
|
|
52176
|
-
const logger$
|
|
52634
|
+
const logger$1R = getLogger("mathjax-converter");
|
|
52177
52635
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
52178
52636
|
const MATHJAX_BUFFER = 30;
|
|
52179
52637
|
const REDUCED_UNIT = 8;
|
|
@@ -52222,7 +52680,7 @@ ${codeText}
|
|
|
52222
52680
|
const svg = result.querySelector("svg");
|
|
52223
52681
|
return svg.outerHTML;
|
|
52224
52682
|
} catch (err) {
|
|
52225
|
-
logger$
|
|
52683
|
+
logger$1R.error(err);
|
|
52226
52684
|
throw err;
|
|
52227
52685
|
} finally {
|
|
52228
52686
|
lockers.release(lockId);
|
|
@@ -52270,7 +52728,7 @@ ${codeText}
|
|
|
52270
52728
|
...perfectState
|
|
52271
52729
|
};
|
|
52272
52730
|
}
|
|
52273
|
-
const logger$
|
|
52731
|
+
const logger$1Q = getLogger("edit-mathjax");
|
|
52274
52732
|
class MathjaxEditor {
|
|
52275
52733
|
constructor() {
|
|
52276
52734
|
__publicField(this, "editMathjaxPopup", null);
|
|
@@ -52347,9 +52805,9 @@ ${codeText}
|
|
|
52347
52805
|
this.observer.observe(textarea2);
|
|
52348
52806
|
}
|
|
52349
52807
|
getTextarea() {
|
|
52350
|
-
assert(logger$
|
|
52808
|
+
assert(logger$1Q, this.editMathjaxPopup, "no exists mathjax editor popup");
|
|
52351
52809
|
const textarea2 = this.editMathjaxPopup.content.querySelector("textarea");
|
|
52352
|
-
assert(logger$
|
|
52810
|
+
assert(logger$1Q, textarea2, "no textarea");
|
|
52353
52811
|
return textarea2;
|
|
52354
52812
|
}
|
|
52355
52813
|
destroy() {
|
|
@@ -52419,7 +52877,7 @@ ${codeText}
|
|
|
52419
52877
|
};
|
|
52420
52878
|
editMathjax(editor, box, data2.tex, update2);
|
|
52421
52879
|
}
|
|
52422
|
-
const logger$
|
|
52880
|
+
const logger$1P = getLogger("mathjax-box");
|
|
52423
52881
|
function updateCaret(editor, event) {
|
|
52424
52882
|
editor.selection.updateSelection(null);
|
|
52425
52883
|
const target = event.target;
|
|
@@ -52524,7 +52982,7 @@ ${codeText}
|
|
|
52524
52982
|
};
|
|
52525
52983
|
editor.updateBoxData(newData);
|
|
52526
52984
|
}).catch((err) => {
|
|
52527
|
-
logger$
|
|
52985
|
+
logger$1P.error(`failed to convert and upload mathjax: ${JSON.stringify(err)}`);
|
|
52528
52986
|
});
|
|
52529
52987
|
return data2;
|
|
52530
52988
|
}
|
|
@@ -52543,7 +53001,7 @@ ${codeText}
|
|
|
52543
53001
|
}
|
|
52544
53002
|
function handleClickBox$3(editor, box, event) {
|
|
52545
53003
|
const parentBlock = getParentBlock(box);
|
|
52546
|
-
assert(logger$
|
|
53004
|
+
assert(logger$1P, parentBlock, "failed to get block");
|
|
52547
53005
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
52548
53006
|
return;
|
|
52549
53007
|
}
|
|
@@ -52740,28 +53198,28 @@ $$${mathData.mathjaxText}$$
|
|
|
52740
53198
|
getBlockProperties: getBlockProperties$b
|
|
52741
53199
|
};
|
|
52742
53200
|
const mathjaxStyle = "";
|
|
52743
|
-
const zhCN$
|
|
53201
|
+
const zhCN$r = {
|
|
52744
53202
|
mathjax: {
|
|
52745
53203
|
emptyText: "\u7A7A\u7684\u516C\u5F0F",
|
|
52746
53204
|
abstract: "\u516C\u5F0F"
|
|
52747
53205
|
}
|
|
52748
53206
|
};
|
|
52749
|
-
const enUS$
|
|
53207
|
+
const enUS$r = {
|
|
52750
53208
|
mathjax: {
|
|
52751
53209
|
emptyText: "Empty formula",
|
|
52752
53210
|
abstract: "Formula"
|
|
52753
53211
|
}
|
|
52754
53212
|
};
|
|
52755
|
-
const jaJP$
|
|
53213
|
+
const jaJP$r = {
|
|
52756
53214
|
mathjax: {
|
|
52757
53215
|
emptyText: "\u6570\u5F0F\u306A\u3057",
|
|
52758
53216
|
abstract: "\u6570\u5F0F"
|
|
52759
53217
|
}
|
|
52760
53218
|
};
|
|
52761
53219
|
i18n$1.mergeLang({
|
|
52762
|
-
"zh-CN": zhCN$
|
|
52763
|
-
"en-US": enUS$
|
|
52764
|
-
"ja-JP": jaJP$
|
|
53220
|
+
"zh-CN": zhCN$r,
|
|
53221
|
+
"en-US": enUS$r,
|
|
53222
|
+
"ja-JP": jaJP$r
|
|
52765
53223
|
});
|
|
52766
53224
|
function convertToMath(editor, containerId, blockIndex, offset) {
|
|
52767
53225
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -58295,7 +58753,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58295
58753
|
const docBlockText = { insert: " ", attributes: data2 };
|
|
58296
58754
|
return docBlockText;
|
|
58297
58755
|
}
|
|
58298
|
-
const logger$
|
|
58756
|
+
const logger$1O = getLogger("StatusBoxEditor");
|
|
58299
58757
|
class StatusBoxEditor {
|
|
58300
58758
|
constructor(editor) {
|
|
58301
58759
|
__publicField(this, "linkPopup", null);
|
|
@@ -58318,10 +58776,10 @@ $$${mathData.mathjaxText}$$
|
|
|
58318
58776
|
});
|
|
58319
58777
|
__publicField(this, "handClose", () => {
|
|
58320
58778
|
var _a;
|
|
58321
|
-
assert(logger$
|
|
58779
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58322
58780
|
const boxData = this.editor.getBoxData(this.boxElement);
|
|
58323
58781
|
const block = getParentBlock(this.boxElement);
|
|
58324
|
-
assert(logger$
|
|
58782
|
+
assert(logger$1O, block, "block not found");
|
|
58325
58783
|
if (!boxData.title) {
|
|
58326
58784
|
const offset = getChildOffset(block, this.boxElement);
|
|
58327
58785
|
this.editor.deleteTextFromBlock(block, offset.start, 1);
|
|
@@ -58359,7 +58817,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58359
58817
|
return;
|
|
58360
58818
|
}
|
|
58361
58819
|
const color = lodash.exports.capitalize(e2.target.getAttribute("data-color"));
|
|
58362
|
-
assert(logger$
|
|
58820
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58363
58821
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58364
58822
|
this.statusPalette.changeColor(color);
|
|
58365
58823
|
const newData = { ...data2, color };
|
|
@@ -58376,7 +58834,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58376
58834
|
});
|
|
58377
58835
|
__publicField(this, "onTitleChange", (e2) => {
|
|
58378
58836
|
const title = e2.target.value;
|
|
58379
|
-
assert(logger$
|
|
58837
|
+
assert(logger$1O, this.boxElement, "boxElement not found");
|
|
58380
58838
|
const data2 = this.editor.getBoxData(this.boxElement);
|
|
58381
58839
|
const newData = { ...data2, title: title.trim() };
|
|
58382
58840
|
this.editor.updateBoxData(newData, { noFocus: true });
|
|
@@ -58457,7 +58915,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58457
58915
|
toStandardText: toStandardText$1,
|
|
58458
58916
|
matchText: matchText$1
|
|
58459
58917
|
};
|
|
58460
|
-
const logger$
|
|
58918
|
+
const logger$1N = getLogger("status-box-command");
|
|
58461
58919
|
class StatusBoxCommand {
|
|
58462
58920
|
static get commands() {
|
|
58463
58921
|
return [
|
|
@@ -58476,7 +58934,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58476
58934
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58477
58935
|
const boxOp = createEmptyStatusBox();
|
|
58478
58936
|
const { start } = editor.selection.range;
|
|
58479
|
-
assert(logger$
|
|
58937
|
+
assert(logger$1N, isSimpleBlockPosition(start), "invalid block position");
|
|
58480
58938
|
editor.insertBoxToBlock(block, start.offset, boxOp.attributes);
|
|
58481
58939
|
const box = editor.getBoxById((_a = boxOp.attributes) == null ? void 0 : _a.id);
|
|
58482
58940
|
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2)).editorStatus(box);
|
|
@@ -58495,7 +58953,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58495
58953
|
}
|
|
58496
58954
|
}
|
|
58497
58955
|
__publicField(StatusBoxCommand, "id", "insert-status");
|
|
58498
|
-
const enUS$
|
|
58956
|
+
const enUS$q = {
|
|
58499
58957
|
status: {
|
|
58500
58958
|
empty: "Set status",
|
|
58501
58959
|
command: {
|
|
@@ -58519,7 +58977,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58519
58977
|
}
|
|
58520
58978
|
}
|
|
58521
58979
|
};
|
|
58522
|
-
const zhCN$
|
|
58980
|
+
const zhCN$q = {
|
|
58523
58981
|
status: {
|
|
58524
58982
|
empty: "\u8BBE\u7F6E\u72B6\u6001",
|
|
58525
58983
|
command: {
|
|
@@ -58543,7 +59001,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58543
59001
|
}
|
|
58544
59002
|
}
|
|
58545
59003
|
};
|
|
58546
|
-
const jaJP$
|
|
59004
|
+
const jaJP$q = {
|
|
58547
59005
|
status: {
|
|
58548
59006
|
empty: "\u30B9\u30C6\u30FC\u30BF\u30B9\u3092\u8A2D\u5B9A",
|
|
58549
59007
|
command: {
|
|
@@ -58568,12 +59026,12 @@ $$${mathData.mathjaxText}$$
|
|
|
58568
59026
|
}
|
|
58569
59027
|
};
|
|
58570
59028
|
const langs$2 = {
|
|
58571
|
-
"en-US": enUS$
|
|
58572
|
-
"zh-CN": zhCN$
|
|
58573
|
-
"ja-JP": jaJP$
|
|
59029
|
+
"en-US": enUS$q,
|
|
59030
|
+
"zh-CN": zhCN$q,
|
|
59031
|
+
"ja-JP": jaJP$q
|
|
58574
59032
|
};
|
|
58575
59033
|
i18n$1.mergeLang(langs$2);
|
|
58576
|
-
const logger$
|
|
59034
|
+
const logger$1M = getLogger("inline-box-items");
|
|
58577
59035
|
function insertEmptyBlockMath(editor, containerId, blockIndex) {
|
|
58578
59036
|
return editor.undoManager.runInGroup(() => {
|
|
58579
59037
|
var _a;
|
|
@@ -58584,7 +59042,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58584
59042
|
const boxOp = createEmptyMathjaxBox();
|
|
58585
59043
|
editor.setBlockText(block, [boxOp]);
|
|
58586
59044
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58587
|
-
assert(logger$
|
|
59045
|
+
assert(logger$1M, boxId, "mathjax box id is empty");
|
|
58588
59046
|
setTimeout(() => {
|
|
58589
59047
|
const box = editor.getBoxById(boxId);
|
|
58590
59048
|
editMathjaxBox(editor, box);
|
|
@@ -58597,11 +59055,11 @@ $$${mathData.mathjaxText}$$
|
|
|
58597
59055
|
var _a;
|
|
58598
59056
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
58599
59057
|
const range = editor.selection.range;
|
|
58600
|
-
assert(logger$
|
|
59058
|
+
assert(logger$1M, isSimpleBlockPosition(range.start), "invalid block position");
|
|
58601
59059
|
const boxOp = createEmptyMathjaxBox();
|
|
58602
59060
|
editor.insertBoxToBlock(block, range.start.offset, boxOp.attributes);
|
|
58603
59061
|
const boxId = (_a = boxOp.attributes) == null ? void 0 : _a.id;
|
|
58604
|
-
assert(logger$
|
|
59062
|
+
assert(logger$1M, boxId, "mathjax box id is empty");
|
|
58605
59063
|
setTimeout(() => {
|
|
58606
59064
|
const box = editor.getBoxById(boxId);
|
|
58607
59065
|
editMathjaxBox(editor, box);
|
|
@@ -58768,7 +59226,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58768
59226
|
}
|
|
58769
59227
|
}
|
|
58770
59228
|
};
|
|
58771
|
-
const logger$
|
|
59229
|
+
const logger$1L = getLogger("insert-menu");
|
|
58772
59230
|
const injectGroup = (commands, group, startIndex) => {
|
|
58773
59231
|
commands.forEach((command, index2) => {
|
|
58774
59232
|
command.group = group;
|
|
@@ -58907,7 +59365,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58907
59365
|
return true;
|
|
58908
59366
|
}
|
|
58909
59367
|
const blockId = getBlockId(block);
|
|
58910
|
-
assert(logger$
|
|
59368
|
+
assert(logger$1L, range.isSimple(), "invalid range");
|
|
58911
59369
|
const offset = range.start.offset;
|
|
58912
59370
|
if (quickItem.commandProvider) {
|
|
58913
59371
|
const params2 = { from: "quick-menu", blockId, offset };
|
|
@@ -58943,7 +59401,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58943
59401
|
});
|
|
58944
59402
|
}
|
|
58945
59403
|
}
|
|
58946
|
-
const logger$
|
|
59404
|
+
const logger$1K = getLogger("quick-command-providers");
|
|
58947
59405
|
class QuickCommandProviders extends AbstractProvider {
|
|
58948
59406
|
constructor(editor) {
|
|
58949
59407
|
super(editor);
|
|
@@ -58963,7 +59421,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58963
59421
|
}
|
|
58964
59422
|
getCommands(range) {
|
|
58965
59423
|
var _a, _b;
|
|
58966
|
-
assert(logger$
|
|
59424
|
+
assert(logger$1K, range.start.blockId === range.end.blockId, "invalid range");
|
|
58967
59425
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
58968
59426
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
58969
59427
|
const container = getParentContainer(block);
|
|
@@ -59032,7 +59490,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59032
59490
|
});
|
|
59033
59491
|
__publicField(this, "onClose", () => {
|
|
59034
59492
|
this.firstEmptyOffset = -1;
|
|
59035
|
-
if (shouldFocusToEditor(this.editor)
|
|
59493
|
+
if (shouldFocusToEditor(this.editor)) {
|
|
59036
59494
|
this.editor.focus({ preventScroll: true });
|
|
59037
59495
|
}
|
|
59038
59496
|
});
|
|
@@ -59308,9 +59766,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59308
59766
|
if (target.hasAttribute("data-editor-overflow-tooltip")) {
|
|
59309
59767
|
if (this.check(target)) {
|
|
59310
59768
|
const title = target.getAttribute("data-editor-overflow-tooltip");
|
|
59311
|
-
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
|
|
59769
|
+
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`, title);
|
|
59312
59770
|
} else {
|
|
59313
|
-
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
|
|
59771
|
+
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}-dynamic`);
|
|
59314
59772
|
}
|
|
59315
59773
|
}
|
|
59316
59774
|
});
|
|
@@ -59400,7 +59858,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59400
59858
|
"CtrlOrCmd+K": (editor) => executeShortcut(editor, "link"),
|
|
59401
59859
|
...headingShortcut()
|
|
59402
59860
|
};
|
|
59403
|
-
const zhCN$
|
|
59861
|
+
const zhCN$p = {
|
|
59404
59862
|
quickMenu: {
|
|
59405
59863
|
basic: {
|
|
59406
59864
|
heading: {
|
|
@@ -59456,7 +59914,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59456
59914
|
selectBlock: "\u9009\u62E9\u533A\u5757"
|
|
59457
59915
|
}
|
|
59458
59916
|
};
|
|
59459
|
-
const enUS$
|
|
59917
|
+
const enUS$p = {
|
|
59460
59918
|
quickMenu: {
|
|
59461
59919
|
basic: {
|
|
59462
59920
|
heading: {
|
|
@@ -59512,7 +59970,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59512
59970
|
selectBlock: "Select Block"
|
|
59513
59971
|
}
|
|
59514
59972
|
};
|
|
59515
|
-
const jaJP$
|
|
59973
|
+
const jaJP$p = {
|
|
59516
59974
|
quickMenu: {
|
|
59517
59975
|
basic: {
|
|
59518
59976
|
heading: {
|
|
@@ -59569,9 +60027,9 @@ $$${mathData.mathjaxText}$$
|
|
|
59569
60027
|
}
|
|
59570
60028
|
};
|
|
59571
60029
|
i18n$1.mergeLang({
|
|
59572
|
-
"zh-CN": zhCN$
|
|
59573
|
-
"en-US": enUS$
|
|
59574
|
-
"ja-JP": jaJP$
|
|
60030
|
+
"zh-CN": zhCN$p,
|
|
60031
|
+
"en-US": enUS$p,
|
|
60032
|
+
"ja-JP": jaJP$p
|
|
59575
60033
|
});
|
|
59576
60034
|
class TextStylesFixedProvider extends ProxyProvider {
|
|
59577
60035
|
constructor(editor, afterCommandCallback) {
|
|
@@ -59776,7 +60234,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59776
60234
|
return false;
|
|
59777
60235
|
}
|
|
59778
60236
|
}
|
|
59779
|
-
const logger$
|
|
60237
|
+
const logger$1J = getLogger("block-command-providers");
|
|
59780
60238
|
class BlockCommandProviders extends AbstractProvider {
|
|
59781
60239
|
constructor(editor, afterCommandCallback) {
|
|
59782
60240
|
super(editor);
|
|
@@ -59797,7 +60255,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59797
60255
|
this.registerCommandProvider(new InsertGroupProvider(editor));
|
|
59798
60256
|
}
|
|
59799
60257
|
getCommands(range) {
|
|
59800
|
-
assert(logger$
|
|
60258
|
+
assert(logger$1J, range.start.blockId === range.end.blockId, "invalid range");
|
|
59801
60259
|
const block = this.editor.getBlockById(range.anchor.blockId);
|
|
59802
60260
|
const commandsMap = /* @__PURE__ */ new Map();
|
|
59803
60261
|
let startIndex = 100;
|
|
@@ -59811,7 +60269,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59811
60269
|
return this.filterItems(range, commands);
|
|
59812
60270
|
}
|
|
59813
60271
|
}
|
|
59814
|
-
const logger$
|
|
60272
|
+
const logger$1I = getLogger("standard-block-actions");
|
|
59815
60273
|
class StandardBlockActionHook {
|
|
59816
60274
|
constructor() {
|
|
59817
60275
|
__publicField(this, "executeCommand", (editor, bloockElement, item) => {
|
|
@@ -59830,7 +60288,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59830
60288
|
this.deleteBlock(editor, block);
|
|
59831
60289
|
}
|
|
59832
60290
|
} catch (err) {
|
|
59833
|
-
logger$
|
|
60291
|
+
logger$1I.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
59834
60292
|
}
|
|
59835
60293
|
});
|
|
59836
60294
|
}
|
|
@@ -59898,7 +60356,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59898
60356
|
}
|
|
59899
60357
|
}
|
|
59900
60358
|
}
|
|
59901
|
-
const logger$
|
|
60359
|
+
const logger$1H = getLogger("block-menu");
|
|
59902
60360
|
class BlockMenu {
|
|
59903
60361
|
constructor(editor) {
|
|
59904
60362
|
__publicField(this, "menu");
|
|
@@ -59906,7 +60364,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59906
60364
|
__publicField(this, "commandBlock", null);
|
|
59907
60365
|
__publicField(this, "blockCommandProviders");
|
|
59908
60366
|
__publicField(this, "handleShow", () => {
|
|
59909
|
-
assert(logger$
|
|
60367
|
+
assert(logger$1H, this.currentBlock, "no target block before show block menu");
|
|
59910
60368
|
const items = this.blockCommandProviders.getCommands(this.editor.selection.range);
|
|
59911
60369
|
this.menu.updateItems(items);
|
|
59912
60370
|
this.commandBlock = this.currentBlock;
|
|
@@ -59917,7 +60375,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59917
60375
|
}
|
|
59918
60376
|
});
|
|
59919
60377
|
__publicField(this, "handleItemClick", (bar2, item) => {
|
|
59920
|
-
assert(logger$
|
|
60378
|
+
assert(logger$1H, this.commandBlock, "no command block before show block menu");
|
|
59921
60379
|
this.blockCommandProviders.executeCommand(this.editor.selection.range, item);
|
|
59922
60380
|
if (!item.element) {
|
|
59923
60381
|
this.close();
|
|
@@ -59960,7 +60418,7 @@ $$${mathData.mathjaxText}$$
|
|
|
59960
60418
|
this.menu.destroy();
|
|
59961
60419
|
}
|
|
59962
60420
|
}
|
|
59963
|
-
const logger$
|
|
60421
|
+
const logger$1G = getLogger("text-styles");
|
|
59964
60422
|
function getIntersectionStyles(text2) {
|
|
59965
60423
|
const getOpStyle = (op) => {
|
|
59966
60424
|
if (!op.attributes) {
|
|
@@ -59994,10 +60452,10 @@ $$${mathData.mathjaxText}$$
|
|
|
59994
60452
|
return new Map(Object.entries(attributes));
|
|
59995
60453
|
}
|
|
59996
60454
|
function applyTextStyle(editor, block, range, style2, value) {
|
|
59997
|
-
assert(logger$
|
|
60455
|
+
assert(logger$1G, range.isSimple(), "invalid range");
|
|
59998
60456
|
const { start, end } = range;
|
|
59999
|
-
assert(logger$
|
|
60000
|
-
assert(logger$
|
|
60457
|
+
assert(logger$1G, start.blockId === end.blockId && start.blockId === getBlockId(block), "invalid range");
|
|
60458
|
+
assert(logger$1G, style2.startsWith("style-"), "invalid style");
|
|
60001
60459
|
const oldText = editor.getBlockText(block);
|
|
60002
60460
|
let newText = oldText;
|
|
60003
60461
|
if (style2 === "style-sub") {
|
|
@@ -60043,13 +60501,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60043
60501
|
return standardItems;
|
|
60044
60502
|
}
|
|
60045
60503
|
function getSubText(editor, block, range) {
|
|
60046
|
-
assert(logger$
|
|
60504
|
+
assert(logger$1G, range.isSimple(), "nor a simple range");
|
|
60047
60505
|
const { start, end } = range;
|
|
60048
|
-
assert(logger$
|
|
60049
|
-
assert(logger$
|
|
60050
|
-
assert(logger$
|
|
60506
|
+
assert(logger$1G, start.isSimple(), "is not a simple block position");
|
|
60507
|
+
assert(logger$1G, end.isSimple(), "is not a simple block position");
|
|
60508
|
+
assert(logger$1G, isTextKindBlock(editor, block), "invalid block type, not a text kind block");
|
|
60051
60509
|
const blockId = getBlockId(block);
|
|
60052
|
-
assert(logger$
|
|
60510
|
+
assert(logger$1G, start.blockId === blockId && end.blockId === blockId, "invalid range");
|
|
60053
60511
|
const text2 = editor.getBlockText(block);
|
|
60054
60512
|
let subText2 = [];
|
|
60055
60513
|
if (start.offset === end.offset) {
|
|
@@ -60061,7 +60519,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60061
60519
|
}
|
|
60062
60520
|
return subText2;
|
|
60063
60521
|
}
|
|
60064
|
-
const logger$
|
|
60522
|
+
const logger$1F = getLogger("text-commands");
|
|
60065
60523
|
function getCommands$1(editor, text2) {
|
|
60066
60524
|
const StandardTextStyles = {
|
|
60067
60525
|
"style-bold": [i18n$1.t("commands.bold"), shortcutToDisplayText("CtrlOrCmd+B"), BoldIcon],
|
|
@@ -60079,13 +60537,13 @@ $$${mathData.mathjaxText}$$
|
|
|
60079
60537
|
}
|
|
60080
60538
|
function executeStyleCommand(editor, block, range, command, params, result) {
|
|
60081
60539
|
if (!command.startsWith("style-")) {
|
|
60082
|
-
logger$
|
|
60540
|
+
logger$1F.warn(`unknown command: ${command}`);
|
|
60083
60541
|
return false;
|
|
60084
60542
|
}
|
|
60085
60543
|
const value = params == null ? void 0 : params.value;
|
|
60086
60544
|
const type = typeof value;
|
|
60087
60545
|
if (type !== "string" && type !== "number" && type !== "boolean" && type !== "undefined") {
|
|
60088
|
-
logger$
|
|
60546
|
+
logger$1F.warn(`invalid value type, accept string | number | boolean | undefined, current is ${type}`);
|
|
60089
60547
|
return false;
|
|
60090
60548
|
}
|
|
60091
60549
|
const newText = applyTextStyle(editor, block, range, command, value);
|
|
@@ -60310,7 +60768,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60310
60768
|
this.providers = [new TextScriptProvider(editor)];
|
|
60311
60769
|
}
|
|
60312
60770
|
}
|
|
60313
|
-
const logger$
|
|
60771
|
+
const logger$1E = getLogger("text-command-provider");
|
|
60314
60772
|
class TextCommandProvider {
|
|
60315
60773
|
constructor(editor, options) {
|
|
60316
60774
|
__publicField(this, "id", "TextCommandProvider");
|
|
@@ -60430,7 +60888,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60430
60888
|
}
|
|
60431
60889
|
static fromTextCommandId(id) {
|
|
60432
60890
|
const prefix = "text/";
|
|
60433
|
-
assert(logger$
|
|
60891
|
+
assert(logger$1E, id.startsWith(prefix), `invalid item id: ${id}`);
|
|
60434
60892
|
return id.substring(prefix.length);
|
|
60435
60893
|
}
|
|
60436
60894
|
}
|
|
@@ -60535,7 +60993,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60535
60993
|
};
|
|
60536
60994
|
editor.updateBlockData(block, newData);
|
|
60537
60995
|
}
|
|
60538
|
-
function addCommentToBlock
|
|
60996
|
+
function addCommentToBlock(editor, block, provider) {
|
|
60539
60997
|
const { start, end } = createBlockSimpleRange(editor, block, 0, getBlockTextLength$6(editor, block));
|
|
60540
60998
|
const selectedBlock = { block, start, end };
|
|
60541
60999
|
const abstract = getCommentAbstractFromSelectedBlocks(editor, [selectedBlock]);
|
|
@@ -60548,7 +61006,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60548
61006
|
provider.localCreateComment(comment, doc2);
|
|
60549
61007
|
return comment;
|
|
60550
61008
|
}
|
|
60551
|
-
const logger$
|
|
61009
|
+
const logger$1D = getLogger("standard-block-actions");
|
|
60552
61010
|
class CommentBlockHook {
|
|
60553
61011
|
constructor(provider, editorComments) {
|
|
60554
61012
|
__publicField(this, "executeCommand", (editor, block, item) => {
|
|
@@ -60556,9 +61014,9 @@ $$${mathData.mathjaxText}$$
|
|
|
60556
61014
|
try {
|
|
60557
61015
|
this.editorComments.showCommentList();
|
|
60558
61016
|
const block2 = editor.getBlockById(blockId);
|
|
60559
|
-
addCommentToBlock
|
|
61017
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
60560
61018
|
} catch (err) {
|
|
60561
|
-
logger$
|
|
61019
|
+
logger$1D.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
60562
61020
|
}
|
|
60563
61021
|
});
|
|
60564
61022
|
this.provider = provider;
|
|
@@ -60662,7 +61120,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60662
61120
|
const attributes = Array.from(element.attributes).map((c) => c.name);
|
|
60663
61121
|
return attributes.filter((attribute) => attribute.startsWith("comment-")).map((attribute) => attribute.replace("comment-", ""));
|
|
60664
61122
|
}
|
|
60665
|
-
const logger$
|
|
61123
|
+
const logger$1C = getLogger("doc-comments");
|
|
60666
61124
|
function addBlockComments(doc2, block, result, resultSet) {
|
|
60667
61125
|
if (block.comments) {
|
|
60668
61126
|
const blockComments = block.comments;
|
|
@@ -60757,8 +61215,8 @@ $$${mathData.mathjaxText}$$
|
|
|
60757
61215
|
const result = commentGroup.filter((group) => commentsMap.has(group.groupId)).sort((group1, group2) => {
|
|
60758
61216
|
const index1 = commentsMap.get(group1.groupId);
|
|
60759
61217
|
const index2 = commentsMap.get(group2.groupId);
|
|
60760
|
-
assert(logger$
|
|
60761
|
-
assert(logger$
|
|
61218
|
+
assert(logger$1C, index1 !== void 0, `comment not exists in doc, ${group1.groupId}`);
|
|
61219
|
+
assert(logger$1C, index2 !== void 0, `comment not exists in doc, ${group2.groupId}`);
|
|
60762
61220
|
return index1 - index2;
|
|
60763
61221
|
});
|
|
60764
61222
|
return result;
|
|
@@ -60819,7 +61277,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60819
61277
|
const commentIds = intersection__default.default(comments1, comments2);
|
|
60820
61278
|
return commentIds;
|
|
60821
61279
|
}
|
|
60822
|
-
const logger$
|
|
61280
|
+
const logger$1B = getLogger("active-comments");
|
|
60823
61281
|
function inactiveComment(editor, commentId) {
|
|
60824
61282
|
const activeCommentElements = editor.rootContainer.querySelectorAll(`span.comment[comment-${commentId}],[data-type=editor-block].comment[comment-${commentId}]`);
|
|
60825
61283
|
activeCommentElements.forEach((el) => {
|
|
@@ -60855,7 +61313,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60855
61313
|
const commentIds = getCommentsFromSelection(editor);
|
|
60856
61314
|
if (commentIds.indexOf(commentId) === -1) {
|
|
60857
61315
|
const block = getParentBlock(targetElement);
|
|
60858
|
-
assert(logger$
|
|
61316
|
+
assert(logger$1B, block, "block not found");
|
|
60859
61317
|
const offset = getChildOffset(block, targetElement);
|
|
60860
61318
|
const anchor2 = createSimpleBlockPosition(block, offset.start, "normal");
|
|
60861
61319
|
editor.selection.setSelection(anchor2, void 0, { noScroll: direction === "next" });
|
|
@@ -60897,7 +61355,7 @@ $$${mathData.mathjaxText}$$
|
|
|
60897
61355
|
function isValidSize(size) {
|
|
60898
61356
|
return typeof size === "number";
|
|
60899
61357
|
}
|
|
60900
|
-
const logger$
|
|
61358
|
+
const logger$1A = getLogger("image-data");
|
|
60901
61359
|
const md5Cache = /* @__PURE__ */ new Map();
|
|
60902
61360
|
const DEFAULT_WIDTH$1 = 1e3;
|
|
60903
61361
|
const DEFAULT_HEIGHT = 400;
|
|
@@ -61029,7 +61487,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61029
61487
|
if (heightKey && isValidSize(image.height)) {
|
|
61030
61488
|
result[heightKey] = image.height;
|
|
61031
61489
|
}
|
|
61032
|
-
assert(logger$
|
|
61490
|
+
assert(logger$1A, image.flex, "no image flex");
|
|
61033
61491
|
const flexKey = getImageFlexKeyFromSrc(index2);
|
|
61034
61492
|
result[flexKey] = image.flex;
|
|
61035
61493
|
});
|
|
@@ -61085,224 +61543,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61085
61543
|
const totalFlex = images.reduce((accumulator, currentValue) => accumulator + currentValue.flex, 0);
|
|
61086
61544
|
return totalFlex;
|
|
61087
61545
|
}
|
|
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");
|
|
61546
|
+
const logger$1z = getLogger("image-dom");
|
|
61306
61547
|
function getExistsProgressMask(imageContainer) {
|
|
61307
61548
|
return imageContainer.querySelector(".uploading-progress-mask");
|
|
61308
61549
|
}
|
|
@@ -61319,7 +61560,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61319
61560
|
function getImageUploadingProgressValueElement(imageContainer) {
|
|
61320
61561
|
const bar2 = getImageUploadingProgressMask(imageContainer);
|
|
61321
61562
|
const value = bar2.querySelector(".uploading-progress-bar-value");
|
|
61322
|
-
assert(logger$
|
|
61563
|
+
assert(logger$1z, value, "no progress value");
|
|
61323
61564
|
return value;
|
|
61324
61565
|
}
|
|
61325
61566
|
function setImageUploading(imageContainer, progress) {
|
|
@@ -61409,7 +61650,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61409
61650
|
const images = Array.from(block.querySelectorAll(".image-container"));
|
|
61410
61651
|
return images;
|
|
61411
61652
|
}
|
|
61412
|
-
const logger$
|
|
61653
|
+
const logger$1y = getLogger("table-resize-drag-drop");
|
|
61413
61654
|
class ImageSplitterResizer {
|
|
61414
61655
|
constructor(editor, elem, data2, mouseDownEvent) {
|
|
61415
61656
|
__publicField(this, "cursor", "col-resize");
|
|
@@ -61422,7 +61663,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61422
61663
|
const imageObject = getImageObject(this.editor, block);
|
|
61423
61664
|
const images = imageObject.getImages();
|
|
61424
61665
|
const splitterIndex = this.data.splitterIndex;
|
|
61425
|
-
assert(logger$
|
|
61666
|
+
assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61426
61667
|
const imageContainers = getImageContainersByBlock(block);
|
|
61427
61668
|
const initWidths = imageContainers.map((imageContainer) => imageContainer.getBoundingClientRect().width);
|
|
61428
61669
|
this.initWidths = initWidths;
|
|
@@ -61440,7 +61681,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61440
61681
|
const imageObject = getImageObject(this.editor, block);
|
|
61441
61682
|
const images = cloneDeep__default.default(imageObject.getImages());
|
|
61442
61683
|
const splitterIndex = this.data.splitterIndex;
|
|
61443
|
-
assert(logger$
|
|
61684
|
+
assert(logger$1y, splitterIndex >= 0 && splitterIndex < images.length - 1, `invalid splitter index: ${splitterIndex}`);
|
|
61444
61685
|
const width1 = this.initWidths[splitterIndex];
|
|
61445
61686
|
const width2 = this.initWidths[splitterIndex + 1];
|
|
61446
61687
|
if (width1 + width2 < 100) {
|
|
@@ -61459,7 +61700,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61459
61700
|
newWidths[splitterIndex] += delta;
|
|
61460
61701
|
newWidths[splitterIndex + 1] -= delta;
|
|
61461
61702
|
const imageContainers = getImageContainersByBlock(block);
|
|
61462
|
-
assert(logger$
|
|
61703
|
+
assert(logger$1y, imageContainers.length === images.length, "invalid image data");
|
|
61463
61704
|
const totalWidth = newWidths.reduce((accumulator, currentValue) => accumulator + currentValue, 0);
|
|
61464
61705
|
for (let i = 0; i < images.length; i++) {
|
|
61465
61706
|
const flex = newWidths[i] / totalWidth;
|
|
@@ -61532,7 +61773,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61532
61773
|
editor.domEvents.addEventListener(splitter2, "mousedown", handleSplitterMouseDown);
|
|
61533
61774
|
editor.domEvents.addEventListener(splitter2, "dblclick", handleSplitterDblclick);
|
|
61534
61775
|
}
|
|
61535
|
-
const logger$
|
|
61776
|
+
const logger$1x = getLogger("image-item");
|
|
61536
61777
|
function getParentImageBlock(eventTarget) {
|
|
61537
61778
|
if (!eventTarget) {
|
|
61538
61779
|
return null;
|
|
@@ -61611,7 +61852,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61611
61852
|
if (file2) {
|
|
61612
61853
|
imageObject.replaceImage(index2, file2);
|
|
61613
61854
|
} else {
|
|
61614
|
-
logger$
|
|
61855
|
+
logger$1x.warn(`failed to download image: ${imageData.src}`);
|
|
61615
61856
|
}
|
|
61616
61857
|
}
|
|
61617
61858
|
function createLoadErrorElement(editor, imageContainer, imageData) {
|
|
@@ -61834,7 +62075,7 @@ $$${mathData.mathjaxText}$$
|
|
|
61834
62075
|
function isImageFile(fileType) {
|
|
61835
62076
|
return fileType.startsWith("image/");
|
|
61836
62077
|
}
|
|
61837
|
-
const logger$
|
|
62078
|
+
const logger$1w = getLogger("image-object");
|
|
61838
62079
|
class ImageObject {
|
|
61839
62080
|
constructor(editor, blockData) {
|
|
61840
62081
|
__publicField(this, "images", []);
|
|
@@ -62125,7 +62366,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62125
62366
|
this.editor.updateEmbedData(block2, embedData);
|
|
62126
62367
|
return true;
|
|
62127
62368
|
} catch (err) {
|
|
62128
|
-
logger$
|
|
62369
|
+
logger$1w.error(err);
|
|
62129
62370
|
const block2 = this.editor.findBlockById(this.blockData.id);
|
|
62130
62371
|
if (!block2) {
|
|
62131
62372
|
return false;
|
|
@@ -62142,7 +62383,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62142
62383
|
if (!block) {
|
|
62143
62384
|
return;
|
|
62144
62385
|
}
|
|
62145
|
-
assert(logger$
|
|
62386
|
+
assert(logger$1w, flex.length === this.images.length, "invalid flex");
|
|
62146
62387
|
for (let i = 0; i < this.images.length; i++) {
|
|
62147
62388
|
this.images[i].flex = flex[i];
|
|
62148
62389
|
}
|
|
@@ -62191,7 +62432,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62191
62432
|
}
|
|
62192
62433
|
}
|
|
62193
62434
|
const imageEmbedStyle = "";
|
|
62194
|
-
const logger$
|
|
62435
|
+
const logger$1v = getLogger("drop-indicator");
|
|
62195
62436
|
const INDICATOR_SIZE$1 = 2;
|
|
62196
62437
|
class DropIndicator {
|
|
62197
62438
|
constructor(editor) {
|
|
@@ -62236,7 +62477,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62236
62477
|
if (insertPos === "before") {
|
|
62237
62478
|
const beforeBlock = getPrevVisibleBlock(block);
|
|
62238
62479
|
if (!beforeBlock) {
|
|
62239
|
-
assert(logger$
|
|
62480
|
+
assert(logger$1v, isChildContainer(getParentContainer(block)), "block does not in a child container");
|
|
62240
62481
|
const rect = block.getBoundingClientRect();
|
|
62241
62482
|
const viewRect2 = this.getViewRect(block);
|
|
62242
62483
|
return new DOMRect(viewRect2.x, rect.y, viewRect2.width, INDICATOR_SIZE$1);
|
|
@@ -62262,14 +62503,14 @@ $$${mathData.mathjaxText}$$
|
|
|
62262
62503
|
const PADDING = 5;
|
|
62263
62504
|
if (insertPos.pos === "left") {
|
|
62264
62505
|
const parent = getParentContainer(block);
|
|
62265
|
-
assert(logger$
|
|
62506
|
+
assert(logger$1v, parent, "block does not in a container");
|
|
62266
62507
|
const rect = block.getBoundingClientRect();
|
|
62267
62508
|
const viewRect = this.getViewRect(block);
|
|
62268
62509
|
return new DOMRect(viewRect.x - INDICATOR_SIZE$1 - PADDING, rect.y, INDICATOR_SIZE$1, rect.height);
|
|
62269
62510
|
}
|
|
62270
62511
|
if (insertPos.pos === "right") {
|
|
62271
62512
|
const parent = getParentContainer(block);
|
|
62272
|
-
assert(logger$
|
|
62513
|
+
assert(logger$1v, parent, "block does not in a container");
|
|
62273
62514
|
const rect = block.getBoundingClientRect();
|
|
62274
62515
|
let viewRect;
|
|
62275
62516
|
if (isEmbedBlock(block)) {
|
|
@@ -62366,7 +62607,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62366
62607
|
}
|
|
62367
62608
|
return void 0;
|
|
62368
62609
|
}
|
|
62369
|
-
const logger$
|
|
62610
|
+
const logger$1u = getLogger("code-dom");
|
|
62370
62611
|
function isCodeBlock(block) {
|
|
62371
62612
|
return getBlockType(block) === "code";
|
|
62372
62613
|
}
|
|
@@ -62384,8 +62625,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62384
62625
|
}
|
|
62385
62626
|
function getParentCodeBlock(elem) {
|
|
62386
62627
|
const codeBlock2 = elem.closest("div[data-type=editor-block][data-block-type=code]");
|
|
62387
|
-
assert(logger$
|
|
62388
|
-
assert(logger$
|
|
62628
|
+
assert(logger$1u, codeBlock2, "no parent code block");
|
|
62629
|
+
assert(logger$1u, isCodeBlock(codeBlock2), "not a code block");
|
|
62389
62630
|
return codeBlock2;
|
|
62390
62631
|
}
|
|
62391
62632
|
const SUPPORTED_LANGUAGES = () => ({
|
|
@@ -62476,7 +62717,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62476
62717
|
function setDefaultLanguage(editor, lang) {
|
|
62477
62718
|
return editor.settingsProvider.setItem("editor-code-lang", lang);
|
|
62478
62719
|
}
|
|
62479
|
-
const logger$
|
|
62720
|
+
const logger$1t = getLogger("convert-to-code");
|
|
62480
62721
|
function convertToCode(editor, srcBlock) {
|
|
62481
62722
|
if (!isTextKindBlock(editor, srcBlock)) {
|
|
62482
62723
|
return null;
|
|
@@ -62489,7 +62730,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62489
62730
|
const textContainerId = genId();
|
|
62490
62731
|
editor.doc.localInsertChildContainers([{ containerId: textContainerId, blocks: [textBlock] }]);
|
|
62491
62732
|
const text2 = editor.getBlockData(srcBlock).text;
|
|
62492
|
-
assert(logger$
|
|
62733
|
+
assert(logger$1t, text2, "no text");
|
|
62493
62734
|
let alias = toPlainText(text2);
|
|
62494
62735
|
if (alias.startsWith("```")) {
|
|
62495
62736
|
alias = alias.substring(3);
|
|
@@ -62507,16 +62748,16 @@ $$${mathData.mathjaxText}$$
|
|
|
62507
62748
|
};
|
|
62508
62749
|
}
|
|
62509
62750
|
const codeBlock = "";
|
|
62510
|
-
const logger$
|
|
62751
|
+
const logger$1s = getLogger("code-block-child-container");
|
|
62511
62752
|
function getTextContainer(codeBlock2) {
|
|
62512
|
-
assert(logger$
|
|
62753
|
+
assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
|
|
62513
62754
|
const content = getBlockContent(codeBlock2);
|
|
62514
62755
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-text-root [data-type=editor-container].child");
|
|
62515
|
-
assert(logger$
|
|
62756
|
+
assert(logger$1s, textContainer, "no code text container");
|
|
62516
62757
|
return textContainer;
|
|
62517
62758
|
}
|
|
62518
62759
|
function getCaptionContainer(codeBlock2) {
|
|
62519
|
-
assert(logger$
|
|
62760
|
+
assert(logger$1s, isCodeBlock(codeBlock2), "not a code block");
|
|
62520
62761
|
const content = getBlockContent(codeBlock2);
|
|
62521
62762
|
const textContainer = content.querySelector(":scope > div.editor-code-root > div.code-caption-root [data-type=editor-container].child");
|
|
62522
62763
|
if (!textContainer)
|
|
@@ -62545,7 +62786,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62545
62786
|
}
|
|
62546
62787
|
return getBlockType(block) === "code";
|
|
62547
62788
|
}
|
|
62548
|
-
const logger$
|
|
62789
|
+
const logger$1r = getLogger("code-caption");
|
|
62549
62790
|
function toggleCodeCaption(editor, codeBlock2) {
|
|
62550
62791
|
if (editor.readonly) {
|
|
62551
62792
|
return;
|
|
@@ -62558,7 +62799,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62558
62799
|
}
|
|
62559
62800
|
const captionContainerId = createEmptyContainer(editor.doc);
|
|
62560
62801
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62561
|
-
assert(logger$
|
|
62802
|
+
assert(logger$1r, oldData.children.length === 1, "code block should have only one child");
|
|
62562
62803
|
const newData = {
|
|
62563
62804
|
...oldData,
|
|
62564
62805
|
children: [oldData.children[0], captionContainerId]
|
|
@@ -62574,7 +62815,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62574
62815
|
return false;
|
|
62575
62816
|
}
|
|
62576
62817
|
const parentBlock = getParentBlock(parentContainer);
|
|
62577
|
-
assert(logger$
|
|
62818
|
+
assert(logger$1r, parentBlock, "no parent block");
|
|
62578
62819
|
if (!isCodeBlock(parentBlock)) {
|
|
62579
62820
|
return false;
|
|
62580
62821
|
}
|
|
@@ -62594,7 +62835,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62594
62835
|
const lastBlock2 = getLastChildBlock(textContainer);
|
|
62595
62836
|
editor.selection.selectBlock(lastBlock2, getBlockTextLength$6(editor, lastBlock2));
|
|
62596
62837
|
const oldData = editor.getBlockData(codeBlock2);
|
|
62597
|
-
assert(logger$
|
|
62838
|
+
assert(logger$1r, oldData.children.length === 2, "code block should have only one child");
|
|
62598
62839
|
const captionContainerId = oldData.children[1];
|
|
62599
62840
|
const newData = {
|
|
62600
62841
|
...oldData,
|
|
@@ -62603,7 +62844,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62603
62844
|
editor.updateBlockData(codeBlock2, newData);
|
|
62604
62845
|
editor.deleteChildContainers([captionContainerId]);
|
|
62605
62846
|
}
|
|
62606
|
-
const logger$
|
|
62847
|
+
const logger$1q = getLogger("paste-in-table-block");
|
|
62607
62848
|
class PasteEventHandler {
|
|
62608
62849
|
constructor(editor) {
|
|
62609
62850
|
this.editor = editor;
|
|
@@ -62624,7 +62865,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62624
62865
|
return false;
|
|
62625
62866
|
}
|
|
62626
62867
|
const parentBlock = getParentBlock(parentContainer);
|
|
62627
|
-
assert(logger$
|
|
62868
|
+
assert(logger$1q, parentBlock, "no parent block");
|
|
62628
62869
|
if (!isCodeBlock(parentBlock)) {
|
|
62629
62870
|
return false;
|
|
62630
62871
|
}
|
|
@@ -62688,7 +62929,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62688
62929
|
function registerCodeBlockCommandProvider(editor) {
|
|
62689
62930
|
editor.addCustom("code-block-command-provider", (editor2) => new CodeBlockCommandProvider(editor2));
|
|
62690
62931
|
}
|
|
62691
|
-
const logger$
|
|
62932
|
+
const logger$1p = getLogger("code-caption-input-handler");
|
|
62692
62933
|
function getCurrentCaptionBlock(editor) {
|
|
62693
62934
|
if (!editor.selection.range.isSimple()) {
|
|
62694
62935
|
return null;
|
|
@@ -62801,7 +63042,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62801
63042
|
editor.undoManager.runInGroup(() => {
|
|
62802
63043
|
editor.clearSelectedContents();
|
|
62803
63044
|
const start = editor.selection.range.start;
|
|
62804
|
-
assert(logger$
|
|
63045
|
+
assert(logger$1p, start.isSimple(), "not simple position");
|
|
62805
63046
|
editor.insertTextToBlock(block, start.offset, text2);
|
|
62806
63047
|
});
|
|
62807
63048
|
return true;
|
|
@@ -62846,9 +63087,9 @@ $$${mathData.mathjaxText}$$
|
|
|
62846
63087
|
};
|
|
62847
63088
|
editor.updateBlockData(codeBlock2, newData);
|
|
62848
63089
|
}
|
|
62849
|
-
const logger$
|
|
63090
|
+
const logger$1o = getLogger("code-block-header");
|
|
62850
63091
|
function selectCodeBlock(editor, block, options) {
|
|
62851
|
-
assert(logger$
|
|
63092
|
+
assert(logger$1o, isCodeBlock(block), "not a code block");
|
|
62852
63093
|
const firstBlock = getFirstChildBlock(getTextContainer(block));
|
|
62853
63094
|
editor.selection.selectBlock(firstBlock, 0);
|
|
62854
63095
|
if (options.focusToEditor) {
|
|
@@ -62890,8 +63131,8 @@ $$${mathData.mathjaxText}$$
|
|
|
62890
63131
|
const target = event.target;
|
|
62891
63132
|
const select2 = target.closest(".language-select");
|
|
62892
63133
|
const block = getParentBlock(select2);
|
|
62893
|
-
assert(logger$
|
|
62894
|
-
assert(logger$
|
|
63134
|
+
assert(logger$1o, block, "no parent block");
|
|
63135
|
+
assert(logger$1o, getBlockType(block) === "code", "not a code block");
|
|
62895
63136
|
const codeData = editor2.getBlockData(block);
|
|
62896
63137
|
const dropdown2 = editor2.getCustom("code-header-language-select-dropdown");
|
|
62897
63138
|
dropdown2.custom = { codeBlock: block, editor: editor2 };
|
|
@@ -62914,11 +63155,11 @@ $$${mathData.mathjaxText}$$
|
|
|
62914
63155
|
function handleCodeHeaderButtonClick(editor, event) {
|
|
62915
63156
|
const target = event.target;
|
|
62916
63157
|
const button2 = target.closest(".code-header-button");
|
|
62917
|
-
assert(logger$
|
|
63158
|
+
assert(logger$1o, button2, "no button");
|
|
62918
63159
|
const block = getParentBlock(target);
|
|
62919
|
-
assert(logger$
|
|
63160
|
+
assert(logger$1o, block, "no parent block");
|
|
62920
63161
|
const id = button2.getAttribute("data-id");
|
|
62921
|
-
assert(logger$
|
|
63162
|
+
assert(logger$1o, getBlockType(block) === "code", "not a code block");
|
|
62922
63163
|
if (id === "wrap") {
|
|
62923
63164
|
const old = editor.getBlockData(block);
|
|
62924
63165
|
changeCodeBlockWrap(editor, block, !old.nowrap);
|
|
@@ -62944,7 +63185,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62944
63185
|
}
|
|
62945
63186
|
});
|
|
62946
63187
|
}).catch((err) => {
|
|
62947
|
-
logger$
|
|
63188
|
+
logger$1o.error(err.message);
|
|
62948
63189
|
});
|
|
62949
63190
|
return;
|
|
62950
63191
|
}
|
|
@@ -62995,7 +63236,7 @@ $$${mathData.mathjaxText}$$
|
|
|
62995
63236
|
}
|
|
62996
63237
|
function getCodeBlockHeader(block) {
|
|
62997
63238
|
const header = block.querySelector(".code-block-header");
|
|
62998
|
-
assert(logger$
|
|
63239
|
+
assert(logger$1o, header, "no code block header");
|
|
62999
63240
|
return header;
|
|
63000
63241
|
}
|
|
63001
63242
|
function handleCodeScroll(editor, event) {
|
|
@@ -63044,7 +63285,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63044
63285
|
focusBlockId: textBlock.id
|
|
63045
63286
|
};
|
|
63046
63287
|
}
|
|
63047
|
-
const logger$
|
|
63288
|
+
const logger$1n = getLogger("code-block");
|
|
63048
63289
|
function getPaddingNum(index2) {
|
|
63049
63290
|
if (index2 <= 2) {
|
|
63050
63291
|
return 32;
|
|
@@ -63071,10 +63312,10 @@ $$${mathData.mathjaxText}$$
|
|
|
63071
63312
|
handlePasteInTableEvent(editor);
|
|
63072
63313
|
registerCodeBlockCommandProvider(editor);
|
|
63073
63314
|
trackChildBlockEvent(editor, handleDebounceUpdate);
|
|
63074
|
-
assert(logger$
|
|
63315
|
+
assert(logger$1n, blockData.type === "code", "invalid block data type");
|
|
63075
63316
|
const codeData = blockData;
|
|
63076
|
-
assert(logger$
|
|
63077
|
-
assert(logger$
|
|
63317
|
+
assert(logger$1n, codeData.children, "invalid block data children");
|
|
63318
|
+
assert(logger$1n, codeData.children.length === 1 || codeData.children.length === 2, "invalid block data children length");
|
|
63078
63319
|
setTimeout(() => {
|
|
63079
63320
|
if (isNodeRemoved(blockElement))
|
|
63080
63321
|
return;
|
|
@@ -63125,15 +63366,15 @@ $$${mathData.mathjaxText}$$
|
|
|
63125
63366
|
}
|
|
63126
63367
|
function updateSelection$3(editor, block, from, to) {
|
|
63127
63368
|
if (from.isSimple()) {
|
|
63128
|
-
assert(logger$
|
|
63129
|
-
logger$
|
|
63369
|
+
assert(logger$1n, to.isSimple(), "from is simple position but to is not simple position");
|
|
63370
|
+
logger$1n.debug("full select list");
|
|
63130
63371
|
addClass(block, "full-selected");
|
|
63131
63372
|
return;
|
|
63132
63373
|
}
|
|
63133
|
-
assert(logger$
|
|
63374
|
+
assert(logger$1n, !to.isSimple(), "from is complex position but end is simple position");
|
|
63134
63375
|
const f = from;
|
|
63135
63376
|
const t2 = to;
|
|
63136
|
-
assert(logger$
|
|
63377
|
+
assert(logger$1n, f.blockId === t2.blockId, "only allow update one table selection");
|
|
63137
63378
|
const containers = getCodeChildContainers(block);
|
|
63138
63379
|
containers.forEach((container) => {
|
|
63139
63380
|
const containerId = getContainerId(container);
|
|
@@ -63168,8 +63409,8 @@ $$${mathData.mathjaxText}$$
|
|
|
63168
63409
|
const containersIds = childContainers.map(getContainerId);
|
|
63169
63410
|
const startIndex = containersIds.indexOf(start.childContainerId);
|
|
63170
63411
|
const endIndex = containersIds.indexOf(end.childContainerId);
|
|
63171
|
-
assert(logger$
|
|
63172
|
-
assert(logger$
|
|
63412
|
+
assert(logger$1n, startIndex !== -1, "invalid start pos");
|
|
63413
|
+
assert(logger$1n, endIndex !== -1, "invalid end pos");
|
|
63173
63414
|
const ret = [childContainers[startIndex]];
|
|
63174
63415
|
if (startIndex !== endIndex) {
|
|
63175
63416
|
ret.push(childContainers[endIndex]);
|
|
@@ -63177,7 +63418,7 @@ $$${mathData.mathjaxText}$$
|
|
|
63177
63418
|
return ret;
|
|
63178
63419
|
}
|
|
63179
63420
|
function handleBlockElementUpdated(editor, block, blockData) {
|
|
63180
|
-
assert(logger$
|
|
63421
|
+
assert(logger$1n, isCodeBlock(block), "invalid block type");
|
|
63181
63422
|
const codeData = blockData;
|
|
63182
63423
|
updateCodeBlockElementStyles(editor, block, codeData);
|
|
63183
63424
|
}
|
|
@@ -63369,10 +63610,10 @@ ${codeText}
|
|
|
63369
63610
|
"Shift+Tab": handleShiftTab$1,
|
|
63370
63611
|
"CtrlOrCmd+A": selectCode
|
|
63371
63612
|
};
|
|
63372
|
-
const logger$
|
|
63613
|
+
const logger$1m = getLogger("code-text-decorate");
|
|
63373
63614
|
class CodeTextDecorator {
|
|
63374
63615
|
decorateText(editor, path, blockText) {
|
|
63375
|
-
assert(logger$
|
|
63616
|
+
assert(logger$1m, path.length > 0, "invalid path");
|
|
63376
63617
|
if (path.length === 1) {
|
|
63377
63618
|
return {};
|
|
63378
63619
|
}
|
|
@@ -63397,7 +63638,7 @@ ${codeText}
|
|
|
63397
63638
|
const grammar = getPrismGrammar(codeData.language);
|
|
63398
63639
|
const tokens = Prism__default.default.tokenize(code, grammar);
|
|
63399
63640
|
const tokenToText = (token, attributes) => {
|
|
63400
|
-
assert(logger$
|
|
63641
|
+
assert(logger$1m, token, "no token");
|
|
63401
63642
|
if (typeof token === "string") {
|
|
63402
63643
|
const ret = {
|
|
63403
63644
|
insert: token,
|
|
@@ -63405,7 +63646,7 @@ ${codeText}
|
|
|
63405
63646
|
};
|
|
63406
63647
|
return [ret];
|
|
63407
63648
|
}
|
|
63408
|
-
assert(logger$
|
|
63649
|
+
assert(logger$1m, token instanceof Prism__default.default.Token, "invalid token type");
|
|
63409
63650
|
const content = token.content;
|
|
63410
63651
|
const newAttributes = cloneDeep__default.default(attributes);
|
|
63411
63652
|
newAttributes[`style-code-${token.type}`] = true;
|
|
@@ -63421,18 +63662,18 @@ ${codeText}
|
|
|
63421
63662
|
const ret = tokens2.map((t2) => tokenToText(t2, newAttributes)).flat();
|
|
63422
63663
|
return ret;
|
|
63423
63664
|
}
|
|
63424
|
-
assert(logger$
|
|
63665
|
+
assert(logger$1m, content instanceof Prism__default.default.Token, "invalid token");
|
|
63425
63666
|
return tokenToText(content, newAttributes);
|
|
63426
63667
|
};
|
|
63427
63668
|
const ops = tokens.map((token) => tokenToText(token, {}));
|
|
63428
63669
|
const newText = ops.flat();
|
|
63429
|
-
assert(logger$
|
|
63670
|
+
assert(logger$1m, getTextLength(newText) === getTextLength(text2), "failed to highlight code, text length mismatch");
|
|
63430
63671
|
return {
|
|
63431
63672
|
text: newText
|
|
63432
63673
|
};
|
|
63433
63674
|
}
|
|
63434
63675
|
}
|
|
63435
|
-
const zhCN$
|
|
63676
|
+
const zhCN$o = {
|
|
63436
63677
|
code: {
|
|
63437
63678
|
title: "\u4EE3\u7801",
|
|
63438
63679
|
abstract: "\u4EE3\u7801",
|
|
@@ -63444,7 +63685,7 @@ ${codeText}
|
|
|
63444
63685
|
plainText: "Plain Text"
|
|
63445
63686
|
}
|
|
63446
63687
|
};
|
|
63447
|
-
const enUS$
|
|
63688
|
+
const enUS$o = {
|
|
63448
63689
|
code: {
|
|
63449
63690
|
title: "Code",
|
|
63450
63691
|
abstract: "Code",
|
|
@@ -63456,7 +63697,7 @@ ${codeText}
|
|
|
63456
63697
|
plainText: "Plain Text"
|
|
63457
63698
|
}
|
|
63458
63699
|
};
|
|
63459
|
-
const jaJP$
|
|
63700
|
+
const jaJP$o = {
|
|
63460
63701
|
code: {
|
|
63461
63702
|
title: "\u30B3\u30FC\u30C9",
|
|
63462
63703
|
abstract: "\u30B3\u30FC\u30C9",
|
|
@@ -63469,9 +63710,9 @@ ${codeText}
|
|
|
63469
63710
|
}
|
|
63470
63711
|
};
|
|
63471
63712
|
i18n$1.mergeLang({
|
|
63472
|
-
"zh-CN": zhCN$
|
|
63473
|
-
"en-US": enUS$
|
|
63474
|
-
"ja-JP": jaJP$
|
|
63713
|
+
"zh-CN": zhCN$o,
|
|
63714
|
+
"en-US": enUS$o,
|
|
63715
|
+
"ja-JP": jaJP$o
|
|
63475
63716
|
});
|
|
63476
63717
|
function convertToTable(editor, containerId, blockIndex, offset) {
|
|
63477
63718
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -63732,7 +63973,7 @@ ${codeText}
|
|
|
63732
63973
|
}
|
|
63733
63974
|
return false;
|
|
63734
63975
|
}
|
|
63735
|
-
const logger$
|
|
63976
|
+
const logger$1l = getLogger("match-text-style");
|
|
63736
63977
|
function matchTextPair(text2, find) {
|
|
63737
63978
|
if (text2.length < find.length * 2 + 1) {
|
|
63738
63979
|
return -1;
|
|
@@ -63802,7 +64043,7 @@ ${codeText}
|
|
|
63802
64043
|
editor.insertBoxToBlock(block, start, boxData);
|
|
63803
64044
|
});
|
|
63804
64045
|
} catch (err) {
|
|
63805
|
-
logger$
|
|
64046
|
+
logger$1l.warn(`failed to convert to box, ${err.message}`);
|
|
63806
64047
|
continue;
|
|
63807
64048
|
}
|
|
63808
64049
|
}
|
|
@@ -63865,7 +64106,7 @@ ${codeText}
|
|
|
63865
64106
|
return false;
|
|
63866
64107
|
}
|
|
63867
64108
|
}
|
|
63868
|
-
const enUS$
|
|
64109
|
+
const enUS$n = {
|
|
63869
64110
|
placeholder: {
|
|
63870
64111
|
default: "Type / for commands",
|
|
63871
64112
|
heading: "Heading {heading}",
|
|
@@ -63876,7 +64117,7 @@ ${codeText}
|
|
|
63876
64117
|
mobileDefault: "Type to add content"
|
|
63877
64118
|
}
|
|
63878
64119
|
};
|
|
63879
|
-
const zhCN$
|
|
64120
|
+
const zhCN$n = {
|
|
63880
64121
|
placeholder: {
|
|
63881
64122
|
default: "\u8F93\u5165\u300C/\u300D\u5FEB\u901F\u63D2\u5165",
|
|
63882
64123
|
heading: "\u6807\u9898{heading}",
|
|
@@ -63887,7 +64128,7 @@ ${codeText}
|
|
|
63887
64128
|
mobileDefault: "\u8F93\u5165\u4EE5\u6DFB\u52A0\u5185\u5BB9"
|
|
63888
64129
|
}
|
|
63889
64130
|
};
|
|
63890
|
-
const jaJP$
|
|
64131
|
+
const jaJP$n = {
|
|
63891
64132
|
placeholder: {
|
|
63892
64133
|
default: "\u300C/\u300D\u3092\u5165\u529B\u3057\u3066\u7D20\u65E9\u304F\u633F\u5165\u3059\u308B",
|
|
63893
64134
|
heading: "\u898B\u51FA\u3057{heading}",
|
|
@@ -63899,9 +64140,9 @@ ${codeText}
|
|
|
63899
64140
|
}
|
|
63900
64141
|
};
|
|
63901
64142
|
const langs$1 = {
|
|
63902
|
-
"en-US": enUS$
|
|
63903
|
-
"zh-CN": zhCN$
|
|
63904
|
-
"ja-JP": jaJP$
|
|
64143
|
+
"en-US": enUS$n,
|
|
64144
|
+
"zh-CN": zhCN$n,
|
|
64145
|
+
"ja-JP": jaJP$n
|
|
63905
64146
|
};
|
|
63906
64147
|
i18n$1.mergeLang(langs$1);
|
|
63907
64148
|
function isEmptyTextBlockWithoutCompositionText(editor, block) {
|
|
@@ -64068,7 +64309,7 @@ ${codeText}
|
|
|
64068
64309
|
}
|
|
64069
64310
|
return false;
|
|
64070
64311
|
}
|
|
64071
|
-
const logger$
|
|
64312
|
+
const logger$1k = getLogger("enforce-title");
|
|
64072
64313
|
class EnforceWithDocumentTitleHandler {
|
|
64073
64314
|
constructor(editor, options = {
|
|
64074
64315
|
headingLevel: 1
|
|
@@ -64140,7 +64381,7 @@ ${codeText}
|
|
|
64140
64381
|
var _a, _b;
|
|
64141
64382
|
try {
|
|
64142
64383
|
const blocks = editor.doc.getContainerBlocks(getContainerId(editor.rootContainer));
|
|
64143
|
-
assert(logger$
|
|
64384
|
+
assert(logger$1k, blocks.length > 0, "root container is empty");
|
|
64144
64385
|
const firstBlock = blocks[0];
|
|
64145
64386
|
if (firstBlock.type !== "text" && !this.options.hideTitle) {
|
|
64146
64387
|
const blockData = createTextBlockData("", { heading: (_a = this.options.headingLevel) != null ? _a : 1 });
|
|
@@ -64149,7 +64390,7 @@ ${codeText}
|
|
|
64149
64390
|
return;
|
|
64150
64391
|
}
|
|
64151
64392
|
if (!this.options.hideTitle) {
|
|
64152
|
-
assert(logger$
|
|
64393
|
+
assert(logger$1k, firstBlock.text, "invalid text block");
|
|
64153
64394
|
const block = editor.getBlockById(firstBlock.id);
|
|
64154
64395
|
if (hasAttributes(firstBlock.text) || firstBlock.quoted || firstBlock.heading !== this.options.headingLevel) {
|
|
64155
64396
|
const text2 = editor.getBlockString(block);
|
|
@@ -64234,7 +64475,7 @@ ${codeText}
|
|
|
64234
64475
|
});
|
|
64235
64476
|
return orgDataUrl;
|
|
64236
64477
|
}
|
|
64237
|
-
const logger$
|
|
64478
|
+
const logger$1j = getLogger("drag-preview-image");
|
|
64238
64479
|
class DragPreviewImage {
|
|
64239
64480
|
constructor(editor) {
|
|
64240
64481
|
__publicField(this, "startPosition", null);
|
|
@@ -64242,7 +64483,7 @@ ${codeText}
|
|
|
64242
64483
|
__publicField(this, "handleDragStart", async (e2, preview) => {
|
|
64243
64484
|
var _a, _b, _c, _d, _e, _f;
|
|
64244
64485
|
const target = e2.target;
|
|
64245
|
-
assert(logger$
|
|
64486
|
+
assert(logger$1j, target instanceof Element, `Invalid Drag target:${target}`);
|
|
64246
64487
|
const { x: startX, y: startY } = e2;
|
|
64247
64488
|
this.startPosition = {
|
|
64248
64489
|
x: startX,
|
|
@@ -64328,7 +64569,7 @@ ${codeText}
|
|
|
64328
64569
|
}
|
|
64329
64570
|
return block;
|
|
64330
64571
|
}
|
|
64331
|
-
const logger$
|
|
64572
|
+
const logger$1i = getLogger("block-menu-drag-handler");
|
|
64332
64573
|
const MIN_DISTANCE_THRESHOLD$1 = 3;
|
|
64333
64574
|
function createDragEventFromMouseEvent$2(event, type) {
|
|
64334
64575
|
const dragEvent = new DragEvent(type, {
|
|
@@ -64350,7 +64591,7 @@ ${codeText}
|
|
|
64350
64591
|
__publicField(this, "startPos", { x: 0, y: 0 });
|
|
64351
64592
|
__publicField(this, "handleMouseDown", (event) => {
|
|
64352
64593
|
const block = this.button.blockMenu.currentBlock;
|
|
64353
|
-
assert(logger$
|
|
64594
|
+
assert(logger$1i, block, "no dragged block");
|
|
64354
64595
|
if (event.button !== 0) {
|
|
64355
64596
|
return;
|
|
64356
64597
|
}
|
|
@@ -64378,7 +64619,7 @@ ${codeText}
|
|
|
64378
64619
|
});
|
|
64379
64620
|
}
|
|
64380
64621
|
const block = this.button.blockMenu.currentBlock;
|
|
64381
|
-
assert(logger$
|
|
64622
|
+
assert(logger$1i, block, "no dragged block");
|
|
64382
64623
|
(_b = (_a = getBlockClass(this.editor, block)).notify) == null ? void 0 : _b.call(_a, this.editor, "beginDrag");
|
|
64383
64624
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragstart");
|
|
64384
64625
|
registerStandardDraggedObject(this.editor, dragEvent, block);
|
|
@@ -64399,7 +64640,7 @@ ${codeText}
|
|
|
64399
64640
|
if (!window.isDragging) {
|
|
64400
64641
|
this.handleDragStart(event);
|
|
64401
64642
|
}
|
|
64402
|
-
assert(logger$
|
|
64643
|
+
assert(logger$1i, target instanceof Element, "target is invalid");
|
|
64403
64644
|
this.dragPreview.handleDrag(event);
|
|
64404
64645
|
const dragEvent = createDragEventFromMouseEvent$2(event, "dragover");
|
|
64405
64646
|
this.editor.contentElement.dispatchEvent(dragEvent);
|
|
@@ -64407,7 +64648,7 @@ ${codeText}
|
|
|
64407
64648
|
__publicField(this, "handleDragEnd", (event) => {
|
|
64408
64649
|
var _a;
|
|
64409
64650
|
const block = this.button.blockMenu.currentBlock;
|
|
64410
|
-
assert(logger$
|
|
64651
|
+
assert(logger$1i, block, "no dragged block");
|
|
64411
64652
|
window.isDragging = false;
|
|
64412
64653
|
this.dragPreview.handleDragEnd();
|
|
64413
64654
|
(_a = this.autoScroll) == null ? void 0 : _a.inactive();
|
|
@@ -64630,7 +64871,7 @@ ${codeText}
|
|
|
64630
64871
|
this.rootButton.destroy();
|
|
64631
64872
|
}
|
|
64632
64873
|
}
|
|
64633
|
-
const zhCN$
|
|
64874
|
+
const zhCN$m = {
|
|
64634
64875
|
blockMenu: {
|
|
64635
64876
|
section: {
|
|
64636
64877
|
basics: "\u57FA\u7840",
|
|
@@ -64654,7 +64895,7 @@ ${codeText}
|
|
|
64654
64895
|
}
|
|
64655
64896
|
}
|
|
64656
64897
|
};
|
|
64657
|
-
const enUS$
|
|
64898
|
+
const enUS$m = {
|
|
64658
64899
|
blockMenu: {
|
|
64659
64900
|
section: {
|
|
64660
64901
|
basics: "Basic",
|
|
@@ -64678,7 +64919,7 @@ ${codeText}
|
|
|
64678
64919
|
}
|
|
64679
64920
|
}
|
|
64680
64921
|
};
|
|
64681
|
-
const jaJP$
|
|
64922
|
+
const jaJP$m = {
|
|
64682
64923
|
blockMenu: {
|
|
64683
64924
|
section: {
|
|
64684
64925
|
basics: "\u4E00\u822C",
|
|
@@ -64703,9 +64944,9 @@ ${codeText}
|
|
|
64703
64944
|
}
|
|
64704
64945
|
};
|
|
64705
64946
|
i18n$1.mergeLang({
|
|
64706
|
-
"zh-CN": zhCN$
|
|
64707
|
-
"en-US": enUS$
|
|
64708
|
-
"ja-JP": jaJP$
|
|
64947
|
+
"zh-CN": zhCN$m,
|
|
64948
|
+
"en-US": enUS$m,
|
|
64949
|
+
"ja-JP": jaJP$m
|
|
64709
64950
|
});
|
|
64710
64951
|
const style$6 = "";
|
|
64711
64952
|
class DragData {
|
|
@@ -64785,7 +65026,7 @@ ${codeText}
|
|
|
64785
65026
|
function clearDraggedObject(editor) {
|
|
64786
65027
|
getDragData(editor).clearData();
|
|
64787
65028
|
}
|
|
64788
|
-
const logger$
|
|
65029
|
+
const logger$1h = getLogger("find-drop-target");
|
|
64789
65030
|
function childContainerFromPoint(x, y) {
|
|
64790
65031
|
const elem = getElementFromPoint(x, y);
|
|
64791
65032
|
if (!elem) {
|
|
@@ -64898,13 +65139,13 @@ ${codeText}
|
|
|
64898
65139
|
return true;
|
|
64899
65140
|
}
|
|
64900
65141
|
const parentBlock = getParentBlock(container);
|
|
64901
|
-
assert(logger$
|
|
65142
|
+
assert(logger$1h, parentBlock, "no parent block");
|
|
64902
65143
|
if (!editor.isBlockWritable(parentBlock)) {
|
|
64903
65144
|
return false;
|
|
64904
65145
|
}
|
|
64905
65146
|
return canInsertAsSibling(editor, parentBlock);
|
|
64906
65147
|
}
|
|
64907
|
-
const logger$
|
|
65148
|
+
const logger$1g = getLogger("drop-target");
|
|
64908
65149
|
function getEmbedClassByFile(editor, file2) {
|
|
64909
65150
|
let embedClass = {};
|
|
64910
65151
|
if (/image/.test(file2.type)) {
|
|
@@ -64914,7 +65155,7 @@ ${codeText}
|
|
|
64914
65155
|
} else if (/video/.test(file2.type)) {
|
|
64915
65156
|
embedClass = editor.editorEmbeds.getEmbedClass("video");
|
|
64916
65157
|
}
|
|
64917
|
-
assert(logger$
|
|
65158
|
+
assert(logger$1g, embedClass, `unSupport file type ${file2.type}`);
|
|
64918
65159
|
return embedClass;
|
|
64919
65160
|
}
|
|
64920
65161
|
async function patchInsertFile(editor, files, containerId, blockIndex) {
|
|
@@ -65664,7 +65905,7 @@ ${codeText}
|
|
|
65664
65905
|
}
|
|
65665
65906
|
}
|
|
65666
65907
|
}
|
|
65667
|
-
const zhCN$
|
|
65908
|
+
const zhCN$l = {
|
|
65668
65909
|
image: {
|
|
65669
65910
|
title: "\u56FE\u7247",
|
|
65670
65911
|
upload: {
|
|
@@ -65680,7 +65921,7 @@ ${codeText}
|
|
|
65680
65921
|
abstract: "\u56FE\u7247"
|
|
65681
65922
|
}
|
|
65682
65923
|
};
|
|
65683
|
-
const enUS$
|
|
65924
|
+
const enUS$l = {
|
|
65684
65925
|
image: {
|
|
65685
65926
|
title: "Image",
|
|
65686
65927
|
upload: {
|
|
@@ -65696,7 +65937,7 @@ ${codeText}
|
|
|
65696
65937
|
abstract: "Image"
|
|
65697
65938
|
}
|
|
65698
65939
|
};
|
|
65699
|
-
const jaJP$
|
|
65940
|
+
const jaJP$l = {
|
|
65700
65941
|
image: {
|
|
65701
65942
|
title: "\u753B\u50CF",
|
|
65702
65943
|
upload: {
|
|
@@ -65713,9 +65954,9 @@ ${codeText}
|
|
|
65713
65954
|
}
|
|
65714
65955
|
};
|
|
65715
65956
|
i18n$1.mergeLang({
|
|
65716
|
-
"zh-CN": zhCN$
|
|
65717
|
-
"en-US": enUS$
|
|
65718
|
-
"ja-JP": jaJP$
|
|
65957
|
+
"zh-CN": zhCN$l,
|
|
65958
|
+
"en-US": enUS$l,
|
|
65959
|
+
"ja-JP": jaJP$l
|
|
65719
65960
|
});
|
|
65720
65961
|
function convertToImage(editor, containerId, blockIndex, offset) {
|
|
65721
65962
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
@@ -65769,7 +66010,7 @@ ${codeText}
|
|
|
65769
66010
|
return false;
|
|
65770
66011
|
}
|
|
65771
66012
|
}
|
|
65772
|
-
const logger$
|
|
66013
|
+
const logger$1f = getLogger("copy-image");
|
|
65773
66014
|
function getImageClipboardData(editor, img, imageObject, index2) {
|
|
65774
66015
|
const imageData = imageObject.getImages()[index2];
|
|
65775
66016
|
const widthPercent = imageObject.getImages().length === 1 ? imageObject.getWidthPercent() : imageData.flex * 100;
|
|
@@ -65810,7 +66051,7 @@ ${codeText}
|
|
|
65810
66051
|
});
|
|
65811
66052
|
clipboardData["image/png"] = fileBlob;
|
|
65812
66053
|
} catch (error2) {
|
|
65813
|
-
logger$
|
|
66054
|
+
logger$1f.error(error2);
|
|
65814
66055
|
}
|
|
65815
66056
|
addMetaToDoc(editor, doc2);
|
|
65816
66057
|
const url = editor.doc.buildResourceUrl(imageData.src, { withToken: true });
|
|
@@ -66083,195 +66324,6 @@ ${codeText}
|
|
|
66083
66324
|
}
|
|
66084
66325
|
return getDragInsertPos(editor, block, images, x);
|
|
66085
66326
|
}
|
|
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
66327
|
class ImageHoveringToolbarCommands$1 {
|
|
66276
66328
|
constructor(editor, block) {
|
|
66277
66329
|
__publicField(this, "group", "hovering-toolbar");
|
|
@@ -66343,7 +66395,7 @@ ${codeText}
|
|
|
66343
66395
|
executeCommand(editor, block, item) {
|
|
66344
66396
|
switch (item.id) {
|
|
66345
66397
|
case "addComment":
|
|
66346
|
-
addCommentToBlock(editor, block);
|
|
66398
|
+
addCommentToBlock$1(editor, block);
|
|
66347
66399
|
break;
|
|
66348
66400
|
case "left":
|
|
66349
66401
|
case "center":
|
|
@@ -67266,7 +67318,7 @@ ${codeText}
|
|
|
67266
67318
|
const { comment } = this;
|
|
67267
67319
|
const head = createElement("div", ["comment-item-head"], this.root);
|
|
67268
67320
|
const quote2 = createElement("span", ["item-head-quote"], head);
|
|
67269
|
-
quote2.
|
|
67321
|
+
quote2.textContent = comment.abstract;
|
|
67270
67322
|
const switchContainer = createElement("span", ["item-head-switch"], head);
|
|
67271
67323
|
const switchUp = createTextButton(switchContainer, GroupItemActions.SwitchUp, "up", switchUpIcon);
|
|
67272
67324
|
const switchDown = createTextButton(switchContainer, GroupItemActions.SwitchDown, "down", switchDownIcon);
|
|
@@ -67659,7 +67711,7 @@ ${codeText}
|
|
|
67659
67711
|
});
|
|
67660
67712
|
});
|
|
67661
67713
|
__publicField(this, "handleEditorResize", () => {
|
|
67662
|
-
this.updateItemsLayout();
|
|
67714
|
+
this.updateItemsLayout(false);
|
|
67663
67715
|
});
|
|
67664
67716
|
__publicField(this, "handleDocChanged", () => {
|
|
67665
67717
|
this.updateComments();
|
|
@@ -67736,9 +67788,11 @@ ${codeText}
|
|
|
67736
67788
|
this.removeAllListeners();
|
|
67737
67789
|
document.removeEventListener("click", this.handleDocumentClick);
|
|
67738
67790
|
}
|
|
67739
|
-
updateItemsLayout() {
|
|
67791
|
+
updateItemsLayout(dispatchScroll = true) {
|
|
67740
67792
|
arrangeItems(this.editor, this.items, this.activeItem);
|
|
67741
|
-
|
|
67793
|
+
if (dispatchScroll) {
|
|
67794
|
+
this.dispatchScroll();
|
|
67795
|
+
}
|
|
67742
67796
|
}
|
|
67743
67797
|
bindEvents() {
|
|
67744
67798
|
this.container.addEventListener("click", this.handleContainerClick);
|
|
@@ -68605,7 +68659,7 @@ ${codeText}
|
|
|
68605
68659
|
const types2 = ["table", "layout"];
|
|
68606
68660
|
if (types2.includes(getBlockType(block))) {
|
|
68607
68661
|
editor.selection.setSelection(createSimpleBlockPosition(block, 0, "home"), createSimpleBlockPosition(block, 0, "end"));
|
|
68608
|
-
comment = addCommentToBlock
|
|
68662
|
+
comment = addCommentToBlock(editor, block, this.provider);
|
|
68609
68663
|
}
|
|
68610
68664
|
}
|
|
68611
68665
|
comment = comment != null ? comment : addCommentToTextBlocks(editor, range, this.provider);
|
|
@@ -68626,7 +68680,7 @@ ${codeText}
|
|
|
68626
68680
|
try {
|
|
68627
68681
|
this.editorComments.showCommentList();
|
|
68628
68682
|
const block2 = editor.getBlockById(blockId);
|
|
68629
|
-
addCommentToBlock
|
|
68683
|
+
addCommentToBlock(editor, block2, this.provider);
|
|
68630
68684
|
} catch (err) {
|
|
68631
68685
|
logger$14.error(`failed to execute block command: ${JSON.stringify(err)}`);
|
|
68632
68686
|
}
|
|
@@ -68635,14 +68689,24 @@ ${codeText}
|
|
|
68635
68689
|
this.editorComments = editorComments;
|
|
68636
68690
|
}
|
|
68637
68691
|
commands(editor, blockElement, child) {
|
|
68638
|
-
|
|
68639
|
-
if (editor.readonly) {
|
|
68692
|
+
if (editor.readonly || clientType.isMobile) {
|
|
68640
68693
|
return void 0;
|
|
68641
68694
|
}
|
|
68642
68695
|
const data2 = getBlockId(blockElement);
|
|
68643
68696
|
if (child) {
|
|
68644
|
-
const
|
|
68645
|
-
|
|
68697
|
+
const showCommandsBar = (child2) => {
|
|
68698
|
+
var _a, _b, _c;
|
|
68699
|
+
if (!child2 || !isTextBlockContentBoxChild(child2)) {
|
|
68700
|
+
return false;
|
|
68701
|
+
}
|
|
68702
|
+
const box = child2;
|
|
68703
|
+
const boxCommands = (_b = (_a = editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.getBoxProperties) == null ? void 0 : _b.call(_a, editor, box).boxCommands;
|
|
68704
|
+
if (!boxCommands) {
|
|
68705
|
+
return false;
|
|
68706
|
+
}
|
|
68707
|
+
return ((_c = boxCommands["hovering-toolbar"]) == null ? void 0 : _c.commands.length) > 0;
|
|
68708
|
+
};
|
|
68709
|
+
if (showCommandsBar(child)) {
|
|
68646
68710
|
return {
|
|
68647
68711
|
group: "hovering-toolbar",
|
|
68648
68712
|
commands: [
|
|
@@ -68962,11 +69026,11 @@ ${codeText}
|
|
|
68962
69026
|
const { containerId } = path[path.length - 1];
|
|
68963
69027
|
const targetBlock = getParentBlock(getContainerById(editor, containerId));
|
|
68964
69028
|
if (targetBlock && getBlockType(targetBlock) === "code") {
|
|
68965
|
-
addCommentToBlock
|
|
69029
|
+
addCommentToBlock(editor, targetBlock, editorComments.commentProvider);
|
|
68966
69030
|
return;
|
|
68967
69031
|
}
|
|
68968
69032
|
}
|
|
68969
|
-
addCommentToBlock
|
|
69033
|
+
addCommentToBlock(editor, block, editorComments.commentProvider);
|
|
68970
69034
|
return;
|
|
68971
69035
|
}
|
|
68972
69036
|
const selectedBlocks = getAllSelectedBlocks(editor, { simpleBlockOnly: true });
|
|
@@ -69202,7 +69266,7 @@ ${codeText}
|
|
|
69202
69266
|
editor2.selection.selectBlock(block, 0, getBlockTextLength$6(editor2, block), { noScroll: true });
|
|
69203
69267
|
const editorComments = editor2.getCustom("editor-comments");
|
|
69204
69268
|
editorComments.showCommentList();
|
|
69205
|
-
addCommentToBlock
|
|
69269
|
+
addCommentToBlock(editor2, block, editorComments.commentProvider);
|
|
69206
69270
|
}
|
|
69207
69271
|
}
|
|
69208
69272
|
};
|
|
@@ -69239,7 +69303,7 @@ ${codeText}
|
|
|
69239
69303
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
69240
69304
|
if (selectedBlock) {
|
|
69241
69305
|
const editorComments = editor.getCustom("editor-comments");
|
|
69242
|
-
addCommentToBlock
|
|
69306
|
+
addCommentToBlock(editor, selectedBlock.block, editorComments.commentProvider);
|
|
69243
69307
|
}
|
|
69244
69308
|
return;
|
|
69245
69309
|
}
|
|
@@ -76497,7 +76561,7 @@ ${content}
|
|
|
76497
76561
|
} else if (item.id === "download") {
|
|
76498
76562
|
downloadFile$1(editor, box);
|
|
76499
76563
|
} else if (item.id === "add-comment") {
|
|
76500
|
-
addCommentToBlock(editor, block);
|
|
76564
|
+
addCommentToBlock$1(editor, block);
|
|
76501
76565
|
}
|
|
76502
76566
|
}
|
|
76503
76567
|
}
|
|
@@ -76789,7 +76853,7 @@ ${content}
|
|
|
76789
76853
|
} else if (item.id === "download") {
|
|
76790
76854
|
downloadFile(editor, block);
|
|
76791
76855
|
} else if (item.id === "add-comment") {
|
|
76792
|
-
addCommentToBlock(editor, block);
|
|
76856
|
+
addCommentToBlock$1(editor, block);
|
|
76793
76857
|
}
|
|
76794
76858
|
}
|
|
76795
76859
|
}
|
|
@@ -80476,7 +80540,7 @@ ${content}
|
|
|
80476
80540
|
background: "Background color"
|
|
80477
80541
|
},
|
|
80478
80542
|
icon: {
|
|
80479
|
-
toggleIcon: "Click to change icon"
|
|
80543
|
+
toggleIcon: "Click to change the icon"
|
|
80480
80544
|
}
|
|
80481
80545
|
}
|
|
80482
80546
|
};
|
|
@@ -80490,7 +80554,7 @@ ${content}
|
|
|
80490
80554
|
background: "\u80CC\u666F\u8272"
|
|
80491
80555
|
},
|
|
80492
80556
|
icon: {
|
|
80493
|
-
toggleIcon: "\u30A2\u30A4\u30B3\u30F3\u3092\u5909\u66F4\u3059\u308B"
|
|
80557
|
+
toggleIcon: "\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u30A2\u30A4\u30B3\u30F3\u3092\u5909\u66F4\u3059\u308B"
|
|
80494
80558
|
}
|
|
80495
80559
|
}
|
|
80496
80560
|
};
|
|
@@ -80897,10 +80961,16 @@ ${content}
|
|
|
80897
80961
|
this.blockId = blockId;
|
|
80898
80962
|
const calloutIcon = createElement("div", ["callout-icon"], null);
|
|
80899
80963
|
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
80964
|
this.emojiPopup = EmojiPopup.get(this.editor, blockId);
|
|
80903
80965
|
this.emojiPopup.emojiPalette.on("onSelectEmoji", this.handleSelectEmoji);
|
|
80966
|
+
setTimeout(() => {
|
|
80967
|
+
if (editor.isWritable()) {
|
|
80968
|
+
calloutIcon.setAttribute("data-editor-tooltip-common", i18n$1.t("callout.icon.toggleIcon"));
|
|
80969
|
+
this.editor.domEvents.addEventListener(this.iconElement, "click", this.handleIconClick);
|
|
80970
|
+
} else {
|
|
80971
|
+
calloutIcon.classList.add("readonly");
|
|
80972
|
+
}
|
|
80973
|
+
}, 50);
|
|
80904
80974
|
}
|
|
80905
80975
|
render(parent, icon) {
|
|
80906
80976
|
this.updateIcon(icon);
|
|
@@ -86411,7 +86481,7 @@ ${data2.flowchartText}
|
|
|
86411
86481
|
executeCommand(editor, block, item) {
|
|
86412
86482
|
switch (item.id) {
|
|
86413
86483
|
case "addComment":
|
|
86414
|
-
addCommentToBlock(editor, block);
|
|
86484
|
+
addCommentToBlock$1(editor, block);
|
|
86415
86485
|
break;
|
|
86416
86486
|
case "left":
|
|
86417
86487
|
case "center":
|
|
@@ -88443,7 +88513,7 @@ ${data2.flowchartText}
|
|
|
88443
88513
|
}
|
|
88444
88514
|
}
|
|
88445
88515
|
});
|
|
88446
|
-
editor.version = "2.2.15-beta.
|
|
88516
|
+
editor.version = "2.2.15-beta.4";
|
|
88447
88517
|
return editor;
|
|
88448
88518
|
}
|
|
88449
88519
|
function isDoc(doc2) {
|
|
@@ -88538,7 +88608,7 @@ ${data2.flowchartText}
|
|
|
88538
88608
|
});
|
|
88539
88609
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88540
88610
|
OnesEditorToolbar.register(editor);
|
|
88541
|
-
editor.version = "2.2.15-beta.
|
|
88611
|
+
editor.version = "2.2.15-beta.4";
|
|
88542
88612
|
return editor;
|
|
88543
88613
|
}
|
|
88544
88614
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134382,6 +134452,7 @@ ${data2.flowchartText}
|
|
|
134382
134452
|
exports2.ShareDBLocalDoc = ShareDBLocalDoc;
|
|
134383
134453
|
exports2.ShareDBServer = ShareDBServer;
|
|
134384
134454
|
exports2.SimpleCache = SimpleCache;
|
|
134455
|
+
exports2.StandardBoxCommands = StandardBoxCommands;
|
|
134385
134456
|
exports2.StandardEmbedBlockCommands = StandardEmbedBlockCommands;
|
|
134386
134457
|
exports2.TEXT_STYLE_BACKGROUND_COLOR_PREFIX = TEXT_STYLE_BACKGROUND_COLOR_PREFIX;
|
|
134387
134458
|
exports2.TEXT_STYLE_COLOR_PREFIX = TEXT_STYLE_COLOR_PREFIX;
|
|
@@ -134400,7 +134471,7 @@ ${data2.flowchartText}
|
|
|
134400
134471
|
exports2.addAttribute = addAttribute;
|
|
134401
134472
|
exports2.addClass = addClass;
|
|
134402
134473
|
exports2.addColor = addColor;
|
|
134403
|
-
exports2.addCommentToBlock = addCommentToBlock;
|
|
134474
|
+
exports2.addCommentToBlock = addCommentToBlock$1;
|
|
134404
134475
|
exports2.addDays = addDays;
|
|
134405
134476
|
exports2.addMetaToDoc = addMetaToDoc;
|
|
134406
134477
|
exports2.addMonths = addMonths;
|