@ones-editor/editor 2.1.1-beta.25 → 2.1.1-beta.28

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.
@@ -26,5 +26,4 @@ export declare class ReadonlyToolbar implements OnesEditorCustom {
26
26
  private handleHoveringBlockChildChange;
27
27
  groupCommands: (allCommands: CommandItem[]) => CommandItem[];
28
28
  showTextToolbar(reason: string): void;
29
- showObjectToolbar(event: MouseEvent | null): void;
30
29
  }
@@ -28,6 +28,7 @@ export default class OnesEditorToolbar implements OnesEditorHoveringBlockFilter,
28
28
  unbindEvents(): void;
29
29
  handleDocumentMouseDown: (event: MouseEvent) => void;
30
30
  handleDocumentMouseUp: () => void;
31
+ isHoveringBlockContent(block: BlockElement): boolean;
31
32
  private handleHoveringBlockChildChange;
32
33
  handleSelectionChange: import("lodash").DebouncedFunc<(editor: OnesEditor) => void>;
33
34
  updateItems(updater: (items: CommandItem[]) => CommandItem[]): void;
package/dist/index.js CHANGED
@@ -439,7 +439,10 @@ div.comment-editor-root div.root.select-all > .container-blocks > div[data-type=
439
439
  position: absolute;
440
440
  pointer-events: none;
441
441
  z-index: -1;
442
- }.editor-command-bar.toolbar .color-button {
442
+ }.editor-command-bar.toolbar .command-item.disabled .color-button {
443
+ color: #c7c7c7;
444
+ }
445
+ .editor-command-bar.toolbar .color-button {
443
446
  width: 24px;
444
447
  height: 24px;
445
448
  display: flex;
@@ -1978,6 +1981,9 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
1978
1981
  }
1979
1982
  :root div.tippy-box[data-theme=editor-tooltip] > .tippy-content > div > span:nth-of-type(2) {
1980
1983
  font-weight: 400;
1984
+ }
1985
+ [data-command-bar-id] .command-item.disabled > .color-button svg {
1986
+ color: #b2bccd;
1981
1987
  }:root {
1982
1988
  --mindmap-bg-color: #f0f2f4;
1983
1989
  }
@@ -49896,7 +49902,7 @@ ${codeText}
49896
49902
  if (this.toolbarType === "text" && this.toolbar.isVisible) {
49897
49903
  return;
49898
49904
  }
49899
- if (!block) {
49905
+ if (!block || !this.isHoveringBlockContent(block)) {
49900
49906
  this.toolbar.close("fromHover");
49901
49907
  return;
49902
49908
  }
@@ -49998,6 +50004,16 @@ ${codeText}
49998
50004
  unbindEvents() {
49999
50005
  document.removeEventListener("mousedown", this.handleDocumentMouseDown);
50000
50006
  }
50007
+ isHoveringBlockContent(block) {
50008
+ const ele = OnesEditorHoveringBlock.get(this.editor).hoveringElem;
50009
+ if (!ele)
50010
+ return false;
50011
+ if (!(ele instanceof Node))
50012
+ return false;
50013
+ if (ele === block)
50014
+ return false;
50015
+ return isChildNode(block, ele);
50016
+ }
50001
50017
  updateItems(updater) {
50002
50018
  const updatedItems = updater(this.toolbar.items);
50003
50019
  this.toolbar.updateItems(updatedItems);
@@ -56875,15 +56891,15 @@ $$${mathData.mathjaxText}$$
56875
56891
  return true;
56876
56892
  }
56877
56893
  }
56878
- for (const provider of this.quickProviders) {
56879
- const params2 = { from: "block-menu", containerId, blockIndex };
56880
- (_d = provider.executeCommand) == null ? void 0 : _d.call(provider, editor, item, params2);
56881
- }
56882
56894
  for (const [id, provider] of this.providersMap) {
56883
- if ((_e = provider.executeInsertCommand) == null ? void 0 : _e.call(provider, editor, containerId, blockIndex, item, params)) {
56895
+ if ((_d = provider.executeInsertCommand) == null ? void 0 : _d.call(provider, editor, containerId, blockIndex, item, params)) {
56884
56896
  return true;
56885
56897
  }
56886
56898
  }
56899
+ for (const provider of this.quickProviders) {
56900
+ const params2 = { from: "block-menu", containerId, blockIndex };
56901
+ (_e = provider.executeCommand) == null ? void 0 : _e.call(provider, editor, item, params2);
56902
+ }
56887
56903
  return false;
56888
56904
  });
56889
56905
  __publicField(this, "executeCommand", (editor, block, range, item, params) => {
@@ -58577,9 +58593,7 @@ $$${mathData.mathjaxText}$$
58577
58593
  }
58578
58594
  if (!block) {
58579
58595
  this.toolbar.close("fromHover");
58580
- return;
58581
58596
  }
58582
- this.showObjectToolbar(event);
58583
58597
  });
58584
58598
  __publicField(this, "groupCommands", (allCommands) => {
58585
58599
  var _a, _b;
@@ -58683,9 +58697,6 @@ $$${mathData.mathjaxText}$$
58683
58697
  }
58684
58698
  if (selectedBlocks.length === 1) {
58685
58699
  if (isEmbedBlock(firstBlock.block)) {
58686
- if (reason === "click") {
58687
- this.showObjectToolbar(null);
58688
- }
58689
58700
  return;
58690
58701
  }
58691
58702
  if (isComplexKindBlock(this.editor, firstBlock.block) && range.isSimple()) {
@@ -58708,8 +58719,6 @@ $$${mathData.mathjaxText}$$
58708
58719
  });
58709
58720
  (_b = (_a = this.toolbar.tippyInstance) == null ? void 0 : _a.popperInstance) == null ? void 0 : _b.update();
58710
58721
  }
58711
- showObjectToolbar(event) {
58712
- }
58713
58722
  }
58714
58723
  function getCommentAbstract(editor, blocks) {
58715
58724
  return blocks.map((block) => {
@@ -84909,7 +84918,7 @@ ${data2.flowchartText}
84909
84918
  }
84910
84919
  }
84911
84920
  });
84912
- editor.version = "2.1.1-beta.25";
84921
+ editor.version = "2.1.1-beta.28";
84913
84922
  if (Logger$2.level === LogLevel.DEBUG) {
84914
84923
  window.setReauthFail = (fail) => {
84915
84924
  window.isReauthError = fail;
@@ -85006,7 +85015,7 @@ ${data2.flowchartText}
85006
85015
  });
85007
85016
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
85008
85017
  OnesEditorToolbar.register(editor);
85009
- editor.version = "2.1.1-beta.25";
85018
+ editor.version = "2.1.1-beta.28";
85010
85019
  return editor;
85011
85020
  }
85012
85021
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "2.1.1-beta.25",
3
+ "version": "2.1.1-beta.28",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",