@ones-editor/editor 3.1.7-beta.ONES22303310.1 → 3.1.7-beta.h1473.2
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/composition/editor-input.d.ts +1 -0
- package/@ones-editor/core/src/core/composition/focus-restoration.d.ts +25 -0
- package/@ones-editor/core/src/core/composition/index.d.ts +2 -0
- package/@ones-editor/main-toolbar/src/index.d.ts +2 -0
- package/@ones-editor/paste-special/src/paste-special-button.d.ts +7 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/package.json +3 -0
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -0
- package/@ones-editor/ui-base/src/auto-suggest/editor-auto-suggest-menu.d.ts +2 -0
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +7 -0
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
- package/dist/index.js +411 -97
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -26414,6 +26414,114 @@ var __publicField = (obj, key, value) => {
|
|
|
26414
26414
|
};
|
|
26415
26415
|
}
|
|
26416
26416
|
}
|
|
26417
|
+
const controllers = /* @__PURE__ */ new WeakMap();
|
|
26418
|
+
const noop$1 = () => {
|
|
26419
|
+
};
|
|
26420
|
+
class FocusRestoration {
|
|
26421
|
+
constructor(input2, restore) {
|
|
26422
|
+
__publicField(this, "generation", 0);
|
|
26423
|
+
__publicField(this, "owner", null);
|
|
26424
|
+
__publicField(this, "destroyed", false);
|
|
26425
|
+
__publicField(this, "activeScope");
|
|
26426
|
+
__publicField(this, "timers", /* @__PURE__ */ new Set());
|
|
26427
|
+
this.input = input2;
|
|
26428
|
+
this.restore = restore;
|
|
26429
|
+
controllers.set(input2, this);
|
|
26430
|
+
}
|
|
26431
|
+
canFocus() {
|
|
26432
|
+
var _a;
|
|
26433
|
+
return !this.destroyed && !this.owner && !((_a = this.activeScope) == null ? void 0 : _a.cancelled) && this.input.isConnected;
|
|
26434
|
+
}
|
|
26435
|
+
hasOtherInput() {
|
|
26436
|
+
const active = this.input.ownerDocument.activeElement;
|
|
26437
|
+
return active !== this.input && !!(active == null ? void 0 : active.matches('input, textarea, select, [contenteditable="true"], [contenteditable=""]'));
|
|
26438
|
+
}
|
|
26439
|
+
schedule(callback, delay = 0, protectUserFocus = false) {
|
|
26440
|
+
var _a;
|
|
26441
|
+
return this.scheduleInScope(callback, delay, protectUserFocus, (_a = this.activeScope) != null ? _a : this.createScope());
|
|
26442
|
+
}
|
|
26443
|
+
createScope() {
|
|
26444
|
+
return { cancelled: false, timers: /* @__PURE__ */ new Set() };
|
|
26445
|
+
}
|
|
26446
|
+
scheduleInScope(callback, delay, protectUserFocus, scope) {
|
|
26447
|
+
if (scope.cancelled || !this.canFocus()) {
|
|
26448
|
+
return noop$1;
|
|
26449
|
+
}
|
|
26450
|
+
const generation = this.generation;
|
|
26451
|
+
const timer = setTimeout(() => {
|
|
26452
|
+
this.timers.delete(timer);
|
|
26453
|
+
scope.timers.delete(timer);
|
|
26454
|
+
if (!scope.cancelled && generation === this.generation && this.canFocus() && (!protectUserFocus || !this.hasOtherInput())) {
|
|
26455
|
+
const previousScope = this.activeScope;
|
|
26456
|
+
this.activeScope = scope;
|
|
26457
|
+
try {
|
|
26458
|
+
callback();
|
|
26459
|
+
} finally {
|
|
26460
|
+
this.activeScope = previousScope;
|
|
26461
|
+
}
|
|
26462
|
+
}
|
|
26463
|
+
}, delay);
|
|
26464
|
+
this.timers.add(timer);
|
|
26465
|
+
scope.timers.add(timer);
|
|
26466
|
+
return () => {
|
|
26467
|
+
scope.cancelled = true;
|
|
26468
|
+
scope.timers.forEach((pending) => {
|
|
26469
|
+
clearTimeout(pending);
|
|
26470
|
+
this.timers.delete(pending);
|
|
26471
|
+
});
|
|
26472
|
+
scope.timers.clear();
|
|
26473
|
+
};
|
|
26474
|
+
}
|
|
26475
|
+
request(delay = 0) {
|
|
26476
|
+
return this.scheduleInScope(this.restore, delay, !clientType.isMobile, this.createScope());
|
|
26477
|
+
}
|
|
26478
|
+
cancelPending() {
|
|
26479
|
+
if (this.activeScope) {
|
|
26480
|
+
this.activeScope.cancelled = true;
|
|
26481
|
+
}
|
|
26482
|
+
this.generation += 1;
|
|
26483
|
+
this.timers.forEach((timer) => clearTimeout(timer));
|
|
26484
|
+
this.timers.clear();
|
|
26485
|
+
}
|
|
26486
|
+
acquire() {
|
|
26487
|
+
this.cancelPending();
|
|
26488
|
+
const owner = {};
|
|
26489
|
+
this.owner = owner;
|
|
26490
|
+
return () => {
|
|
26491
|
+
if (this.owner === owner) {
|
|
26492
|
+
this.cancelPending();
|
|
26493
|
+
this.owner = null;
|
|
26494
|
+
}
|
|
26495
|
+
};
|
|
26496
|
+
}
|
|
26497
|
+
destroy() {
|
|
26498
|
+
this.destroyed = true;
|
|
26499
|
+
this.cancelPending();
|
|
26500
|
+
this.owner = null;
|
|
26501
|
+
controllers.delete(this.input);
|
|
26502
|
+
}
|
|
26503
|
+
}
|
|
26504
|
+
function requestInputFocus(input2, delay = 0) {
|
|
26505
|
+
var _a, _b;
|
|
26506
|
+
return (_b = (_a = controllers.get(input2)) == null ? void 0 : _a.request(delay)) != null ? _b : noop$1;
|
|
26507
|
+
}
|
|
26508
|
+
function requestEditorFocus(editor, delay = 0) {
|
|
26509
|
+
if (editor.destroyed) {
|
|
26510
|
+
return noop$1;
|
|
26511
|
+
}
|
|
26512
|
+
if (clientType.isMobile && delay === 0) {
|
|
26513
|
+
editor.focus();
|
|
26514
|
+
return noop$1;
|
|
26515
|
+
}
|
|
26516
|
+
return requestInputFocus(editor.input.inputElement, delay);
|
|
26517
|
+
}
|
|
26518
|
+
function acquireEditorFocus(editor) {
|
|
26519
|
+
var _a, _b;
|
|
26520
|
+
if (clientType.isMobile || editor.destroyed) {
|
|
26521
|
+
return noop$1;
|
|
26522
|
+
}
|
|
26523
|
+
return (_b = (_a = controllers.get(editor.input.inputElement)) == null ? void 0 : _a.acquire()) != null ? _b : noop$1;
|
|
26524
|
+
}
|
|
26417
26525
|
const logger$3V = getLogger("editor-input");
|
|
26418
26526
|
class EditorInput$1 {
|
|
26419
26527
|
constructor(editor, callbacks) {
|
|
@@ -26423,6 +26531,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26423
26531
|
__publicField(this, "callbacks");
|
|
26424
26532
|
__publicField(this, "inputElement");
|
|
26425
26533
|
__publicField(this, "focused", false);
|
|
26534
|
+
__publicField(this, "focusRestoration");
|
|
26426
26535
|
__publicField(this, "handleBlur", () => {
|
|
26427
26536
|
this.editor.emit("blur", this.editor);
|
|
26428
26537
|
this.callbacks.onBlur();
|
|
@@ -26444,12 +26553,20 @@ var __publicField = (obj, key, value) => {
|
|
|
26444
26553
|
const isInDisableScrollMask = this.isInDisableScrollMask(target);
|
|
26445
26554
|
if (target && (isInDisableScrollMask || rootElement === target || rootElement.contains(target))) {
|
|
26446
26555
|
if (!isInDisableScrollMask && !isInBlockTools(target)) {
|
|
26447
|
-
|
|
26556
|
+
const focus = () => {
|
|
26557
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26558
|
+
return;
|
|
26559
|
+
}
|
|
26448
26560
|
this.editor.emit("focus", this.editor);
|
|
26449
26561
|
this.callbacks.onFocus();
|
|
26450
26562
|
this.editor.input.focus();
|
|
26451
26563
|
this.focused = true;
|
|
26452
|
-
}
|
|
26564
|
+
};
|
|
26565
|
+
if (clientType.isMobile) {
|
|
26566
|
+
setTimeout(focus);
|
|
26567
|
+
} else {
|
|
26568
|
+
this.focusRestoration.schedule(focus);
|
|
26569
|
+
}
|
|
26453
26570
|
}
|
|
26454
26571
|
return;
|
|
26455
26572
|
}
|
|
@@ -26584,6 +26701,11 @@ var __publicField = (obj, key, value) => {
|
|
|
26584
26701
|
input2.addEventListener("compositionstart", this.handleCompositionstart);
|
|
26585
26702
|
input2.addEventListener("compositionend", this.handleCompositionend);
|
|
26586
26703
|
this.inputElement = input2;
|
|
26704
|
+
this.focusRestoration = new FocusRestoration(input2, () => {
|
|
26705
|
+
if (!this.editor.destroyed) {
|
|
26706
|
+
this.editor.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
26707
|
+
}
|
|
26708
|
+
});
|
|
26587
26709
|
if (clientType.isMobile) {
|
|
26588
26710
|
document.addEventListener("touchend", this.handleDocumentClick);
|
|
26589
26711
|
} else {
|
|
@@ -26606,6 +26728,7 @@ var __publicField = (obj, key, value) => {
|
|
|
26606
26728
|
return !!(elem == null ? void 0 : elem.closest("div[data-command-bar-id]")) || !!(elem == null ? void 0 : elem.closest("[data-keep-editor-focus]")) || !!(elem == null ? void 0 : elem.closest(".data-keep-editor-focus"));
|
|
26607
26729
|
}
|
|
26608
26730
|
destroy() {
|
|
26731
|
+
this.focusRestoration.destroy();
|
|
26609
26732
|
this.callbacks.destroy();
|
|
26610
26733
|
if (clientType.isMobile) {
|
|
26611
26734
|
document.removeEventListener("touchend", this.handleDocumentClick);
|
|
@@ -26630,24 +26753,36 @@ var __publicField = (obj, key, value) => {
|
|
|
26630
26753
|
return this.inputElement;
|
|
26631
26754
|
}
|
|
26632
26755
|
focus(options) {
|
|
26756
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26757
|
+
return;
|
|
26758
|
+
}
|
|
26633
26759
|
if (!this.editor.selection.caret.visible()) {
|
|
26634
26760
|
this.editor.selection.caret.update();
|
|
26635
26761
|
}
|
|
26636
26762
|
if (clientType.isMobile) {
|
|
26637
26763
|
this.inputElement.focus(options);
|
|
26638
26764
|
this.callbacks.onFocus();
|
|
26765
|
+
this.focused = true;
|
|
26639
26766
|
} else {
|
|
26640
|
-
|
|
26767
|
+
this.focusRestoration.schedule(() => {
|
|
26768
|
+
if (this.editor.destroyed) {
|
|
26769
|
+
return;
|
|
26770
|
+
}
|
|
26641
26771
|
if (document.activeElement !== this.inputElement) {
|
|
26642
|
-
|
|
26643
|
-
this.editor.
|
|
26772
|
+
this.focusRestoration.schedule(() => {
|
|
26773
|
+
if (!this.editor.destroyed && document.activeElement === this.inputElement) {
|
|
26774
|
+
this.editor.emit("focus", this.editor);
|
|
26775
|
+
}
|
|
26644
26776
|
});
|
|
26645
26777
|
}
|
|
26646
26778
|
this.inputElement.focus(options);
|
|
26779
|
+
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26780
|
+
return;
|
|
26781
|
+
}
|
|
26647
26782
|
this.callbacks.onFocus();
|
|
26648
|
-
|
|
26783
|
+
this.focused = true;
|
|
26784
|
+
}, 0, (options == null ? void 0 : options.preventScroll) === true);
|
|
26649
26785
|
}
|
|
26650
|
-
this.focused = true;
|
|
26651
26786
|
}
|
|
26652
26787
|
isInDisableScrollMask(target) {
|
|
26653
26788
|
let elem = target;
|
|
@@ -32206,7 +32341,7 @@ ${codeText}
|
|
|
32206
32341
|
editor.doc.endBatchUpdate();
|
|
32207
32342
|
}
|
|
32208
32343
|
if (!clientType.isMobile) {
|
|
32209
|
-
editor
|
|
32344
|
+
requestEditorFocus(editor);
|
|
32210
32345
|
}
|
|
32211
32346
|
return rangeResult;
|
|
32212
32347
|
});
|
|
@@ -42516,8 +42651,12 @@ ${codeText}
|
|
|
42516
42651
|
});
|
|
42517
42652
|
__publicField(this, "tippyInstance", null);
|
|
42518
42653
|
__publicField(this, "_target", null);
|
|
42654
|
+
__publicField(this, "cancelFocus");
|
|
42655
|
+
__publicField(this, "focusTimer", null);
|
|
42519
42656
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42520
42657
|
var _a;
|
|
42658
|
+
const focusOwner = this.getFocusOwner();
|
|
42659
|
+
focusOwner.clearFocusTimer();
|
|
42521
42660
|
let ret = false;
|
|
42522
42661
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42523
42662
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42525,32 +42664,68 @@ ${codeText}
|
|
|
42525
42664
|
if (ret) {
|
|
42526
42665
|
return ret;
|
|
42527
42666
|
}
|
|
42528
|
-
|
|
42529
|
-
return ret;
|
|
42530
|
-
}
|
|
42531
|
-
const target = this._target;
|
|
42532
|
-
setTimeout(() => {
|
|
42533
|
-
const parentEditor = target.closest(".editor-root");
|
|
42534
|
-
if (parentEditor) {
|
|
42535
|
-
const input2 = parentEditor.querySelector(".editor-input");
|
|
42536
|
-
if (input2) {
|
|
42537
|
-
if (parentEditor.contains(document.activeElement)) {
|
|
42538
|
-
return;
|
|
42539
|
-
}
|
|
42540
|
-
input2.focus();
|
|
42541
|
-
}
|
|
42542
|
-
}
|
|
42543
|
-
}, 100);
|
|
42667
|
+
focusOwner.restoreFocusAfterClose(event);
|
|
42544
42668
|
return ret;
|
|
42545
42669
|
});
|
|
42670
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42671
|
+
if (!this.isFocusOwner(event.target)) {
|
|
42672
|
+
this.clearFocusTimer();
|
|
42673
|
+
}
|
|
42674
|
+
});
|
|
42546
42675
|
__publicField(this, "setProps", (props) => {
|
|
42547
42676
|
var _a;
|
|
42548
42677
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
42549
42678
|
});
|
|
42550
42679
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42551
42680
|
}
|
|
42681
|
+
getFocusOwner() {
|
|
42682
|
+
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42683
|
+
}
|
|
42684
|
+
restoreFocusAfterClose(event) {
|
|
42685
|
+
if (!this._target) {
|
|
42686
|
+
return;
|
|
42687
|
+
}
|
|
42688
|
+
const target = this._target;
|
|
42689
|
+
const parentEditor = target.closest(".editor-root");
|
|
42690
|
+
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42691
|
+
return;
|
|
42692
|
+
}
|
|
42693
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
42694
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
42695
|
+
this.focusTimer = setTimeout(() => {
|
|
42696
|
+
this.clearFocusTimer();
|
|
42697
|
+
const input2 = parentEditor.querySelector(".editor-input");
|
|
42698
|
+
if (!target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected)) {
|
|
42699
|
+
return;
|
|
42700
|
+
}
|
|
42701
|
+
const activeElement = document.activeElement;
|
|
42702
|
+
if (parentEditor.contains(activeElement)) {
|
|
42703
|
+
return;
|
|
42704
|
+
}
|
|
42705
|
+
if (!activeElement || activeElement === document.body || this.isInCommandBar(activeElement)) {
|
|
42706
|
+
this.cancelFocus = requestInputFocus(input2);
|
|
42707
|
+
}
|
|
42708
|
+
}, 100);
|
|
42709
|
+
}
|
|
42710
|
+
isFocusOwner(target) {
|
|
42711
|
+
var _a;
|
|
42712
|
+
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
42713
|
+
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
42714
|
+
}
|
|
42715
|
+
clearFocusTimer() {
|
|
42716
|
+
var _a;
|
|
42717
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
42718
|
+
this.cancelFocus = void 0;
|
|
42719
|
+
if (this.focusTimer !== null) {
|
|
42720
|
+
clearTimeout(this.focusTimer);
|
|
42721
|
+
this.focusTimer = null;
|
|
42722
|
+
}
|
|
42723
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
42724
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
42725
|
+
}
|
|
42552
42726
|
manualShow(target, options) {
|
|
42553
42727
|
var _a, _b, _c, _d;
|
|
42728
|
+
this.getFocusOwner().clearFocusTimer();
|
|
42554
42729
|
this._target = target;
|
|
42555
42730
|
if (this.isVisible) {
|
|
42556
42731
|
return;
|
|
@@ -42599,6 +42774,9 @@ ${codeText}
|
|
|
42599
42774
|
}
|
|
42600
42775
|
close(reason, e2) {
|
|
42601
42776
|
var _a, _b;
|
|
42777
|
+
if (reason && reason !== "clickBackground" && reason !== "cancelBar" && reason !== "clickItem") {
|
|
42778
|
+
this.clearFocusTimer();
|
|
42779
|
+
}
|
|
42602
42780
|
super.close(reason);
|
|
42603
42781
|
if (this.isVisible) {
|
|
42604
42782
|
if (e2) {
|
|
@@ -42609,10 +42787,12 @@ ${codeText}
|
|
|
42609
42787
|
}
|
|
42610
42788
|
}
|
|
42611
42789
|
destroy() {
|
|
42612
|
-
var _a;
|
|
42790
|
+
var _a, _b;
|
|
42791
|
+
this.clearFocusTimer();
|
|
42613
42792
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42614
42793
|
this.tippyInstance = null;
|
|
42615
42794
|
super.destroy();
|
|
42795
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
42616
42796
|
}
|
|
42617
42797
|
getCommandBarRoot() {
|
|
42618
42798
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -44732,19 +44912,22 @@ ${codeText}
|
|
|
44732
44912
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
44733
44913
|
constructor(editor, editorOptions) {
|
|
44734
44914
|
super(editorOptions);
|
|
44915
|
+
__publicField(this, "cancelFocus");
|
|
44735
44916
|
__publicField(this, "handleClose", () => {
|
|
44736
|
-
var _a, _b;
|
|
44917
|
+
var _a, _b, _c;
|
|
44918
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44737
44919
|
if (shouldFocusToEditor(this.editor)) {
|
|
44738
|
-
this.editor
|
|
44920
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
44739
44921
|
}
|
|
44740
|
-
(
|
|
44922
|
+
(_c = (_b = this.options).onClose) == null ? void 0 : _c.call(_b);
|
|
44741
44923
|
});
|
|
44742
44924
|
this.editor = editor;
|
|
44743
44925
|
this.editorOptions = editorOptions;
|
|
44744
44926
|
}
|
|
44745
44927
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
44746
|
-
var _a, _b;
|
|
44747
|
-
|
|
44928
|
+
var _a, _b, _c;
|
|
44929
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44930
|
+
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
44748
44931
|
return;
|
|
44749
44932
|
}
|
|
44750
44933
|
if (this.options.showLoading) {
|
|
@@ -44762,6 +44945,11 @@ ${codeText}
|
|
|
44762
44945
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
44763
44946
|
super.popup(anchor2, { noEvent: true });
|
|
44764
44947
|
}
|
|
44948
|
+
destroy() {
|
|
44949
|
+
var _a;
|
|
44950
|
+
super.destroy();
|
|
44951
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44952
|
+
}
|
|
44765
44953
|
}
|
|
44766
44954
|
const logger$2G = getLogger("auto-suggest-menu");
|
|
44767
44955
|
class OnesEditorAutoSuggest {
|
|
@@ -54088,6 +54276,7 @@ ${codeText}
|
|
|
54088
54276
|
});
|
|
54089
54277
|
__publicField(this, "close", () => {
|
|
54090
54278
|
this.linkPopup.close("cancelBar");
|
|
54279
|
+
this.emit("close");
|
|
54091
54280
|
});
|
|
54092
54281
|
__publicField(this, "createItems", (content) => [{
|
|
54093
54282
|
id: "link-popup",
|
|
@@ -54109,7 +54298,6 @@ ${codeText}
|
|
|
54109
54298
|
this.emit("finished");
|
|
54110
54299
|
});
|
|
54111
54300
|
__publicField(this, "handleClose", () => {
|
|
54112
|
-
this.emit("close");
|
|
54113
54301
|
this.close();
|
|
54114
54302
|
});
|
|
54115
54303
|
__publicField(this, "handleShown", () => {
|
|
@@ -54138,8 +54326,13 @@ ${codeText}
|
|
|
54138
54326
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54139
54327
|
id: "link-popup",
|
|
54140
54328
|
header: this.createHeader(),
|
|
54141
|
-
disableSelectedScroll: true
|
|
54329
|
+
disableSelectedScroll: true,
|
|
54330
|
+
beforeClose: () => {
|
|
54331
|
+
this.handleClose();
|
|
54332
|
+
return true;
|
|
54333
|
+
}
|
|
54142
54334
|
});
|
|
54335
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54143
54336
|
}
|
|
54144
54337
|
destroy() {
|
|
54145
54338
|
var _a, _b;
|
|
@@ -54158,11 +54351,11 @@ ${codeText}
|
|
|
54158
54351
|
this.emit("finished");
|
|
54159
54352
|
});
|
|
54160
54353
|
__publicField(this, "handleClose", () => {
|
|
54161
|
-
this.emit("close");
|
|
54162
54354
|
this.close();
|
|
54163
54355
|
});
|
|
54164
54356
|
__publicField(this, "close", () => {
|
|
54165
54357
|
this.linkPopup.close("cancelBar");
|
|
54358
|
+
this.emit("close");
|
|
54166
54359
|
});
|
|
54167
54360
|
__publicField(this, "disabledSubmit", () => {
|
|
54168
54361
|
var _a;
|
|
@@ -54182,8 +54375,13 @@ ${codeText}
|
|
|
54182
54375
|
this.content = content;
|
|
54183
54376
|
this.options = options;
|
|
54184
54377
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54185
|
-
id: "link-popup"
|
|
54378
|
+
id: "link-popup",
|
|
54379
|
+
beforeClose: () => {
|
|
54380
|
+
this.handleClose();
|
|
54381
|
+
return true;
|
|
54382
|
+
}
|
|
54186
54383
|
});
|
|
54384
|
+
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54187
54385
|
}
|
|
54188
54386
|
createPopupContent() {
|
|
54189
54387
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54216,46 +54414,85 @@ ${codeText}
|
|
|
54216
54414
|
__publicField(this, "onFinished", null);
|
|
54217
54415
|
__publicField(this, "onClose", null);
|
|
54218
54416
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54417
|
+
__publicField(this, "session", 0);
|
|
54418
|
+
__publicField(this, "submitting", false);
|
|
54419
|
+
__publicField(this, "focusTimer");
|
|
54420
|
+
__publicField(this, "releaseFocus");
|
|
54219
54421
|
__publicField(this, "handleOk", async () => {
|
|
54220
|
-
|
|
54422
|
+
if (!this.linkPopup || this.submitting || this.editor.destroyed) {
|
|
54423
|
+
return;
|
|
54424
|
+
}
|
|
54425
|
+
const session = this.session;
|
|
54426
|
+
const form = this.form;
|
|
54427
|
+
const onFinished = this.onFinished;
|
|
54428
|
+
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54429
|
+
this.submitting = true;
|
|
54221
54430
|
try {
|
|
54222
|
-
await this.checkValue();
|
|
54223
|
-
|
|
54431
|
+
await this.checkValue(form);
|
|
54432
|
+
if (!this.isCurrent(session)) {
|
|
54433
|
+
return;
|
|
54434
|
+
}
|
|
54435
|
+
const { linkText, linkUrl } = form;
|
|
54224
54436
|
const inputValue = linkUrl.getInputValue();
|
|
54225
|
-
|
|
54226
|
-
|
|
54227
|
-
|
|
54228
|
-
|
|
54229
|
-
|
|
54437
|
+
const formatted = beforeFormatUrl == null ? void 0 : beforeFormatUrl(inputValue);
|
|
54438
|
+
const link2 = typeof formatted === "string" ? formatted : this.formatUrl(inputValue);
|
|
54439
|
+
const text2 = linkText.getInputValue() || link2;
|
|
54440
|
+
if (!this.isCurrent(session)) {
|
|
54441
|
+
return;
|
|
54230
54442
|
}
|
|
54231
|
-
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54232
54443
|
this._destroy();
|
|
54444
|
+
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54233
54445
|
} catch (error2) {
|
|
54446
|
+
if (this.isCurrent(session)) {
|
|
54447
|
+
this.submitting = false;
|
|
54448
|
+
}
|
|
54234
54449
|
}
|
|
54235
54450
|
});
|
|
54236
54451
|
__publicField(this, "handleClose", () => {
|
|
54237
|
-
|
|
54238
|
-
|
|
54452
|
+
if (!this.linkPopup) {
|
|
54453
|
+
return;
|
|
54454
|
+
}
|
|
54455
|
+
const onClose = this.onClose;
|
|
54239
54456
|
this._destroy();
|
|
54457
|
+
if (!this.editor.destroyed) {
|
|
54458
|
+
onClose == null ? void 0 : onClose();
|
|
54459
|
+
}
|
|
54240
54460
|
});
|
|
54241
54461
|
__publicField(this, "onShow", () => {
|
|
54242
|
-
|
|
54243
|
-
|
|
54244
|
-
|
|
54462
|
+
var _a;
|
|
54463
|
+
const session = this.session;
|
|
54464
|
+
const field = (_a = this.form.linkUrl) == null ? void 0 : _a.getField();
|
|
54465
|
+
clearTimeout(this.focusTimer);
|
|
54466
|
+
this.focusTimer = setTimeout(() => {
|
|
54467
|
+
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54468
|
+
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54469
|
+
}
|
|
54245
54470
|
}, 400);
|
|
54246
54471
|
});
|
|
54247
54472
|
__publicField(this, "showPopup", (options) => {
|
|
54248
|
-
|
|
54473
|
+
const session = this.session;
|
|
54249
54474
|
if (clientType.isMobile) {
|
|
54250
54475
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54251
54476
|
} else {
|
|
54252
54477
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54253
54478
|
}
|
|
54254
|
-
|
|
54255
|
-
|
|
54256
|
-
|
|
54257
|
-
|
|
54258
|
-
|
|
54479
|
+
this.linkPopup.addListener("show", () => {
|
|
54480
|
+
if (this.isCurrent(session)) {
|
|
54481
|
+
this.onShow();
|
|
54482
|
+
}
|
|
54483
|
+
});
|
|
54484
|
+
this.linkPopup.addListener("finished", () => {
|
|
54485
|
+
if (this.isCurrent(session)) {
|
|
54486
|
+
this.handleOk();
|
|
54487
|
+
}
|
|
54488
|
+
});
|
|
54489
|
+
this.linkPopup.addListener("close", () => {
|
|
54490
|
+
if (this.isCurrent(session)) {
|
|
54491
|
+
this.handleClose();
|
|
54492
|
+
}
|
|
54493
|
+
});
|
|
54494
|
+
this.linkPopup.disabledSubmit();
|
|
54495
|
+
this.linkPopup.manualShow();
|
|
54259
54496
|
});
|
|
54260
54497
|
__publicField(this, "onChange", () => {
|
|
54261
54498
|
var _a;
|
|
@@ -54267,11 +54504,14 @@ ${codeText}
|
|
|
54267
54504
|
return;
|
|
54268
54505
|
}
|
|
54269
54506
|
if (event.key === "Enter") {
|
|
54270
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54507
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54508
|
+
event.preventDefault();
|
|
54271
54509
|
event.stopPropagation();
|
|
54272
54510
|
return;
|
|
54273
54511
|
}
|
|
54274
54512
|
if (event.key === "Escape") {
|
|
54513
|
+
event.preventDefault();
|
|
54514
|
+
event.stopPropagation();
|
|
54275
54515
|
this.handleClose();
|
|
54276
54516
|
}
|
|
54277
54517
|
});
|
|
@@ -54285,13 +54525,18 @@ ${codeText}
|
|
|
54285
54525
|
return;
|
|
54286
54526
|
}
|
|
54287
54527
|
if (event.key === "Escape") {
|
|
54528
|
+
event.preventDefault();
|
|
54529
|
+
event.stopPropagation();
|
|
54288
54530
|
this.handleClose();
|
|
54289
54531
|
}
|
|
54290
54532
|
});
|
|
54291
54533
|
this.editor = editor;
|
|
54292
54534
|
}
|
|
54293
|
-
|
|
54294
|
-
|
|
54535
|
+
isCurrent(session) {
|
|
54536
|
+
return session === this.session && !!this.linkPopup && !this.editor.destroyed;
|
|
54537
|
+
}
|
|
54538
|
+
async checkValue(form) {
|
|
54539
|
+
const { linkUrl } = form;
|
|
54295
54540
|
if (!linkUrl.getInputValue()) {
|
|
54296
54541
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54297
54542
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54309,14 +54554,20 @@ ${codeText}
|
|
|
54309
54554
|
return link2;
|
|
54310
54555
|
}
|
|
54311
54556
|
editLink(options) {
|
|
54312
|
-
this.
|
|
54557
|
+
this._destroy();
|
|
54558
|
+
if (this.editor.destroyed) {
|
|
54559
|
+
return;
|
|
54560
|
+
}
|
|
54561
|
+
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54313
54562
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54314
54563
|
this.onFinished = onFinished;
|
|
54315
|
-
|
|
54316
|
-
|
|
54317
|
-
|
|
54318
|
-
|
|
54319
|
-
|
|
54564
|
+
this.onClose = onClose != null ? onClose : null;
|
|
54565
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl != null ? onBeforeFormatUrl : null;
|
|
54566
|
+
try {
|
|
54567
|
+
this.showPopup(options);
|
|
54568
|
+
} catch (error2) {
|
|
54569
|
+
this._destroy();
|
|
54570
|
+
throw error2;
|
|
54320
54571
|
}
|
|
54321
54572
|
}
|
|
54322
54573
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54345,12 +54596,21 @@ ${codeText}
|
|
|
54345
54596
|
return content;
|
|
54346
54597
|
}
|
|
54347
54598
|
_destroy() {
|
|
54348
|
-
|
|
54599
|
+
this.session += 1;
|
|
54600
|
+
clearTimeout(this.focusTimer);
|
|
54601
|
+
this.focusTimer = void 0;
|
|
54602
|
+
const popup = this.linkPopup;
|
|
54603
|
+
const releaseFocus = this.releaseFocus;
|
|
54604
|
+
this.linkPopup = null;
|
|
54605
|
+
this.releaseFocus = void 0;
|
|
54606
|
+
this.submitting = false;
|
|
54349
54607
|
this.onFinished = null;
|
|
54350
54608
|
this.onClose = null;
|
|
54609
|
+
this.onBeforeFormatUrl = null;
|
|
54351
54610
|
this.form = {};
|
|
54352
|
-
|
|
54353
|
-
|
|
54611
|
+
popup == null ? void 0 : popup.removeAllListeners();
|
|
54612
|
+
popup == null ? void 0 : popup.destroy();
|
|
54613
|
+
releaseFocus == null ? void 0 : releaseFocus();
|
|
54354
54614
|
}
|
|
54355
54615
|
destroy() {
|
|
54356
54616
|
this._destroy();
|
|
@@ -54390,14 +54650,14 @@ ${codeText}
|
|
|
54390
54650
|
const text2 = [op1, op2];
|
|
54391
54651
|
editor.insertTextToBlock(block, 0, text2);
|
|
54392
54652
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54393
|
-
editor
|
|
54653
|
+
requestEditorFocus(editor);
|
|
54394
54654
|
} catch (error2) {
|
|
54395
54655
|
logger$20.error(error2);
|
|
54396
54656
|
}
|
|
54397
54657
|
});
|
|
54398
54658
|
};
|
|
54399
54659
|
const onClose = () => {
|
|
54400
|
-
editor
|
|
54660
|
+
requestEditorFocus(editor);
|
|
54401
54661
|
};
|
|
54402
54662
|
editLink(editor, {
|
|
54403
54663
|
target: block,
|
|
@@ -54429,21 +54689,21 @@ ${codeText}
|
|
|
54429
54689
|
if (isCollapsed) {
|
|
54430
54690
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54431
54691
|
editor.setBlockText(block, newText);
|
|
54432
|
-
editor
|
|
54692
|
+
requestEditorFocus(editor);
|
|
54433
54693
|
return;
|
|
54434
54694
|
}
|
|
54435
54695
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54436
54696
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54437
54697
|
editor.setBlockText(block, newText);
|
|
54438
54698
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54439
|
-
editor
|
|
54699
|
+
requestEditorFocus(editor);
|
|
54440
54700
|
} catch (error2) {
|
|
54441
54701
|
logger$20.error(error2);
|
|
54442
54702
|
}
|
|
54443
54703
|
});
|
|
54444
54704
|
};
|
|
54445
54705
|
const onClose = () => {
|
|
54446
|
-
editor
|
|
54706
|
+
requestEditorFocus(editor);
|
|
54447
54707
|
};
|
|
54448
54708
|
editLink(editor, {
|
|
54449
54709
|
target: anchor2,
|
|
@@ -54692,14 +54952,14 @@ ${codeText}
|
|
|
54692
54952
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54693
54953
|
editor.setBlockText(block, newText);
|
|
54694
54954
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54695
|
-
editor
|
|
54955
|
+
requestEditorFocus(editor);
|
|
54696
54956
|
} catch (error2) {
|
|
54697
54957
|
logger$1$.error(error2);
|
|
54698
54958
|
}
|
|
54699
54959
|
};
|
|
54700
54960
|
const onClose = () => {
|
|
54701
54961
|
editor.selection.selectBlock(block, range.end);
|
|
54702
|
-
editor
|
|
54962
|
+
requestEditorFocus(editor);
|
|
54703
54963
|
};
|
|
54704
54964
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
54705
54965
|
if (!rect) {
|
|
@@ -55201,6 +55461,7 @@ ${codeText}
|
|
|
55201
55461
|
__publicField(this, "_disableTextToolbar", false);
|
|
55202
55462
|
__publicField(this, "_lastClickTime", 0);
|
|
55203
55463
|
__publicField(this, "_disabled", false);
|
|
55464
|
+
__publicField(this, "cancelFocus");
|
|
55204
55465
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55205
55466
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55206
55467
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55225,16 +55486,15 @@ ${codeText}
|
|
|
55225
55486
|
this._lastClickTime = Date.now();
|
|
55226
55487
|
});
|
|
55227
55488
|
__publicField(this, "handleClose", () => {
|
|
55228
|
-
var _a;
|
|
55489
|
+
var _a, _b;
|
|
55229
55490
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55230
55491
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55231
55492
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55232
55493
|
logger$1Z.debug("focus is in block tools, ignore focus");
|
|
55233
55494
|
return;
|
|
55234
55495
|
}
|
|
55235
|
-
this.
|
|
55236
|
-
|
|
55237
|
-
});
|
|
55496
|
+
(_b = this.cancelFocus) == null ? void 0 : _b.call(this);
|
|
55497
|
+
this.cancelFocus = requestEditorFocus(this.editor);
|
|
55238
55498
|
}
|
|
55239
55499
|
});
|
|
55240
55500
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55363,8 +55623,10 @@ ${codeText}
|
|
|
55363
55623
|
this.toolbar.close("selectionChange");
|
|
55364
55624
|
}
|
|
55365
55625
|
destroy() {
|
|
55626
|
+
var _a;
|
|
55366
55627
|
this.unbindEvents();
|
|
55367
55628
|
this.toolbar.destroy();
|
|
55629
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55368
55630
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55369
55631
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55370
55632
|
}
|
|
@@ -73838,11 +74100,10 @@ ${codeText}
|
|
|
73838
74100
|
createTableBorderBar(editor, tableBlock);
|
|
73839
74101
|
}
|
|
73840
74102
|
function hideTableBorderBar(editor, tableBlock) {
|
|
73841
|
-
var _a, _b;
|
|
73842
74103
|
assert(logger$14, isTableBlock(tableBlock), "invalid table block");
|
|
73843
|
-
const tools = (
|
|
74104
|
+
const tools = getTableTools(editor, tableBlock);
|
|
73844
74105
|
const blockTools = getBlockTools(tableBlock);
|
|
73845
|
-
const topTableBorderBar =
|
|
74106
|
+
const topTableBorderBar = tools.querySelectorAll(".table-border-bar-container");
|
|
73846
74107
|
const leftTableBorderBar = blockTools.querySelectorAll(".table-border-bar-container");
|
|
73847
74108
|
topTableBorderBar.forEach((elem) => {
|
|
73848
74109
|
editor.domEvents.removeEventListener(elem, "click", handleBorderBarClicked);
|
|
@@ -76201,6 +76462,8 @@ ${codeText}
|
|
|
76201
76462
|
__publicField(this, "item");
|
|
76202
76463
|
__publicField(this, "docs", null);
|
|
76203
76464
|
__publicField(this, "checkedId");
|
|
76465
|
+
__publicField(this, "focusTimer", null);
|
|
76466
|
+
__publicField(this, "destroyed", false);
|
|
76204
76467
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76205
76468
|
if (!item.data) {
|
|
76206
76469
|
return;
|
|
@@ -76211,24 +76474,37 @@ ${codeText}
|
|
|
76211
76474
|
this.checkedId = item.id;
|
|
76212
76475
|
}
|
|
76213
76476
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76214
|
-
|
|
76477
|
+
this.clearFocusTimer();
|
|
76478
|
+
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76479
|
+
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76480
|
+
this.focusTimer = setTimeout(() => {
|
|
76481
|
+
this.clearFocusTimer();
|
|
76482
|
+
if (!this.canRestoreFocus()) {
|
|
76483
|
+
return;
|
|
76484
|
+
}
|
|
76215
76485
|
if (this.docs) {
|
|
76216
76486
|
this.show(this.docs);
|
|
76217
76487
|
}
|
|
76218
76488
|
this.editor.focus();
|
|
76219
76489
|
});
|
|
76220
76490
|
});
|
|
76221
|
-
__publicField(this, "handleClose", () => {
|
|
76222
|
-
|
|
76223
|
-
|
|
76224
|
-
if (tagName === "input" || tagName === "textarea") {
|
|
76491
|
+
__publicField(this, "handleClose", (bar2) => {
|
|
76492
|
+
if (bar2.closeReason === "clickBackground") {
|
|
76493
|
+
this.clearFocusTimer();
|
|
76225
76494
|
return;
|
|
76226
76495
|
}
|
|
76227
|
-
this.
|
|
76496
|
+
if (bar2.closeReason === "cancelBar" && this.canRestoreFocus()) {
|
|
76497
|
+
this.editor.focus();
|
|
76498
|
+
}
|
|
76228
76499
|
});
|
|
76229
76500
|
__publicField(this, "handleSelectionChange", () => {
|
|
76230
76501
|
if (this.toolbar.isVisible) {
|
|
76231
|
-
this.handleClose();
|
|
76502
|
+
this.handleClose(this.toolbar);
|
|
76503
|
+
}
|
|
76504
|
+
});
|
|
76505
|
+
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76506
|
+
if (!this.isFocusOwner(event.target)) {
|
|
76507
|
+
this.clearFocusTimer();
|
|
76232
76508
|
}
|
|
76233
76509
|
});
|
|
76234
76510
|
this.editor = editor;
|
|
@@ -76252,6 +76528,10 @@ ${codeText}
|
|
|
76252
76528
|
this.toolbar.addListener("close", this.handleClose);
|
|
76253
76529
|
}
|
|
76254
76530
|
show(docs) {
|
|
76531
|
+
this.clearFocusTimer();
|
|
76532
|
+
if (this.destroyed || this.editor.destroyed) {
|
|
76533
|
+
return;
|
|
76534
|
+
}
|
|
76255
76535
|
this.docs = docs;
|
|
76256
76536
|
const editor = this.editor;
|
|
76257
76537
|
const range = editor.selection.range;
|
|
@@ -76310,13 +76590,39 @@ ${codeText}
|
|
|
76310
76590
|
return doc2;
|
|
76311
76591
|
}
|
|
76312
76592
|
hide() {
|
|
76593
|
+
this.clearFocusTimer();
|
|
76313
76594
|
this.toolbar.close("selectionChange");
|
|
76314
76595
|
}
|
|
76315
76596
|
clearCheckedState() {
|
|
76316
76597
|
this.checkedId = void 0;
|
|
76317
76598
|
}
|
|
76318
76599
|
destroy() {
|
|
76600
|
+
var _a;
|
|
76601
|
+
this.destroyed = true;
|
|
76602
|
+
this.clearFocusTimer();
|
|
76319
76603
|
this.toolbar.destroy();
|
|
76604
|
+
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
76605
|
+
this.anchor = null;
|
|
76606
|
+
this.docs = null;
|
|
76607
|
+
}
|
|
76608
|
+
canRestoreFocus() {
|
|
76609
|
+
var _a;
|
|
76610
|
+
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
76611
|
+
return false;
|
|
76612
|
+
}
|
|
76613
|
+
const activeElement = document.activeElement;
|
|
76614
|
+
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
76615
|
+
}
|
|
76616
|
+
isFocusOwner(target) {
|
|
76617
|
+
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
76618
|
+
}
|
|
76619
|
+
clearFocusTimer() {
|
|
76620
|
+
if (this.focusTimer !== null) {
|
|
76621
|
+
clearTimeout(this.focusTimer);
|
|
76622
|
+
this.focusTimer = null;
|
|
76623
|
+
}
|
|
76624
|
+
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
76625
|
+
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76320
76626
|
}
|
|
76321
76627
|
getCommandItems(docs) {
|
|
76322
76628
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -96705,14 +97011,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96705
97011
|
__publicField(this, "toolbar");
|
|
96706
97012
|
__publicField(this, "toolbarFullScreen");
|
|
96707
97013
|
__publicField(this, "root");
|
|
97014
|
+
__publicField(this, "cancelFocus");
|
|
96708
97015
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
96709
97016
|
const command = item;
|
|
96710
97017
|
if (command.onClick) {
|
|
96711
97018
|
command.onClick(this.editor, command, bar2);
|
|
96712
97019
|
this.handleSelectionChanged();
|
|
96713
|
-
|
|
96714
|
-
this.editor.focus();
|
|
96715
|
-
});
|
|
97020
|
+
this.restoreFocus();
|
|
96716
97021
|
return;
|
|
96717
97022
|
}
|
|
96718
97023
|
const findParent = (item2, id) => {
|
|
@@ -96758,9 +97063,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96758
97063
|
id: "main-toolbar"
|
|
96759
97064
|
});
|
|
96760
97065
|
this.toolbar.addListener("closing", () => {
|
|
96761
|
-
|
|
96762
|
-
editor.focus();
|
|
96763
|
-
}, 100);
|
|
97066
|
+
this.restoreFocus(100);
|
|
96764
97067
|
return true;
|
|
96765
97068
|
});
|
|
96766
97069
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -96791,11 +97094,18 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96791
97094
|
});
|
|
96792
97095
|
}
|
|
96793
97096
|
}
|
|
96794
|
-
|
|
97097
|
+
restoreFocus(delay = 0) {
|
|
96795
97098
|
var _a;
|
|
97099
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
97100
|
+
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
97101
|
+
}
|
|
97102
|
+
destroy() {
|
|
97103
|
+
var _a, _b, _c;
|
|
97104
|
+
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
96796
97105
|
this.toolbar.destroy();
|
|
96797
97106
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
96798
|
-
(
|
|
97107
|
+
(_b = this.toolbarFullScreen) == null ? void 0 : _b.destroy();
|
|
97108
|
+
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
96799
97109
|
this.root.remove();
|
|
96800
97110
|
}
|
|
96801
97111
|
setItems(items) {
|
|
@@ -97388,7 +97698,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97388
97698
|
}
|
|
97389
97699
|
}
|
|
97390
97700
|
});
|
|
97391
|
-
editor.version = "3.1.7-beta.
|
|
97701
|
+
editor.version = "3.1.7-beta.h1473.2";
|
|
97392
97702
|
return editor;
|
|
97393
97703
|
}
|
|
97394
97704
|
function isDoc(doc2) {
|
|
@@ -97529,7 +97839,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97529
97839
|
OnesEditorDropTarget.register(editor);
|
|
97530
97840
|
OnesEditorTocProvider.register(editor);
|
|
97531
97841
|
OnesEditorExclusiveBlock.register(editor);
|
|
97532
|
-
editor.version = "3.1.7-beta.
|
|
97842
|
+
editor.version = "3.1.7-beta.h1473.2";
|
|
97533
97843
|
return editor;
|
|
97534
97844
|
} catch (error2) {
|
|
97535
97845
|
if (editorForCleanup) {
|
|
@@ -143432,6 +143742,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143432
143742
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
143433
143743
|
exports2.FitIcon = FitIcon;
|
|
143434
143744
|
exports2.FixedToolbar = FixedToolbar;
|
|
143745
|
+
exports2.FocusRestoration = FocusRestoration;
|
|
143435
143746
|
exports2.FontBoldItem = FontBoldItem;
|
|
143436
143747
|
exports2.FontItalicItem = FontItalicItem;
|
|
143437
143748
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -143627,6 +143938,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143627
143938
|
exports2.YoukuIcon = YoukuIcon;
|
|
143628
143939
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
143629
143940
|
exports2.abbreviation = abbreviation;
|
|
143941
|
+
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
143630
143942
|
exports2.activeComment = activeComment;
|
|
143631
143943
|
exports2.addAttribute = addAttribute;
|
|
143632
143944
|
exports2.addClass = addClass;
|
|
@@ -144110,6 +144422,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144110
144422
|
exports2.replaceAllText = replaceAllText;
|
|
144111
144423
|
exports2.replaceText = replaceText;
|
|
144112
144424
|
exports2.requestDownload = requestDownload;
|
|
144425
|
+
exports2.requestEditorFocus = requestEditorFocus;
|
|
144426
|
+
exports2.requestInputFocus = requestInputFocus;
|
|
144113
144427
|
exports2.resetListStart = resetListStart;
|
|
144114
144428
|
exports2.saveAs = saveAs$1;
|
|
144115
144429
|
exports2.scrollBarIntoView = scrollBarIntoView;
|