@ones-editor/editor 3.1.7-beta.ONES22303263.1 → 3.1.7-beta.ONES22303310.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/paste-special/src/paste-special-button.d.ts +1 -7
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/manual-command-bar.d.ts +0 -6
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +0 -1
- package/dist/index.js +28 -112
- package/package.json +1 -1
|
@@ -6,14 +6,8 @@ export default abstract class ManualCommandBar extends CommandBar implements Abs
|
|
|
6
6
|
private manualCommandBarOptions?;
|
|
7
7
|
tippyInstance: Instance | null;
|
|
8
8
|
_target: HTMLElement | null;
|
|
9
|
-
private focusTimer;
|
|
10
9
|
constructor(items: CommandItem[], closeable?: Closeable, manualCommandBarOptions?: CommandBarOptions | undefined);
|
|
11
10
|
handleBeforeClose: (event?: MouseEvent | TouchEvent) => boolean;
|
|
12
|
-
private getFocusOwner;
|
|
13
|
-
private restoreFocusAfterClose;
|
|
14
|
-
private isFocusOwner;
|
|
15
|
-
private handleFocusInteraction;
|
|
16
|
-
private clearFocusTimer;
|
|
17
11
|
setProps: (props: ManualShowCommandBarOptions) => void;
|
|
18
12
|
manualShow(target: HTMLElement, options?: ManualShowCommandBarOptions): void;
|
|
19
13
|
close(reason: CloseReason, e?: MouseEvent | null): void;
|
|
@@ -24,7 +24,6 @@ export interface ManualShowCommandBarOptions {
|
|
|
24
24
|
}
|
|
25
25
|
export interface AbstractCommandBar extends TypedEmitter<CommandBarEvents> {
|
|
26
26
|
readonly isVisible: boolean;
|
|
27
|
-
readonly closeReason: CloseReason;
|
|
28
27
|
readonly parentItem: CommandItem | null;
|
|
29
28
|
closeable: Closeable | null;
|
|
30
29
|
close: (reason: CloseReason, e?: MouseEvent | null) => void;
|
package/dist/index.js
CHANGED
|
@@ -42516,11 +42516,8 @@ ${codeText}
|
|
|
42516
42516
|
});
|
|
42517
42517
|
__publicField(this, "tippyInstance", null);
|
|
42518
42518
|
__publicField(this, "_target", null);
|
|
42519
|
-
__publicField(this, "focusTimer", null);
|
|
42520
42519
|
__publicField(this, "handleBeforeClose", (event) => {
|
|
42521
42520
|
var _a;
|
|
42522
|
-
const focusOwner = this.getFocusOwner();
|
|
42523
|
-
focusOwner.clearFocusTimer();
|
|
42524
42521
|
let ret = false;
|
|
42525
42522
|
if ((_a = this.manualCommandBarOptions) == null ? void 0 : _a.beforeClose) {
|
|
42526
42523
|
ret = this.manualCommandBarOptions.beforeClose(event);
|
|
@@ -42528,13 +42525,23 @@ ${codeText}
|
|
|
42528
42525
|
if (ret) {
|
|
42529
42526
|
return ret;
|
|
42530
42527
|
}
|
|
42531
|
-
|
|
42532
|
-
|
|
42533
|
-
});
|
|
42534
|
-
__publicField(this, "handleFocusInteraction", (event) => {
|
|
42535
|
-
if (!this.isFocusOwner(event.target)) {
|
|
42536
|
-
this.clearFocusTimer();
|
|
42528
|
+
if (!this._target) {
|
|
42529
|
+
return ret;
|
|
42537
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);
|
|
42544
|
+
return ret;
|
|
42538
42545
|
});
|
|
42539
42546
|
__publicField(this, "setProps", (props) => {
|
|
42540
42547
|
var _a;
|
|
@@ -42542,51 +42549,8 @@ ${codeText}
|
|
|
42542
42549
|
});
|
|
42543
42550
|
this.manualCommandBarOptions = manualCommandBarOptions;
|
|
42544
42551
|
}
|
|
42545
|
-
getFocusOwner() {
|
|
42546
|
-
return this.closeable instanceof ManualCommandBar ? this.closeable.getFocusOwner() : this;
|
|
42547
|
-
}
|
|
42548
|
-
restoreFocusAfterClose(event) {
|
|
42549
|
-
if (!this._target) {
|
|
42550
|
-
return;
|
|
42551
|
-
}
|
|
42552
|
-
const target = this._target;
|
|
42553
|
-
const parentEditor = target.closest(".editor-root");
|
|
42554
|
-
if (!parentEditor || event && !this.isFocusOwner(event.target)) {
|
|
42555
|
-
return;
|
|
42556
|
-
}
|
|
42557
|
-
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
42558
|
-
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
42559
|
-
this.focusTimer = setTimeout(() => {
|
|
42560
|
-
this.clearFocusTimer();
|
|
42561
|
-
const input2 = parentEditor.querySelector(".editor-input");
|
|
42562
|
-
if (!target.isConnected || !parentEditor.isConnected || !(input2 == null ? void 0 : input2.isConnected)) {
|
|
42563
|
-
return;
|
|
42564
|
-
}
|
|
42565
|
-
const activeElement = document.activeElement;
|
|
42566
|
-
if (parentEditor.contains(activeElement)) {
|
|
42567
|
-
return;
|
|
42568
|
-
}
|
|
42569
|
-
if (!activeElement || activeElement === document.body || this.isInCommandBar(activeElement)) {
|
|
42570
|
-
input2.focus();
|
|
42571
|
-
}
|
|
42572
|
-
}, 100);
|
|
42573
|
-
}
|
|
42574
|
-
isFocusOwner(target) {
|
|
42575
|
-
var _a;
|
|
42576
|
-
const parentEditor = (_a = this._target) == null ? void 0 : _a.closest(".editor-root");
|
|
42577
|
-
return target instanceof Node && (!!(parentEditor == null ? void 0 : parentEditor.contains(target)) || this.isInCommandBar(target));
|
|
42578
|
-
}
|
|
42579
|
-
clearFocusTimer() {
|
|
42580
|
-
if (this.focusTimer !== null) {
|
|
42581
|
-
clearTimeout(this.focusTimer);
|
|
42582
|
-
this.focusTimer = null;
|
|
42583
|
-
}
|
|
42584
|
-
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
42585
|
-
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
42586
|
-
}
|
|
42587
42552
|
manualShow(target, options) {
|
|
42588
42553
|
var _a, _b, _c, _d;
|
|
42589
|
-
this.getFocusOwner().clearFocusTimer();
|
|
42590
42554
|
this._target = target;
|
|
42591
42555
|
if (this.isVisible) {
|
|
42592
42556
|
return;
|
|
@@ -42635,9 +42599,6 @@ ${codeText}
|
|
|
42635
42599
|
}
|
|
42636
42600
|
close(reason, e2) {
|
|
42637
42601
|
var _a, _b;
|
|
42638
|
-
if (reason && reason !== "clickBackground" && reason !== "cancelBar" && reason !== "clickItem") {
|
|
42639
|
-
this.clearFocusTimer();
|
|
42640
|
-
}
|
|
42641
42602
|
super.close(reason);
|
|
42642
42603
|
if (this.isVisible) {
|
|
42643
42604
|
if (e2) {
|
|
@@ -42649,7 +42610,6 @@ ${codeText}
|
|
|
42649
42610
|
}
|
|
42650
42611
|
destroy() {
|
|
42651
42612
|
var _a;
|
|
42652
|
-
this.clearFocusTimer();
|
|
42653
42613
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
42654
42614
|
this.tippyInstance = null;
|
|
42655
42615
|
super.destroy();
|
|
@@ -73878,10 +73838,11 @@ ${codeText}
|
|
|
73878
73838
|
createTableBorderBar(editor, tableBlock);
|
|
73879
73839
|
}
|
|
73880
73840
|
function hideTableBorderBar(editor, tableBlock) {
|
|
73841
|
+
var _a, _b;
|
|
73881
73842
|
assert(logger$14, isTableBlock(tableBlock), "invalid table block");
|
|
73882
|
-
const tools =
|
|
73843
|
+
const tools = (_a = getBlockContent(tableBlock).querySelector("div[data-type=table-content]")) == null ? void 0 : _a.querySelector(":scope >div[data-type=table-tools]");
|
|
73883
73844
|
const blockTools = getBlockTools(tableBlock);
|
|
73884
|
-
const topTableBorderBar = tools.querySelectorAll(".table-border-bar-container");
|
|
73845
|
+
const topTableBorderBar = (_b = tools == null ? void 0 : tools.querySelectorAll(".table-border-bar-container")) != null ? _b : [];
|
|
73885
73846
|
const leftTableBorderBar = blockTools.querySelectorAll(".table-border-bar-container");
|
|
73886
73847
|
topTableBorderBar.forEach((elem) => {
|
|
73887
73848
|
editor.domEvents.removeEventListener(elem, "click", handleBorderBarClicked);
|
|
@@ -76240,8 +76201,6 @@ ${codeText}
|
|
|
76240
76201
|
__publicField(this, "item");
|
|
76241
76202
|
__publicField(this, "docs", null);
|
|
76242
76203
|
__publicField(this, "checkedId");
|
|
76243
|
-
__publicField(this, "focusTimer", null);
|
|
76244
|
-
__publicField(this, "destroyed", false);
|
|
76245
76204
|
__publicField(this, "handlePasteSpecial", (bar2, item) => {
|
|
76246
76205
|
if (!item.data) {
|
|
76247
76206
|
return;
|
|
@@ -76252,37 +76211,24 @@ ${codeText}
|
|
|
76252
76211
|
this.checkedId = item.id;
|
|
76253
76212
|
}
|
|
76254
76213
|
this.onPasteSpecial(this.cleaningDoc(item), item.id);
|
|
76255
|
-
|
|
76256
|
-
document.addEventListener("mousedown", this.handleFocusInteraction);
|
|
76257
|
-
document.addEventListener("focusin", this.handleFocusInteraction);
|
|
76258
|
-
this.focusTimer = setTimeout(() => {
|
|
76259
|
-
this.clearFocusTimer();
|
|
76260
|
-
if (!this.canRestoreFocus()) {
|
|
76261
|
-
return;
|
|
76262
|
-
}
|
|
76214
|
+
setTimeout(() => {
|
|
76263
76215
|
if (this.docs) {
|
|
76264
76216
|
this.show(this.docs);
|
|
76265
76217
|
}
|
|
76266
76218
|
this.editor.focus();
|
|
76267
76219
|
});
|
|
76268
76220
|
});
|
|
76269
|
-
__publicField(this, "handleClose", (
|
|
76270
|
-
|
|
76271
|
-
|
|
76221
|
+
__publicField(this, "handleClose", () => {
|
|
76222
|
+
const activeElem = document.activeElement;
|
|
76223
|
+
const tagName = activeElem ? activeElem.tagName.toLowerCase() : "";
|
|
76224
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
76272
76225
|
return;
|
|
76273
76226
|
}
|
|
76274
|
-
|
|
76275
|
-
this.editor.focus();
|
|
76276
|
-
}
|
|
76227
|
+
this.editor.focus();
|
|
76277
76228
|
});
|
|
76278
76229
|
__publicField(this, "handleSelectionChange", () => {
|
|
76279
76230
|
if (this.toolbar.isVisible) {
|
|
76280
|
-
this.handleClose(
|
|
76281
|
-
}
|
|
76282
|
-
});
|
|
76283
|
-
__publicField(this, "handleFocusInteraction", (event) => {
|
|
76284
|
-
if (!this.isFocusOwner(event.target)) {
|
|
76285
|
-
this.clearFocusTimer();
|
|
76231
|
+
this.handleClose();
|
|
76286
76232
|
}
|
|
76287
76233
|
});
|
|
76288
76234
|
this.editor = editor;
|
|
@@ -76306,10 +76252,6 @@ ${codeText}
|
|
|
76306
76252
|
this.toolbar.addListener("close", this.handleClose);
|
|
76307
76253
|
}
|
|
76308
76254
|
show(docs) {
|
|
76309
|
-
this.clearFocusTimer();
|
|
76310
|
-
if (this.destroyed || this.editor.destroyed) {
|
|
76311
|
-
return;
|
|
76312
|
-
}
|
|
76313
76255
|
this.docs = docs;
|
|
76314
76256
|
const editor = this.editor;
|
|
76315
76257
|
const range = editor.selection.range;
|
|
@@ -76368,39 +76310,13 @@ ${codeText}
|
|
|
76368
76310
|
return doc2;
|
|
76369
76311
|
}
|
|
76370
76312
|
hide() {
|
|
76371
|
-
this.clearFocusTimer();
|
|
76372
76313
|
this.toolbar.close("selectionChange");
|
|
76373
76314
|
}
|
|
76374
76315
|
clearCheckedState() {
|
|
76375
76316
|
this.checkedId = void 0;
|
|
76376
76317
|
}
|
|
76377
76318
|
destroy() {
|
|
76378
|
-
var _a;
|
|
76379
|
-
this.destroyed = true;
|
|
76380
|
-
this.clearFocusTimer();
|
|
76381
76319
|
this.toolbar.destroy();
|
|
76382
|
-
(_a = this.anchor) == null ? void 0 : _a.remove();
|
|
76383
|
-
this.anchor = null;
|
|
76384
|
-
this.docs = null;
|
|
76385
|
-
}
|
|
76386
|
-
canRestoreFocus() {
|
|
76387
|
-
var _a;
|
|
76388
|
-
if (this.destroyed || this.editor.destroyed || !this.editor.rootElement.isConnected || !((_a = this.anchor) == null ? void 0 : _a.isConnected)) {
|
|
76389
|
-
return false;
|
|
76390
|
-
}
|
|
76391
|
-
const activeElement = document.activeElement;
|
|
76392
|
-
return !activeElement || activeElement === document.body || this.isFocusOwner(activeElement);
|
|
76393
|
-
}
|
|
76394
|
-
isFocusOwner(target) {
|
|
76395
|
-
return target instanceof Node && (this.editor.rootElement.contains(target) || this.toolbar.isInCommandBar(target));
|
|
76396
|
-
}
|
|
76397
|
-
clearFocusTimer() {
|
|
76398
|
-
if (this.focusTimer !== null) {
|
|
76399
|
-
clearTimeout(this.focusTimer);
|
|
76400
|
-
this.focusTimer = null;
|
|
76401
|
-
}
|
|
76402
|
-
document.removeEventListener("mousedown", this.handleFocusInteraction);
|
|
76403
|
-
document.removeEventListener("focusin", this.handleFocusInteraction);
|
|
76404
76320
|
}
|
|
76405
76321
|
getCommandItems(docs) {
|
|
76406
76322
|
const getKeepFormatCommand = (format2) => {
|
|
@@ -97472,7 +97388,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97472
97388
|
}
|
|
97473
97389
|
}
|
|
97474
97390
|
});
|
|
97475
|
-
editor.version = "3.1.7-beta.
|
|
97391
|
+
editor.version = "3.1.7-beta.ONES22303310.2";
|
|
97476
97392
|
return editor;
|
|
97477
97393
|
}
|
|
97478
97394
|
function isDoc(doc2) {
|
|
@@ -97613,7 +97529,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97613
97529
|
OnesEditorDropTarget.register(editor);
|
|
97614
97530
|
OnesEditorTocProvider.register(editor);
|
|
97615
97531
|
OnesEditorExclusiveBlock.register(editor);
|
|
97616
|
-
editor.version = "3.1.7-beta.
|
|
97532
|
+
editor.version = "3.1.7-beta.ONES22303310.2";
|
|
97617
97533
|
return editor;
|
|
97618
97534
|
} catch (error2) {
|
|
97619
97535
|
if (editorForCleanup) {
|