@ones-editor/editor 2.2.8-beta.10 → 2.2.8-beta.13
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/comments/src/comments-list/group-list.d.ts +1 -1
- package/@ones-editor/core/src/utils/character.d.ts +0 -1
- package/@ones-editor/tsconfig.tsbuildinfo +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 +2 -1
- package/dist/index.js +68 -58
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
|
|
|
16
16
|
constructor(items: CommandItem[], closeable?: Closeable, options?: CommandBarOptions);
|
|
17
17
|
close(reason: CloseReason): void;
|
|
18
18
|
click(item: CommandItem, target: HTMLElement): void;
|
|
19
|
-
createPopperOptions(): Partial<import("@popperjs/core").Options>;
|
|
19
|
+
createPopperOptions(flip?: boolean): Partial<import("@popperjs/core").Options>;
|
|
20
20
|
destroy(): void;
|
|
21
21
|
abstract readonly isVisible: boolean;
|
|
22
22
|
get isSubCommandBar(): boolean;
|
|
@@ -67,9 +67,10 @@ export interface CommandBarOptions {
|
|
|
67
67
|
padding?: number;
|
|
68
68
|
beforeClose?: (event?: MouseEvent | TouchEvent) => boolean;
|
|
69
69
|
showName?: boolean;
|
|
70
|
+
maxWidth?: number | string;
|
|
70
71
|
}
|
|
71
72
|
export type CreateManualCommandBarFunction = (parentItem: CommandItem, closeable: Closeable, options?: CommandBarOptions) => AbstractManualCommandBar;
|
|
72
73
|
export type PopoverOptions = {
|
|
73
|
-
overflowBoundary?: Element
|
|
74
|
+
overflowBoundary?: Element;
|
|
74
75
|
};
|
|
75
76
|
export type SelectItemFrom = 'event' | 'manual';
|
package/dist/index.js
CHANGED
|
@@ -879,8 +879,7 @@ div.tippy-box button {
|
|
|
879
879
|
overflow-y: auto;
|
|
880
880
|
}
|
|
881
881
|
.editor-command-bar.toolbar {
|
|
882
|
-
|
|
883
|
-
overflow-x: auto;
|
|
882
|
+
width: max-content;
|
|
884
883
|
}
|
|
885
884
|
.editor-command-bar.fixed.mobile, .editor-command-bar.toolbar.mobile {
|
|
886
885
|
gap: 16px;
|
|
@@ -10079,9 +10078,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10079
10078
|
c = "\\\\";
|
|
10080
10079
|
return s.replace(new RegExp(`^[${c}]+|[${c}]+$`, "g"), "");
|
|
10081
10080
|
}
|
|
10082
|
-
function isFunction$1(functionToCheck) {
|
|
10083
|
-
return !!functionToCheck && {}.toString.call(functionToCheck) === "[object Function]";
|
|
10084
|
-
}
|
|
10085
10081
|
function isPrintableKey(key) {
|
|
10086
10082
|
if (!key)
|
|
10087
10083
|
return false;
|
|
@@ -40120,44 +40116,54 @@ ${codeText}
|
|
|
40120
40116
|
click(item, target) {
|
|
40121
40117
|
this.emit("click", this, item, target);
|
|
40122
40118
|
}
|
|
40123
|
-
createPopperOptions() {
|
|
40124
|
-
var _a, _b, _c;
|
|
40119
|
+
createPopperOptions(flip = false) {
|
|
40120
|
+
var _a, _b, _c, _d;
|
|
40125
40121
|
const popperOptions = { modifiers: [] };
|
|
40126
40122
|
const overflowBoundary = this.options.overflowBoundary;
|
|
40127
40123
|
const padding = this.options.padding;
|
|
40128
40124
|
if (overflowBoundary) {
|
|
40129
|
-
(
|
|
40130
|
-
|
|
40131
|
-
|
|
40132
|
-
|
|
40133
|
-
|
|
40134
|
-
|
|
40135
|
-
const popperRect = popper.getBoundingClientRect();
|
|
40136
|
-
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40137
|
-
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40138
|
-
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40139
|
-
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40140
|
-
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40141
|
-
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40142
|
-
popper.setAttribute("data-tippy-hidden", "");
|
|
40143
|
-
} else {
|
|
40144
|
-
popper.removeAttribute("data-tippy-hidden");
|
|
40125
|
+
if (flip) {
|
|
40126
|
+
(_a = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _a.push({
|
|
40127
|
+
name: "flip",
|
|
40128
|
+
options: {
|
|
40129
|
+
boundary: overflowBoundary,
|
|
40130
|
+
fallbackPlacements: ["top", "bottom"]
|
|
40145
40131
|
}
|
|
40146
|
-
}
|
|
40147
|
-
}
|
|
40132
|
+
});
|
|
40133
|
+
} else {
|
|
40134
|
+
(_b = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _b.push({
|
|
40135
|
+
name: "hide",
|
|
40136
|
+
enabled: true,
|
|
40137
|
+
phase: "main",
|
|
40138
|
+
fn: debounce__default.default(({ state }) => {
|
|
40139
|
+
const popper = state.elements.popper;
|
|
40140
|
+
const popperRect = popper.getBoundingClientRect();
|
|
40141
|
+
const overflowBoundaryRect = overflowBoundary.getBoundingClientRect();
|
|
40142
|
+
const topCheck = popperRect.top < overflowBoundaryRect.top;
|
|
40143
|
+
const bottomCheck = popperRect.bottom > overflowBoundaryRect.bottom;
|
|
40144
|
+
const leftCheck = popperRect.left < overflowBoundaryRect.left;
|
|
40145
|
+
const rightCheck = popperRect.right > overflowBoundaryRect.right;
|
|
40146
|
+
if (topCheck || bottomCheck || leftCheck || rightCheck) {
|
|
40147
|
+
popper.setAttribute("data-tippy-hidden", "");
|
|
40148
|
+
} else {
|
|
40149
|
+
popper.removeAttribute("data-tippy-hidden");
|
|
40150
|
+
}
|
|
40151
|
+
}, 10)
|
|
40152
|
+
});
|
|
40153
|
+
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40154
|
+
name: "flip",
|
|
40155
|
+
enabled: false
|
|
40156
|
+
});
|
|
40157
|
+
}
|
|
40148
40158
|
}
|
|
40149
40159
|
if (padding) {
|
|
40150
|
-
(
|
|
40160
|
+
(_d = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _d.push({
|
|
40151
40161
|
name: "preventOverflow",
|
|
40152
40162
|
options: {
|
|
40153
40163
|
padding
|
|
40154
40164
|
}
|
|
40155
40165
|
});
|
|
40156
40166
|
}
|
|
40157
|
-
(_c = popperOptions == null ? void 0 : popperOptions.modifiers) == null ? void 0 : _c.push({
|
|
40158
|
-
name: "flip",
|
|
40159
|
-
enabled: false
|
|
40160
|
-
});
|
|
40161
40167
|
return popperOptions;
|
|
40162
40168
|
}
|
|
40163
40169
|
destroy() {
|
|
@@ -40521,7 +40527,7 @@ ${codeText}
|
|
|
40521
40527
|
});
|
|
40522
40528
|
}
|
|
40523
40529
|
manualShow(target, options) {
|
|
40524
|
-
var _a, _b, _c;
|
|
40530
|
+
var _a, _b, _c, _d;
|
|
40525
40531
|
if (this.isVisible) {
|
|
40526
40532
|
return;
|
|
40527
40533
|
}
|
|
@@ -40536,15 +40542,15 @@ ${codeText}
|
|
|
40536
40542
|
triggerTarget: null,
|
|
40537
40543
|
hideOnClick: false,
|
|
40538
40544
|
placement: (_a = options == null ? void 0 : options.placement) != null ? _a : "bottom-start",
|
|
40539
|
-
maxWidth: 650,
|
|
40540
|
-
arrow: (
|
|
40545
|
+
maxWidth: (_b = this.options.maxWidth) != null ? _b : 650,
|
|
40546
|
+
arrow: (_c = options == null ? void 0 : options.arrow) != null ? _c : this.options.tippyArrow,
|
|
40541
40547
|
appendTo: document.body,
|
|
40542
40548
|
onShow: this.handleShow,
|
|
40543
40549
|
onHidden: this.handleHidden,
|
|
40544
40550
|
onShown: this.handleShown,
|
|
40545
40551
|
theme: options == null ? void 0 : options.theme,
|
|
40546
40552
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
40547
|
-
offset: (
|
|
40553
|
+
offset: (_d = options == null ? void 0 : options.offset) != null ? _d : [0, 0],
|
|
40548
40554
|
popperOptions: this.createPopperOptions()
|
|
40549
40555
|
});
|
|
40550
40556
|
if (options == null ? void 0 : options.point) {
|
|
@@ -41031,6 +41037,7 @@ ${codeText}
|
|
|
41031
41037
|
super(items, closeable, {
|
|
41032
41038
|
itemElementTag: "button",
|
|
41033
41039
|
tippyArrow: false,
|
|
41040
|
+
maxWidth: clientType.isMobile ? "90vw" : "max-content",
|
|
41034
41041
|
...options
|
|
41035
41042
|
});
|
|
41036
41043
|
}
|
|
@@ -41295,7 +41302,7 @@ ${codeText}
|
|
|
41295
41302
|
theme: options == null ? void 0 : options.theme,
|
|
41296
41303
|
getReferenceClientRect: options == null ? void 0 : options.getReferenceClientRect,
|
|
41297
41304
|
offset: (_c = options == null ? void 0 : options.offset) != null ? _c : [0, 0],
|
|
41298
|
-
popperOptions: this.createPopperOptions()
|
|
41305
|
+
popperOptions: this.createPopperOptions(true)
|
|
41299
41306
|
});
|
|
41300
41307
|
this.clearSelectedItem();
|
|
41301
41308
|
document.addEventListener("keydown", this.handleDocumentKeydown);
|
|
@@ -52112,7 +52119,7 @@ ${codeText}
|
|
|
52112
52119
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
52113
52120
|
tooltipId: editor.clientId,
|
|
52114
52121
|
id: "editor-readonly-toolbar",
|
|
52115
|
-
overflowBoundary:
|
|
52122
|
+
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
52116
52123
|
refuseOverflow: true,
|
|
52117
52124
|
padding: 20
|
|
52118
52125
|
});
|
|
@@ -52346,7 +52353,7 @@ ${codeText}
|
|
|
52346
52353
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
52347
52354
|
tooltipId: editor.clientId,
|
|
52348
52355
|
id: "editor-toolbar",
|
|
52349
|
-
overflowBoundary:
|
|
52356
|
+
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
52350
52357
|
refuseOverflow: true,
|
|
52351
52358
|
padding: 20,
|
|
52352
52359
|
showName: clientType.isMobile,
|
|
@@ -52526,8 +52533,15 @@ ${codeText}
|
|
|
52526
52533
|
}
|
|
52527
52534
|
}
|
|
52528
52535
|
const getReferenceClientRectByCaret = () => {
|
|
52536
|
+
if (!this.hoveringBlock) {
|
|
52537
|
+
return new DOMRect();
|
|
52538
|
+
}
|
|
52539
|
+
const { element: element2 } = getObjectCommands(this.editor, this.hoveringBlock, this.hoveringTextChild);
|
|
52540
|
+
if (!element2) {
|
|
52541
|
+
return new DOMRect();
|
|
52542
|
+
}
|
|
52529
52543
|
let rect;
|
|
52530
|
-
const clientRects =
|
|
52544
|
+
const clientRects = element2.getClientRects();
|
|
52531
52545
|
const lineRects = [];
|
|
52532
52546
|
Array.from(clientRects).forEach((clientRect) => {
|
|
52533
52547
|
const { y } = clientRect;
|
|
@@ -52537,7 +52551,7 @@ ${codeText}
|
|
|
52537
52551
|
lineRects.push(y);
|
|
52538
52552
|
});
|
|
52539
52553
|
if (lineRects.length > 1) {
|
|
52540
|
-
rect =
|
|
52554
|
+
rect = isBlock$1(element2) ? clientRects[0] : clientRects[clientRects.length - 1];
|
|
52541
52555
|
if (event) {
|
|
52542
52556
|
for (let i = 0; i < clientRects.length; i++) {
|
|
52543
52557
|
const clientRect = clientRects[i];
|
|
@@ -52549,21 +52563,15 @@ ${codeText}
|
|
|
52549
52563
|
}
|
|
52550
52564
|
}
|
|
52551
52565
|
} else {
|
|
52552
|
-
rect =
|
|
52553
|
-
if (
|
|
52554
|
-
const childRect =
|
|
52566
|
+
rect = element2.getBoundingClientRect();
|
|
52567
|
+
if (!isBlock$1(element2)) {
|
|
52568
|
+
const childRect = element2.getBoundingClientRect();
|
|
52555
52569
|
return new DOMRect(childRect.x, childRect.y, childRect.width, childRect.height);
|
|
52556
52570
|
}
|
|
52557
52571
|
if (clientRects.length === 1) {
|
|
52558
52572
|
return new DOMRect(clientRects[0].x, clientRects[0].y, clientRects[0].width, clientRects[0].height);
|
|
52559
52573
|
}
|
|
52560
52574
|
}
|
|
52561
|
-
if (this.hoveringBlock) {
|
|
52562
|
-
const blockContent = getBlockContent(this.hoveringBlock);
|
|
52563
|
-
if (blockContent !== element) {
|
|
52564
|
-
return blockContent.getBoundingClientRect();
|
|
52565
|
-
}
|
|
52566
|
-
}
|
|
52567
52575
|
if (event) {
|
|
52568
52576
|
const y = rect.y;
|
|
52569
52577
|
const x = event.clientX;
|
|
@@ -52573,8 +52581,9 @@ ${codeText}
|
|
|
52573
52581
|
};
|
|
52574
52582
|
this.toolbar.updateItems(commands);
|
|
52575
52583
|
if (!this.toolbar.isVisible) {
|
|
52584
|
+
const isText = element === child && !isTextBlockContentBoxChild(element);
|
|
52576
52585
|
this.toolbar.manualShow(element, {
|
|
52577
|
-
placement:
|
|
52586
|
+
placement: isText && !clientType.isMobile ? "bottom" : "top",
|
|
52578
52587
|
getReferenceClientRect: getReferenceClientRectByCaret
|
|
52579
52588
|
});
|
|
52580
52589
|
if ((_c = this.toolbar.tippyInstance) == null ? void 0 : _c.popper) {
|
|
@@ -67710,7 +67719,7 @@ ${codeText}
|
|
|
67710
67719
|
});
|
|
67711
67720
|
});
|
|
67712
67721
|
__publicField(this, "handleEditorResize", () => {
|
|
67713
|
-
this.updateItemsLayout();
|
|
67722
|
+
this.updateItemsLayout(false);
|
|
67714
67723
|
});
|
|
67715
67724
|
__publicField(this, "handleDocChanged", () => {
|
|
67716
67725
|
this.updateComments();
|
|
@@ -67787,9 +67796,11 @@ ${codeText}
|
|
|
67787
67796
|
this.removeAllListeners();
|
|
67788
67797
|
document.removeEventListener("click", this.handleDocumentClick);
|
|
67789
67798
|
}
|
|
67790
|
-
updateItemsLayout() {
|
|
67799
|
+
updateItemsLayout(dispatchScroll = true) {
|
|
67791
67800
|
arrangeItems(this.editor, this.items, this.activeItem);
|
|
67792
|
-
|
|
67801
|
+
if (dispatchScroll) {
|
|
67802
|
+
this.dispatchScroll();
|
|
67803
|
+
}
|
|
67793
67804
|
}
|
|
67794
67805
|
bindEvents() {
|
|
67795
67806
|
this.container.addEventListener("click", this.handleContainerClick);
|
|
@@ -68687,7 +68698,7 @@ ${codeText}
|
|
|
68687
68698
|
}
|
|
68688
68699
|
commands(editor, blockElement, child) {
|
|
68689
68700
|
var _a;
|
|
68690
|
-
if (editor.readonly) {
|
|
68701
|
+
if (editor.readonly || clientType.isMobile) {
|
|
68691
68702
|
return void 0;
|
|
68692
68703
|
}
|
|
68693
68704
|
const data2 = getBlockId(blockElement);
|
|
@@ -69596,7 +69607,7 @@ ${codeText}
|
|
|
69596
69607
|
const popover = editor.options.componentsOptions.popover;
|
|
69597
69608
|
this.toolbar = new ManualToolbar([], void 0, {
|
|
69598
69609
|
id: "table-row-column-toolbar",
|
|
69599
|
-
overflowBoundary:
|
|
69610
|
+
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
69600
69611
|
refuseOverflow: true,
|
|
69601
69612
|
tooltipId: this.editor.clientId
|
|
69602
69613
|
});
|
|
@@ -69660,7 +69671,7 @@ ${codeText}
|
|
|
69660
69671
|
modifiers: [{
|
|
69661
69672
|
name: "flip",
|
|
69662
69673
|
options: {
|
|
69663
|
-
boundary:
|
|
69674
|
+
boundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
69664
69675
|
fallbackPlacements: ["left", "right"]
|
|
69665
69676
|
}
|
|
69666
69677
|
}]
|
|
@@ -88377,7 +88388,7 @@ ${data2.flowchartText}
|
|
|
88377
88388
|
}
|
|
88378
88389
|
}
|
|
88379
88390
|
});
|
|
88380
|
-
editor.version = "2.2.8-beta.
|
|
88391
|
+
editor.version = "2.2.8-beta.13";
|
|
88381
88392
|
return editor;
|
|
88382
88393
|
}
|
|
88383
88394
|
function isDoc(doc2) {
|
|
@@ -88472,7 +88483,7 @@ ${data2.flowchartText}
|
|
|
88472
88483
|
});
|
|
88473
88484
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
88474
88485
|
OnesEditorToolbar.register(editor);
|
|
88475
|
-
editor.version = "2.2.8-beta.
|
|
88486
|
+
editor.version = "2.2.8-beta.13";
|
|
88476
88487
|
return editor;
|
|
88477
88488
|
}
|
|
88478
88489
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -134703,7 +134714,6 @@ ${data2.flowchartText}
|
|
|
134703
134714
|
exports2.isFirefox = isFirefox;
|
|
134704
134715
|
exports2.isFirstChildBlockInComplexBlock = isFirstChildBlockInComplexBlock;
|
|
134705
134716
|
exports2.isFullSelectedOneComplexBlock = isFullSelectedOneComplexBlock;
|
|
134706
|
-
exports2.isFunction = isFunction$1;
|
|
134707
134717
|
exports2.isHeadingBlock = isHeadingBlock$1;
|
|
134708
134718
|
exports2.isHighSurrogate = t$7;
|
|
134709
134719
|
exports2.isInBlock = isInBlock;
|