@ones-editor/editor 2.0.7-beta.17 → 2.0.7-beta.19

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/dist/index.js CHANGED
@@ -24029,7 +24029,7 @@ var __publicField = (obj, key, value) => {
24029
24029
  if (elem.nodeType === 3) {
24030
24030
  elem = elem.parentElement;
24031
24031
  }
24032
- return !!(elem == null ? void 0 : elem.closest("div[data-command-bar-id]")) || !!(elem == null ? void 0 : elem.closest("[data-keep-editor-focus]"));
24032
+ return !!(elem == null ? void 0 : elem.closest("div[data-command-bar-id]")) || !!(elem == null ? void 0 : elem.closest("[data-keep-editor-focus]")) || !!(elem == null ? void 0 : elem.closest(".data-keep-editor-focus"));
24033
24033
  }
24034
24034
  destroy() {
24035
24035
  this.callbacks.destroy();
@@ -55039,13 +55039,23 @@ $$${mathData.mathjaxText}$$
55039
55039
  }
55040
55040
  const rect = rects[0];
55041
55041
  const anchor2 = createBlockAnchor(editor, block, "quick-menu-inline-link", rect);
55042
+ const start = range.start.offset;
55043
+ const end = range.end.offset;
55042
55044
  const onFinished = (linkText, linkUrl) => {
55043
55045
  editor.undoManager.runInGroup(() => {
55044
55046
  try {
55045
- const text2 = editor.getBlockText(block);
55046
- const newText = insertText(text2, range.start.offset, linkText, { link: linkUrl });
55047
+ const isCollapsed = editor.selection.range.isCollapsed();
55048
+ let newText;
55049
+ if (isCollapsed) {
55050
+ newText = insertText(editor.getBlockText(block), end, linkText, { link: linkUrl });
55051
+ editor.setBlockText(block, newText);
55052
+ editor.focus();
55053
+ return;
55054
+ }
55055
+ newText = replaceText(editor.getBlockText(block), start, end, linkText);
55056
+ newText = rangeAddAttribute(start, linkText.length, newText, "link", linkUrl);
55047
55057
  editor.setBlockText(block, newText);
55048
- editor.selection.selectBlock(block, range.start.offset + linkText.length);
55058
+ editor.selection.selectBlock(block, start + linkText.length);
55049
55059
  editor.focus();
55050
55060
  } catch (error2) {
55051
55061
  logger$1K.error(error2);
@@ -82305,7 +82315,7 @@ ${data2.flowchartText}
82305
82315
  }
82306
82316
  }
82307
82317
  });
82308
- editor.version = "2.0.7-beta.17";
82318
+ editor.version = "2.0.7-beta.19";
82309
82319
  if (Logger$2.level === LogLevel.DEBUG) {
82310
82320
  window.setReauthFail = (fail) => {
82311
82321
  window.isReauthError = fail;
@@ -82399,7 +82409,7 @@ ${data2.flowchartText}
82399
82409
  if (!clientType.isMobile) {
82400
82410
  OnesEditorToolbar.register(editor);
82401
82411
  }
82402
- editor.version = "2.0.7-beta.17";
82412
+ editor.version = "2.0.7-beta.19";
82403
82413
  return editor;
82404
82414
  }
82405
82415
  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.0.7-beta.17",
3
+ "version": "2.0.7-beta.19",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",