@ones-editor/editor 3.1.7-beta.ONES22302172.4 → 3.1.7-beta.ONES22302592.1
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 +0 -1
- package/@ones-editor/core/src/core/composition/index.d.ts +0 -2
- package/@ones-editor/main-toolbar/src/index.d.ts +0 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/package.json +0 -3
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -2
- package/@ones-editor/ui-base/src/auto-suggest/editor-auto-suggest-menu.d.ts +0 -2
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +4 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -0
- package/dist/index.js +137 -293
- package/package.json +1 -1
- package/@ones-editor/core/src/core/composition/focus-restoration.d.ts +0 -22
package/dist/index.js
CHANGED
|
@@ -26414,90 +26414,6 @@ 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, "timers", /* @__PURE__ */ new Set());
|
|
26426
|
-
this.input = input2;
|
|
26427
|
-
this.restore = restore;
|
|
26428
|
-
controllers.set(input2, this);
|
|
26429
|
-
}
|
|
26430
|
-
canFocus() {
|
|
26431
|
-
return !this.destroyed && !this.owner && this.input.isConnected;
|
|
26432
|
-
}
|
|
26433
|
-
hasOtherInput() {
|
|
26434
|
-
const active = this.input.ownerDocument.activeElement;
|
|
26435
|
-
return active !== this.input && !!(active == null ? void 0 : active.matches('input, textarea, select, [contenteditable="true"], [contenteditable=""]'));
|
|
26436
|
-
}
|
|
26437
|
-
schedule(callback, delay = 0, protectUserFocus = false) {
|
|
26438
|
-
if (!this.canFocus()) {
|
|
26439
|
-
return noop$1;
|
|
26440
|
-
}
|
|
26441
|
-
const generation = this.generation;
|
|
26442
|
-
const timer = setTimeout(() => {
|
|
26443
|
-
this.timers.delete(timer);
|
|
26444
|
-
if (generation === this.generation && this.canFocus() && (!protectUserFocus || !this.hasOtherInput())) {
|
|
26445
|
-
callback();
|
|
26446
|
-
}
|
|
26447
|
-
}, delay);
|
|
26448
|
-
this.timers.add(timer);
|
|
26449
|
-
return () => {
|
|
26450
|
-
clearTimeout(timer);
|
|
26451
|
-
this.timers.delete(timer);
|
|
26452
|
-
};
|
|
26453
|
-
}
|
|
26454
|
-
request(delay = 0) {
|
|
26455
|
-
return this.schedule(this.restore, delay, !clientType.isMobile);
|
|
26456
|
-
}
|
|
26457
|
-
cancelPending() {
|
|
26458
|
-
this.generation += 1;
|
|
26459
|
-
this.timers.forEach((timer) => clearTimeout(timer));
|
|
26460
|
-
this.timers.clear();
|
|
26461
|
-
}
|
|
26462
|
-
acquire() {
|
|
26463
|
-
this.cancelPending();
|
|
26464
|
-
const owner = {};
|
|
26465
|
-
this.owner = owner;
|
|
26466
|
-
return () => {
|
|
26467
|
-
if (this.owner === owner) {
|
|
26468
|
-
this.cancelPending();
|
|
26469
|
-
this.owner = null;
|
|
26470
|
-
}
|
|
26471
|
-
};
|
|
26472
|
-
}
|
|
26473
|
-
destroy() {
|
|
26474
|
-
this.destroyed = true;
|
|
26475
|
-
this.cancelPending();
|
|
26476
|
-
this.owner = null;
|
|
26477
|
-
controllers.delete(this.input);
|
|
26478
|
-
}
|
|
26479
|
-
}
|
|
26480
|
-
function requestInputFocus(input2, delay = 0) {
|
|
26481
|
-
var _a, _b;
|
|
26482
|
-
return (_b = (_a = controllers.get(input2)) == null ? void 0 : _a.request(delay)) != null ? _b : noop$1;
|
|
26483
|
-
}
|
|
26484
|
-
function requestEditorFocus(editor, delay = 0) {
|
|
26485
|
-
if (editor.destroyed) {
|
|
26486
|
-
return noop$1;
|
|
26487
|
-
}
|
|
26488
|
-
if (clientType.isMobile && delay === 0) {
|
|
26489
|
-
editor.focus();
|
|
26490
|
-
return noop$1;
|
|
26491
|
-
}
|
|
26492
|
-
return requestInputFocus(editor.input.inputElement, delay);
|
|
26493
|
-
}
|
|
26494
|
-
function acquireEditorFocus(editor) {
|
|
26495
|
-
var _a, _b;
|
|
26496
|
-
if (clientType.isMobile || editor.destroyed) {
|
|
26497
|
-
return noop$1;
|
|
26498
|
-
}
|
|
26499
|
-
return (_b = (_a = controllers.get(editor.input.inputElement)) == null ? void 0 : _a.acquire()) != null ? _b : noop$1;
|
|
26500
|
-
}
|
|
26501
26417
|
const logger$3V = getLogger("editor-input");
|
|
26502
26418
|
class EditorInput$1 {
|
|
26503
26419
|
constructor(editor, callbacks) {
|
|
@@ -26507,7 +26423,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26507
26423
|
__publicField(this, "callbacks");
|
|
26508
26424
|
__publicField(this, "inputElement");
|
|
26509
26425
|
__publicField(this, "focused", false);
|
|
26510
|
-
__publicField(this, "focusRestoration");
|
|
26511
26426
|
__publicField(this, "handleBlur", () => {
|
|
26512
26427
|
this.editor.emit("blur", this.editor);
|
|
26513
26428
|
this.callbacks.onBlur();
|
|
@@ -26529,20 +26444,12 @@ var __publicField = (obj, key, value) => {
|
|
|
26529
26444
|
const isInDisableScrollMask = this.isInDisableScrollMask(target);
|
|
26530
26445
|
if (target && (isInDisableScrollMask || rootElement === target || rootElement.contains(target))) {
|
|
26531
26446
|
if (!isInDisableScrollMask && !isInBlockTools(target)) {
|
|
26532
|
-
|
|
26533
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26534
|
-
return;
|
|
26535
|
-
}
|
|
26447
|
+
setTimeout(() => {
|
|
26536
26448
|
this.editor.emit("focus", this.editor);
|
|
26537
26449
|
this.callbacks.onFocus();
|
|
26538
26450
|
this.editor.input.focus();
|
|
26539
26451
|
this.focused = true;
|
|
26540
|
-
};
|
|
26541
|
-
if (clientType.isMobile) {
|
|
26542
|
-
setTimeout(focus);
|
|
26543
|
-
} else {
|
|
26544
|
-
this.focusRestoration.schedule(focus);
|
|
26545
|
-
}
|
|
26452
|
+
});
|
|
26546
26453
|
}
|
|
26547
26454
|
return;
|
|
26548
26455
|
}
|
|
@@ -26677,11 +26584,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26677
26584
|
input2.addEventListener("compositionstart", this.handleCompositionstart);
|
|
26678
26585
|
input2.addEventListener("compositionend", this.handleCompositionend);
|
|
26679
26586
|
this.inputElement = input2;
|
|
26680
|
-
this.focusRestoration = new FocusRestoration(input2, () => {
|
|
26681
|
-
if (!this.editor.destroyed) {
|
|
26682
|
-
this.editor.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
26683
|
-
}
|
|
26684
|
-
});
|
|
26685
26587
|
if (clientType.isMobile) {
|
|
26686
26588
|
document.addEventListener("touchend", this.handleDocumentClick);
|
|
26687
26589
|
} else {
|
|
@@ -26704,7 +26606,6 @@ var __publicField = (obj, key, value) => {
|
|
|
26704
26606
|
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"));
|
|
26705
26607
|
}
|
|
26706
26608
|
destroy() {
|
|
26707
|
-
this.focusRestoration.destroy();
|
|
26708
26609
|
this.callbacks.destroy();
|
|
26709
26610
|
if (clientType.isMobile) {
|
|
26710
26611
|
document.removeEventListener("touchend", this.handleDocumentClick);
|
|
@@ -26729,36 +26630,24 @@ var __publicField = (obj, key, value) => {
|
|
|
26729
26630
|
return this.inputElement;
|
|
26730
26631
|
}
|
|
26731
26632
|
focus(options) {
|
|
26732
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26733
|
-
return;
|
|
26734
|
-
}
|
|
26735
26633
|
if (!this.editor.selection.caret.visible()) {
|
|
26736
26634
|
this.editor.selection.caret.update();
|
|
26737
26635
|
}
|
|
26738
26636
|
if (clientType.isMobile) {
|
|
26739
26637
|
this.inputElement.focus(options);
|
|
26740
26638
|
this.callbacks.onFocus();
|
|
26741
|
-
this.focused = true;
|
|
26742
26639
|
} else {
|
|
26743
|
-
|
|
26744
|
-
if (this.editor.destroyed) {
|
|
26745
|
-
return;
|
|
26746
|
-
}
|
|
26640
|
+
setTimeout(() => {
|
|
26747
26641
|
if (document.activeElement !== this.inputElement) {
|
|
26748
|
-
|
|
26749
|
-
|
|
26750
|
-
this.editor.emit("focus", this.editor);
|
|
26751
|
-
}
|
|
26642
|
+
setTimeout(() => {
|
|
26643
|
+
this.editor.emit("focus", this.editor);
|
|
26752
26644
|
});
|
|
26753
26645
|
}
|
|
26754
26646
|
this.inputElement.focus(options);
|
|
26755
|
-
if (this.editor.destroyed || !this.focusRestoration.canFocus()) {
|
|
26756
|
-
return;
|
|
26757
|
-
}
|
|
26758
26647
|
this.callbacks.onFocus();
|
|
26759
|
-
|
|
26760
|
-
}, 0, (options == null ? void 0 : options.preventScroll) === true);
|
|
26648
|
+
});
|
|
26761
26649
|
}
|
|
26650
|
+
this.focused = true;
|
|
26762
26651
|
}
|
|
26763
26652
|
isInDisableScrollMask(target) {
|
|
26764
26653
|
let elem = target;
|
|
@@ -32317,7 +32206,7 @@ ${codeText}
|
|
|
32317
32206
|
editor.doc.endBatchUpdate();
|
|
32318
32207
|
}
|
|
32319
32208
|
if (!clientType.isMobile) {
|
|
32320
|
-
|
|
32209
|
+
editor.focus();
|
|
32321
32210
|
}
|
|
32322
32211
|
return rangeResult;
|
|
32323
32212
|
});
|
|
@@ -42627,12 +42516,13 @@ ${codeText}
|
|
|
42627
42516
|
});
|
|
42628
42517
|
__publicField(this, "tippyInstance", null);
|
|
42629
42518
|
__publicField(this, "_target", null);
|
|
42630
|
-
__publicField(this, "
|
|
42519
|
+
__publicField(this, "focusRestoreTimer", null);
|
|
42520
|
+
__publicField(this, "focusRestoreGeneration", 0);
|
|
42631
42521
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42632
|
-
var _a
|
|
42633
|
-
|
|
42522
|
+
var _a;
|
|
42523
|
+
this.cancelFocusRestore();
|
|
42634
42524
|
let ret = false;
|
|
42635
|
-
if ((
|
|
42525
|
+
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42636
42526
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
42637
42527
|
}
|
|
42638
42528
|
if (ret) {
|
|
@@ -42644,16 +42534,51 @@ ${codeText}
|
|
|
42644
42534
|
const target = this._target;
|
|
42645
42535
|
const parentEditor = target.closest(".editor-root");
|
|
42646
42536
|
const input2 = parentEditor == null ? void 0 : parentEditor.querySelector(".editor-input");
|
|
42647
|
-
if (
|
|
42648
|
-
|
|
42649
|
-
|
|
42650
|
-
|
|
42651
|
-
|
|
42652
|
-
this.cancelFocus = requestInputFocus(input2, 100);
|
|
42653
|
-
}
|
|
42537
|
+
if (!parentEditor || !input2) {
|
|
42538
|
+
return ret;
|
|
42539
|
+
}
|
|
42540
|
+
if (event && !parentEditor.contains(event.target) && !this.isInCommandBar(event.target)) {
|
|
42541
|
+
return ret;
|
|
42654
42542
|
}
|
|
42543
|
+
const generation = this.focusRestoreGeneration;
|
|
42544
|
+
document.addEventListener("mousedown", this.cancelFocusRestore, true);
|
|
42545
|
+
document.addEventListener("focusin", this.handleFocusRestoreFocus, true);
|
|
42546
|
+
window.addEventListener("blur", this.cancelFocusRestore);
|
|
42547
|
+
this.focusRestoreTimer = setTimeout(() => {
|
|
42548
|
+
if (generation !== this.focusRestoreGeneration) {
|
|
42549
|
+
return;
|
|
42550
|
+
}
|
|
42551
|
+
this.cancelFocusRestore();
|
|
42552
|
+
if (this._target !== target || !target.isConnected || !input2.isConnected || !document.hasFocus()) {
|
|
42553
|
+
return;
|
|
42554
|
+
}
|
|
42555
|
+
const activeElement = document.activeElement;
|
|
42556
|
+
if (parentEditor.contains(activeElement)) {
|
|
42557
|
+
return;
|
|
42558
|
+
}
|
|
42559
|
+
if (activeElement && activeElement !== document.body && activeElement !== document.documentElement && !this.isInCommandBar(activeElement)) {
|
|
42560
|
+
return;
|
|
42561
|
+
}
|
|
42562
|
+
input2.focus({ preventScroll: true });
|
|
42563
|
+
}, 100);
|
|
42655
42564
|
return ret;
|
|
42656
42565
|
});
|
|
42566
|
+
__publicField(this, "cancelFocusRestore", () => {
|
|
42567
|
+
this.focusRestoreGeneration += 1;
|
|
42568
|
+
if (this.focusRestoreTimer !== null) {
|
|
42569
|
+
clearTimeout(this.focusRestoreTimer);
|
|
42570
|
+
this.focusRestoreTimer = null;
|
|
42571
|
+
}
|
|
42572
|
+
document.removeEventListener("mousedown", this.cancelFocusRestore, true);
|
|
42573
|
+
document.removeEventListener("focusin", this.handleFocusRestoreFocus, true);
|
|
42574
|
+
window.removeEventListener("blur", this.cancelFocusRestore);
|
|
42575
|
+
});
|
|
42576
|
+
__publicField(this, "handleFocusRestoreFocus", (event) => {
|
|
42577
|
+
var _a, _b;
|
|
42578
|
+
if (!((_b = (_a = this._target) == null ? void 0 : _a.closest(".editor-root")) == null ? void 0 : _b.contains(event.target)) && !this.isInCommandBar(event.target)) {
|
|
42579
|
+
this.cancelFocusRestore();
|
|
42580
|
+
}
|
|
42581
|
+
});
|
|
42657
42582
|
__publicField(this, "setProps", (props) => {
|
|
42658
42583
|
var _a;
|
|
42659
42584
|
(_a = this.tippyInstance) == null ? void 0 : _a.setProps(props);
|
|
@@ -42661,8 +42586,8 @@ ${codeText}
|
|
|
42661
42586
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42662
42587
|
}
|
|
42663
42588
|
manualShow(target, options) {
|
|
42664
|
-
var _a, _b, _c, _d
|
|
42665
|
-
|
|
42589
|
+
var _a, _b, _c, _d;
|
|
42590
|
+
this.cancelFocusRestore();
|
|
42666
42591
|
this._target = target;
|
|
42667
42592
|
if (this.isVisible) {
|
|
42668
42593
|
return;
|
|
@@ -42677,16 +42602,16 @@ ${codeText}
|
|
|
42677
42602
|
trigger: "manual",
|
|
42678
42603
|
triggerTarget: null,
|
|
42679
42604
|
hideOnClick: false,
|
|
42680
|
-
placement: (
|
|
42681
|
-
maxWidth: (
|
|
42682
|
-
arrow: (
|
|
42605
|
+
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
42606
|
+
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
42607
|
+
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
42683
42608
|
appendTo: this.options.appendTo || target.closest(".command-bar-container") || document.body,
|
|
42684
42609
|
onShow: this.handleShow,
|
|
42685
42610
|
onHidden: this.handleHidden,
|
|
42686
42611
|
onShown: this.handleShown,
|
|
42687
42612
|
theme: options == null ? void 0 : options.theme,
|
|
42688
42613
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
42689
|
-
offset: (
|
|
42614
|
+
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
42690
42615
|
popperOptions: this.createPopperOptions(),
|
|
42691
42616
|
delay: 500
|
|
42692
42617
|
});
|
|
@@ -42711,6 +42636,9 @@ ${codeText}
|
|
|
42711
42636
|
}
|
|
42712
42637
|
close(reason, e2) {
|
|
42713
42638
|
var _a, _b;
|
|
42639
|
+
if (reason === "clickBackground") {
|
|
42640
|
+
this.cancelFocusRestore();
|
|
42641
|
+
}
|
|
42714
42642
|
super.close(reason);
|
|
42715
42643
|
if (this.isVisible) {
|
|
42716
42644
|
if (e2) {
|
|
@@ -42721,12 +42649,11 @@ ${codeText}
|
|
|
42721
42649
|
}
|
|
42722
42650
|
}
|
|
42723
42651
|
destroy() {
|
|
42724
|
-
var _a
|
|
42725
|
-
|
|
42726
|
-
(
|
|
42652
|
+
var _a;
|
|
42653
|
+
this.cancelFocusRestore();
|
|
42654
|
+
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42727
42655
|
this.tippyInstance = null;
|
|
42728
42656
|
super.destroy();
|
|
42729
|
-
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
42730
42657
|
}
|
|
42731
42658
|
getCommandBarRoot() {
|
|
42732
42659
|
return this.content.closest("[data-tippy-root]");
|
|
@@ -44846,22 +44773,19 @@ ${codeText}
|
|
|
44846
44773
|
class EditorAutoSuggestMenu extends AutoSuggestMenu {
|
|
44847
44774
|
constructor(editor, editorOptions) {
|
|
44848
44775
|
super(editorOptions);
|
|
44849
|
-
__publicField(this, "cancelFocus");
|
|
44850
44776
|
__publicField(this, "handleClose", () => {
|
|
44851
|
-
var _a, _b
|
|
44852
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44777
|
+
var _a, _b;
|
|
44853
44778
|
if (shouldFocusToEditor(this.editor)) {
|
|
44854
|
-
this.
|
|
44779
|
+
this.editor.focus();
|
|
44855
44780
|
}
|
|
44856
|
-
(
|
|
44781
|
+
(_b = (_a = this.options).onClose) == null ? void 0 : _b.call(_a);
|
|
44857
44782
|
});
|
|
44858
44783
|
this.editor = editor;
|
|
44859
44784
|
this.editorOptions = editorOptions;
|
|
44860
44785
|
}
|
|
44861
44786
|
async popupInEditor(containerId, blockIndex, offset) {
|
|
44862
|
-
var _a, _b
|
|
44863
|
-
(_a = this.
|
|
44864
|
-
if (((_c = (_b = this.editorOptions).onShow) == null ? void 0 : _c.call(_b, this, containerId, blockIndex, offset)) === false) {
|
|
44787
|
+
var _a, _b;
|
|
44788
|
+
if (((_b = (_a = this.editorOptions).onShow) == null ? void 0 : _b.call(_a, this, containerId, blockIndex, offset)) === false) {
|
|
44865
44789
|
return;
|
|
44866
44790
|
}
|
|
44867
44791
|
if (this.options.showLoading) {
|
|
@@ -44879,11 +44803,6 @@ ${codeText}
|
|
|
44879
44803
|
const anchor2 = createBlockAnchor(this.editor, block, "editor-auto-suggest-menu", rect);
|
|
44880
44804
|
super.popup(anchor2, { noEvent: true });
|
|
44881
44805
|
}
|
|
44882
|
-
destroy() {
|
|
44883
|
-
var _a;
|
|
44884
|
-
super.destroy();
|
|
44885
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
44886
|
-
}
|
|
44887
44806
|
}
|
|
44888
44807
|
const logger$2G = getLogger("auto-suggest-menu");
|
|
44889
44808
|
class OnesEditorAutoSuggest {
|
|
@@ -54210,7 +54129,6 @@ ${codeText}
|
|
|
54210
54129
|
});
|
|
54211
54130
|
__publicField(this, "close", () => {
|
|
54212
54131
|
this.linkPopup.close("cancelBar");
|
|
54213
|
-
this.emit("close");
|
|
54214
54132
|
});
|
|
54215
54133
|
__publicField(this, "createItems", (content) => [{
|
|
54216
54134
|
id: "link-popup",
|
|
@@ -54232,6 +54150,7 @@ ${codeText}
|
|
|
54232
54150
|
this.emit("finished");
|
|
54233
54151
|
});
|
|
54234
54152
|
__publicField(this, "handleClose", () => {
|
|
54153
|
+
this.emit("close");
|
|
54235
54154
|
this.close();
|
|
54236
54155
|
});
|
|
54237
54156
|
__publicField(this, "handleShown", () => {
|
|
@@ -54260,13 +54179,8 @@ ${codeText}
|
|
|
54260
54179
|
this.linkPopup = new MobileBottomMenu(this.createItems(content), void 0, {
|
|
54261
54180
|
id: "link-popup",
|
|
54262
54181
|
header: this.createHeader(),
|
|
54263
|
-
disableSelectedScroll: true
|
|
54264
|
-
beforeClose: () => {
|
|
54265
|
-
this.handleClose();
|
|
54266
|
-
return true;
|
|
54267
|
-
}
|
|
54182
|
+
disableSelectedScroll: true
|
|
54268
54183
|
});
|
|
54269
|
-
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54270
54184
|
}
|
|
54271
54185
|
destroy() {
|
|
54272
54186
|
var _a, _b;
|
|
@@ -54285,11 +54199,11 @@ ${codeText}
|
|
|
54285
54199
|
this.emit("finished");
|
|
54286
54200
|
});
|
|
54287
54201
|
__publicField(this, "handleClose", () => {
|
|
54202
|
+
this.emit("close");
|
|
54288
54203
|
this.close();
|
|
54289
54204
|
});
|
|
54290
54205
|
__publicField(this, "close", () => {
|
|
54291
54206
|
this.linkPopup.close("cancelBar");
|
|
54292
|
-
this.emit("close");
|
|
54293
54207
|
});
|
|
54294
54208
|
__publicField(this, "disabledSubmit", () => {
|
|
54295
54209
|
var _a;
|
|
@@ -54309,13 +54223,8 @@ ${codeText}
|
|
|
54309
54223
|
this.content = content;
|
|
54310
54224
|
this.options = options;
|
|
54311
54225
|
this.linkPopup = new Popup(this.createPopupContent(), {
|
|
54312
|
-
id: "link-popup"
|
|
54313
|
-
beforeClose: () => {
|
|
54314
|
-
this.handleClose();
|
|
54315
|
-
return true;
|
|
54316
|
-
}
|
|
54226
|
+
id: "link-popup"
|
|
54317
54227
|
});
|
|
54318
|
-
this.linkPopup.addListener("close", () => this.emit("close"));
|
|
54319
54228
|
}
|
|
54320
54229
|
createPopupContent() {
|
|
54321
54230
|
const container = createElement("div", ["link-popup-content"], null);
|
|
@@ -54348,85 +54257,46 @@ ${codeText}
|
|
|
54348
54257
|
__publicField(this, "onFinished", null);
|
|
54349
54258
|
__publicField(this, "onClose", null);
|
|
54350
54259
|
__publicField(this, "onBeforeFormatUrl", null);
|
|
54351
|
-
__publicField(this, "session", 0);
|
|
54352
|
-
__publicField(this, "submitting", false);
|
|
54353
|
-
__publicField(this, "focusTimer");
|
|
54354
|
-
__publicField(this, "releaseFocus");
|
|
54355
54260
|
__publicField(this, "handleOk", async () => {
|
|
54356
|
-
|
|
54357
|
-
return;
|
|
54358
|
-
}
|
|
54359
|
-
const session = this.session;
|
|
54360
|
-
const form = this.form;
|
|
54361
|
-
const onFinished = this.onFinished;
|
|
54362
|
-
const beforeFormatUrl = this.onBeforeFormatUrl;
|
|
54363
|
-
this.submitting = true;
|
|
54261
|
+
var _a;
|
|
54364
54262
|
try {
|
|
54365
|
-
await this.checkValue(
|
|
54366
|
-
|
|
54367
|
-
return;
|
|
54368
|
-
}
|
|
54369
|
-
const { linkText, linkUrl } = form;
|
|
54263
|
+
await this.checkValue();
|
|
54264
|
+
const { linkText, linkUrl } = this.form;
|
|
54370
54265
|
const inputValue = linkUrl.getInputValue();
|
|
54371
|
-
|
|
54372
|
-
|
|
54373
|
-
|
|
54374
|
-
|
|
54375
|
-
|
|
54266
|
+
let link2 = "";
|
|
54267
|
+
if (this.onBeforeFormatUrl && this.onBeforeFormatUrl(inputValue) !== false) {
|
|
54268
|
+
link2 = this.onBeforeFormatUrl(inputValue);
|
|
54269
|
+
} else {
|
|
54270
|
+
link2 = this.formatUrl(inputValue);
|
|
54376
54271
|
}
|
|
54272
|
+
(_a = this.onFinished) == null ? void 0 : _a.call(this, linkText.getInputValue() || link2, link2);
|
|
54377
54273
|
this._destroy();
|
|
54378
|
-
onFinished == null ? void 0 : onFinished(text2, link2);
|
|
54379
54274
|
} catch (error2) {
|
|
54380
|
-
if (this.isCurrent(session)) {
|
|
54381
|
-
this.submitting = false;
|
|
54382
|
-
}
|
|
54383
54275
|
}
|
|
54384
54276
|
});
|
|
54385
54277
|
__publicField(this, "handleClose", () => {
|
|
54386
|
-
|
|
54387
|
-
|
|
54388
|
-
}
|
|
54389
|
-
const onClose = this.onClose;
|
|
54278
|
+
var _a;
|
|
54279
|
+
(_a = this.onClose) == null ? void 0 : _a.call(this);
|
|
54390
54280
|
this._destroy();
|
|
54391
|
-
if (!this.editor.destroyed) {
|
|
54392
|
-
onClose == null ? void 0 : onClose();
|
|
54393
|
-
}
|
|
54394
54281
|
});
|
|
54395
54282
|
__publicField(this, "onShow", () => {
|
|
54396
|
-
|
|
54397
|
-
|
|
54398
|
-
|
|
54399
|
-
clearTimeout(this.focusTimer);
|
|
54400
|
-
this.focusTimer = setTimeout(() => {
|
|
54401
|
-
if (this.isCurrent(session) && (field == null ? void 0 : field.isConnected)) {
|
|
54402
|
-
field.focus(clientType.isMobile ? void 0 : { preventScroll: true });
|
|
54403
|
-
}
|
|
54283
|
+
setTimeout(() => {
|
|
54284
|
+
var _a;
|
|
54285
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54404
54286
|
}, 400);
|
|
54405
54287
|
});
|
|
54406
54288
|
__publicField(this, "showPopup", (options) => {
|
|
54407
|
-
|
|
54289
|
+
var _a, _b, _c, _d, _e;
|
|
54408
54290
|
if (clientType.isMobile) {
|
|
54409
54291
|
this.linkPopup = new MobileLinkPopup(this.editor, this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54410
54292
|
} else {
|
|
54411
54293
|
this.linkPopup = new LinkPopup(this.createPopupContent(options.linkText, options.linkUrl), options);
|
|
54412
54294
|
}
|
|
54413
|
-
this.linkPopup.addListener("show",
|
|
54414
|
-
|
|
54415
|
-
|
|
54416
|
-
|
|
54417
|
-
|
|
54418
|
-
this.linkPopup.addListener("finished", () => {
|
|
54419
|
-
if (this.isCurrent(session)) {
|
|
54420
|
-
this.handleOk();
|
|
54421
|
-
}
|
|
54422
|
-
});
|
|
54423
|
-
this.linkPopup.addListener("close", () => {
|
|
54424
|
-
if (this.isCurrent(session)) {
|
|
54425
|
-
this.handleClose();
|
|
54426
|
-
}
|
|
54427
|
-
});
|
|
54428
|
-
this.linkPopup.disabledSubmit();
|
|
54429
|
-
this.linkPopup.manualShow();
|
|
54295
|
+
(_a = this.linkPopup) == null ? void 0 : _a.addListener("show", this.onShow);
|
|
54296
|
+
(_b = this.linkPopup) == null ? void 0 : _b.manualShow();
|
|
54297
|
+
(_c = this.linkPopup) == null ? void 0 : _c.disabledSubmit();
|
|
54298
|
+
(_d = this.linkPopup) == null ? void 0 : _d.addListener("finished", this.handleOk);
|
|
54299
|
+
(_e = this.linkPopup) == null ? void 0 : _e.addListener("close", this.handleClose);
|
|
54430
54300
|
});
|
|
54431
54301
|
__publicField(this, "onChange", () => {
|
|
54432
54302
|
var _a;
|
|
@@ -54438,14 +54308,11 @@ ${codeText}
|
|
|
54438
54308
|
return;
|
|
54439
54309
|
}
|
|
54440
54310
|
if (event.key === "Enter") {
|
|
54441
|
-
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus(
|
|
54442
|
-
event.preventDefault();
|
|
54311
|
+
(_a = this.form.linkUrl) == null ? void 0 : _a.getField().focus();
|
|
54443
54312
|
event.stopPropagation();
|
|
54444
54313
|
return;
|
|
54445
54314
|
}
|
|
54446
54315
|
if (event.key === "Escape") {
|
|
54447
|
-
event.preventDefault();
|
|
54448
|
-
event.stopPropagation();
|
|
54449
54316
|
this.handleClose();
|
|
54450
54317
|
}
|
|
54451
54318
|
});
|
|
@@ -54459,18 +54326,13 @@ ${codeText}
|
|
|
54459
54326
|
return;
|
|
54460
54327
|
}
|
|
54461
54328
|
if (event.key === "Escape") {
|
|
54462
|
-
event.preventDefault();
|
|
54463
|
-
event.stopPropagation();
|
|
54464
54329
|
this.handleClose();
|
|
54465
54330
|
}
|
|
54466
54331
|
});
|
|
54467
54332
|
this.editor = editor;
|
|
54468
54333
|
}
|
|
54469
|
-
|
|
54470
|
-
|
|
54471
|
-
}
|
|
54472
|
-
async checkValue(form) {
|
|
54473
|
-
const { linkUrl } = form;
|
|
54334
|
+
async checkValue() {
|
|
54335
|
+
const { linkUrl } = this.form;
|
|
54474
54336
|
if (!linkUrl.getInputValue()) {
|
|
54475
54337
|
linkUrl.setFieldError(i18n$1.t("link.urlPlaceholder"));
|
|
54476
54338
|
throw new Error(i18n$1.t("link.urlPlaceholder"));
|
|
@@ -54488,20 +54350,14 @@ ${codeText}
|
|
|
54488
54350
|
return link2;
|
|
54489
54351
|
}
|
|
54490
54352
|
editLink(options) {
|
|
54491
|
-
this.
|
|
54492
|
-
if (this.editor.destroyed) {
|
|
54493
|
-
return;
|
|
54494
|
-
}
|
|
54495
|
-
this.releaseFocus = acquireEditorFocus(this.editor);
|
|
54353
|
+
this.showPopup(options);
|
|
54496
54354
|
const { onFinished, onClose, onBeforeFormatUrl } = options;
|
|
54497
54355
|
this.onFinished = onFinished;
|
|
54498
|
-
|
|
54499
|
-
|
|
54500
|
-
|
|
54501
|
-
|
|
54502
|
-
|
|
54503
|
-
this._destroy();
|
|
54504
|
-
throw error2;
|
|
54356
|
+
if (onClose) {
|
|
54357
|
+
this.onClose = onClose;
|
|
54358
|
+
}
|
|
54359
|
+
if (onBeforeFormatUrl) {
|
|
54360
|
+
this.onBeforeFormatUrl = onBeforeFormatUrl;
|
|
54505
54361
|
}
|
|
54506
54362
|
}
|
|
54507
54363
|
createPopupContent(linkText, linkUrl) {
|
|
@@ -54530,21 +54386,12 @@ ${codeText}
|
|
|
54530
54386
|
return content;
|
|
54531
54387
|
}
|
|
54532
54388
|
_destroy() {
|
|
54533
|
-
|
|
54534
|
-
clearTimeout(this.focusTimer);
|
|
54535
|
-
this.focusTimer = void 0;
|
|
54536
|
-
const popup = this.linkPopup;
|
|
54537
|
-
const releaseFocus = this.releaseFocus;
|
|
54538
|
-
this.linkPopup = null;
|
|
54539
|
-
this.releaseFocus = void 0;
|
|
54540
|
-
this.submitting = false;
|
|
54389
|
+
var _a, _b;
|
|
54541
54390
|
this.onFinished = null;
|
|
54542
54391
|
this.onClose = null;
|
|
54543
|
-
this.onBeforeFormatUrl = null;
|
|
54544
54392
|
this.form = {};
|
|
54545
|
-
|
|
54546
|
-
|
|
54547
|
-
releaseFocus == null ? void 0 : releaseFocus();
|
|
54393
|
+
(_a = this.linkPopup) == null ? void 0 : _a.removeAllListeners();
|
|
54394
|
+
(_b = this.linkPopup) == null ? void 0 : _b.destroy();
|
|
54548
54395
|
}
|
|
54549
54396
|
destroy() {
|
|
54550
54397
|
this._destroy();
|
|
@@ -54584,14 +54431,14 @@ ${codeText}
|
|
|
54584
54431
|
const text2 = [op1, op2];
|
|
54585
54432
|
editor.insertTextToBlock(block, 0, text2);
|
|
54586
54433
|
editor.selection.selectBlock(block, getTextLength(text2));
|
|
54587
|
-
|
|
54434
|
+
editor.focus();
|
|
54588
54435
|
} catch (error2) {
|
|
54589
54436
|
logger$20.error(error2);
|
|
54590
54437
|
}
|
|
54591
54438
|
});
|
|
54592
54439
|
};
|
|
54593
54440
|
const onClose = () => {
|
|
54594
|
-
|
|
54441
|
+
editor.focus();
|
|
54595
54442
|
};
|
|
54596
54443
|
editLink(editor, {
|
|
54597
54444
|
target: block,
|
|
@@ -54623,21 +54470,21 @@ ${codeText}
|
|
|
54623
54470
|
if (isCollapsed) {
|
|
54624
54471
|
newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
|
|
54625
54472
|
editor.setBlockText(block, newText);
|
|
54626
|
-
|
|
54473
|
+
editor.focus();
|
|
54627
54474
|
return;
|
|
54628
54475
|
}
|
|
54629
54476
|
newText = replaceText(editor.getBlockText(block), start, end, linkText);
|
|
54630
54477
|
newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
|
|
54631
54478
|
editor.setBlockText(block, newText);
|
|
54632
54479
|
editor.selection.selectBlock(block, start + linkText.length);
|
|
54633
|
-
|
|
54480
|
+
editor.focus();
|
|
54634
54481
|
} catch (error2) {
|
|
54635
54482
|
logger$20.error(error2);
|
|
54636
54483
|
}
|
|
54637
54484
|
});
|
|
54638
54485
|
};
|
|
54639
54486
|
const onClose = () => {
|
|
54640
|
-
|
|
54487
|
+
editor.focus();
|
|
54641
54488
|
};
|
|
54642
54489
|
editLink(editor, {
|
|
54643
54490
|
target: anchor2,
|
|
@@ -54886,14 +54733,14 @@ ${codeText}
|
|
|
54886
54733
|
const newText = insertText(deleted, range.start, linkText, { link: linkUrl });
|
|
54887
54734
|
editor.setBlockText(block, newText);
|
|
54888
54735
|
editor.selection.selectBlock(block, range.start + linkText.length);
|
|
54889
|
-
|
|
54736
|
+
editor.focus();
|
|
54890
54737
|
} catch (error2) {
|
|
54891
54738
|
logger$1$.error(error2);
|
|
54892
54739
|
}
|
|
54893
54740
|
};
|
|
54894
54741
|
const onClose = () => {
|
|
54895
54742
|
editor.selection.selectBlock(block, range.end);
|
|
54896
|
-
|
|
54743
|
+
editor.focus();
|
|
54897
54744
|
};
|
|
54898
54745
|
const rect = getBlockClientRects(editor, block, editor.selection.range)[0];
|
|
54899
54746
|
if (!rect) {
|
|
@@ -55395,7 +55242,6 @@ ${codeText}
|
|
|
55395
55242
|
__publicField(this, "_disableTextToolbar", false);
|
|
55396
55243
|
__publicField(this, "_lastClickTime", 0);
|
|
55397
55244
|
__publicField(this, "_disabled", false);
|
|
55398
|
-
__publicField(this, "cancelFocus");
|
|
55399
55245
|
__publicField(this, "isInToolbar", (event) => this.toolbar.isInCommandBar(event.target));
|
|
55400
55246
|
__publicField(this, "handleButtonClick", (toolbar2, item) => {
|
|
55401
55247
|
const tooltip = this.editor.findCustom("editor-tooltip");
|
|
@@ -55419,16 +55265,24 @@ ${codeText}
|
|
|
55419
55265
|
}
|
|
55420
55266
|
this._lastClickTime = Date.now();
|
|
55421
55267
|
});
|
|
55422
|
-
__publicField(this, "handleClose", () => {
|
|
55423
|
-
var _a
|
|
55268
|
+
__publicField(this, "handleClose", (toolbar2) => {
|
|
55269
|
+
var _a;
|
|
55270
|
+
if (toolbar2.closeReason === "clickBackground" || !this.editor.rootElement.isConnected) {
|
|
55271
|
+
return;
|
|
55272
|
+
}
|
|
55273
|
+
const focusedElement = document.activeElement;
|
|
55274
|
+
if (focusedElement && focusedElement !== document.body && focusedElement !== document.documentElement && !this.editor.rootElement.contains(focusedElement) && !toolbar2.isInCommandBar(focusedElement)) {
|
|
55275
|
+
return;
|
|
55276
|
+
}
|
|
55424
55277
|
if (shouldFocusToEditor(this.editor) && !clientType.isMobile) {
|
|
55425
55278
|
const activeElement = (_a = document.getSelection()) == null ? void 0 : _a.focusNode;
|
|
55426
55279
|
if (activeElement && isInBlockTools(activeElement)) {
|
|
55427
55280
|
logger$1Z.debug("focus is in block tools, ignore focus");
|
|
55428
55281
|
return;
|
|
55429
55282
|
}
|
|
55430
|
-
|
|
55431
|
-
|
|
55283
|
+
this.editor.focus({
|
|
55284
|
+
preventScroll: true
|
|
55285
|
+
});
|
|
55432
55286
|
}
|
|
55433
55287
|
});
|
|
55434
55288
|
__publicField(this, "handleClosing", (bar2, event) => {
|
|
@@ -55557,10 +55411,8 @@ ${codeText}
|
|
|
55557
55411
|
this.toolbar.close("selectionChange");
|
|
55558
55412
|
}
|
|
55559
55413
|
destroy() {
|
|
55560
|
-
var _a;
|
|
55561
55414
|
this.unbindEvents();
|
|
55562
55415
|
this.toolbar.destroy();
|
|
55563
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
55564
55416
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
55565
55417
|
OnesEditorHoveringBlock.get(this.editor).removeListener("childChange", this.handleHoveringBlockChildChange);
|
|
55566
55418
|
}
|
|
@@ -96900,13 +96752,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96900
96752
|
__publicField(this, "toolbar");
|
|
96901
96753
|
__publicField(this, "toolbarFullScreen");
|
|
96902
96754
|
__publicField(this, "root");
|
|
96903
|
-
__publicField(this, "cancelFocus");
|
|
96904
96755
|
__publicField(this, "handleClick", (bar2, item) => {
|
|
96905
96756
|
const command = item;
|
|
96906
96757
|
if (command.onClick) {
|
|
96907
96758
|
command.onClick(this.editor, command, bar2);
|
|
96908
96759
|
this.handleSelectionChanged();
|
|
96909
|
-
|
|
96760
|
+
setTimeout(() => {
|
|
96761
|
+
this.editor.focus();
|
|
96762
|
+
});
|
|
96910
96763
|
return;
|
|
96911
96764
|
}
|
|
96912
96765
|
const findParent = (item2, id) => {
|
|
@@ -96952,7 +96805,9 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96952
96805
|
id: "main-toolbar"
|
|
96953
96806
|
});
|
|
96954
96807
|
this.toolbar.addListener("closing", () => {
|
|
96955
|
-
|
|
96808
|
+
setTimeout(() => {
|
|
96809
|
+
editor.focus();
|
|
96810
|
+
}, 100);
|
|
96956
96811
|
return true;
|
|
96957
96812
|
});
|
|
96958
96813
|
this.toolbar.addListener("click", this.handleClick);
|
|
@@ -96983,18 +96838,11 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96983
96838
|
});
|
|
96984
96839
|
}
|
|
96985
96840
|
}
|
|
96986
|
-
restoreFocus(delay = 0) {
|
|
96987
|
-
var _a;
|
|
96988
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
96989
|
-
this.cancelFocus = requestEditorFocus(this.editor, delay);
|
|
96990
|
-
}
|
|
96991
96841
|
destroy() {
|
|
96992
|
-
var _a
|
|
96993
|
-
(_a = this.cancelFocus) == null ? void 0 : _a.call(this);
|
|
96842
|
+
var _a;
|
|
96994
96843
|
this.toolbar.destroy();
|
|
96995
96844
|
this.editor.removeListener("selectionChanged", this.handleSelectionChanged);
|
|
96996
|
-
(
|
|
96997
|
-
(_c = this.cancelFocus) == null ? void 0 : _c.call(this);
|
|
96845
|
+
(_a = this.toolbarFullScreen) == null ? void 0 : _a.destroy();
|
|
96998
96846
|
this.root.remove();
|
|
96999
96847
|
}
|
|
97000
96848
|
setItems(items) {
|
|
@@ -97587,7 +97435,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97587
97435
|
}
|
|
97588
97436
|
}
|
|
97589
97437
|
});
|
|
97590
|
-
editor.version = "3.1.7-beta.
|
|
97438
|
+
editor.version = "3.1.7-beta.ONES22302592.1";
|
|
97591
97439
|
return editor;
|
|
97592
97440
|
}
|
|
97593
97441
|
function isDoc(doc2) {
|
|
@@ -97728,7 +97576,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97728
97576
|
OnesEditorDropTarget.register(editor);
|
|
97729
97577
|
OnesEditorTocProvider.register(editor);
|
|
97730
97578
|
OnesEditorExclusiveBlock.register(editor);
|
|
97731
|
-
editor.version = "3.1.7-beta.
|
|
97579
|
+
editor.version = "3.1.7-beta.ONES22302592.1";
|
|
97732
97580
|
return editor;
|
|
97733
97581
|
} catch (error2) {
|
|
97734
97582
|
if (editorForCleanup) {
|
|
@@ -143631,7 +143479,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143631
143479
|
exports2.FindReplaceItem = FindReplaceItem;
|
|
143632
143480
|
exports2.FitIcon = FitIcon;
|
|
143633
143481
|
exports2.FixedToolbar = FixedToolbar;
|
|
143634
|
-
exports2.FocusRestoration = FocusRestoration;
|
|
143635
143482
|
exports2.FontBoldItem = FontBoldItem;
|
|
143636
143483
|
exports2.FontItalicItem = FontItalicItem;
|
|
143637
143484
|
exports2.FontStrikethroughItem = FontStrikethroughItem;
|
|
@@ -143827,7 +143674,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143827
143674
|
exports2.YoukuIcon = YoukuIcon;
|
|
143828
143675
|
exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
|
|
143829
143676
|
exports2.abbreviation = abbreviation;
|
|
143830
|
-
exports2.acquireEditorFocus = acquireEditorFocus;
|
|
143831
143677
|
exports2.activeComment = activeComment;
|
|
143832
143678
|
exports2.addAttribute = addAttribute;
|
|
143833
143679
|
exports2.addClass = addClass;
|
|
@@ -144311,8 +144157,6 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
144311
144157
|
exports2.replaceAllText = replaceAllText;
|
|
144312
144158
|
exports2.replaceText = replaceText;
|
|
144313
144159
|
exports2.requestDownload = requestDownload;
|
|
144314
|
-
exports2.requestEditorFocus = requestEditorFocus;
|
|
144315
|
-
exports2.requestInputFocus = requestInputFocus;
|
|
144316
144160
|
exports2.resetListStart = resetListStart;
|
|
144317
144161
|
exports2.saveAs = saveAs$1;
|
|
144318
144162
|
exports2.scrollBarIntoView = scrollBarIntoView;
|