@ones-editor/editor 2.1.1-beta.77 → 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.
- package/@ones-editor/core/src/core/types.d.ts +6 -0
- package/@ones-editor/core/src/utils/animate-scroll.d.ts +2 -0
- package/@ones-editor/core/src/utils/dom.d.ts +0 -1
- package/@ones-editor/mention/src/mention.d.ts +9 -3
- package/@ones-editor/mobile-helper/src/fixed-toolbar/index.d.ts +2 -3
- package/@ones-editor/mobile-helper/src/fixed-toolbar/toolbar-handler.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/readonly-toolbar/index.d.ts +1 -1
- package/@ones-editor/ui/src/toolbar/toolbar-handler.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +1 -1
- package/@ones-editor/ui-base/src/command-bar/types.d.ts +1 -1
- package/@ones-editor/ui-base/src/dialog/manual-close-dialog.d.ts +1 -1
- package/@ones-editor/ui-base/src/input/create-input.d.ts +2 -2
- package/dist/index.js +131 -83
- package/dist/types.d.ts +2 -1
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@ export declare class ReadonlyToolbar implements OnesEditorCustom {
|
|
|
17
17
|
isInBlock(block: BlockElement, event: MouseEvent): boolean;
|
|
18
18
|
handleButtonClick: (toolbar: AbstractCommandBar, item: CommandItem) => void;
|
|
19
19
|
handleClose: () => void;
|
|
20
|
-
handleClosing: (bar: unknown, event: MouseEvent) => boolean;
|
|
20
|
+
handleClosing: (bar: unknown, event: MouseEvent | TouchEvent) => boolean;
|
|
21
21
|
bindEvents(): void;
|
|
22
22
|
unbindEvents(): void;
|
|
23
23
|
handleDocumentMouseDown: (event: MouseEvent) => void;
|
|
@@ -23,7 +23,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
|
|
|
23
23
|
isInBlock(block: BlockElement, event: MouseEvent): boolean;
|
|
24
24
|
handleButtonClick: (toolbar: AbstractCommandBar, item: CommandItem) => void;
|
|
25
25
|
handleClose: () => void;
|
|
26
|
-
handleClosing: (bar: unknown, event: MouseEvent) => boolean;
|
|
26
|
+
handleClosing: (bar: unknown, event: MouseEvent | TouchEvent) => boolean;
|
|
27
27
|
bindEvents(): void;
|
|
28
28
|
unbindEvents(): void;
|
|
29
29
|
handleDocumentMouseDown: (event: MouseEvent) => void;
|
|
@@ -22,7 +22,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
|
|
|
22
22
|
get isSubCommandBar(): boolean;
|
|
23
23
|
updateItems(items: CommandItem[]): void;
|
|
24
24
|
handleDocumentKeydown: (event: KeyboardEvent) => boolean;
|
|
25
|
-
protected handleDocumentMouseDown: (event: MouseEvent) => void;
|
|
25
|
+
protected handleDocumentMouseDown: (event: MouseEvent | TouchEvent) => void;
|
|
26
26
|
protected handleHidden: () => void;
|
|
27
27
|
protected handleShown: () => void;
|
|
28
28
|
protected handleShow: () => void;
|
|
@@ -8,7 +8,7 @@ export interface CommandBarEvents {
|
|
|
8
8
|
'click': (bar: AbstractCommandBar, item: CommandItem, elem: HTMLElement) => void;
|
|
9
9
|
'close': (bar: AbstractCommandBar) => void;
|
|
10
10
|
'selectionChange': (bar: AbstractCommandBar, id: string) => void;
|
|
11
|
-
'closing': (bar: AbstractCommandBar, event: MouseEvent) => boolean | undefined;
|
|
11
|
+
'closing': (bar: AbstractCommandBar, event: MouseEvent | TouchEvent) => boolean | undefined;
|
|
12
12
|
'subBarShown': (bar: AbstractCommandBar, subBar: AbstractCommandBar) => void;
|
|
13
13
|
}
|
|
14
14
|
export interface ManualShowCommandBarOptions {
|
|
@@ -20,6 +20,6 @@ export default class ManualCloseDialog extends ManualCommandBar {
|
|
|
20
20
|
getReferenceClientRect?: GetReferenceClientRect | null | undefined;
|
|
21
21
|
}): void;
|
|
22
22
|
get dialogContent(): HTMLElement | ((item: CommandItem) => HTMLElement);
|
|
23
|
-
handleDocumentMouseDown: (
|
|
23
|
+
handleDocumentMouseDown: () => void;
|
|
24
24
|
static getCommandItems(content: HTMLElement, options?: ManualCloseDialogOptions): CommandItem[];
|
|
25
25
|
}
|
|
@@ -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 {
|
|
@@ -2641,6 +2641,12 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
|
|
|
2641
2641
|
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] > span.math-box .mathjax-tex-text.mathjax-error {
|
|
2642
2642
|
color: var(--color-0);
|
|
2643
2643
|
}
|
|
2644
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax {
|
|
2645
|
+
-webkit-touch-callout: none;
|
|
2646
|
+
}
|
|
2647
|
+
div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax {
|
|
2648
|
+
-webkit-touch-callout: default;
|
|
2649
|
+
}
|
|
2644
2650
|
div.editor-root div.editor-content div[data-type=editor-container] .embed-block.selected[data-embed-type=math] > div[data-type=block-content].mathjax-overflow::before {
|
|
2645
2651
|
width: var(--mathjax-width, "100%");
|
|
2646
2652
|
}
|
|
@@ -8955,25 +8961,13 @@ var __publicField = (obj, key, value) => {
|
|
|
8955
8961
|
elem.removeEventListener("click", simulateDoubleClick);
|
|
8956
8962
|
};
|
|
8957
8963
|
}
|
|
8958
|
-
const getVisualViewportHeightOffset = () => {
|
|
8959
|
-
var _a, _b;
|
|
8960
|
-
if (!clientType.isMobile) {
|
|
8961
|
-
return 0;
|
|
8962
|
-
}
|
|
8963
|
-
let topWindow = window;
|
|
8964
|
-
if (window.top) {
|
|
8965
|
-
topWindow = window.top;
|
|
8966
|
-
}
|
|
8967
|
-
const visualViewportHeight = (_b = (_a = topWindow.visualViewport) == null ? void 0 : _a.height) != null ? _b : topWindow.innerHeight || topWindow.document.documentElement.clientHeight;
|
|
8968
|
-
return Math.max(topWindow.innerHeight - visualViewportHeight + 40, 40);
|
|
8969
|
-
};
|
|
8970
8964
|
class ScrollDomElement {
|
|
8971
8965
|
constructor(element) {
|
|
8972
8966
|
__publicField(this, "element");
|
|
8973
8967
|
this.element = element;
|
|
8974
8968
|
}
|
|
8975
8969
|
getClientHeight() {
|
|
8976
|
-
return this.element.clientHeight
|
|
8970
|
+
return this.element.clientHeight;
|
|
8977
8971
|
}
|
|
8978
8972
|
getHorizontalScroll() {
|
|
8979
8973
|
return this.element.scrollLeft;
|
|
@@ -9073,7 +9067,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9073
9067
|
verticalOffset: 0
|
|
9074
9068
|
};
|
|
9075
9069
|
async function animateScrollTo(numberOrCoordsOrElement, userOptions = {}) {
|
|
9076
|
-
var _a, _b;
|
|
9070
|
+
var _a, _b, _c, _d;
|
|
9077
9071
|
if (!WINDOW_EXISTS) {
|
|
9078
9072
|
return new Promise((resolve) => {
|
|
9079
9073
|
resolve(false);
|
|
@@ -9140,10 +9134,11 @@ var __publicField = (obj, key, value) => {
|
|
|
9140
9134
|
const maxVerticalScroll = elementToScroll.getMaxVerticalScroll();
|
|
9141
9135
|
const initialVerticalScroll = elementToScroll.getVerticalScroll();
|
|
9142
9136
|
if (!options.verticalOffset) {
|
|
9137
|
+
const clientHeight = (_d = (_c = options.getClientHeight) == null ? void 0 : _c.call(options)) != null ? _d : elementToScroll.getClientHeight();
|
|
9143
9138
|
if (initialVerticalScroll < y) {
|
|
9144
|
-
y -=
|
|
9139
|
+
y -= clientHeight * 3 / 4;
|
|
9145
9140
|
} else {
|
|
9146
|
-
y -=
|
|
9141
|
+
y -= clientHeight * 1 / 4;
|
|
9147
9142
|
}
|
|
9148
9143
|
}
|
|
9149
9144
|
if (y > maxVerticalScroll) {
|
|
@@ -25044,10 +25039,9 @@ var __publicField = (obj, key, value) => {
|
|
|
25044
25039
|
const x1 = rect.x < 0 ? 0 : rect.x;
|
|
25045
25040
|
const y1 = rect.y < 0 ? 0 : rect.y;
|
|
25046
25041
|
const x2 = rect.right > window.innerWidth ? window.innerWidth : rect.right;
|
|
25047
|
-
|
|
25048
|
-
|
|
25049
|
-
|
|
25050
|
-
}
|
|
25042
|
+
const mobileClient = editor.options.componentsOptions.mobile;
|
|
25043
|
+
const innerHeight = clientType.isMobile ? mobileClient.getViewPortHeight() : window.innerHeight;
|
|
25044
|
+
const y2 = rect.bottom > innerHeight ? innerHeight : rect.bottom;
|
|
25051
25045
|
return new DOMRect(x1, y1, x2 - x1, y2 - y1);
|
|
25052
25046
|
}
|
|
25053
25047
|
function isBlockPositionVisible(editor, pos) {
|
|
@@ -25103,10 +25097,12 @@ var __publicField = (obj, key, value) => {
|
|
|
25103
25097
|
disableHorizontal: false
|
|
25104
25098
|
});
|
|
25105
25099
|
}
|
|
25100
|
+
const mobileClient = editor.options.componentsOptions.mobile;
|
|
25106
25101
|
animateScrollTo(target, {
|
|
25107
25102
|
elementToScroll: (_a = options.elementToScroll) != null ? _a : getScrollContainer$1(target),
|
|
25108
25103
|
disableHorizontal: true,
|
|
25109
|
-
verticalOffset: options == null ? void 0 : options.verticalOffset
|
|
25104
|
+
verticalOffset: options == null ? void 0 : options.verticalOffset,
|
|
25105
|
+
getClientHeight: mobileClient && clientType.isMobile ? mobileClient.getViewPortHeight : void 0
|
|
25110
25106
|
});
|
|
25111
25107
|
} else if (target.scrollIntoView) {
|
|
25112
25108
|
target.scrollIntoView({
|
|
@@ -39164,6 +39160,9 @@ ${codeText}
|
|
|
39164
39160
|
return;
|
|
39165
39161
|
}
|
|
39166
39162
|
this.emit("click", this, item, elem);
|
|
39163
|
+
if (item.clickToClose === false) {
|
|
39164
|
+
return;
|
|
39165
|
+
}
|
|
39167
39166
|
if (this.options.autoClose) {
|
|
39168
39167
|
if ((_c = (_b = this.options).beforeClose) == null ? void 0 : _c.call(_b, event)) {
|
|
39169
39168
|
return;
|
|
@@ -40161,7 +40160,11 @@ ${codeText}
|
|
|
40161
40160
|
});
|
|
40162
40161
|
parent.appendChild(this.content);
|
|
40163
40162
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
40164
|
-
|
|
40163
|
+
if (clientType.isMobile) {
|
|
40164
|
+
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
40165
|
+
} else {
|
|
40166
|
+
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
40167
|
+
}
|
|
40165
40168
|
}
|
|
40166
40169
|
initCommandBarElement(elem) {
|
|
40167
40170
|
addClass(elem, "toolbar", "fixed");
|
|
@@ -40184,6 +40187,7 @@ ${codeText}
|
|
|
40184
40187
|
super.destroy();
|
|
40185
40188
|
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
40186
40189
|
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
40190
|
+
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
40187
40191
|
}
|
|
40188
40192
|
getCommandBarRoot() {
|
|
40189
40193
|
return this.content.parentElement;
|
|
@@ -40203,7 +40207,7 @@ ${codeText}
|
|
|
40203
40207
|
disablePageScroll: true,
|
|
40204
40208
|
...options
|
|
40205
40209
|
});
|
|
40206
|
-
__publicField(this, "handleDocumentMouseDown", (
|
|
40210
|
+
__publicField(this, "handleDocumentMouseDown", () => {
|
|
40207
40211
|
});
|
|
40208
40212
|
}
|
|
40209
40213
|
initCommandBarElement(elem) {
|
|
@@ -40356,7 +40360,7 @@ ${codeText}
|
|
|
40356
40360
|
});
|
|
40357
40361
|
this.clearSelectedItem();
|
|
40358
40362
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
40359
|
-
document.addEventListener("
|
|
40363
|
+
document.addEventListener("touchend", this.handleDocumentMouseDown);
|
|
40360
40364
|
setTimeout(() => {
|
|
40361
40365
|
var _a2, _b2;
|
|
40362
40366
|
const rect = document.body.clientHeight;
|
|
@@ -40382,6 +40386,8 @@ ${codeText}
|
|
|
40382
40386
|
(_a = this.tippyInstance) == null ? void 0 : _a.destroy();
|
|
40383
40387
|
this.tippyInstance = null;
|
|
40384
40388
|
super.destroy();
|
|
40389
|
+
document.removeEventListener("keydown", this.handleDocumentKeydown);
|
|
40390
|
+
document.removeEventListener("touchend", this.handleDocumentMouseDown);
|
|
40385
40391
|
}
|
|
40386
40392
|
get isVisible() {
|
|
40387
40393
|
var _a, _b;
|
|
@@ -41017,6 +41023,11 @@ ${codeText}
|
|
|
41017
41023
|
removeClass(this.input, "has-suffix");
|
|
41018
41024
|
}
|
|
41019
41025
|
});
|
|
41026
|
+
__publicField(this, "reset", () => {
|
|
41027
|
+
this.input.value = "";
|
|
41028
|
+
removeClass(this.container, "error");
|
|
41029
|
+
this.hideSuffix();
|
|
41030
|
+
});
|
|
41020
41031
|
__publicField(this, "handleInput", (e2) => {
|
|
41021
41032
|
var _a, _b;
|
|
41022
41033
|
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, e2);
|
|
@@ -41955,8 +41966,15 @@ ${codeText}
|
|
|
41955
41966
|
if (popperRect) {
|
|
41956
41967
|
const bottom = activeRect.reduce((acc, cur) => acc > cur.bottom ? acc : cur.bottom, 0);
|
|
41957
41968
|
if (bottom > popperRect.top) {
|
|
41958
|
-
const
|
|
41959
|
-
|
|
41969
|
+
const scrollContainer2 = editor.scrollContainer;
|
|
41970
|
+
scrollContainer2.scrollTop += bottom - popperRect.top + 20;
|
|
41971
|
+
return;
|
|
41972
|
+
}
|
|
41973
|
+
const top = activeRect.reduce((acc, cur) => acc < cur.top ? acc : cur.top, Infinity);
|
|
41974
|
+
const scrollContainer = editor.scrollContainer;
|
|
41975
|
+
const containerRect = scrollContainer.getBoundingClientRect();
|
|
41976
|
+
if (top < containerRect.top) {
|
|
41977
|
+
scrollContainer.scrollTop -= containerRect.top - top + 20;
|
|
41960
41978
|
}
|
|
41961
41979
|
}
|
|
41962
41980
|
};
|
|
@@ -50046,7 +50064,7 @@ ${codeText}
|
|
|
50046
50064
|
return [
|
|
50047
50065
|
{
|
|
50048
50066
|
id: "insert-link",
|
|
50049
|
-
name:
|
|
50067
|
+
name: i18n$1.t("quickMenu.inlineBox.link"),
|
|
50050
50068
|
icon: LinkIcon,
|
|
50051
50069
|
states: [],
|
|
50052
50070
|
subText: getShortcutById("insert-link")
|
|
@@ -50545,7 +50563,8 @@ ${codeText}
|
|
|
50545
50563
|
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
50546
50564
|
refuseOverflow: true,
|
|
50547
50565
|
padding: 20,
|
|
50548
|
-
showName: clientType.isMobile
|
|
50566
|
+
showName: clientType.isMobile,
|
|
50567
|
+
autoClose: clientType.isMobile ? true : void 0
|
|
50549
50568
|
});
|
|
50550
50569
|
this.toolbar.on("click", this.handleButtonClick);
|
|
50551
50570
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -59121,7 +59140,13 @@ $$${mathData.mathjaxText}$$
|
|
|
59121
59140
|
return this.editProvider.getAvailableCommands(editor, block, range, { child });
|
|
59122
59141
|
}
|
|
59123
59142
|
if (((_b = this.options) == null ? void 0 : _b.linkMode) === "insert" && !child) {
|
|
59124
|
-
|
|
59143
|
+
const commands = this.insertProvider.getAvailableCommands(editor, block, range, { ...params, isFilter: true });
|
|
59144
|
+
commands.forEach((command) => {
|
|
59145
|
+
if (command.id === "insert-link") {
|
|
59146
|
+
command.name = i18n$1.t("link.title");
|
|
59147
|
+
}
|
|
59148
|
+
});
|
|
59149
|
+
return commands;
|
|
59125
59150
|
}
|
|
59126
59151
|
return [];
|
|
59127
59152
|
});
|
|
@@ -62401,6 +62426,7 @@ ${codeText}
|
|
|
62401
62426
|
return editor.addCustom("markdown-converter-interceptors", () => new MarkdownConverterInterceptors());
|
|
62402
62427
|
}
|
|
62403
62428
|
}
|
|
62429
|
+
const DISABLE_MOBILE_CONVERTERS = ["mermaid", "flowchart", "plantuml"];
|
|
62404
62430
|
const ENTER_CONVERTER = {
|
|
62405
62431
|
mermaid: {
|
|
62406
62432
|
blockType: "embed",
|
|
@@ -62527,6 +62553,11 @@ ${codeText}
|
|
|
62527
62553
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
62528
62554
|
const text2 = toPlainText(splitText(editor.getBlockText(block), offset).left);
|
|
62529
62555
|
const converters = type === "enter" ? ENTER_CONVERTER : SPACE_CONVERTER;
|
|
62556
|
+
if (clientType.isMobile) {
|
|
62557
|
+
DISABLE_MOBILE_CONVERTERS.forEach((key) => {
|
|
62558
|
+
delete converters[key];
|
|
62559
|
+
});
|
|
62560
|
+
}
|
|
62530
62561
|
for (const [, converter] of Object.entries(converters)) {
|
|
62531
62562
|
if (!text2.match(converter.reg))
|
|
62532
62563
|
continue;
|
|
@@ -69754,7 +69785,8 @@ ${codeText}
|
|
|
69754
69785
|
return editor.undoManager.runInGroup(() => {
|
|
69755
69786
|
var _a, _b;
|
|
69756
69787
|
const item = options.item;
|
|
69757
|
-
const
|
|
69788
|
+
const defaultColCount = clientType.isMobile ? 3 : 5;
|
|
69789
|
+
const cols = (_a = item.colCount) != null ? _a : defaultColCount;
|
|
69758
69790
|
const rows = (_b = item.rowCount) != null ? _b : 3;
|
|
69759
69791
|
const ret = createEmptyTableData(editor, { cols, rows });
|
|
69760
69792
|
if (!ret) {
|
|
@@ -70374,16 +70406,20 @@ ${codeText}
|
|
|
70374
70406
|
const tableData = editor.getBlockData(tableBlock);
|
|
70375
70407
|
const children = [{
|
|
70376
70408
|
id: "insert-right-col",
|
|
70377
|
-
name: i18n$1.t("table.commands.insertRightCol")
|
|
70409
|
+
name: i18n$1.t("table.commands.insertRightCol"),
|
|
70410
|
+
clickToClose: false
|
|
70378
70411
|
}, {
|
|
70379
70412
|
id: "insert-bottom-row",
|
|
70380
|
-
name: i18n$1.t("table.commands.insertBottomRow")
|
|
70413
|
+
name: i18n$1.t("table.commands.insertBottomRow"),
|
|
70414
|
+
clickToClose: false
|
|
70381
70415
|
}, {
|
|
70382
70416
|
id: "delete-cell",
|
|
70383
|
-
name: i18n$1.t("table.deleteCol")
|
|
70417
|
+
name: i18n$1.t("table.deleteCol"),
|
|
70418
|
+
clickToClose: false
|
|
70384
70419
|
}, {
|
|
70385
70420
|
id: "delete-row",
|
|
70386
|
-
name: i18n$1.t("table.deleteRow")
|
|
70421
|
+
name: i18n$1.t("table.deleteRow"),
|
|
70422
|
+
clickToClose: false
|
|
70387
70423
|
}, {
|
|
70388
70424
|
type: "section",
|
|
70389
70425
|
id: "section-1",
|
|
@@ -70392,17 +70428,20 @@ ${codeText}
|
|
|
70392
70428
|
id: "row-title",
|
|
70393
70429
|
name: i18n$1.t("table.tableConfig.rowTitle"),
|
|
70394
70430
|
states: tableData.hasRowTitle ? ["checked"] : [],
|
|
70395
|
-
switchable: true
|
|
70431
|
+
switchable: true,
|
|
70432
|
+
clickToClose: false
|
|
70396
70433
|
}, {
|
|
70397
70434
|
id: "col-title",
|
|
70398
70435
|
name: i18n$1.t("table.tableConfig.colTitle"),
|
|
70399
70436
|
states: tableData.hasColTitle ? ["checked"] : [],
|
|
70400
|
-
switchable: true
|
|
70437
|
+
switchable: true,
|
|
70438
|
+
clickToClose: false
|
|
70401
70439
|
}, {
|
|
70402
70440
|
id: "stripe-style",
|
|
70403
70441
|
name: i18n$1.t("table.tableConfig.stripeStyle"),
|
|
70404
70442
|
states: tableData.isStripeStyle ? ["checked"] : [],
|
|
70405
|
-
switchable: true
|
|
70443
|
+
switchable: true,
|
|
70444
|
+
clickToClose: false
|
|
70406
70445
|
}, {
|
|
70407
70446
|
type: "section",
|
|
70408
70447
|
id: "section-2",
|
|
@@ -78342,7 +78381,7 @@ ${content}
|
|
|
78342
78381
|
class OnesEditorMention {
|
|
78343
78382
|
constructor(editor, options) {
|
|
78344
78383
|
__publicField(this, "suggest");
|
|
78345
|
-
__publicField(this, "mobileWrap"
|
|
78384
|
+
__publicField(this, "mobileWrap");
|
|
78346
78385
|
__publicField(this, "items", []);
|
|
78347
78386
|
__publicField(this, "createMobileHeader", () => {
|
|
78348
78387
|
if (!clientType.isMobile) {
|
|
@@ -78367,8 +78406,7 @@ ${content}
|
|
|
78367
78406
|
});
|
|
78368
78407
|
__publicField(this, "onShown", (bar2) => {
|
|
78369
78408
|
if (clientType.isMobile) {
|
|
78370
|
-
const
|
|
78371
|
-
const input2 = mobileWrap.querySelector("input");
|
|
78409
|
+
const { input: input2 } = this.createMobileWrap();
|
|
78372
78410
|
input2.focus();
|
|
78373
78411
|
scrollBarIntoView(this.editor, bar2.menu.menu);
|
|
78374
78412
|
}
|
|
@@ -78443,33 +78481,36 @@ ${content}
|
|
|
78443
78481
|
this.createMobileItems(content, items, find);
|
|
78444
78482
|
});
|
|
78445
78483
|
}, 100));
|
|
78446
|
-
__publicField(this, "
|
|
78484
|
+
__publicField(this, "createMobileWrap", () => {
|
|
78447
78485
|
if (this.mobileWrap) {
|
|
78448
78486
|
return this.mobileWrap;
|
|
78449
78487
|
}
|
|
78450
|
-
|
|
78488
|
+
const wrapper = createElement("div", ["mobile-item-wrap"], null);
|
|
78451
78489
|
const content = createElement("div", ["mobile-item-content"], null);
|
|
78452
78490
|
const icon = createElement("div", ["editor-input-icon"], null);
|
|
78453
78491
|
icon.innerHTML = SearchIcon;
|
|
78454
|
-
createInput(
|
|
78492
|
+
const input2 = createInput(wrapper, {
|
|
78455
78493
|
onChange: (e2) => this.onInputChanged(content, e2),
|
|
78456
78494
|
placeholder: i18n$1.t("mention.placeholder"),
|
|
78457
78495
|
prefix: icon,
|
|
78458
78496
|
suffixClose: true
|
|
78459
78497
|
});
|
|
78460
|
-
|
|
78461
|
-
|
|
78498
|
+
wrapper.appendChild(content);
|
|
78499
|
+
wrapper.addEventListener("click", this.handleMobileWrapClick);
|
|
78462
78500
|
content.addEventListener("scroll", () => {
|
|
78463
78501
|
var _a;
|
|
78464
78502
|
return (_a = document.activeElement) == null ? void 0 : _a.blur();
|
|
78465
78503
|
});
|
|
78504
|
+
this.mobileWrap = {
|
|
78505
|
+
wrapper,
|
|
78506
|
+
input: input2,
|
|
78507
|
+
content
|
|
78508
|
+
};
|
|
78466
78509
|
return this.mobileWrap;
|
|
78467
78510
|
});
|
|
78468
78511
|
__publicField(this, "createMobileCommandItem", (items) => {
|
|
78469
|
-
const
|
|
78470
|
-
|
|
78471
|
-
const input2 = mobileWrap.querySelector("input");
|
|
78472
|
-
input2.value = "";
|
|
78512
|
+
const { wrapper, input: input2, content } = this.createMobileWrap();
|
|
78513
|
+
input2.reset();
|
|
78473
78514
|
this.createMobileItems(content, items, "");
|
|
78474
78515
|
setTimeout(() => {
|
|
78475
78516
|
const clientHeight = this.editor.scrollContainer.clientHeight;
|
|
@@ -78478,7 +78519,7 @@ ${content}
|
|
|
78478
78519
|
return [{
|
|
78479
78520
|
id: "create-mobile-item",
|
|
78480
78521
|
name: "Create Mobile Item",
|
|
78481
|
-
element:
|
|
78522
|
+
element: wrapper
|
|
78482
78523
|
}];
|
|
78483
78524
|
});
|
|
78484
78525
|
__publicField(this, "_queryItems", async (text2) => {
|
|
@@ -78525,7 +78566,8 @@ ${content}
|
|
|
78525
78566
|
}
|
|
78526
78567
|
destroy() {
|
|
78527
78568
|
if (this.mobileWrap) {
|
|
78528
|
-
this.mobileWrap.removeEventListener("click", this.handleMobileWrapClick);
|
|
78569
|
+
this.mobileWrap.wrapper.removeEventListener("click", this.handleMobileWrapClick);
|
|
78570
|
+
this.mobileWrap.input.destroy();
|
|
78529
78571
|
}
|
|
78530
78572
|
}
|
|
78531
78573
|
}
|
|
@@ -80003,10 +80045,10 @@ ${content}
|
|
|
80003
80045
|
__publicField(this, "mobileToolbar");
|
|
80004
80046
|
__publicField(this, "fixedProviders");
|
|
80005
80047
|
__publicField(this, "bar");
|
|
80006
|
-
__publicField(this, "subBar",
|
|
80048
|
+
__publicField(this, "subBar", []);
|
|
80007
80049
|
__publicField(this, "handleSubBarShown", (_2, subBar) => {
|
|
80008
80050
|
scrollBarIntoView(this.editor, subBar);
|
|
80009
|
-
this.subBar
|
|
80051
|
+
this.addSubBar(subBar);
|
|
80010
80052
|
});
|
|
80011
80053
|
__publicField(this, "handleSelectionChange", debounce__default.default(() => {
|
|
80012
80054
|
const commands = this.fixedProviders.getCommands(this.editor.selection.range);
|
|
@@ -80038,14 +80080,22 @@ ${content}
|
|
|
80038
80080
|
}
|
|
80039
80081
|
}, 500);
|
|
80040
80082
|
}
|
|
80083
|
+
addSubBar(subBar) {
|
|
80084
|
+
this.subBar.push(subBar);
|
|
80085
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80086
|
+
}
|
|
80041
80087
|
layoutSubBar() {
|
|
80042
|
-
var _a
|
|
80043
|
-
|
|
80044
|
-
|
|
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
|
+
}
|
|
80045
80093
|
}
|
|
80094
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80046
80095
|
}
|
|
80047
80096
|
destroy() {
|
|
80048
80097
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
80098
|
+
this.subBar.forEach((item) => item.destroy());
|
|
80049
80099
|
this.mobileToolbar.destroy();
|
|
80050
80100
|
this.bar.remove();
|
|
80051
80101
|
}
|
|
@@ -80074,26 +80124,29 @@ ${content}
|
|
|
80074
80124
|
constructor(editor) {
|
|
80075
80125
|
__publicField(this, "commandBar");
|
|
80076
80126
|
__publicField(this, "observer");
|
|
80127
|
+
__publicField(this, "timer");
|
|
80128
|
+
__publicField(this, "mobileClient");
|
|
80077
80129
|
__publicField(this, "toggleDelay", clientType.isSafari ? 800 : 100);
|
|
80078
|
-
__publicField(this, "preHeight",
|
|
80130
|
+
__publicField(this, "preHeight", 0);
|
|
80079
80131
|
__publicField(this, "layoutBar", debounce__default.default(() => {
|
|
80080
|
-
|
|
80081
|
-
|
|
80082
|
-
|
|
80132
|
+
var _a, _b, _c, _d, _e;
|
|
80133
|
+
const offsetHeight = (_b = (_a = this.mobileClient) == null ? void 0 : _a.getOffsetHeight()) != null ? _b : 0;
|
|
80134
|
+
if (clientType.isIOS && this.mobileClient) {
|
|
80135
|
+
if (this.preHeight > this.mobileClient.virtualViewportHeight) {
|
|
80083
80136
|
editorScrollIntoView(this.editor);
|
|
80084
80137
|
}
|
|
80085
80138
|
}
|
|
80086
80139
|
this.commandBar.bar.style.bottom = `${offsetHeight}px`;
|
|
80087
|
-
if (this.preHeight !== this.virtualViewportHeight) {
|
|
80140
|
+
if (this.preHeight !== ((_c = this.mobileClient) == null ? void 0 : _c.virtualViewportHeight)) {
|
|
80088
80141
|
this.commandBar.layoutSubBar();
|
|
80089
80142
|
}
|
|
80090
|
-
this.preHeight = this.virtualViewportHeight;
|
|
80143
|
+
this.preHeight = (_e = (_d = this.mobileClient) == null ? void 0 : _d.virtualViewportHeight) != null ? _e : 0;
|
|
80091
80144
|
}, this.toggleDelay));
|
|
80092
80145
|
__publicField(this, "handScroll", debounce__default.default(() => {
|
|
80093
80146
|
const input2 = this.editor.input.getInput();
|
|
80094
|
-
if (input2) {
|
|
80147
|
+
if (input2 && this.mobileClient) {
|
|
80095
80148
|
const inputRect = input2.getBoundingClientRect();
|
|
80096
|
-
if (inputRect.bottom > this.virtualViewportHeight || inputRect.top < 0) {
|
|
80149
|
+
if (inputRect.bottom > this.mobileClient.virtualViewportHeight || inputRect.top < 0) {
|
|
80097
80150
|
input2.style.top = `${this.editor.scrollContainer.scrollTop}px`;
|
|
80098
80151
|
}
|
|
80099
80152
|
}
|
|
@@ -80104,6 +80157,7 @@ ${content}
|
|
|
80104
80157
|
__publicField(this, "handleFocusOut", () => {
|
|
80105
80158
|
this.layoutBar();
|
|
80106
80159
|
});
|
|
80160
|
+
var _a, _b;
|
|
80107
80161
|
this.editor = editor;
|
|
80108
80162
|
this.commandBar = new MobileToolbarHandler(editor, document.body);
|
|
80109
80163
|
this.observer = new ActiveElementObserver({
|
|
@@ -80112,23 +80166,19 @@ ${content}
|
|
|
80112
80166
|
});
|
|
80113
80167
|
this.layoutBar();
|
|
80114
80168
|
this.editor.scrollContainer.addEventListener("scroll", this.handScroll);
|
|
80115
|
-
|
|
80116
|
-
|
|
80117
|
-
if (
|
|
80118
|
-
|
|
80169
|
+
this.mobileClient = this.editor.options.componentsOptions.mobile;
|
|
80170
|
+
this.preHeight = (_b = (_a = this.mobileClient) == null ? void 0 : _a.virtualViewportHeight) != null ? _b : 0;
|
|
80171
|
+
if (clientType.isAndroid) {
|
|
80172
|
+
this.timer = setInterval(() => {
|
|
80173
|
+
var _a2, _b2;
|
|
80174
|
+
if (((_a2 = this.mobileClient) == null ? void 0 : _a2.virtualViewportHeight) !== this.preHeight || ((_b2 = this.mobileClient) == null ? void 0 : _b2.virtualViewportOffsetTop) !== 0) {
|
|
80175
|
+
this.layoutBar();
|
|
80176
|
+
}
|
|
80177
|
+
}, 1e3);
|
|
80119
80178
|
}
|
|
80120
|
-
return window;
|
|
80121
|
-
}
|
|
80122
|
-
get virtualViewportHeight() {
|
|
80123
|
-
var _a, _b;
|
|
80124
|
-
const virtualViewportHeight = (_b = (_a = this.window.visualViewport) == null ? void 0 : _a.height) != null ? _b : this.clientHeight;
|
|
80125
|
-
return virtualViewportHeight;
|
|
80126
|
-
}
|
|
80127
|
-
get clientHeight() {
|
|
80128
|
-
const clientHeight = this.window.document.body.clientHeight;
|
|
80129
|
-
return clientHeight;
|
|
80130
80179
|
}
|
|
80131
80180
|
destroy() {
|
|
80181
|
+
clearInterval(this.timer);
|
|
80132
80182
|
this.observer.destroy();
|
|
80133
80183
|
this.commandBar.destroy();
|
|
80134
80184
|
this.editor.scrollContainer.removeEventListener("scroll", this.handScroll);
|
|
@@ -80216,7 +80266,6 @@ ${content}
|
|
|
80216
80266
|
return false;
|
|
80217
80267
|
}
|
|
80218
80268
|
if (!range.isSimple()) {
|
|
80219
|
-
this.editor.selection.setRange(range);
|
|
80220
80269
|
return true;
|
|
80221
80270
|
}
|
|
80222
80271
|
const block = this.editor.getBlockById(range.start.blockId);
|
|
@@ -86719,7 +86768,7 @@ ${data2.flowchartText}
|
|
|
86719
86768
|
}
|
|
86720
86769
|
}
|
|
86721
86770
|
});
|
|
86722
|
-
editor.version = "2.1.1-beta.
|
|
86771
|
+
editor.version = "2.1.1-beta.79";
|
|
86723
86772
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86724
86773
|
window.setReauthFail = (fail) => {
|
|
86725
86774
|
window.isReauthError = fail;
|
|
@@ -86820,7 +86869,7 @@ ${data2.flowchartText}
|
|
|
86820
86869
|
});
|
|
86821
86870
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86822
86871
|
OnesEditorToolbar.register(editor);
|
|
86823
|
-
editor.version = "2.1.1-beta.
|
|
86872
|
+
editor.version = "2.1.1-beta.79";
|
|
86824
86873
|
return editor;
|
|
86825
86874
|
}
|
|
86826
86875
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -132986,7 +133035,6 @@ ${data2.flowchartText}
|
|
|
132986
133035
|
exports2.getTextOpLength = getTextOpLength;
|
|
132987
133036
|
exports2.getTextWidth = getTextWidth;
|
|
132988
133037
|
exports2.getToolbar = getToolbar;
|
|
132989
|
-
exports2.getVisualViewportHeightOffset = getVisualViewportHeightOffset;
|
|
132990
133038
|
exports2.groupEachCommand = groupEachCommand;
|
|
132991
133039
|
exports2.handleBlockElementUpdated = handleBlockElementUpdated$1;
|
|
132992
133040
|
exports2.hasAltOnly = hasAltOnly;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Embed, Box, i18n, OnesEditor, OnesEditorUser, OnesEditorUserPermission, OnesEditorBlockHook, OnesEditorCommandProvider, LogLevel, Block, ShortcutRecords, OnesEditorBlockRenderer, BuildResourceUrlOptions, UploadResourceOptions, UploadResourceResult } from '../@ones-editor/core';
|
|
1
|
+
import { Embed, Box, i18n, OnesEditor, OnesEditorUser, OnesEditorUserPermission, OnesEditorBlockHook, OnesEditorCommandProvider, LogLevel, Block, ShortcutRecords, OnesEditorBlockRenderer, BuildResourceUrlOptions, UploadResourceOptions, UploadResourceResult, MobileClient } from '../@ones-editor/core';
|
|
2
2
|
import { DrawIoOptions } from '../@ones-editor/drawio-embed';
|
|
3
3
|
import { FlowCharEmbedOptions, MermaidEmbedOptions, PlantumlEmbedOptions } from '../@ones-editor/graph-embed';
|
|
4
4
|
import { ImageOptions } from '../@ones-editor/image-embed';
|
|
@@ -42,6 +42,7 @@ export type EditorComponentOptions = {
|
|
|
42
42
|
mathjax?: MathjaxOptions;
|
|
43
43
|
link?: LinkOptions;
|
|
44
44
|
columns?: EditorConfigLayoutOptions;
|
|
45
|
+
mobile?: MobileClient;
|
|
45
46
|
};
|
|
46
47
|
export type EditorEvents = {
|
|
47
48
|
onClickLink?: (editor: OnesEditor, event: MouseEvent, link: Element) => void;
|