@haluo/biz 2.0.19-beat.1 → 2.0.19-beat.2

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/haluo-biz.js CHANGED
@@ -4955,12 +4955,10 @@ const _sfc_main = {
4955
4955
  node.onclick = function(e) {
4956
4956
  me2.selectDom = node;
4957
4957
  img2.classList.add("halo-select");
4958
- e.stopPropagation();
4959
4958
  };
4960
4959
  node.onblur = function(e) {
4961
4960
  img2.classList.remove("halo-select");
4962
4961
  me2.selectDom = null;
4963
- e.stopPropagation();
4964
4962
  };
4965
4963
  this.setDragMove(node);
4966
4964
  const desc = img2.dataset.desc;
@@ -5021,12 +5019,10 @@ const _sfc_main = {
5021
5019
  node.onclick = function(e) {
5022
5020
  me2.selectDom = node;
5023
5021
  video.classList.add("halo-select");
5024
- e.stopPropagation();
5025
5022
  };
5026
5023
  node.onblur = function(e) {
5027
5024
  video.classList.remove("halo-select");
5028
5025
  me2.selectDom = null;
5029
- e.stopPropagation();
5030
5026
  };
5031
5027
  const replaceBtn = me2.insertVideoBtns(me2.editor, video);
5032
5028
  node.appendChild(delBtn);
@@ -5481,9 +5477,16 @@ const _sfc_main = {
5481
5477
  const isPre = me2.moverClasses.includes(previousSibling.className);
5482
5478
  if (isPre && offSet === 0) {
5483
5479
  const curSelect = previousSibling.querySelector("img") || previousSibling.querySelector("video");
5484
- event.preventDefault();
5485
- me2.selectDom = previousSibling;
5486
- curSelect.classList.add("halo-select");
5480
+ if (curSelect) {
5481
+ previousSibling.click();
5482
+ previousSibling.focus();
5483
+ const range = document.createRange();
5484
+ range.selectNodeContents(previousSibling);
5485
+ range.collapse(false);
5486
+ selection.removeAllRanges();
5487
+ selection.addRange(range);
5488
+ event.preventDefault();
5489
+ }
5487
5490
  }
5488
5491
  }
5489
5492
  }
@@ -5617,12 +5620,10 @@ const _sfc_main = {
5617
5620
  p.onclick = function(e) {
5618
5621
  me2.selectDom = p;
5619
5622
  img2.classList.add("halo-select");
5620
- e.stopPropagation();
5621
5623
  };
5622
5624
  p.onblur = function(e) {
5623
5625
  img2.classList.remove("halo-select");
5624
5626
  me2.selectDom = null;
5625
- e.stopPropagation();
5626
5627
  };
5627
5628
  this.insertElement(p, range);
5628
5629
  if (isSeameless) {
@@ -5688,7 +5689,6 @@ const _sfc_main = {
5688
5689
  p.onblur = function(e) {
5689
5690
  img.classList.remove("halo-select");
5690
5691
  me2.selectDom = null;
5691
- e.stopPropagation();
5692
5692
  };
5693
5693
  me2.setDragMove(p);
5694
5694
  this.insertElement(p);
@@ -4957,12 +4957,10 @@
4957
4957
  node.onclick = function(e) {
4958
4958
  me2.selectDom = node;
4959
4959
  img2.classList.add("halo-select");
4960
- e.stopPropagation();
4961
4960
  };
4962
4961
  node.onblur = function(e) {
4963
4962
  img2.classList.remove("halo-select");
4964
4963
  me2.selectDom = null;
4965
- e.stopPropagation();
4966
4964
  };
4967
4965
  this.setDragMove(node);
4968
4966
  const desc = img2.dataset.desc;
@@ -5023,12 +5021,10 @@
5023
5021
  node.onclick = function(e) {
5024
5022
  me2.selectDom = node;
5025
5023
  video.classList.add("halo-select");
5026
- e.stopPropagation();
5027
5024
  };
5028
5025
  node.onblur = function(e) {
5029
5026
  video.classList.remove("halo-select");
5030
5027
  me2.selectDom = null;
5031
- e.stopPropagation();
5032
5028
  };
5033
5029
  const replaceBtn = me2.insertVideoBtns(me2.editor, video);
5034
5030
  node.appendChild(delBtn);
@@ -5483,9 +5479,16 @@
5483
5479
  const isPre = me2.moverClasses.includes(previousSibling.className);
5484
5480
  if (isPre && offSet === 0) {
5485
5481
  const curSelect = previousSibling.querySelector("img") || previousSibling.querySelector("video");
5486
- event.preventDefault();
5487
- me2.selectDom = previousSibling;
5488
- curSelect.classList.add("halo-select");
5482
+ if (curSelect) {
5483
+ previousSibling.click();
5484
+ previousSibling.focus();
5485
+ const range = document.createRange();
5486
+ range.selectNodeContents(previousSibling);
5487
+ range.collapse(false);
5488
+ selection.removeAllRanges();
5489
+ selection.addRange(range);
5490
+ event.preventDefault();
5491
+ }
5489
5492
  }
5490
5493
  }
5491
5494
  }
@@ -5619,12 +5622,10 @@
5619
5622
  p.onclick = function(e) {
5620
5623
  me2.selectDom = p;
5621
5624
  img2.classList.add("halo-select");
5622
- e.stopPropagation();
5623
5625
  };
5624
5626
  p.onblur = function(e) {
5625
5627
  img2.classList.remove("halo-select");
5626
5628
  me2.selectDom = null;
5627
- e.stopPropagation();
5628
5629
  };
5629
5630
  this.insertElement(p, range);
5630
5631
  if (isSeameless) {
@@ -5690,7 +5691,6 @@
5690
5691
  p.onblur = function(e) {
5691
5692
  img.classList.remove("halo-select");
5692
5693
  me2.selectDom = null;
5693
- e.stopPropagation();
5694
5694
  };
5695
5695
  me2.setDragMove(p);
5696
5696
  this.insertElement(p);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "2.0.19-beat.1",
4
+ "version": "2.0.19-beat.2",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",