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