@ones-editor/editor 2.1.7-beta.34 → 2.1.7-beta.37
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 +1 -0
- package/@ones-editor/main-toolbar/src/items/index.d.ts +3 -2
- package/@ones-editor/main-toolbar/src/items/more-item.d.ts +20 -0
- package/@ones-editor/main-toolbar/src/items/text-color.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/command-bar/command-bar.d.ts +2 -1
- package/@ones-editor/ui-base/src/command-bar/fixed-toolbar.d.ts +1 -0
- package/dist/index.js +156 -11
- package/package.json +1 -1
|
@@ -39,12 +39,13 @@ export default abstract class CommandBar extends TypedEmitter<CommandBarEvents>
|
|
|
39
39
|
private handleItemMouseLeave;
|
|
40
40
|
protected handleItemClick: (event: MouseEvent | TouchEvent) => void;
|
|
41
41
|
private showSubCommandBar;
|
|
42
|
+
getSubBarCreateOptions(item: CommandItem): CommandBarOptions;
|
|
42
43
|
isInCommandBar(target: EventTarget | null): boolean;
|
|
43
44
|
createCommandItem(item: CommandItem): CommandItemElement;
|
|
44
45
|
getItemById(id: string): CommandItem;
|
|
45
46
|
getSelectedItem(): CommandItem | null;
|
|
46
47
|
protected getItemElementId(elem: CommandItemElement): string;
|
|
47
|
-
|
|
48
|
+
getItemElementById(id: string): CommandItemElement;
|
|
48
49
|
protected getParentCommandItemElement(target: EventTarget | null): CommandItemElement | null;
|
|
49
50
|
protected createCommandBarContent(items: CommandItem[]): HTMLElement;
|
|
50
51
|
handleWheel: (e: WheelEvent) => void;
|
|
@@ -7,6 +7,7 @@ export default class FixedToolbar extends CommandBar {
|
|
|
7
7
|
protected initCommandBarElement(elem: HTMLElement): void;
|
|
8
8
|
protected initItemElement(item: CommandItem, elem: CommandItemElement): void;
|
|
9
9
|
close(): void;
|
|
10
|
+
getSubBarCreateOptions: (item: CommandItem) => CommandBarOptions;
|
|
10
11
|
getSubBarOptions: (item: CommandItem) => ManualShowCommandBarOptions;
|
|
11
12
|
destroy(): void;
|
|
12
13
|
protected getCommandBarRoot(): HTMLElement | null;
|
package/dist/index.js
CHANGED
|
@@ -913,6 +913,9 @@ div.tippy-box button {
|
|
|
913
913
|
--separator-color: #e8e8e8;
|
|
914
914
|
--warn-color: #fdf4f4;
|
|
915
915
|
}
|
|
916
|
+
.editor-command-bar.toolbar .command-item.hidden, .editor-command-bar.menu .command-item.hidden {
|
|
917
|
+
display: none;
|
|
918
|
+
}
|
|
916
919
|
.editor-command-bar.fixed.toolbar {
|
|
917
920
|
box-shadow: none;
|
|
918
921
|
}
|
|
@@ -8179,6 +8182,9 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
|
|
|
8179
8182
|
.editor-command-bar.toolbar[data-fixed-toolbar-id=main-toolbar] .command-item[data-button-id=paragraph] .toolbar-item-name-container {
|
|
8180
8183
|
flex-grow: 1;
|
|
8181
8184
|
flex-shrink: 0;
|
|
8185
|
+
}
|
|
8186
|
+
[data-command-bar-id=main-toolbar-more-menu] .editor-command-bar.toolbar .command-item.hidden, [data-command-bar-id=main-toolbar-more-menu] .editor-command-bar.menu .command-item.hidden {
|
|
8187
|
+
display: flex;
|
|
8182
8188
|
}`)),document.head.appendChild(t)}}catch(o){console.error("vite-plugin-css-injected-by-js",o)}})();
|
|
8183
8189
|
var __defProp = Object.defineProperty;
|
|
8184
8190
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -8914,7 +8920,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8914
8920
|
return ResizeObserverSPI2;
|
|
8915
8921
|
}();
|
|
8916
8922
|
var observers = typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : new MapShim();
|
|
8917
|
-
var ResizeObserver = function() {
|
|
8923
|
+
var ResizeObserver$1 = function() {
|
|
8918
8924
|
function ResizeObserver2(callback) {
|
|
8919
8925
|
if (!(this instanceof ResizeObserver2)) {
|
|
8920
8926
|
throw new TypeError("Cannot call a class as a function.");
|
|
@@ -8933,7 +8939,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8933
8939
|
"unobserve",
|
|
8934
8940
|
"disconnect"
|
|
8935
8941
|
].forEach(function(method) {
|
|
8936
|
-
ResizeObserver.prototype[method] = function() {
|
|
8942
|
+
ResizeObserver$1.prototype[method] = function() {
|
|
8937
8943
|
var _a;
|
|
8938
8944
|
return (_a = observers.get(this))[method].apply(_a, arguments);
|
|
8939
8945
|
};
|
|
@@ -8942,7 +8948,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8942
8948
|
if (typeof global$1.ResizeObserver !== "undefined") {
|
|
8943
8949
|
return global$1.ResizeObserver;
|
|
8944
8950
|
}
|
|
8945
|
-
return ResizeObserver;
|
|
8951
|
+
return ResizeObserver$1;
|
|
8946
8952
|
}();
|
|
8947
8953
|
class AssertError extends Error {
|
|
8948
8954
|
constructor(message) {
|
|
@@ -40311,9 +40317,11 @@ ${codeText}
|
|
|
40311
40317
|
if (!elem) {
|
|
40312
40318
|
return;
|
|
40313
40319
|
}
|
|
40314
|
-
const
|
|
40315
|
-
id: subMenuId
|
|
40316
|
-
|
|
40320
|
+
const createOptions = {
|
|
40321
|
+
id: subMenuId,
|
|
40322
|
+
...this.getSubBarCreateOptions(item)
|
|
40323
|
+
};
|
|
40324
|
+
const subBar = _CommandBar.createSubCommandBar(item, (_d = this.closeable) != null ? _d : this, createOptions);
|
|
40317
40325
|
this.subBar = subBar;
|
|
40318
40326
|
this.subBar.on("click", (bar2, item2, elem2) => {
|
|
40319
40327
|
this.emit("click", bar2, item2, elem2);
|
|
@@ -40336,6 +40344,11 @@ ${codeText}
|
|
|
40336
40344
|
this.subBar.manualShow(elem, this.getSubBarOptions(item));
|
|
40337
40345
|
addClass(elem, "active");
|
|
40338
40346
|
}
|
|
40347
|
+
getSubBarCreateOptions(item) {
|
|
40348
|
+
return {
|
|
40349
|
+
id: item.childrenMenuId
|
|
40350
|
+
};
|
|
40351
|
+
}
|
|
40339
40352
|
isInCommandBar(target) {
|
|
40340
40353
|
if (!target || !(target instanceof Node)) {
|
|
40341
40354
|
return false;
|
|
@@ -40470,6 +40483,9 @@ ${codeText}
|
|
|
40470
40483
|
if (item.element && item.setCloseable) {
|
|
40471
40484
|
item.setCloseable((_a = this.closeable) != null ? _a : this);
|
|
40472
40485
|
}
|
|
40486
|
+
if (item.hidden) {
|
|
40487
|
+
addClass(elem, "hidden");
|
|
40488
|
+
}
|
|
40473
40489
|
});
|
|
40474
40490
|
if (this.options.footer) {
|
|
40475
40491
|
const footerElem = createElement("div", ["menu-item", "editor-command-bar", "footer"], null);
|
|
@@ -41100,6 +41116,12 @@ ${codeText}
|
|
|
41100
41116
|
}
|
|
41101
41117
|
return true;
|
|
41102
41118
|
});
|
|
41119
|
+
__publicField(this, "getSubBarCreateOptions", (item) => {
|
|
41120
|
+
const options = {
|
|
41121
|
+
autoClose: true
|
|
41122
|
+
};
|
|
41123
|
+
return options;
|
|
41124
|
+
});
|
|
41103
41125
|
__publicField(this, "getSubBarOptions", (item) => {
|
|
41104
41126
|
var _a;
|
|
41105
41127
|
const options = {
|
|
@@ -73964,6 +73986,7 @@ ${content}
|
|
|
73964
73986
|
}
|
|
73965
73987
|
const hasRowTitle = hasRowHeader(table);
|
|
73966
73988
|
const hasColTitle = hasColHeader(table);
|
|
73989
|
+
const striped = table.classList.contains("table-color-striped");
|
|
73967
73990
|
return [{
|
|
73968
73991
|
cols: grid.colCount,
|
|
73969
73992
|
rows: grid.rowCount,
|
|
@@ -73973,7 +73996,8 @@ ${content}
|
|
|
73973
73996
|
...spanData,
|
|
73974
73997
|
colsWidth,
|
|
73975
73998
|
hasRowTitle,
|
|
73976
|
-
hasColTitle
|
|
73999
|
+
hasColTitle,
|
|
74000
|
+
isStripeStyle: striped
|
|
73977
74001
|
}];
|
|
73978
74002
|
}
|
|
73979
74003
|
function convertAllTables(node, options) {
|
|
@@ -88737,7 +88761,7 @@ ${data2.flowchartText}
|
|
|
88737
88761
|
}
|
|
88738
88762
|
class SeparatorItem {
|
|
88739
88763
|
constructor() {
|
|
88740
|
-
__publicField(this, "id", `separator-${
|
|
88764
|
+
__publicField(this, "id", `separator-${genId()}`);
|
|
88741
88765
|
__publicField(this, "type", "separator");
|
|
88742
88766
|
__publicField(this, "name", "");
|
|
88743
88767
|
}
|
|
@@ -88920,6 +88944,120 @@ ${data2.flowchartText}
|
|
|
88920
88944
|
}
|
|
88921
88945
|
}
|
|
88922
88946
|
}
|
|
88947
|
+
class MoreItem {
|
|
88948
|
+
constructor(editor) {
|
|
88949
|
+
__publicField(this, "name", i18n$1.t("commands.more"));
|
|
88950
|
+
__publicField(this, "id", "more");
|
|
88951
|
+
__publicField(this, "manualShowChildren", true);
|
|
88952
|
+
__publicField(this, "childrenPlacement", "bottom-start");
|
|
88953
|
+
__publicField(this, "children", []);
|
|
88954
|
+
__publicField(this, "hidden");
|
|
88955
|
+
__publicField(this, "fixedToolbar");
|
|
88956
|
+
__publicField(this, "observer");
|
|
88957
|
+
__publicField(this, "icon", MoreIcon$1);
|
|
88958
|
+
__publicField(this, "childrenType", "toolbar");
|
|
88959
|
+
__publicField(this, "childrenMenuId", "main-toolbar-more-menu");
|
|
88960
|
+
setTimeout(() => {
|
|
88961
|
+
var _a;
|
|
88962
|
+
this.fixedToolbar = (_a = editor.findCustom("main-toolbar-fixed-toolbar")) == null ? void 0 : _a.toolbar;
|
|
88963
|
+
if (this.fixedToolbar) {
|
|
88964
|
+
const content = this.fixedToolbar.content;
|
|
88965
|
+
const toolbar2 = content.closest(".editor-command-bar-root");
|
|
88966
|
+
this.observer = new ResizeObserver(() => {
|
|
88967
|
+
this.updateItems();
|
|
88968
|
+
});
|
|
88969
|
+
this.observer.observe(toolbar2);
|
|
88970
|
+
editor.addCustom("main-toolbar-more-item", () => this);
|
|
88971
|
+
}
|
|
88972
|
+
});
|
|
88973
|
+
}
|
|
88974
|
+
destroy() {
|
|
88975
|
+
var _a;
|
|
88976
|
+
(_a = this.observer) == null ? void 0 : _a.disconnect();
|
|
88977
|
+
}
|
|
88978
|
+
onClick(editor, item) {
|
|
88979
|
+
var _a;
|
|
88980
|
+
const subBar = (_a = this.fixedToolbar) == null ? void 0 : _a.subBar;
|
|
88981
|
+
if (subBar) {
|
|
88982
|
+
subBar.options.autoClose = true;
|
|
88983
|
+
}
|
|
88984
|
+
}
|
|
88985
|
+
updateItems() {
|
|
88986
|
+
const toolbar2 = this.fixedToolbar;
|
|
88987
|
+
if (!toolbar2) {
|
|
88988
|
+
return;
|
|
88989
|
+
}
|
|
88990
|
+
const items = toolbar2.items;
|
|
88991
|
+
const moreIndex = items.findIndex((item) => item === this);
|
|
88992
|
+
if (moreIndex === -1) {
|
|
88993
|
+
return;
|
|
88994
|
+
}
|
|
88995
|
+
const content = toolbar2.content;
|
|
88996
|
+
const toolbarRoot = content.closest(".editor-command-bar-root");
|
|
88997
|
+
const toolbarRect = toolbarRoot.getBoundingClientRect();
|
|
88998
|
+
const toolbarRight = toolbarRect.right;
|
|
88999
|
+
items.forEach((item) => {
|
|
89000
|
+
const elem = toolbar2.getItemElementById(item.id);
|
|
89001
|
+
if (item === this) {
|
|
89002
|
+
addClass(elem, "hidden");
|
|
89003
|
+
} else {
|
|
89004
|
+
removeClass(elem, "hidden");
|
|
89005
|
+
}
|
|
89006
|
+
});
|
|
89007
|
+
const positions = /* @__PURE__ */ new Map();
|
|
89008
|
+
items.forEach((item) => {
|
|
89009
|
+
const elem = toolbar2.getItemElementById(item.id);
|
|
89010
|
+
positions.set(item.id, elem.getBoundingClientRect().right);
|
|
89011
|
+
});
|
|
89012
|
+
const lastItem = moreIndex === items.length - 1 ? items[items.length - 2] : items[items.length - 1];
|
|
89013
|
+
const lastElem = toolbar2.getItemElementById(lastItem.id);
|
|
89014
|
+
if (lastElem.getBoundingClientRect().right <= toolbarRight) {
|
|
89015
|
+
this.hidden = true;
|
|
89016
|
+
items.forEach((item) => {
|
|
89017
|
+
if (item === this) {
|
|
89018
|
+
return;
|
|
89019
|
+
}
|
|
89020
|
+
item.hidden = false;
|
|
89021
|
+
});
|
|
89022
|
+
toolbar2.updateItems(items);
|
|
89023
|
+
return;
|
|
89024
|
+
}
|
|
89025
|
+
let fixedWidth = 0;
|
|
89026
|
+
const last = items[items.length - 1];
|
|
89027
|
+
if (last !== this) {
|
|
89028
|
+
const elem = toolbar2.getItemElementById(last.id);
|
|
89029
|
+
const lastRight = elem.getBoundingClientRect().right;
|
|
89030
|
+
const prevItem = items[moreIndex - 1];
|
|
89031
|
+
const prevElem = toolbar2.getItemElementById(prevItem.id);
|
|
89032
|
+
const prevRight = prevElem.getBoundingClientRect().right;
|
|
89033
|
+
fixedWidth = lastRight - prevRight;
|
|
89034
|
+
}
|
|
89035
|
+
const moreWidth = 24;
|
|
89036
|
+
const maxRight = toolbarRight - moreWidth - fixedWidth - 10;
|
|
89037
|
+
const moreItems = [];
|
|
89038
|
+
items.forEach((item, index2) => {
|
|
89039
|
+
if (item === this) {
|
|
89040
|
+
return;
|
|
89041
|
+
}
|
|
89042
|
+
const right = positions.get(item.id);
|
|
89043
|
+
if (!right) {
|
|
89044
|
+
return;
|
|
89045
|
+
}
|
|
89046
|
+
const isFixedItem = index2 > moreIndex;
|
|
89047
|
+
if (isFixedItem) {
|
|
89048
|
+
item.hidden = false;
|
|
89049
|
+
return;
|
|
89050
|
+
}
|
|
89051
|
+
item.hidden = right > maxRight;
|
|
89052
|
+
if (item.hidden) {
|
|
89053
|
+
moreItems.push(item);
|
|
89054
|
+
}
|
|
89055
|
+
});
|
|
89056
|
+
this.hidden = moreItems.length === 0;
|
|
89057
|
+
this.children = moreItems;
|
|
89058
|
+
toolbar2.updateItems(items);
|
|
89059
|
+
}
|
|
89060
|
+
}
|
|
88923
89061
|
function getToolbarDefaultItems(editor) {
|
|
88924
89062
|
return [
|
|
88925
89063
|
new UndoItem(),
|
|
@@ -88951,7 +89089,8 @@ ${data2.flowchartText}
|
|
|
88951
89089
|
new InsertItem(editor),
|
|
88952
89090
|
new SeparatorItem(),
|
|
88953
89091
|
new FindReplaceItem(),
|
|
88954
|
-
new CommentItem()
|
|
89092
|
+
new CommentItem(),
|
|
89093
|
+
new MoreItem(editor)
|
|
88955
89094
|
];
|
|
88956
89095
|
}
|
|
88957
89096
|
const zhCN = {
|
|
@@ -89030,6 +89169,11 @@ ${data2.flowchartText}
|
|
|
89030
89169
|
this.toolbar.addListener("click", this.handleClick);
|
|
89031
89170
|
this.editor.addListener("selectionChanged", this.handleSelectionChanged);
|
|
89032
89171
|
this.updateState();
|
|
89172
|
+
editor.addCustom("main-toolbar-fixed-toolbar", () => ({
|
|
89173
|
+
toolbar: this.toolbar,
|
|
89174
|
+
destroy: () => {
|
|
89175
|
+
}
|
|
89176
|
+
}));
|
|
89033
89177
|
}
|
|
89034
89178
|
destroy() {
|
|
89035
89179
|
this.toolbar.destroy();
|
|
@@ -89266,7 +89410,7 @@ ${data2.flowchartText}
|
|
|
89266
89410
|
}
|
|
89267
89411
|
}
|
|
89268
89412
|
});
|
|
89269
|
-
editor.version = "2.1.7-beta.
|
|
89413
|
+
editor.version = "2.1.7-beta.37";
|
|
89270
89414
|
return editor;
|
|
89271
89415
|
}
|
|
89272
89416
|
function isDoc(doc2) {
|
|
@@ -89380,7 +89524,7 @@ ${data2.flowchartText}
|
|
|
89380
89524
|
}
|
|
89381
89525
|
}
|
|
89382
89526
|
OnesEditorToolbar.register(editor);
|
|
89383
|
-
editor.version = "2.1.7-beta.
|
|
89527
|
+
editor.version = "2.1.7-beta.37";
|
|
89384
89528
|
return editor;
|
|
89385
89529
|
}
|
|
89386
89530
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -135245,6 +135389,7 @@ ${data2.flowchartText}
|
|
|
135245
135389
|
exports2.MobileCommandHandler = MobileCommandHandler;
|
|
135246
135390
|
exports2.MobileLinkProvider = MobileLinkProvider;
|
|
135247
135391
|
exports2.MobileTableCommandProvider = MobileTableCommandProvider;
|
|
135392
|
+
exports2.MoreItem = MoreItem;
|
|
135248
135393
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
135249
135394
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
135250
135395
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|