@ones-editor/editor 2.1.1-beta.46 → 2.1.1-beta.49
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/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { OnesEditor, DocObject, OnesEditorDoc } from '../@ones-editor/core';
|
|
|
2
2
|
import * as OnesEditorIcons from '../@ones-editor/ui-base/src/icons';
|
|
3
3
|
import { OnesEditorVersionsDialog, VersionDialogOptions } from '../@ones-editor/versions';
|
|
4
4
|
import { CalloutQuickMenuItemFilter } from '../@ones-editor/callout-block';
|
|
5
|
+
import { MobileCommandHandler } from '../@ones-editor/mobile-helper';
|
|
5
6
|
import { LayoutQuickMenuItemFilter, isLayoutBlock } from '../@ones-editor/layout-block';
|
|
6
7
|
import ShareDBDocVersionsProvider from './versions/versions-provider';
|
|
7
8
|
import { CreateLocalEditorOptions, CreateOnesEditorOptions } from './types';
|
|
@@ -32,7 +33,7 @@ export { resetListStart, getListAllNextBrothers, toMindmap, Mindmap } from '../@
|
|
|
32
33
|
export * from '../@ones-editor/exclusive-block';
|
|
33
34
|
export * from '../@ones-editor/templates';
|
|
34
35
|
export * from 'tiny-typed-emitter';
|
|
35
|
-
export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter };
|
|
36
|
+
export { ShareDBDocVersionsProvider, OnesEditorIcons, isLayoutBlock, LayoutQuickMenuItemFilter, CalloutQuickMenuItemFilter, MobileCommandHandler };
|
|
36
37
|
export type { FileBoxData, FileEmbedData } from '../@ones-editor/file';
|
|
37
38
|
export { type DocListBlock } from '../@ones-editor/list-block';
|
|
38
39
|
export declare function createOnesEditor(root: HTMLElement, options: CreateOnesEditorOptions): Promise<OnesEditor>;
|
package/dist/index.js
CHANGED
|
@@ -6322,7 +6322,7 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6322
6322
|
.command-item[data-id=preset-1] {
|
|
6323
6323
|
background-color: #fff0d9 !important;
|
|
6324
6324
|
}.command-m-bar {
|
|
6325
|
-
position:
|
|
6325
|
+
position: fixed;
|
|
6326
6326
|
z-index: 111;
|
|
6327
6327
|
bottom: 0;
|
|
6328
6328
|
height: 40px;
|
|
@@ -78992,7 +78992,6 @@ ${content}
|
|
|
78992
78992
|
removeClass(this.endGripper, "active");
|
|
78993
78993
|
}
|
|
78994
78994
|
}
|
|
78995
|
-
const mobile = "";
|
|
78996
78995
|
class InsertMenuProvider extends ProxyProvider {
|
|
78997
78996
|
constructor(editor) {
|
|
78998
78997
|
super();
|
|
@@ -79295,40 +79294,62 @@ ${content}
|
|
|
79295
79294
|
this.mobileToolbar.destroy();
|
|
79296
79295
|
}
|
|
79297
79296
|
}
|
|
79297
|
+
class ActiveElementObserver {
|
|
79298
|
+
constructor(options) {
|
|
79299
|
+
__publicField(this, "handleFocusIn", (event) => {
|
|
79300
|
+
if (this.isFormElement(event.target)) {
|
|
79301
|
+
this.options.onFocused();
|
|
79302
|
+
}
|
|
79303
|
+
});
|
|
79304
|
+
__publicField(this, "handleFocusOut", (event) => {
|
|
79305
|
+
if (this.isFormElement(event.target)) {
|
|
79306
|
+
this.options.onBlurred();
|
|
79307
|
+
}
|
|
79308
|
+
});
|
|
79309
|
+
this.options = options;
|
|
79310
|
+
document.addEventListener("focusin", this.handleFocusIn);
|
|
79311
|
+
document.addEventListener("focusout", this.handleFocusOut);
|
|
79312
|
+
}
|
|
79313
|
+
isFormElement(element) {
|
|
79314
|
+
return element.tagName === "INPUT" || element.tagName === "TEXTAREA";
|
|
79315
|
+
}
|
|
79316
|
+
destroy() {
|
|
79317
|
+
document.removeEventListener("focusin", this.handleFocusIn);
|
|
79318
|
+
document.removeEventListener("focusout", this.handleFocusOut);
|
|
79319
|
+
}
|
|
79320
|
+
}
|
|
79321
|
+
const mobile = "";
|
|
79298
79322
|
class MobileCommandHandler {
|
|
79299
79323
|
constructor(editor) {
|
|
79300
79324
|
__publicField(this, "commandBar");
|
|
79325
|
+
__publicField(this, "observer");
|
|
79301
79326
|
__publicField(this, "showKeyboard", false);
|
|
79302
|
-
__publicField(this, "initViewportHeight", window.visualViewport.height);
|
|
79303
|
-
__publicField(this, "toggle", () => {
|
|
79304
|
-
|
|
79305
|
-
|
|
79306
|
-
|
|
79307
|
-
} else {
|
|
79308
|
-
this.commandBar.bar.style.bottom = "0px";
|
|
79309
|
-
}
|
|
79310
|
-
});
|
|
79311
|
-
__publicField(this, "handleViewportScroll", () => {
|
|
79312
|
-
this.setDebugInfo();
|
|
79313
|
-
this.toggle();
|
|
79314
|
-
});
|
|
79327
|
+
__publicField(this, "initViewportHeight", this.window.visualViewport.height);
|
|
79328
|
+
__publicField(this, "toggle", debounce__default.default(() => {
|
|
79329
|
+
const offsetHeight = Math.max(this.clientHeight - this.virtualViewportHeight, 0);
|
|
79330
|
+
this.commandBar.bar.style.bottom = `${offsetHeight}px`;
|
|
79331
|
+
}, 100));
|
|
79315
79332
|
__publicField(this, "handleFocusIn", () => {
|
|
79316
79333
|
if (!this.showKeyboard) {
|
|
79317
79334
|
this.showKeyboard = true;
|
|
79318
79335
|
}
|
|
79336
|
+
this.setDebugInfo();
|
|
79337
|
+
this.toggle();
|
|
79319
79338
|
});
|
|
79320
|
-
__publicField(this, "handleFocusOut", (
|
|
79339
|
+
__publicField(this, "handleFocusOut", () => {
|
|
79321
79340
|
if (this.showKeyboard) {
|
|
79322
79341
|
this.showKeyboard = false;
|
|
79323
79342
|
}
|
|
79343
|
+
this.setDebugInfo();
|
|
79344
|
+
this.toggle();
|
|
79324
79345
|
});
|
|
79325
|
-
var _a, _b;
|
|
79326
79346
|
this.editor = editor;
|
|
79327
79347
|
this.commandBar = new MobileToolbarHandler(editor, document.body);
|
|
79328
|
-
|
|
79329
|
-
|
|
79330
|
-
|
|
79331
|
-
|
|
79348
|
+
this.observer = new ActiveElementObserver({
|
|
79349
|
+
onFocused: this.handleFocusIn,
|
|
79350
|
+
onBlurred: this.handleFocusOut
|
|
79351
|
+
});
|
|
79352
|
+
this.toggle();
|
|
79332
79353
|
setTimeout(() => {
|
|
79333
79354
|
const container = this.commandBar.bar.firstChild;
|
|
79334
79355
|
if (container.scrollWidth > container.clientWidth) {
|
|
@@ -79339,24 +79360,31 @@ ${content}
|
|
|
79339
79360
|
}, 500);
|
|
79340
79361
|
}
|
|
79341
79362
|
destroy() {
|
|
79342
|
-
|
|
79343
|
-
|
|
79344
|
-
document.removeEventListener("focusout", this.handleFocusOut);
|
|
79345
|
-
(_a = window == null ? void 0 : window.visualViewport) == null ? void 0 : _a.removeEventListener("scroll", this.handleViewportScroll);
|
|
79346
|
-
(_b = window == null ? void 0 : window.visualViewport) == null ? void 0 : _b.removeEventListener("resize", this.handleViewportScroll);
|
|
79363
|
+
this.observer.destroy();
|
|
79364
|
+
this.commandBar.destroy();
|
|
79347
79365
|
}
|
|
79348
79366
|
get isKeyboardShow() {
|
|
79349
79367
|
const isKeyboardShow = this.virtualViewportHeight < this.initViewportHeight;
|
|
79350
79368
|
return isKeyboardShow;
|
|
79351
79369
|
}
|
|
79352
79370
|
get virtualViewportHeight() {
|
|
79353
|
-
const virtualViewportHeight = window.visualViewport.height;
|
|
79371
|
+
const virtualViewportHeight = this.window.visualViewport.height;
|
|
79354
79372
|
return virtualViewportHeight;
|
|
79355
79373
|
}
|
|
79374
|
+
get clientHeight() {
|
|
79375
|
+
const clientHeight = this.window.document.body.clientHeight;
|
|
79376
|
+
return clientHeight;
|
|
79377
|
+
}
|
|
79356
79378
|
get virtualViewportOffsetTop() {
|
|
79357
|
-
const virtualViewportOffsetTop = window.visualViewport.offsetTop;
|
|
79379
|
+
const virtualViewportOffsetTop = this.window.visualViewport.offsetTop;
|
|
79358
79380
|
return virtualViewportOffsetTop;
|
|
79359
79381
|
}
|
|
79382
|
+
get window() {
|
|
79383
|
+
if (window.parent) {
|
|
79384
|
+
return window.parent;
|
|
79385
|
+
}
|
|
79386
|
+
return window;
|
|
79387
|
+
}
|
|
79360
79388
|
setDebugInfo() {
|
|
79361
79389
|
setInterval(() => {
|
|
79362
79390
|
const visualViewport = document.querySelector("#visualViewport");
|
|
@@ -79364,18 +79392,18 @@ ${content}
|
|
|
79364
79392
|
const clientHeight = document.querySelector("#clientHeight");
|
|
79365
79393
|
const bottom = document.querySelector("#bottom");
|
|
79366
79394
|
visualViewport.innerText = JSON.stringify({
|
|
79367
|
-
height: window.visualViewport.height,
|
|
79368
|
-
offsetTop: window.visualViewport.offsetTop,
|
|
79369
|
-
scale: window.visualViewport.scale,
|
|
79370
|
-
pageTop: window.visualViewport.pageTop,
|
|
79371
|
-
onscroll: window.visualViewport.onscroll
|
|
79395
|
+
height: this.window.visualViewport.height,
|
|
79396
|
+
offsetTop: this.window.visualViewport.offsetTop,
|
|
79397
|
+
scale: this.window.visualViewport.scale,
|
|
79398
|
+
pageTop: this.window.visualViewport.pageTop,
|
|
79399
|
+
onscroll: this.window.visualViewport.onscroll
|
|
79372
79400
|
});
|
|
79373
79401
|
scrollTop.innerText = JSON.stringify(document.documentElement.scrollTop);
|
|
79374
|
-
clientHeight.innerText = `${JSON.stringify(
|
|
79402
|
+
clientHeight.innerText = `${JSON.stringify(this.clientHeight)} , offset: ${Math.max(this.clientHeight - this.virtualViewportHeight, 0)}`;
|
|
79375
79403
|
const bottomOffset = this.commandBar.bar.style.bottom;
|
|
79376
79404
|
bottom.innerText = JSON.stringify(bottomOffset);
|
|
79377
79405
|
const d = document.querySelector("#debug");
|
|
79378
|
-
d.style.top = `${window.visualViewport.offsetTop}px`;
|
|
79406
|
+
d.style.top = `${this.window.visualViewport.offsetTop}px`;
|
|
79379
79407
|
}, 1e3);
|
|
79380
79408
|
}
|
|
79381
79409
|
}
|
|
@@ -85778,7 +85806,6 @@ ${data2.flowchartText}
|
|
|
85778
85806
|
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
85779
85807
|
} else {
|
|
85780
85808
|
editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
|
|
85781
|
-
editor.addCustom("mobile-command", () => new MobileCommandHandler(editor));
|
|
85782
85809
|
}
|
|
85783
85810
|
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
85784
85811
|
var _a2;
|
|
@@ -85819,7 +85846,7 @@ ${data2.flowchartText}
|
|
|
85819
85846
|
}
|
|
85820
85847
|
}
|
|
85821
85848
|
});
|
|
85822
|
-
editor.version = "2.1.1-beta.
|
|
85849
|
+
editor.version = "2.1.1-beta.49";
|
|
85823
85850
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
85824
85851
|
window.setReauthFail = (fail) => {
|
|
85825
85852
|
window.isReauthError = fail;
|
|
@@ -85890,7 +85917,6 @@ ${data2.flowchartText}
|
|
|
85890
85917
|
(_i = editor.findCustom("editor-block-menu")) == null ? void 0 : _i.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
|
|
85891
85918
|
} else {
|
|
85892
85919
|
editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
|
|
85893
|
-
editor.addCustom("mobile-command", () => new MobileCommandHandler(editor));
|
|
85894
85920
|
}
|
|
85895
85921
|
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
85896
85922
|
if (enableComments) {
|
|
@@ -85918,7 +85944,7 @@ ${data2.flowchartText}
|
|
|
85918
85944
|
});
|
|
85919
85945
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
85920
85946
|
OnesEditorToolbar.register(editor);
|
|
85921
|
-
editor.version = "2.1.1-beta.
|
|
85947
|
+
editor.version = "2.1.1-beta.49";
|
|
85922
85948
|
return editor;
|
|
85923
85949
|
}
|
|
85924
85950
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -131723,6 +131749,7 @@ ${data2.flowchartText}
|
|
|
131723
131749
|
exports2.MarkdownInputHandler = MarkdownInputHandler;
|
|
131724
131750
|
exports2.MaxUserError = MaxUserError;
|
|
131725
131751
|
exports2.Mindmap = Mindmap;
|
|
131752
|
+
exports2.MobileCommandHandler = MobileCommandHandler;
|
|
131726
131753
|
exports2.MobileLinkProvider = MobileLinkProvider;
|
|
131727
131754
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
131728
131755
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|