@ones-editor/editor 2.1.2-beta.5 → 2.1.2-beta.6

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.
@@ -0,0 +1,2 @@
1
+ import type { OnesEditor } from '../../../../@ones-editor/editor';
2
+ export declare const isAllContainersSelected: (editor: OnesEditor) => boolean;
package/dist/index.js CHANGED
@@ -68154,6 +68154,27 @@ ${codeText}
68154
68154
  method: "delete"
68155
68155
  });
68156
68156
  }
68157
+ const isAllContainersSelected = (editor) => {
68158
+ var _a;
68159
+ const range = editor.selection.range;
68160
+ const block = editor.getBlockById(range.start.blockId);
68161
+ if (range.isSimple() && range.start.blockId === range.end.blockId) {
68162
+ if (isComplexKindBlock(editor, block)) {
68163
+ return true;
68164
+ }
68165
+ }
68166
+ if (!range.isSimple()) {
68167
+ const { start, end } = range;
68168
+ const startContainerId = start.childContainerId;
68169
+ const endContainerId = end.childContainerId;
68170
+ const blockData = editor.getBlockData(block);
68171
+ const children = (_a = blockData.children) != null ? _a : [];
68172
+ if ((children == null ? void 0 : children[0]) === startContainerId && (children == null ? void 0 : children[children.length - 1]) === endContainerId) {
68173
+ return true;
68174
+ }
68175
+ }
68176
+ return false;
68177
+ };
68157
68178
  class AddCommentToOldDocCommandProvider {
68158
68179
  constructor(editor, version) {
68159
68180
  __publicField(this, "localCreatedComments", /* @__PURE__ */ new Map());
@@ -68216,11 +68237,13 @@ ${codeText}
68216
68237
  }, 300);
68217
68238
  }
68218
68239
  commands(editor, blockElement, child) {
68240
+ var _a;
68219
68241
  if (!editor.readonly) {
68220
68242
  return void 0;
68221
68243
  }
68222
68244
  if (child) {
68223
- if (isTextBlockContentBoxChild(child)) {
68245
+ const whitList = ["file"];
68246
+ if (isTextBlockContentBoxChild(child) && whitList.includes((_a = child.getAttribute("data-box-type")) != null ? _a : "")) {
68224
68247
  return {
68225
68248
  group: "hovering-toolbar",
68226
68249
  commands: [{
@@ -68288,6 +68311,10 @@ ${codeText}
68288
68311
  if (range.isCollapsed()) {
68289
68312
  return [];
68290
68313
  }
68314
+ const focusedBlock = editor.selection.focusedBlock;
68315
+ if (!isTextKindBlock(editor, focusedBlock) && !isAllContainersSelected(editor)) {
68316
+ return [];
68317
+ }
68291
68318
  if (range.isSimple()) {
68292
68319
  return [{
68293
68320
  id: "add-comment-to-old-doc/text",
@@ -87092,7 +87119,7 @@ ${data2.flowchartText}
87092
87119
  }
87093
87120
  }
87094
87121
  });
87095
- editor.version = "2.1.2-beta.5";
87122
+ editor.version = "2.1.2-beta.6";
87096
87123
  if (Logger$2.level === LogLevel.DEBUG) {
87097
87124
  window.setReauthFail = (fail) => {
87098
87125
  window.isReauthError = fail;
@@ -87193,7 +87220,7 @@ ${data2.flowchartText}
87193
87220
  });
87194
87221
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
87195
87222
  OnesEditorToolbar.register(editor);
87196
- editor.version = "2.1.2-beta.5";
87223
+ editor.version = "2.1.2-beta.6";
87197
87224
  return editor;
87198
87225
  }
87199
87226
  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.2-beta.5",
3
+ "version": "2.1.2-beta.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",