@ones-editor/editor 2.1.1-beta.78 → 2.1.1-beta.79
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.
|
@@ -11,7 +11,7 @@ export type EditorInputOptions = {
|
|
|
11
11
|
prefix?: Element;
|
|
12
12
|
suffixClose?: boolean;
|
|
13
13
|
};
|
|
14
|
-
declare class EditorInput {
|
|
14
|
+
export declare class EditorInput {
|
|
15
15
|
private parent;
|
|
16
16
|
private options;
|
|
17
17
|
private unbindKeyDownEvent;
|
|
@@ -28,10 +28,10 @@ declare class EditorInput {
|
|
|
28
28
|
handleKeyDown: (e: KeyboardEvent, composing: boolean) => void;
|
|
29
29
|
showSuffix: () => void;
|
|
30
30
|
hideSuffix: () => void;
|
|
31
|
+
reset: () => void;
|
|
31
32
|
handleInput: (e: Event) => void;
|
|
32
33
|
handleClose: (e: Event | TouchEvent) => void;
|
|
33
34
|
init(): HTMLDivElement;
|
|
34
35
|
destroy(): void;
|
|
35
36
|
}
|
|
36
37
|
export declare function createInput(parent: HTMLElement, options: EditorInputOptions): EditorInput;
|
|
37
|
-
export {};
|
package/dist/index.js
CHANGED
|
@@ -2604,7 +2604,7 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
2604
2604
|
width: 100%;
|
|
2605
2605
|
}
|
|
2606
2606
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] {
|
|
2607
|
-
height:
|
|
2607
|
+
height: 495px;
|
|
2608
2608
|
align-items: start;
|
|
2609
2609
|
}
|
|
2610
2610
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup].selected {
|
|
@@ -39160,6 +39160,9 @@ ${codeText}
|
|
|
39160
39160
|
return;
|
|
39161
39161
|
}
|
|
39162
39162
|
this.emit("click", this, item, elem);
|
|
39163
|
+
if (item.clickToClose === false) {
|
|
39164
|
+
return;
|
|
39165
|
+
}
|
|
39163
39166
|
if (this.options.autoClose) {
|
|
39164
39167
|
if ((_c = (_b = this.options).beforeClose) == null ? void 0 : _c.call(_b, event)) {
|
|
39165
39168
|
return;
|
|
@@ -41020,6 +41023,11 @@ ${codeText}
|
|
|
41020
41023
|
removeClass(this.input, "has-suffix");
|
|
41021
41024
|
}
|
|
41022
41025
|
});
|
|
41026
|
+
__publicField(this, "reset", () => {
|
|
41027
|
+
this.input.value = "";
|
|
41028
|
+
removeClass(this.container, "error");
|
|
41029
|
+
this.hideSuffix();
|
|
41030
|
+
});
|
|
41023
41031
|
__publicField(this, "handleInput", (e2) => {
|
|
41024
41032
|
var _a, _b;
|
|
41025
41033
|
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, e2);
|
|
@@ -50555,7 +50563,8 @@ ${codeText}
|
|
|
50555
50563
|
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
50556
50564
|
refuseOverflow: true,
|
|
50557
50565
|
padding: 20,
|
|
50558
|
-
showName: clientType.isMobile
|
|
50566
|
+
showName: clientType.isMobile,
|
|
50567
|
+
autoClose: clientType.isMobile ? true : void 0
|
|
50559
50568
|
});
|
|
50560
50569
|
this.toolbar.on("click", this.handleButtonClick);
|
|
50561
50570
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -62544,9 +62553,11 @@ ${codeText}
|
|
|
62544
62553
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
62545
62554
|
const text2 = toPlainText(splitText(editor.getBlockText(block), offset).left);
|
|
62546
62555
|
const converters = type === "enter" ? ENTER_CONVERTER : SPACE_CONVERTER;
|
|
62547
|
-
|
|
62548
|
-
|
|
62549
|
-
|
|
62556
|
+
if (clientType.isMobile) {
|
|
62557
|
+
DISABLE_MOBILE_CONVERTERS.forEach((key) => {
|
|
62558
|
+
delete converters[key];
|
|
62559
|
+
});
|
|
62560
|
+
}
|
|
62550
62561
|
for (const [, converter] of Object.entries(converters)) {
|
|
62551
62562
|
if (!text2.match(converter.reg))
|
|
62552
62563
|
continue;
|
|
@@ -70395,16 +70406,20 @@ ${codeText}
|
|
|
70395
70406
|
const tableData = editor.getBlockData(tableBlock);
|
|
70396
70407
|
const children = [{
|
|
70397
70408
|
id: "insert-right-col",
|
|
70398
|
-
name: i18n$1.t("table.commands.insertRightCol")
|
|
70409
|
+
name: i18n$1.t("table.commands.insertRightCol"),
|
|
70410
|
+
clickToClose: false
|
|
70399
70411
|
}, {
|
|
70400
70412
|
id: "insert-bottom-row",
|
|
70401
|
-
name: i18n$1.t("table.commands.insertBottomRow")
|
|
70413
|
+
name: i18n$1.t("table.commands.insertBottomRow"),
|
|
70414
|
+
clickToClose: false
|
|
70402
70415
|
}, {
|
|
70403
70416
|
id: "delete-cell",
|
|
70404
|
-
name: i18n$1.t("table.deleteCol")
|
|
70417
|
+
name: i18n$1.t("table.deleteCol"),
|
|
70418
|
+
clickToClose: false
|
|
70405
70419
|
}, {
|
|
70406
70420
|
id: "delete-row",
|
|
70407
|
-
name: i18n$1.t("table.deleteRow")
|
|
70421
|
+
name: i18n$1.t("table.deleteRow"),
|
|
70422
|
+
clickToClose: false
|
|
70408
70423
|
}, {
|
|
70409
70424
|
type: "section",
|
|
70410
70425
|
id: "section-1",
|
|
@@ -70413,17 +70428,20 @@ ${codeText}
|
|
|
70413
70428
|
id: "row-title",
|
|
70414
70429
|
name: i18n$1.t("table.tableConfig.rowTitle"),
|
|
70415
70430
|
states: tableData.hasRowTitle ? ["checked"] : [],
|
|
70416
|
-
switchable: true
|
|
70431
|
+
switchable: true,
|
|
70432
|
+
clickToClose: false
|
|
70417
70433
|
}, {
|
|
70418
70434
|
id: "col-title",
|
|
70419
70435
|
name: i18n$1.t("table.tableConfig.colTitle"),
|
|
70420
70436
|
states: tableData.hasColTitle ? ["checked"] : [],
|
|
70421
|
-
switchable: true
|
|
70437
|
+
switchable: true,
|
|
70438
|
+
clickToClose: false
|
|
70422
70439
|
}, {
|
|
70423
70440
|
id: "stripe-style",
|
|
70424
70441
|
name: i18n$1.t("table.tableConfig.stripeStyle"),
|
|
70425
70442
|
states: tableData.isStripeStyle ? ["checked"] : [],
|
|
70426
|
-
switchable: true
|
|
70443
|
+
switchable: true,
|
|
70444
|
+
clickToClose: false
|
|
70427
70445
|
}, {
|
|
70428
70446
|
type: "section",
|
|
70429
70447
|
id: "section-2",
|
|
@@ -78363,7 +78381,7 @@ ${content}
|
|
|
78363
78381
|
class OnesEditorMention {
|
|
78364
78382
|
constructor(editor, options) {
|
|
78365
78383
|
__publicField(this, "suggest");
|
|
78366
|
-
__publicField(this, "mobileWrap"
|
|
78384
|
+
__publicField(this, "mobileWrap");
|
|
78367
78385
|
__publicField(this, "items", []);
|
|
78368
78386
|
__publicField(this, "createMobileHeader", () => {
|
|
78369
78387
|
if (!clientType.isMobile) {
|
|
@@ -78388,8 +78406,7 @@ ${content}
|
|
|
78388
78406
|
});
|
|
78389
78407
|
__publicField(this, "onShown", (bar2) => {
|
|
78390
78408
|
if (clientType.isMobile) {
|
|
78391
|
-
const
|
|
78392
|
-
const input2 = mobileWrap.querySelector("input");
|
|
78409
|
+
const { input: input2 } = this.createMobileWrap();
|
|
78393
78410
|
input2.focus();
|
|
78394
78411
|
scrollBarIntoView(this.editor, bar2.menu.menu);
|
|
78395
78412
|
}
|
|
@@ -78464,33 +78481,36 @@ ${content}
|
|
|
78464
78481
|
this.createMobileItems(content, items, find);
|
|
78465
78482
|
});
|
|
78466
78483
|
}, 100));
|
|
78467
|
-
__publicField(this, "
|
|
78484
|
+
__publicField(this, "createMobileWrap", () => {
|
|
78468
78485
|
if (this.mobileWrap) {
|
|
78469
78486
|
return this.mobileWrap;
|
|
78470
78487
|
}
|
|
78471
|
-
|
|
78488
|
+
const wrapper = createElement("div", ["mobile-item-wrap"], null);
|
|
78472
78489
|
const content = createElement("div", ["mobile-item-content"], null);
|
|
78473
78490
|
const icon = createElement("div", ["editor-input-icon"], null);
|
|
78474
78491
|
icon.innerHTML = SearchIcon;
|
|
78475
|
-
createInput(
|
|
78492
|
+
const input2 = createInput(wrapper, {
|
|
78476
78493
|
onChange: (e2) => this.onInputChanged(content, e2),
|
|
78477
78494
|
placeholder: i18n$1.t("mention.placeholder"),
|
|
78478
78495
|
prefix: icon,
|
|
78479
78496
|
suffixClose: true
|
|
78480
78497
|
});
|
|
78481
|
-
|
|
78482
|
-
|
|
78498
|
+
wrapper.appendChild(content);
|
|
78499
|
+
wrapper.addEventListener("click", this.handleMobileWrapClick);
|
|
78483
78500
|
content.addEventListener("scroll", () => {
|
|
78484
78501
|
var _a;
|
|
78485
78502
|
return (_a = document.activeElement) == null ? void 0 : _a.blur();
|
|
78486
78503
|
});
|
|
78504
|
+
this.mobileWrap = {
|
|
78505
|
+
wrapper,
|
|
78506
|
+
input: input2,
|
|
78507
|
+
content
|
|
78508
|
+
};
|
|
78487
78509
|
return this.mobileWrap;
|
|
78488
78510
|
});
|
|
78489
78511
|
__publicField(this, "createMobileCommandItem", (items) => {
|
|
78490
|
-
const
|
|
78491
|
-
|
|
78492
|
-
const input2 = mobileWrap.querySelector("input");
|
|
78493
|
-
input2.value = "";
|
|
78512
|
+
const { wrapper, input: input2, content } = this.createMobileWrap();
|
|
78513
|
+
input2.reset();
|
|
78494
78514
|
this.createMobileItems(content, items, "");
|
|
78495
78515
|
setTimeout(() => {
|
|
78496
78516
|
const clientHeight = this.editor.scrollContainer.clientHeight;
|
|
@@ -78499,7 +78519,7 @@ ${content}
|
|
|
78499
78519
|
return [{
|
|
78500
78520
|
id: "create-mobile-item",
|
|
78501
78521
|
name: "Create Mobile Item",
|
|
78502
|
-
element:
|
|
78522
|
+
element: wrapper
|
|
78503
78523
|
}];
|
|
78504
78524
|
});
|
|
78505
78525
|
__publicField(this, "_queryItems", async (text2) => {
|
|
@@ -78546,7 +78566,8 @@ ${content}
|
|
|
78546
78566
|
}
|
|
78547
78567
|
destroy() {
|
|
78548
78568
|
if (this.mobileWrap) {
|
|
78549
|
-
this.mobileWrap.removeEventListener("click", this.handleMobileWrapClick);
|
|
78569
|
+
this.mobileWrap.wrapper.removeEventListener("click", this.handleMobileWrapClick);
|
|
78570
|
+
this.mobileWrap.input.destroy();
|
|
78550
78571
|
}
|
|
78551
78572
|
}
|
|
78552
78573
|
}
|
|
@@ -80024,10 +80045,10 @@ ${content}
|
|
|
80024
80045
|
__publicField(this, "mobileToolbar");
|
|
80025
80046
|
__publicField(this, "fixedProviders");
|
|
80026
80047
|
__publicField(this, "bar");
|
|
80027
|
-
__publicField(this, "subBar",
|
|
80048
|
+
__publicField(this, "subBar", []);
|
|
80028
80049
|
__publicField(this, "handleSubBarShown", (_2, subBar) => {
|
|
80029
80050
|
scrollBarIntoView(this.editor, subBar);
|
|
80030
|
-
this.subBar
|
|
80051
|
+
this.addSubBar(subBar);
|
|
80031
80052
|
});
|
|
80032
80053
|
__publicField(this, "handleSelectionChange", debounce__default.default(() => {
|
|
80033
80054
|
const commands = this.fixedProviders.getCommands(this.editor.selection.range);
|
|
@@ -80059,14 +80080,22 @@ ${content}
|
|
|
80059
80080
|
}
|
|
80060
80081
|
}, 500);
|
|
80061
80082
|
}
|
|
80083
|
+
addSubBar(subBar) {
|
|
80084
|
+
this.subBar.push(subBar);
|
|
80085
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80086
|
+
}
|
|
80062
80087
|
layoutSubBar() {
|
|
80063
|
-
var _a
|
|
80064
|
-
|
|
80065
|
-
|
|
80088
|
+
var _a;
|
|
80089
|
+
for (const subBar of this.subBar) {
|
|
80090
|
+
if ((subBar == null ? void 0 : subBar.isVisible) && subBar.parentItem) {
|
|
80091
|
+
(_a = subBar.setProps) == null ? void 0 : _a.call(subBar, this.mobileToolbar.getSubBarOptions(subBar.parentItem));
|
|
80092
|
+
}
|
|
80066
80093
|
}
|
|
80094
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80067
80095
|
}
|
|
80068
80096
|
destroy() {
|
|
80069
80097
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
80098
|
+
this.subBar.forEach((item) => item.destroy());
|
|
80070
80099
|
this.mobileToolbar.destroy();
|
|
80071
80100
|
this.bar.remove();
|
|
80072
80101
|
}
|
|
@@ -86739,7 +86768,7 @@ ${data2.flowchartText}
|
|
|
86739
86768
|
}
|
|
86740
86769
|
}
|
|
86741
86770
|
});
|
|
86742
|
-
editor.version = "2.1.1-beta.
|
|
86771
|
+
editor.version = "2.1.1-beta.79";
|
|
86743
86772
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86744
86773
|
window.setReauthFail = (fail) => {
|
|
86745
86774
|
window.isReauthError = fail;
|
|
@@ -86840,7 +86869,7 @@ ${data2.flowchartText}
|
|
|
86840
86869
|
});
|
|
86841
86870
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86842
86871
|
OnesEditorToolbar.register(editor);
|
|
86843
|
-
editor.version = "2.1.1-beta.
|
|
86872
|
+
editor.version = "2.1.1-beta.79";
|
|
86844
86873
|
return editor;
|
|
86845
86874
|
}
|
|
86846
86875
|
async function showDocVersions(editor, options, serverUrl) {
|