@ones-editor/editor 2.1.1-beta.54 → 2.1.1-beta.56
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/file/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/file/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/file/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/mobile-helper/src/index.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +58 -38
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11210,25 +11210,19 @@ var __publicField = (obj, key, value) => {
|
|
|
11210
11210
|
}
|
|
11211
11211
|
});
|
|
11212
11212
|
__publicField(this, "handleClick", (event) => {
|
|
11213
|
-
|
|
11214
|
-
|
|
11215
|
-
const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
|
|
11216
|
-
this.editor.emit("click", this.editor, mouseEvent);
|
|
11217
|
-
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;
|
|
11218
11215
|
if (isInBlockTools(target)) {
|
|
11219
|
-
this.mouseDownEvent = null;
|
|
11220
11216
|
return;
|
|
11221
11217
|
}
|
|
11222
|
-
if (event.detail === 1
|
|
11218
|
+
if (event.detail === 1) {
|
|
11223
11219
|
this.editor.input.focus();
|
|
11224
11220
|
}
|
|
11225
|
-
if (
|
|
11221
|
+
if (event.detail === 3) {
|
|
11226
11222
|
this.editor.selectionHandler.handleTripleClick(event);
|
|
11227
11223
|
}
|
|
11228
|
-
if (event.detail === 1
|
|
11229
|
-
const
|
|
11230
|
-
const clientY = ensureIsMobileEvent(event) ? event.changedTouches[0].clientY : event.clientY;
|
|
11231
|
-
const elem = getElementFromPoint(clientX, clientY);
|
|
11224
|
+
if (event.detail === 1 && event.button === 0) {
|
|
11225
|
+
const elem = getElementFromPoint(event.clientX, event.clientY);
|
|
11232
11226
|
if (elem && isChildNode(this.rootContainer, elem)) {
|
|
11233
11227
|
const block = getParentBlock(elem);
|
|
11234
11228
|
if (block && isChildNode(block, elem)) {
|
|
@@ -11236,19 +11230,17 @@ var __publicField = (obj, key, value) => {
|
|
|
11236
11230
|
}
|
|
11237
11231
|
}
|
|
11238
11232
|
}
|
|
11239
|
-
this.mouseDownEvent = null;
|
|
11240
11233
|
});
|
|
11241
11234
|
__publicField(this, "handleBlockClick", (event, block, elem) => {
|
|
11242
11235
|
var _a, _b;
|
|
11243
11236
|
if (!isTextKindBlock(this.editor, block)) {
|
|
11244
11237
|
return;
|
|
11245
11238
|
}
|
|
11246
|
-
const mouseEvent = ensureIsMobileEvent(event) ? createMouseEventFromTouchEvent(event) : event;
|
|
11247
11239
|
const box = getParentBox(elem);
|
|
11248
11240
|
if (box) {
|
|
11249
11241
|
const block2 = getParentBlock(box);
|
|
11250
11242
|
assert(logger$4n, block2, "no parent block");
|
|
11251
|
-
(_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);
|
|
11252
11244
|
return;
|
|
11253
11245
|
}
|
|
11254
11246
|
const link2 = elem.closest("span.text.link");
|
|
@@ -11256,7 +11248,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11256
11248
|
const children = getTextBlockContentChildren(block);
|
|
11257
11249
|
const index2 = children.indexOf(link2);
|
|
11258
11250
|
if (index2 !== -1) {
|
|
11259
|
-
this.editor.emit("clickLink", this.editor,
|
|
11251
|
+
this.editor.emit("clickLink", this.editor, event, link2);
|
|
11260
11252
|
}
|
|
11261
11253
|
}
|
|
11262
11254
|
});
|
|
@@ -50555,8 +50547,12 @@ ${codeText}
|
|
|
50555
50547
|
}
|
|
50556
50548
|
this.toolbar.updateItems(allCommands);
|
|
50557
50549
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
50558
|
-
|
|
50559
|
-
|
|
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
|
+
}
|
|
50560
50556
|
const rect = getReferenceClientRect(this.editor, selectedBlock);
|
|
50561
50557
|
if (!this.toolbar.isVisible) {
|
|
50562
50558
|
const anchor2 = createBlockAnchor(this.editor, selectedBlock.block, "editor-quick-menu", rect);
|
|
@@ -75024,6 +75020,10 @@ ${content}
|
|
|
75024
75020
|
name: i18n$1.t("file.commands.download"),
|
|
75025
75021
|
icon: DownloadIcon
|
|
75026
75022
|
},
|
|
75023
|
+
{
|
|
75024
|
+
id: "preview",
|
|
75025
|
+
name: i18n$1.t("file.commands.preview")
|
|
75026
|
+
},
|
|
75027
75027
|
{
|
|
75028
75028
|
id: "add-comment",
|
|
75029
75029
|
name: i18n$1.t("file.commands.comment"),
|
|
@@ -75060,6 +75060,9 @@ ${content}
|
|
|
75060
75060
|
get commands() {
|
|
75061
75061
|
let items = this._commands.slice();
|
|
75062
75062
|
const needRemoveCommandIds = /* @__PURE__ */ new Set();
|
|
75063
|
+
if (!clientType.isMobile) {
|
|
75064
|
+
needRemoveCommandIds.add("preview");
|
|
75065
|
+
}
|
|
75063
75066
|
if (this.editor.readonly || clientType.isMobile) {
|
|
75064
75067
|
needRemoveCommandIds.add("to-link");
|
|
75065
75068
|
needRemoveCommandIds.add("to-card");
|
|
@@ -75086,6 +75089,18 @@ ${content}
|
|
|
75086
75089
|
return items;
|
|
75087
75090
|
}
|
|
75088
75091
|
executeCommand(editor, block, box, item) {
|
|
75092
|
+
if (item.id === "preview") {
|
|
75093
|
+
const options = editor.options.componentsOptions.file;
|
|
75094
|
+
if (options == null ? void 0 : options.onClick) {
|
|
75095
|
+
const mouseEvent = new MouseEvent("mousedown", {
|
|
75096
|
+
bubbles: true,
|
|
75097
|
+
cancelable: true,
|
|
75098
|
+
button: 0
|
|
75099
|
+
});
|
|
75100
|
+
options.onClick(editor, box, mouseEvent);
|
|
75101
|
+
}
|
|
75102
|
+
return;
|
|
75103
|
+
}
|
|
75089
75104
|
if (item.id === "to-card") {
|
|
75090
75105
|
const container = getParentContainer(block);
|
|
75091
75106
|
const containerId = getContainerId(container);
|
|
@@ -75143,14 +75158,14 @@ ${content}
|
|
|
75143
75158
|
link2.setAttribute("data-file-src", fileData.src);
|
|
75144
75159
|
}
|
|
75145
75160
|
function handleClickBox$1(editor, box, event) {
|
|
75161
|
+
if (clientType.isMobile) {
|
|
75162
|
+
return;
|
|
75163
|
+
}
|
|
75146
75164
|
const options = editor.options.componentsOptions.file;
|
|
75147
75165
|
if (options == null ? void 0 : options.onClick) {
|
|
75148
75166
|
options.onClick(editor, box, event);
|
|
75149
75167
|
return;
|
|
75150
75168
|
}
|
|
75151
|
-
if (clientType.isMobile) {
|
|
75152
|
-
return;
|
|
75153
|
-
}
|
|
75154
75169
|
downloadFile$1(editor, box);
|
|
75155
75170
|
}
|
|
75156
75171
|
function getBoxProperties$1(editor, boxElement) {
|
|
@@ -75498,7 +75513,8 @@ ${content}
|
|
|
75498
75513
|
download: "\u4E0B\u8F7D",
|
|
75499
75514
|
toLink: "\u8F6C\u4E3A\u6807\u9898",
|
|
75500
75515
|
toCard: "\u8F6C\u4E3A\u5361\u7247",
|
|
75501
|
-
comment: "\u6DFB\u52A0\u6279\u6CE8"
|
|
75516
|
+
comment: "\u6DFB\u52A0\u6279\u6CE8",
|
|
75517
|
+
preview: "\u9884\u89C8"
|
|
75502
75518
|
}
|
|
75503
75519
|
}
|
|
75504
75520
|
};
|
|
@@ -75509,7 +75525,8 @@ ${content}
|
|
|
75509
75525
|
download: "Download",
|
|
75510
75526
|
toLink: "To Link",
|
|
75511
75527
|
toCard: "To Card",
|
|
75512
|
-
comment: "Add annotation"
|
|
75528
|
+
comment: "Add annotation",
|
|
75529
|
+
preview: "Preview"
|
|
75513
75530
|
}
|
|
75514
75531
|
}
|
|
75515
75532
|
};
|
|
@@ -75520,7 +75537,8 @@ ${content}
|
|
|
75520
75537
|
download: "\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",
|
|
75521
75538
|
toLink: "\u30BF\u30A4\u30C8\u30EB\u306B\u5909\u63DB",
|
|
75522
75539
|
toCard: "\u30AB\u30FC\u30C9\u306B\u5909\u63DB",
|
|
75523
|
-
comment: "\u6CE8\u91C8\u3092\u8FFD\u52A0"
|
|
75540
|
+
comment: "\u6CE8\u91C8\u3092\u8FFD\u52A0",
|
|
75541
|
+
preview: "\u30D7\u30EC\u30D3\u30E5\u30FC"
|
|
75524
75542
|
}
|
|
75525
75543
|
}
|
|
75526
75544
|
};
|
|
@@ -79994,6 +80012,7 @@ ${content}
|
|
|
79994
80012
|
this.toggle();
|
|
79995
80013
|
});
|
|
79996
80014
|
this.editor = editor;
|
|
80015
|
+
createMobileBottomMenu();
|
|
79997
80016
|
this.commandBar = new MobileToolbarHandler(editor, document.body);
|
|
79998
80017
|
this.observer = new ActiveElementObserver({
|
|
79999
80018
|
onFocused: this.handleFocusIn,
|
|
@@ -80075,6 +80094,7 @@ ${content}
|
|
|
80075
80094
|
__publicField(this, "longPressTriggered", false);
|
|
80076
80095
|
__publicField(this, "gripper");
|
|
80077
80096
|
__publicField(this, "cursorToolbar");
|
|
80097
|
+
__publicField(this, "isMoving", false);
|
|
80078
80098
|
__publicField(this, "handleSelectionChange", () => {
|
|
80079
80099
|
this.gripper.update();
|
|
80080
80100
|
});
|
|
@@ -80082,25 +80102,23 @@ ${content}
|
|
|
80082
80102
|
const touch = event.touches[0];
|
|
80083
80103
|
const range = getBlockRangeFromPoint(this.editor, touch.clientX, touch.clientY);
|
|
80084
80104
|
if (!range || this.isMoving) {
|
|
80085
|
-
return;
|
|
80105
|
+
return false;
|
|
80086
80106
|
}
|
|
80087
80107
|
if (!range.isSimple()) {
|
|
80088
80108
|
this.editor.selection.setRange(range);
|
|
80089
|
-
return;
|
|
80109
|
+
return true;
|
|
80090
80110
|
}
|
|
80091
80111
|
const block = this.editor.getBlockById(range.start.blockId);
|
|
80092
80112
|
if (!isTextKindBlock(this.editor, block)) {
|
|
80093
80113
|
this.editor.selection.selectBlock(block, 0);
|
|
80114
|
+
return true;
|
|
80094
80115
|
}
|
|
80095
80116
|
if (isTextKindBlock(this.editor, block)) {
|
|
80096
80117
|
const offset = range.start.offset;
|
|
80097
80118
|
const childInfo = getTextBlockChild(block, offset);
|
|
80098
80119
|
if (childInfo.next && isBox(childInfo.next)) {
|
|
80099
80120
|
this.editor.selection.selectBlock(block, offset, offset + 1);
|
|
80100
|
-
|
|
80101
|
-
event.preventDefault();
|
|
80102
|
-
event.stopPropagation();
|
|
80103
|
-
return;
|
|
80121
|
+
return true;
|
|
80104
80122
|
}
|
|
80105
80123
|
if (this.editor.selection.range.isCollapsed()) {
|
|
80106
80124
|
const rangeRect = getBlockClientRects(this.editor, block, this.editor.selection.range);
|
|
@@ -80110,14 +80128,12 @@ ${content}
|
|
|
80110
80128
|
const inRect = rangeRect.some((rect) => clientX > rect.left - step && clientX < rect.right + step && clientY > rect.top - step && clientY < rect.bottom + step);
|
|
80111
80129
|
if (inRect) {
|
|
80112
80130
|
this.cursorToolbar.showToolbar();
|
|
80113
|
-
|
|
80114
|
-
event.stopPropagation();
|
|
80115
|
-
this.editor.focus();
|
|
80131
|
+
return true;
|
|
80116
80132
|
}
|
|
80117
80133
|
}
|
|
80118
80134
|
}
|
|
80135
|
+
return false;
|
|
80119
80136
|
});
|
|
80120
|
-
__publicField(this, "isMoving", false);
|
|
80121
80137
|
__publicField(this, "handleTouchMove", (event) => {
|
|
80122
80138
|
this.isMoving = true;
|
|
80123
80139
|
});
|
|
@@ -80126,7 +80142,9 @@ ${content}
|
|
|
80126
80142
|
if (event.touches.length === 1) {
|
|
80127
80143
|
this.longPressTimeout = window.setTimeout(() => {
|
|
80128
80144
|
this.longPressTriggered = true;
|
|
80129
|
-
this.handleLongPress(event)
|
|
80145
|
+
if (this.handleLongPress(event)) {
|
|
80146
|
+
this.editor.focus();
|
|
80147
|
+
}
|
|
80130
80148
|
}, LONG_PRESS_DELAY);
|
|
80131
80149
|
}
|
|
80132
80150
|
});
|
|
@@ -80144,17 +80162,19 @@ ${content}
|
|
|
80144
80162
|
});
|
|
80145
80163
|
this.editor = editor;
|
|
80146
80164
|
this.editor.addListener("selectionChanged", this.handleSelectionChange);
|
|
80165
|
+
this.editor.addListener("docChanged", this.handleSelectionChange);
|
|
80147
80166
|
document.addEventListener("touchstart", this.handleTouchStart);
|
|
80148
80167
|
document.addEventListener("touchend", this.handleTouchEnd, { capture: true });
|
|
80149
80168
|
document.addEventListener("touchmove", this.handleTouchMove);
|
|
80150
80169
|
this.gripper = new SelectionGripper(this.editor);
|
|
80151
|
-
createMobileBottomMenu();
|
|
80152
80170
|
this.cursorToolbar = createCursorToolbar(this.editor);
|
|
80153
80171
|
}
|
|
80154
80172
|
destroy() {
|
|
80155
80173
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
80174
|
+
this.editor.removeListener("docChanged", this.handleSelectionChange);
|
|
80156
80175
|
document.removeEventListener("touchstart", this.handleTouchStart);
|
|
80157
80176
|
document.removeEventListener("touchend", this.handleTouchEnd);
|
|
80177
|
+
document.removeEventListener("touchmove", this.handleTouchMove);
|
|
80158
80178
|
}
|
|
80159
80179
|
}
|
|
80160
80180
|
function getChildContainers(editor, block, from, to) {
|
|
@@ -86540,7 +86560,7 @@ ${data2.flowchartText}
|
|
|
86540
86560
|
}
|
|
86541
86561
|
}
|
|
86542
86562
|
});
|
|
86543
|
-
editor.version = "2.1.1-beta.
|
|
86563
|
+
editor.version = "2.1.1-beta.56";
|
|
86544
86564
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86545
86565
|
window.setReauthFail = (fail) => {
|
|
86546
86566
|
window.isReauthError = fail;
|
|
@@ -86638,7 +86658,7 @@ ${data2.flowchartText}
|
|
|
86638
86658
|
});
|
|
86639
86659
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86640
86660
|
OnesEditorToolbar.register(editor);
|
|
86641
|
-
editor.version = "2.1.1-beta.
|
|
86661
|
+
editor.version = "2.1.1-beta.56";
|
|
86642
86662
|
return editor;
|
|
86643
86663
|
}
|
|
86644
86664
|
async function showDocVersions(editor, options, serverUrl) {
|