@ones-editor/editor 2.1.1-beta.59 → 2.1.1-beta.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@ones-editor/core/src/core/containers/root-container.d.ts +1 -0
- package/@ones-editor/mobile-helper/src/cursor-toolbar.d.ts +1 -0
- package/@ones-editor/mobile-helper/src/embed-mask.d.ts +10 -0
- package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +1 -0
- package/@ones-editor/mobile-helper/src/index.d.ts +3 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/providers/clipboard-provider.d.ts +3 -2
- package/dist/index.js +141 -36
- package/package.json +1 -1
|
@@ -11,9 +11,10 @@ export default class ClipboardProvider implements OnesEditorCommandProvider {
|
|
|
11
11
|
get hasClipboardReadPermission(): boolean;
|
|
12
12
|
get hasClipboardWritePermission(): boolean;
|
|
13
13
|
clipboardSupport(): void;
|
|
14
|
-
canPaste(): boolean
|
|
14
|
+
canPaste(): Promise<boolean>;
|
|
15
|
+
createPasteElement(editor: OnesEditor): HTMLDivElement;
|
|
15
16
|
getAvailableCommands: (editor: OnesEditor, blockElement: BlockElement) => CommandItem[];
|
|
16
17
|
getInsertCommands: () => never[];
|
|
17
18
|
copyRange(editor: OnesEditor, range: SelectionRange): void;
|
|
18
|
-
|
|
19
|
+
executeRangeCommand(editor: OnesEditor, range: SelectionRange, command: CommandItem): boolean;
|
|
19
20
|
}
|
package/dist/index.js
CHANGED
|
@@ -2026,6 +2026,9 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2026
2026
|
[data-command-bar-id] .command-item.disabled > .color-button svg {
|
|
2027
2027
|
color: #b2bccd;
|
|
2028
2028
|
}
|
|
2029
|
+
[data-command-bar-id] .command-item .command-item-paste.disabled {
|
|
2030
|
+
color: #c7c7c7;
|
|
2031
|
+
}
|
|
2029
2032
|
[data-command-bar-id=cursor-toolbar].mobile .tippy-box,
|
|
2030
2033
|
[data-command-bar-id=paste-special-button].mobile .tippy-box,
|
|
2031
2034
|
[data-command-bar-id=editor-toolbar].mobile .tippy-box {
|
|
@@ -6513,16 +6516,19 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6513
6516
|
html, body {
|
|
6514
6517
|
height: 100%;
|
|
6515
6518
|
overscroll-behavior: contain;
|
|
6516
|
-
}
|
|
6519
|
+
}[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle,
|
|
6520
|
+
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle {
|
|
6517
6521
|
position: absolute;
|
|
6518
6522
|
flex-direction: column;
|
|
6519
6523
|
align-items: center;
|
|
6520
6524
|
display: none;
|
|
6521
6525
|
z-index: 10;
|
|
6522
6526
|
}
|
|
6527
|
+
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.active,
|
|
6523
6528
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.active {
|
|
6524
6529
|
display: flex;
|
|
6525
6530
|
}
|
|
6531
|
+
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line,
|
|
6526
6532
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .line {
|
|
6527
6533
|
width: 4px;
|
|
6528
6534
|
height: 16px;
|
|
@@ -6530,6 +6536,7 @@ html, body {
|
|
|
6530
6536
|
flex-grow: 1;
|
|
6531
6537
|
flex-shrink: 1;
|
|
6532
6538
|
}
|
|
6539
|
+
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle,
|
|
6533
6540
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle .circle {
|
|
6534
6541
|
width: 16px;
|
|
6535
6542
|
height: 16px;
|
|
@@ -6538,20 +6545,33 @@ html, body {
|
|
|
6538
6545
|
flex-shrink: 0;
|
|
6539
6546
|
background-color: var(--primary-color);
|
|
6540
6547
|
}
|
|
6548
|
+
[data-command-bar-id=editor-toolbar] .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.start,
|
|
6541
6549
|
.editor-root .editor-content div[data-type=editor-block] div[data-type=block-tools] div.select-handle.start {
|
|
6542
6550
|
flex-direction: column-reverse;
|
|
6551
|
+
}
|
|
6552
|
+
div.editor-root div.editor-content div[data-block-type=embed] > .embed-mask::after {
|
|
6553
|
+
content: " ";
|
|
6554
|
+
position: absolute;
|
|
6555
|
+
left: 0;
|
|
6556
|
+
top: 0;
|
|
6557
|
+
right: 0;
|
|
6558
|
+
bottom: 0;
|
|
6559
|
+
z-index: 999;
|
|
6560
|
+
opacity: 0;
|
|
6543
6561
|
}.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-container.layout-column-container {
|
|
6544
6562
|
background-color: transparent;
|
|
6545
6563
|
}
|
|
6546
6564
|
.editor-root div.editor-content div[data-type=editor-container].root > .container-blocks > * + .layout-block {
|
|
6547
6565
|
margin-top: 1.67em;
|
|
6548
6566
|
}
|
|
6567
|
+
.editor-root.mobile [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar,
|
|
6549
6568
|
.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar,
|
|
6550
6569
|
.editor-content.dragging [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-column-action-bar {
|
|
6551
6570
|
display: none;
|
|
6552
6571
|
user-select: none;
|
|
6553
6572
|
pointer-events: none;
|
|
6554
6573
|
}
|
|
6574
|
+
.editor-root.mobile [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator,
|
|
6555
6575
|
.editor-root.readonly [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator,
|
|
6556
6576
|
.editor-content.dragging [data-type=editor-container].root div[data-type=editor-block].layout-block .layout-separator {
|
|
6557
6577
|
opacity: 0;
|
|
@@ -11191,11 +11211,29 @@ var __publicField = (obj, key, value) => {
|
|
|
11191
11211
|
function ensureIsMobileEvent(events2) {
|
|
11192
11212
|
return events2 instanceof TouchEvent;
|
|
11193
11213
|
}
|
|
11214
|
+
function bindDbClick(elem, handler) {
|
|
11215
|
+
let touchTime = 0;
|
|
11216
|
+
const callback = (event) => {
|
|
11217
|
+
if (touchTime === 0) {
|
|
11218
|
+
touchTime = new Date().getTime();
|
|
11219
|
+
} else {
|
|
11220
|
+
if (new Date().getTime() - touchTime < 800) {
|
|
11221
|
+
handler(event);
|
|
11222
|
+
}
|
|
11223
|
+
touchTime = 0;
|
|
11224
|
+
}
|
|
11225
|
+
};
|
|
11226
|
+
elem.addEventListener("click", callback);
|
|
11227
|
+
return () => {
|
|
11228
|
+
elem.removeEventListener("click", callback);
|
|
11229
|
+
};
|
|
11230
|
+
}
|
|
11194
11231
|
class RootContainer {
|
|
11195
11232
|
constructor(editor, rootContainer) {
|
|
11196
11233
|
__publicField(this, "resizeObserver");
|
|
11197
11234
|
__publicField(this, "isMoved", false);
|
|
11198
11235
|
__publicField(this, "mouseDownEvent", null);
|
|
11236
|
+
__publicField(this, "dbClickRef", null);
|
|
11199
11237
|
__publicField(this, "handleContextMenu", (event) => {
|
|
11200
11238
|
if (clientType.isSafari) {
|
|
11201
11239
|
const sel = document.getSelection();
|
|
@@ -11344,7 +11382,11 @@ var __publicField = (obj, key, value) => {
|
|
|
11344
11382
|
container.oncontextmenu = this.handleContextMenu;
|
|
11345
11383
|
container.onclick = this.handleClick;
|
|
11346
11384
|
}
|
|
11347
|
-
|
|
11385
|
+
if (clientType.isIOS) {
|
|
11386
|
+
this.dbClickRef = bindDbClick(container, this.handleDblClick);
|
|
11387
|
+
} else {
|
|
11388
|
+
container.ondblclick = this.handleDblClick;
|
|
11389
|
+
}
|
|
11348
11390
|
}
|
|
11349
11391
|
unbindEvents() {
|
|
11350
11392
|
this.resizeObserver.disconnect();
|
|
@@ -11353,6 +11395,10 @@ var __publicField = (obj, key, value) => {
|
|
|
11353
11395
|
container.ondblclick = null;
|
|
11354
11396
|
container.onclick = null;
|
|
11355
11397
|
container.oncontextmenu = null;
|
|
11398
|
+
if (this.dbClickRef) {
|
|
11399
|
+
this.dbClickRef();
|
|
11400
|
+
this.dbClickRef = null;
|
|
11401
|
+
}
|
|
11356
11402
|
}
|
|
11357
11403
|
destroy() {
|
|
11358
11404
|
this.unbindEvents();
|
|
@@ -46456,8 +46502,8 @@ ${codeText}
|
|
|
46456
46502
|
const pasteItem = {
|
|
46457
46503
|
id: "paste",
|
|
46458
46504
|
name: i18n$1.t("commands.paste"),
|
|
46459
|
-
|
|
46460
|
-
states:
|
|
46505
|
+
element: this.createPasteElement(editor),
|
|
46506
|
+
states: []
|
|
46461
46507
|
};
|
|
46462
46508
|
const items = [cutItem, copyItem];
|
|
46463
46509
|
if (this.options.withPaste) {
|
|
@@ -46522,23 +46568,45 @@ ${codeText}
|
|
|
46522
46568
|
};
|
|
46523
46569
|
}
|
|
46524
46570
|
}
|
|
46525
|
-
canPaste() {
|
|
46571
|
+
async canPaste() {
|
|
46526
46572
|
const hasReadPermission = this.hasClipboardReadPermission;
|
|
46527
46573
|
let clipboardEmpty;
|
|
46528
46574
|
if (isFirefox() || isSafari()) {
|
|
46529
46575
|
clipboardEmpty = true;
|
|
46530
46576
|
} else {
|
|
46531
|
-
clipboardEmpty = hasReadPermission;
|
|
46577
|
+
clipboardEmpty = hasReadPermission ? await isClipboardEmpty$1() : false;
|
|
46532
46578
|
}
|
|
46533
46579
|
return this.isSecureContext && this.clipboardPermission.read !== "denied" && !clipboardEmpty;
|
|
46534
46580
|
}
|
|
46581
|
+
createPasteElement(editor) {
|
|
46582
|
+
const pasteItemElement = createElement("div", ["command-item-paste"], null);
|
|
46583
|
+
pasteItemElement.textContent = i18n$1.t("commands.paste");
|
|
46584
|
+
this.canPaste().then((canPaste) => {
|
|
46585
|
+
if (!canPaste) {
|
|
46586
|
+
pasteItemElement.classList.add("disabled");
|
|
46587
|
+
}
|
|
46588
|
+
});
|
|
46589
|
+
pasteItemElement.addEventListener("click", () => {
|
|
46590
|
+
if (pasteItemElement.classList.contains("disabled")) {
|
|
46591
|
+
return;
|
|
46592
|
+
}
|
|
46593
|
+
getClipboardData$1().then((clipboardData) => {
|
|
46594
|
+
const event = new ClipboardEvent("paste", {
|
|
46595
|
+
clipboardData,
|
|
46596
|
+
bubbles: true
|
|
46597
|
+
});
|
|
46598
|
+
editor.input.inputElement.dispatchEvent(event);
|
|
46599
|
+
});
|
|
46600
|
+
});
|
|
46601
|
+
return pasteItemElement;
|
|
46602
|
+
}
|
|
46535
46603
|
copyRange(editor, range) {
|
|
46536
46604
|
const selectedBlocks = range.getSelectedBlocks();
|
|
46537
46605
|
const docs = selectedBlocks.map((s) => selectedBlockToDoc(editor, s));
|
|
46538
46606
|
const doc2 = mergeDocs(docs);
|
|
46539
46607
|
editorCopyDoc(editor, doc2);
|
|
46540
46608
|
}
|
|
46541
|
-
|
|
46609
|
+
executeRangeCommand(editor, range, command) {
|
|
46542
46610
|
if (command.id === "copy") {
|
|
46543
46611
|
this.copyRange(editor, range);
|
|
46544
46612
|
return true;
|
|
@@ -46548,16 +46616,6 @@ ${codeText}
|
|
|
46548
46616
|
editorClearSelectedContents(editor, range);
|
|
46549
46617
|
return true;
|
|
46550
46618
|
}
|
|
46551
|
-
if (command.id === "paste") {
|
|
46552
|
-
getClipboardData$1().then((clipboardData) => {
|
|
46553
|
-
const event = new ClipboardEvent("paste", {
|
|
46554
|
-
clipboardData,
|
|
46555
|
-
bubbles: true
|
|
46556
|
-
});
|
|
46557
|
-
editor.input.inputElement.dispatchEvent(event);
|
|
46558
|
-
});
|
|
46559
|
-
return true;
|
|
46560
|
-
}
|
|
46561
46619
|
return false;
|
|
46562
46620
|
}
|
|
46563
46621
|
}
|
|
@@ -46582,11 +46640,14 @@ ${codeText}
|
|
|
46582
46640
|
return items;
|
|
46583
46641
|
}
|
|
46584
46642
|
executeCommand(editor, block, box, item) {
|
|
46585
|
-
var _a;
|
|
46643
|
+
var _a, _b;
|
|
46586
46644
|
const { start, end } = getChildOffset(block, box);
|
|
46587
46645
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
46588
46646
|
for (const provider of this.providers) {
|
|
46589
|
-
if ((_a = provider.
|
|
46647
|
+
if ((_a = provider.executeRangeCommand) == null ? void 0 : _a.call(provider, editor, range, item, {})) {
|
|
46648
|
+
return;
|
|
46649
|
+
}
|
|
46650
|
+
if ((_b = provider.executeCommand) == null ? void 0 : _b.call(provider, editor, block, range, item, {})) {
|
|
46590
46651
|
return;
|
|
46591
46652
|
}
|
|
46592
46653
|
}
|
|
@@ -50221,7 +50282,7 @@ ${codeText}
|
|
|
50221
50282
|
this.provider.executeCommand(editor, block, editor.selection.range, item, { child });
|
|
50222
50283
|
const { start, end } = getChildOffset(block, child);
|
|
50223
50284
|
const range = createBlockSimpleRange(editor, block, start, end);
|
|
50224
|
-
this.clipboardProvider.
|
|
50285
|
+
this.clipboardProvider.executeRangeCommand(editor, range, item);
|
|
50225
50286
|
});
|
|
50226
50287
|
this.editor = editor;
|
|
50227
50288
|
this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: true });
|
|
@@ -50328,7 +50389,7 @@ ${codeText}
|
|
|
50328
50389
|
this._lastClickTime = Date.now();
|
|
50329
50390
|
});
|
|
50330
50391
|
__publicField(this, "handleClose", () => {
|
|
50331
|
-
if (shouldFocusToEditor(this.editor)) {
|
|
50392
|
+
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
50332
50393
|
this.editor.focus({
|
|
50333
50394
|
preventScroll: true
|
|
50334
50395
|
});
|
|
@@ -69101,7 +69162,7 @@ ${codeText}
|
|
|
69101
69162
|
scrollContainer.init({
|
|
69102
69163
|
parentElement: content,
|
|
69103
69164
|
childElement: tableContent,
|
|
69104
|
-
safeRightSpace: 50,
|
|
69165
|
+
safeRightSpace: clientType.isMobile ? 20 : 50,
|
|
69105
69166
|
safeLeftSpace: 40,
|
|
69106
69167
|
parentContainer: isRootContainer(container) || !containerScrollable ? editor.scrollContainer : container,
|
|
69107
69168
|
locatingContainer: isRootContainer(container) ? (options == null ? void 0 : options.locatingContainer) || editor.parent : container,
|
|
@@ -78318,7 +78379,7 @@ ${content}
|
|
|
78318
78379
|
__publicField(this, "createMobileCommandItem", (items) => {
|
|
78319
78380
|
this.mobileWrap = createElement("div", ["mobile-item-wrap"], null);
|
|
78320
78381
|
const content = createElement("div", ["mobile-item-content"], null);
|
|
78321
|
-
const clientHeight = this.editor.
|
|
78382
|
+
const clientHeight = this.editor.scrollContainer.clientHeight;
|
|
78322
78383
|
content.style.maxHeight = `${clientHeight - 180}px`;
|
|
78323
78384
|
const icon = createElement("div", ["editor-input-icon"], null);
|
|
78324
78385
|
icon.innerHTML = SearchIcon;
|
|
@@ -79493,10 +79554,10 @@ ${content}
|
|
|
79493
79554
|
const endToolsRect = endBlock.getBoundingClientRect();
|
|
79494
79555
|
const startGripperHeight = startRect.height + HANDLE_CIRCLE_SIZE;
|
|
79495
79556
|
const endGripperHeight = endRect.height + HANDLE_CIRCLE_SIZE;
|
|
79496
|
-
const startX = startRect.left - startToolsRect.left - HANDLE_WIDTH / 2;
|
|
79497
|
-
const startY = startRect.top - startToolsRect.top - HANDLE_CIRCLE_SIZE;
|
|
79498
|
-
const endX = endRect.left - endToolsRect.left - HANDLE_WIDTH / 2;
|
|
79499
|
-
const endY = endRect.top - endToolsRect.top;
|
|
79557
|
+
const startX = startRect.left - startToolsRect.left - startBlock.clientLeft - HANDLE_WIDTH / 2;
|
|
79558
|
+
const startY = startRect.top - startToolsRect.top - startBlock.clientTop - HANDLE_CIRCLE_SIZE;
|
|
79559
|
+
const endX = endRect.left - endToolsRect.left - endBlock.clientLeft - HANDLE_WIDTH / 2;
|
|
79560
|
+
const endY = endRect.top - endToolsRect.top - endBlock.clientTop;
|
|
79500
79561
|
this.startGripper.style.left = `${startX}px`;
|
|
79501
79562
|
this.startGripper.style.top = `${startY}px`;
|
|
79502
79563
|
this.endGripper.style.left = `${endX}px`;
|
|
@@ -79612,14 +79673,14 @@ ${content}
|
|
|
79612
79673
|
class CursorToolbarHandler {
|
|
79613
79674
|
constructor(editor) {
|
|
79614
79675
|
__publicField(this, "toolbar");
|
|
79676
|
+
__publicField(this, "clipboardProvider");
|
|
79615
79677
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
79616
|
-
const focusBlock = this.editor.selection.focusedBlock;
|
|
79617
79678
|
const range = this.editor.selection.range;
|
|
79618
79679
|
if (item.id === "select") {
|
|
79619
79680
|
editorSelectWord(this.editor);
|
|
79620
79681
|
}
|
|
79621
79682
|
if (item.id === "paste") {
|
|
79622
|
-
|
|
79683
|
+
this.clipboardProvider.executeRangeCommand(this.editor, range, item);
|
|
79623
79684
|
}
|
|
79624
79685
|
});
|
|
79625
79686
|
__publicField(this, "handleSelectionChange", () => {
|
|
@@ -79628,7 +79689,7 @@ ${content}
|
|
|
79628
79689
|
__publicField(this, "getCommands", () => {
|
|
79629
79690
|
const commands = [{ id: "select", name: i18n$1.t("mobile.commands.select") }];
|
|
79630
79691
|
const focusBlock = this.editor.selection.focusedBlock;
|
|
79631
|
-
const clipboardCommands =
|
|
79692
|
+
const clipboardCommands = this.clipboardProvider.getAvailableCommands(this.editor, focusBlock);
|
|
79632
79693
|
clipboardCommands.filter((cmd) => cmd.id === "paste").forEach((cmd) => commands.push(cmd));
|
|
79633
79694
|
return groupEachCommand(commands);
|
|
79634
79695
|
});
|
|
@@ -79657,6 +79718,7 @@ ${content}
|
|
|
79657
79718
|
});
|
|
79658
79719
|
this.toolbar.on("click", this.handleButtonClick);
|
|
79659
79720
|
this.editor.addListener("selectionChanged", this.handleSelectionChange);
|
|
79721
|
+
this.clipboardProvider = new ClipboardProvider(this.editor, { withPaste: true });
|
|
79660
79722
|
}
|
|
79661
79723
|
destroy() {
|
|
79662
79724
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
@@ -79740,7 +79802,7 @@ ${content}
|
|
|
79740
79802
|
];
|
|
79741
79803
|
});
|
|
79742
79804
|
this.editor = editor;
|
|
79743
|
-
this.providers = [new HeadingProvider(editor)];
|
|
79805
|
+
this.providers = [new HeadingProvider(editor, { withPlainText: true })];
|
|
79744
79806
|
}
|
|
79745
79807
|
}
|
|
79746
79808
|
class TabProvider {
|
|
@@ -79956,6 +80018,7 @@ ${content}
|
|
|
79956
80018
|
destroy() {
|
|
79957
80019
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
79958
80020
|
this.mobileToolbar.destroy();
|
|
80021
|
+
this.bar.remove();
|
|
79959
80022
|
}
|
|
79960
80023
|
}
|
|
79961
80024
|
class ActiveElementObserver {
|
|
@@ -79984,10 +80047,11 @@ ${content}
|
|
|
79984
80047
|
__publicField(this, "observer");
|
|
79985
80048
|
__publicField(this, "showKeyboard", false);
|
|
79986
80049
|
__publicField(this, "initViewportHeight", this.window.visualViewport.height);
|
|
80050
|
+
__publicField(this, "toggleDelay", clientType.isSafari ? 800 : 100);
|
|
79987
80051
|
__publicField(this, "toggle", debounce__default.default(() => {
|
|
79988
80052
|
const offsetHeight = Math.max(this.clientHeight - this.virtualViewportHeight, 0);
|
|
79989
80053
|
this.commandBar.bar.style.bottom = `${offsetHeight}px`;
|
|
79990
|
-
},
|
|
80054
|
+
}, this.toggleDelay));
|
|
79991
80055
|
__publicField(this, "handleFocusIn", () => {
|
|
79992
80056
|
if (!this.showKeyboard) {
|
|
79993
80057
|
this.showKeyboard = true;
|
|
@@ -80076,6 +80140,39 @@ ${content}
|
|
|
80076
80140
|
"en-US": enUS$7,
|
|
80077
80141
|
"ja-JP": jaJP$7
|
|
80078
80142
|
});
|
|
80143
|
+
class MobileEmbedMask {
|
|
80144
|
+
constructor(editor) {
|
|
80145
|
+
__publicField(this, "addMask", (block) => {
|
|
80146
|
+
const content = getBlockContent(block);
|
|
80147
|
+
addClass(content, "embed-mask");
|
|
80148
|
+
});
|
|
80149
|
+
__publicField(this, "removeMask", (block) => {
|
|
80150
|
+
const content = getBlockContent(block);
|
|
80151
|
+
removeClass(content, "embed-mask");
|
|
80152
|
+
});
|
|
80153
|
+
__publicField(this, "handleSelectionChanged", debounce__default.default(() => {
|
|
80154
|
+
if (this.editor.readonly) {
|
|
80155
|
+
return;
|
|
80156
|
+
}
|
|
80157
|
+
const { start, end } = this.editor.selection.range;
|
|
80158
|
+
this.editor.rootContainer.querySelectorAll("div.embed-block[data-type=editor-block][data-block-type=embed]").forEach((blockElem) => {
|
|
80159
|
+
const block = blockElem;
|
|
80160
|
+
const blockId = getBlockId(block);
|
|
80161
|
+
if (start.blockId === end.blockId && start.blockId === blockId) {
|
|
80162
|
+
this.removeMask(block);
|
|
80163
|
+
return;
|
|
80164
|
+
}
|
|
80165
|
+
this.addMask(block);
|
|
80166
|
+
});
|
|
80167
|
+
}, 400));
|
|
80168
|
+
this.editor = editor;
|
|
80169
|
+
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
80170
|
+
this.handleSelectionChanged();
|
|
80171
|
+
}
|
|
80172
|
+
destroy() {
|
|
80173
|
+
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
80174
|
+
}
|
|
80175
|
+
}
|
|
80079
80176
|
const LONG_PRESS_DELAY = 800;
|
|
80080
80177
|
class OnesEditorMobileHelper {
|
|
80081
80178
|
constructor(editor) {
|
|
@@ -80084,9 +80181,10 @@ ${content}
|
|
|
80084
80181
|
__publicField(this, "gripper");
|
|
80085
80182
|
__publicField(this, "cursorToolbar");
|
|
80086
80183
|
__publicField(this, "isMoving", false);
|
|
80087
|
-
__publicField(this, "
|
|
80184
|
+
__publicField(this, "mobileEmbedMask");
|
|
80185
|
+
__publicField(this, "handleSelectionChange", debounce__default.default(() => {
|
|
80088
80186
|
this.gripper.update();
|
|
80089
|
-
});
|
|
80187
|
+
}, 10));
|
|
80090
80188
|
__publicField(this, "handleLongPress", (event) => {
|
|
80091
80189
|
const touch = event.touches[0];
|
|
80092
80190
|
const range = getBlockRangeFromPoint(this.editor, touch.clientX, touch.clientY);
|
|
@@ -80157,6 +80255,7 @@ ${content}
|
|
|
80157
80255
|
document.addEventListener("touchmove", this.handleTouchMove);
|
|
80158
80256
|
this.gripper = new SelectionGripper(this.editor);
|
|
80159
80257
|
this.cursorToolbar = createCursorToolbar(this.editor);
|
|
80258
|
+
this.mobileEmbedMask = new MobileEmbedMask(this.editor);
|
|
80160
80259
|
}
|
|
80161
80260
|
destroy() {
|
|
80162
80261
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
@@ -80164,6 +80263,9 @@ ${content}
|
|
|
80164
80263
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
80165
80264
|
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
80166
80265
|
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
80266
|
+
this.mobileEmbedMask.destroy();
|
|
80267
|
+
this.cursorToolbar.destroy();
|
|
80268
|
+
this.gripper.destroy();
|
|
80167
80269
|
}
|
|
80168
80270
|
}
|
|
80169
80271
|
function getChildContainers(editor, block, from, to) {
|
|
@@ -83175,6 +83277,9 @@ ${content}
|
|
|
83175
83277
|
content.style.height = `${embedData.height}px`;
|
|
83176
83278
|
}
|
|
83177
83279
|
setTimeout(() => {
|
|
83280
|
+
if (clientType.isMobile) {
|
|
83281
|
+
return;
|
|
83282
|
+
}
|
|
83178
83283
|
const blockElement = this.editor.getBlockById(id);
|
|
83179
83284
|
EmbedBlockResizer.register(this.editor, blockElement);
|
|
83180
83285
|
});
|
|
@@ -86551,7 +86656,7 @@ ${data2.flowchartText}
|
|
|
86551
86656
|
}
|
|
86552
86657
|
}
|
|
86553
86658
|
});
|
|
86554
|
-
editor.version = "2.1.1-beta.
|
|
86659
|
+
editor.version = "2.1.1-beta.60";
|
|
86555
86660
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86556
86661
|
window.setReauthFail = (fail) => {
|
|
86557
86662
|
window.isReauthError = fail;
|
|
@@ -86649,7 +86754,7 @@ ${data2.flowchartText}
|
|
|
86649
86754
|
});
|
|
86650
86755
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86651
86756
|
OnesEditorToolbar.register(editor);
|
|
86652
|
-
editor.version = "2.1.1-beta.
|
|
86757
|
+
editor.version = "2.1.1-beta.60";
|
|
86653
86758
|
return editor;
|
|
86654
86759
|
}
|
|
86655
86760
|
async function showDocVersions(editor, options, serverUrl) {
|