@ones-editor/editor 2.1.1-beta.53 → 2.1.1-beta.55
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/containers/root-container.d.ts +2 -2
- package/@ones-editor/mobile-helper/src/index.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -1
- package/dist/index.js +43 -46
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="lodash" />
|
|
1
2
|
import { TypedEmitter } from 'tiny-typed-emitter';
|
|
2
3
|
import { CloseReason, CommandItem, Closeable } from '../../../../@ones-editor/core';
|
|
3
4
|
import { AbstractManualCommandBar, AbstractCommandBar, CommandBarEvents, CommandBarOptions, CommandItemElement, CreateManualCommandBarFunction, ManualShowCommandBarOptions, SelectItemFrom } from './types';
|
|
@@ -29,7 +30,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
|
|
|
29
30
|
private getSelectedItemIndex;
|
|
30
31
|
private getPrevItemIndex;
|
|
31
32
|
private getNextItemIndex;
|
|
32
|
-
protected clearSelectedItem()
|
|
33
|
+
protected clearSelectedItem: import("lodash").DebouncedFunc<() => void>;
|
|
33
34
|
selectItem(id: string, from?: SelectItemFrom): void;
|
|
34
35
|
private lastEnterPauseTime;
|
|
35
36
|
private startPauseMouseEnter;
|
package/dist/index.js
CHANGED
|
@@ -5829,7 +5829,6 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
5829
5829
|
line-height: 2.4;
|
|
5830
5830
|
}
|
|
5831
5831
|
div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .command-item .mobile-item-wrap .mobile-item-content {
|
|
5832
|
-
max-height: calc(100vh - 180px);
|
|
5833
5832
|
height: 400px;
|
|
5834
5833
|
overflow-x: auto;
|
|
5835
5834
|
overscroll-behavior: contain;
|
|
@@ -11211,25 +11210,19 @@ var __publicField = (obj, key, value) => {
|
|
|
11211
11210
|
}
|
|
11212
11211
|
});
|
|
11213
11212
|
__publicField(this, "handleClick", (event) => {
|
|
11214
|
-
|
|
11215
|
-
|
|
11216
|
-
const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
|
|
11217
|
-
this.editor.emit("click", this.editor, mouseEvent);
|
|
11218
|
-
const target = ensureIsMobileEvent(this.mouseDownEvent) ? this.mouseDownEvent.changedTouches[0].target : this.mouseDownEvent.target;
|
|
11213
|
+
this.editor.emit("click", this.editor, event);
|
|
11214
|
+
const target = event.target;
|
|
11219
11215
|
if (isInBlockTools(target)) {
|
|
11220
|
-
this.mouseDownEvent = null;
|
|
11221
11216
|
return;
|
|
11222
11217
|
}
|
|
11223
|
-
if (event.detail === 1
|
|
11218
|
+
if (event.detail === 1) {
|
|
11224
11219
|
this.editor.input.focus();
|
|
11225
11220
|
}
|
|
11226
|
-
if (
|
|
11221
|
+
if (event.detail === 3) {
|
|
11227
11222
|
this.editor.selectionHandler.handleTripleClick(event);
|
|
11228
11223
|
}
|
|
11229
|
-
if (event.detail === 1
|
|
11230
|
-
const
|
|
11231
|
-
const clientY = ensureIsMobileEvent(event) ? event.changedTouches[0].clientY : event.clientY;
|
|
11232
|
-
const elem = getElementFromPoint(clientX, clientY);
|
|
11224
|
+
if (event.detail === 1 && event.button === 0) {
|
|
11225
|
+
const elem = getElementFromPoint(event.clientX, event.clientY);
|
|
11233
11226
|
if (elem && isChildNode(this.rootContainer, elem)) {
|
|
11234
11227
|
const block = getParentBlock(elem);
|
|
11235
11228
|
if (block && isChildNode(block, elem)) {
|
|
@@ -11237,19 +11230,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11237
11230
|
}
|
|
11238
11231
|
}
|
|
11239
11232
|
}
|
|
11240
|
-
this.mouseDownEvent = null;
|
|
11241
11233
|
});
|
|
11242
11234
|
__publicField(this, "handleBlockClick", (event, block, elem) => {
|
|
11243
11235
|
var _a, _b;
|
|
11244
11236
|
if (!isTextKindBlock(this.editor, block)) {
|
|
11245
11237
|
return;
|
|
11246
11238
|
}
|
|
11247
|
-
const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
|
|
11248
11239
|
const box = getParentBox(elem);
|
|
11249
11240
|
if (box) {
|
|
11250
11241
|
const block2 = getParentBlock(box);
|
|
11251
11242
|
assert(logger$4n, block2, "no parent block");
|
|
11252
|
-
(_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box,
|
|
11243
|
+
(_b = (_a = this.editor.editorBoxes.getBoxClass(getBoxTypeFromElement(box))) == null ? void 0 : _a.handleClickBox) == null ? void 0 : _b.call(_a, this.editor, box, event);
|
|
11253
11244
|
return;
|
|
11254
11245
|
}
|
|
11255
11246
|
const link2 = elem.closest("span.text.link");
|
|
@@ -11257,7 +11248,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11257
11248
|
const children = getTextBlockContentChildren(block);
|
|
11258
11249
|
const index2 = children.indexOf(link2);
|
|
11259
11250
|
if (index2 !== -1) {
|
|
11260
|
-
this.editor.emit("clickLink", this.editor,
|
|
11251
|
+
this.editor.emit("clickLink", this.editor, event, link2);
|
|
11261
11252
|
}
|
|
11262
11253
|
}
|
|
11263
11254
|
});
|
|
@@ -39073,6 +39064,16 @@ ${codeText}
|
|
|
39073
39064
|
disablePageScroll(this.id);
|
|
39074
39065
|
}
|
|
39075
39066
|
});
|
|
39067
|
+
__publicField(this, "clearSelectedItem", debounce__default.default(() => {
|
|
39068
|
+
const item = this.getSelectedItem();
|
|
39069
|
+
if (!item) {
|
|
39070
|
+
return;
|
|
39071
|
+
}
|
|
39072
|
+
const elem = this.getItemElementById(item.id);
|
|
39073
|
+
if (elem) {
|
|
39074
|
+
removeClass(elem, "selected");
|
|
39075
|
+
}
|
|
39076
|
+
}, 200));
|
|
39076
39077
|
__publicField(this, "lastEnterPauseTime", 0);
|
|
39077
39078
|
__publicField(this, "startPauseMouseEnter", () => {
|
|
39078
39079
|
this.lastEnterPauseTime = Date.now();
|
|
@@ -39133,9 +39134,7 @@ ${codeText}
|
|
|
39133
39134
|
}
|
|
39134
39135
|
if (clientType.isMobile) {
|
|
39135
39136
|
this.selectItem(id);
|
|
39136
|
-
|
|
39137
|
-
this.clearSelectedItem();
|
|
39138
|
-
}, 1e3);
|
|
39137
|
+
this.clearSelectedItem();
|
|
39139
39138
|
}
|
|
39140
39139
|
if (item.children && item.children.length > 0 && item.manualShowChildren) {
|
|
39141
39140
|
this.showSubCommandBar(item.childrenMenuId);
|
|
@@ -39306,16 +39305,6 @@ ${codeText}
|
|
|
39306
39305
|
}
|
|
39307
39306
|
}
|
|
39308
39307
|
}
|
|
39309
|
-
clearSelectedItem() {
|
|
39310
|
-
const item = this.getSelectedItem();
|
|
39311
|
-
if (!item) {
|
|
39312
|
-
return;
|
|
39313
|
-
}
|
|
39314
|
-
const elem = this.getItemElementById(item.id);
|
|
39315
|
-
if (elem) {
|
|
39316
|
-
removeClass(elem, "selected");
|
|
39317
|
-
}
|
|
39318
|
-
}
|
|
39319
39308
|
selectItem(id, from = "event") {
|
|
39320
39309
|
const exists = this.getSelectedItem();
|
|
39321
39310
|
if (exists) {
|
|
@@ -50558,8 +50547,12 @@ ${codeText}
|
|
|
50558
50547
|
}
|
|
50559
50548
|
this.toolbar.updateItems(allCommands);
|
|
50560
50549
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
50561
|
-
|
|
50562
|
-
|
|
50550
|
+
let reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
|
|
50551
|
+
let selectedBlock = reverseToolbar ? lastBlock2 : firstBlock;
|
|
50552
|
+
if (clientType.isMobile) {
|
|
50553
|
+
reverseToolbar = false;
|
|
50554
|
+
selectedBlock = firstBlock;
|
|
50555
|
+
}
|
|
50563
50556
|
const rect = getReferenceClientRect(this.editor, selectedBlock);
|
|
50564
50557
|
if (!this.toolbar.isVisible) {
|
|
50565
50558
|
const anchor2 = createBlockAnchor(this.editor, selectedBlock.block, "editor-quick-menu", rect);
|
|
@@ -78318,6 +78311,8 @@ ${content}
|
|
|
78318
78311
|
__publicField(this, "createMobileCommandItem", (items) => {
|
|
78319
78312
|
this.mobileWrap = createElement("div", ["mobile-item-wrap"], null);
|
|
78320
78313
|
const content = createElement("div", ["mobile-item-content"], null);
|
|
78314
|
+
const clientHeight = this.editor.rootContainer.clientHeight;
|
|
78315
|
+
content.style.maxHeight = `${clientHeight - 180}px`;
|
|
78321
78316
|
const icon = createElement("div", ["editor-input-icon"], null);
|
|
78322
78317
|
icon.innerHTML = SearchIcon;
|
|
78323
78318
|
const input2 = createInput(this.mobileWrap, {
|
|
@@ -79995,6 +79990,7 @@ ${content}
|
|
|
79995
79990
|
this.toggle();
|
|
79996
79991
|
});
|
|
79997
79992
|
this.editor = editor;
|
|
79993
|
+
createMobileBottomMenu();
|
|
79998
79994
|
this.commandBar = new MobileToolbarHandler(editor, document.body);
|
|
79999
79995
|
this.observer = new ActiveElementObserver({
|
|
80000
79996
|
onFocused: this.handleFocusIn,
|
|
@@ -80076,6 +80072,7 @@ ${content}
|
|
|
80076
80072
|
__publicField(this, "longPressTriggered", false);
|
|
80077
80073
|
__publicField(this, "gripper");
|
|
80078
80074
|
__publicField(this, "cursorToolbar");
|
|
80075
|
+
__publicField(this, "isMoving", false);
|
|
80079
80076
|
__publicField(this, "handleSelectionChange", () => {
|
|
80080
80077
|
this.gripper.update();
|
|
80081
80078
|
});
|
|
@@ -80083,25 +80080,23 @@ ${content}
|
|
|
80083
80080
|
const touch = event.touches[0];
|
|
80084
80081
|
const range = getBlockRangeFromPoint(this.editor, touch.clientX, touch.clientY);
|
|
80085
80082
|
if (!range || this.isMoving) {
|
|
80086
|
-
return;
|
|
80083
|
+
return false;
|
|
80087
80084
|
}
|
|
80088
80085
|
if (!range.isSimple()) {
|
|
80089
80086
|
this.editor.selection.setRange(range);
|
|
80090
|
-
return;
|
|
80087
|
+
return true;
|
|
80091
80088
|
}
|
|
80092
80089
|
const block = this.editor.getBlockById(range.start.blockId);
|
|
80093
80090
|
if (!isTextKindBlock(this.editor, block)) {
|
|
80094
80091
|
this.editor.selection.selectBlock(block, 0);
|
|
80092
|
+
return true;
|
|
80095
80093
|
}
|
|
80096
80094
|
if (isTextKindBlock(this.editor, block)) {
|
|
80097
80095
|
const offset = range.start.offset;
|
|
80098
80096
|
const childInfo = getTextBlockChild(block, offset);
|
|
80099
80097
|
if (childInfo.next && isBox(childInfo.next)) {
|
|
80100
80098
|
this.editor.selection.selectBlock(block, offset, offset + 1);
|
|
80101
|
-
|
|
80102
|
-
event.preventDefault();
|
|
80103
|
-
event.stopPropagation();
|
|
80104
|
-
return;
|
|
80099
|
+
return true;
|
|
80105
80100
|
}
|
|
80106
80101
|
if (this.editor.selection.range.isCollapsed()) {
|
|
80107
80102
|
const rangeRect = getBlockClientRects(this.editor, block, this.editor.selection.range);
|
|
@@ -80111,14 +80106,12 @@ ${content}
|
|
|
80111
80106
|
const inRect = rangeRect.some((rect) => clientX > rect.left - step && clientX < rect.right + step && clientY > rect.top - step && clientY < rect.bottom + step);
|
|
80112
80107
|
if (inRect) {
|
|
80113
80108
|
this.cursorToolbar.showToolbar();
|
|
80114
|
-
|
|
80115
|
-
event.stopPropagation();
|
|
80116
|
-
this.editor.focus();
|
|
80109
|
+
return true;
|
|
80117
80110
|
}
|
|
80118
80111
|
}
|
|
80119
80112
|
}
|
|
80113
|
+
return false;
|
|
80120
80114
|
});
|
|
80121
|
-
__publicField(this, "isMoving", false);
|
|
80122
80115
|
__publicField(this, "handleTouchMove", (event) => {
|
|
80123
80116
|
this.isMoving = true;
|
|
80124
80117
|
});
|
|
@@ -80127,7 +80120,9 @@ ${content}
|
|
|
80127
80120
|
if (event.touches.length === 1) {
|
|
80128
80121
|
this.longPressTimeout = window.setTimeout(() => {
|
|
80129
80122
|
this.longPressTriggered = true;
|
|
80130
|
-
this.handleLongPress(event)
|
|
80123
|
+
if (this.handleLongPress(event)) {
|
|
80124
|
+
this.editor.focus();
|
|
80125
|
+
}
|
|
80131
80126
|
}, LONG_PRESS_DELAY);
|
|
80132
80127
|
}
|
|
80133
80128
|
});
|
|
@@ -80145,17 +80140,19 @@ ${content}
|
|
|
80145
80140
|
});
|
|
80146
80141
|
this.editor = editor;
|
|
80147
80142
|
this.editor.addListener("selectionChanged", this.handleSelectionChange);
|
|
80143
|
+
this.editor.addListener("docChanged", this.handleSelectionChange);
|
|
80148
80144
|
document.addEventListener("touchstart", this.handleTouchStart);
|
|
80149
80145
|
document.addEventListener("touchend", this.handleTouchEnd, { capture: true });
|
|
80150
80146
|
document.addEventListener("touchmove", this.handleTouchMove);
|
|
80151
80147
|
this.gripper = new SelectionGripper(this.editor);
|
|
80152
|
-
createMobileBottomMenu();
|
|
80153
80148
|
this.cursorToolbar = createCursorToolbar(this.editor);
|
|
80154
80149
|
}
|
|
80155
80150
|
destroy() {
|
|
80156
80151
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
80152
|
+
this.editor.removeListener("docChanged", this.handleSelectionChange);
|
|
80157
80153
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
80158
80154
|
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
80155
|
+
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
80159
80156
|
}
|
|
80160
80157
|
}
|
|
80161
80158
|
function getChildContainers(editor, block, from, to) {
|
|
@@ -86541,7 +86538,7 @@ ${data2.flowchartText}
|
|
|
86541
86538
|
}
|
|
86542
86539
|
}
|
|
86543
86540
|
});
|
|
86544
|
-
editor.version = "2.1.1-beta.
|
|
86541
|
+
editor.version = "2.1.1-beta.55";
|
|
86545
86542
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86546
86543
|
window.setReauthFail = (fail) => {
|
|
86547
86544
|
window.isReauthError = fail;
|
|
@@ -86639,7 +86636,7 @@ ${data2.flowchartText}
|
|
|
86639
86636
|
});
|
|
86640
86637
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86641
86638
|
OnesEditorToolbar.register(editor);
|
|
86642
|
-
editor.version = "2.1.1-beta.
|
|
86639
|
+
editor.version = "2.1.1-beta.55";
|
|
86643
86640
|
return editor;
|
|
86644
86641
|
}
|
|
86645
86642
|
async function showDocVersions(editor, options, serverUrl) {
|