@haluo/biz 2.0.51-beta.1 → 2.0.51-beta.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
@@ -5300,6 +5300,21 @@ const _sfc_main$3 = {
5300
5300
  }, 0);
5301
5301
  this.$emit("update-topic-position");
5302
5302
  },
5303
+ moveCursor(spaceNode) {
5304
+ setTimeout(() => {
5305
+ const currentSelection = window.getSelection();
5306
+ if (currentSelection.rangeCount > 0) {
5307
+ const currentRange = currentSelection.getRangeAt(0);
5308
+ if (currentRange.startContainer !== spaceNode.nextSibling) {
5309
+ const correctRange = document.createRange();
5310
+ correctRange.setStartAfter(spaceNode);
5311
+ correctRange.collapse(true);
5312
+ currentSelection.removeAllRanges();
5313
+ currentSelection.addRange(correctRange);
5314
+ }
5315
+ }
5316
+ }, 0);
5317
+ },
5303
5318
  // 供外部项目调用:插入热门话题
5304
5319
  // 组件内部会自动监听外部点击并保存光标位置
5305
5320
  // topic: { id, type, title, exactlyMatchTitle }
@@ -5337,19 +5352,7 @@ const _sfc_main$3 = {
5337
5352
  newRange.collapse(true);
5338
5353
  selection.removeAllRanges();
5339
5354
  selection.addRange(newRange);
5340
- setTimeout(() => {
5341
- const currentSelection = window.getSelection();
5342
- if (currentSelection.rangeCount > 0) {
5343
- const currentRange = currentSelection.getRangeAt(0);
5344
- if (currentRange.startContainer !== spaceNode.nextSibling) {
5345
- const correctRange = document.createRange();
5346
- correctRange.setStartAfter(spaceNode);
5347
- correctRange.collapse(true);
5348
- currentSelection.removeAllRanges();
5349
- currentSelection.addRange(correctRange);
5350
- }
5351
- }
5352
- }, 0);
5355
+ this.moveCursor(spaceNode);
5353
5356
  } else {
5354
5357
  let lastParagraph = editorContent.lastElementChild;
5355
5358
  if (!lastParagraph || lastParagraph.nodeName !== "P" && !lastParagraph.classList.contains("halo-paragraph") && !lastParagraph.classList.contains("halo-paragraph-title")) {
@@ -5366,6 +5369,7 @@ const _sfc_main$3 = {
5366
5369
  newRange.collapse(true);
5367
5370
  selection.removeAllRanges();
5368
5371
  selection.addRange(newRange);
5372
+ this.moveCursor(spaceNode);
5369
5373
  } else {
5370
5374
  editorContent.appendChild(topicElement);
5371
5375
  }
@@ -5910,6 +5914,7 @@ const _sfc_main = {
5910
5914
  insertHotTopic(topic) {
5911
5915
  if (this.$refs.topicManager) {
5912
5916
  this.$refs.topicManager.insertHotTopic(topic);
5917
+ this.updateData(true);
5913
5918
  }
5914
5919
  },
5915
5920
  getHtml(type) {
@@ -5299,6 +5299,21 @@
5299
5299
  }, 0);
5300
5300
  this.$emit("update-topic-position");
5301
5301
  },
5302
+ moveCursor(spaceNode) {
5303
+ setTimeout(() => {
5304
+ const currentSelection = window.getSelection();
5305
+ if (currentSelection.rangeCount > 0) {
5306
+ const currentRange = currentSelection.getRangeAt(0);
5307
+ if (currentRange.startContainer !== spaceNode.nextSibling) {
5308
+ const correctRange = document.createRange();
5309
+ correctRange.setStartAfter(spaceNode);
5310
+ correctRange.collapse(true);
5311
+ currentSelection.removeAllRanges();
5312
+ currentSelection.addRange(correctRange);
5313
+ }
5314
+ }
5315
+ }, 0);
5316
+ },
5302
5317
  // 供外部项目调用:插入热门话题
5303
5318
  // 组件内部会自动监听外部点击并保存光标位置
5304
5319
  // topic: { id, type, title, exactlyMatchTitle }
@@ -5336,19 +5351,7 @@
5336
5351
  newRange.collapse(true);
5337
5352
  selection.removeAllRanges();
5338
5353
  selection.addRange(newRange);
5339
- setTimeout(() => {
5340
- const currentSelection = window.getSelection();
5341
- if (currentSelection.rangeCount > 0) {
5342
- const currentRange = currentSelection.getRangeAt(0);
5343
- if (currentRange.startContainer !== spaceNode.nextSibling) {
5344
- const correctRange = document.createRange();
5345
- correctRange.setStartAfter(spaceNode);
5346
- correctRange.collapse(true);
5347
- currentSelection.removeAllRanges();
5348
- currentSelection.addRange(correctRange);
5349
- }
5350
- }
5351
- }, 0);
5354
+ this.moveCursor(spaceNode);
5352
5355
  } else {
5353
5356
  let lastParagraph = editorContent.lastElementChild;
5354
5357
  if (!lastParagraph || lastParagraph.nodeName !== "P" && !lastParagraph.classList.contains("halo-paragraph") && !lastParagraph.classList.contains("halo-paragraph-title")) {
@@ -5365,6 +5368,7 @@
5365
5368
  newRange.collapse(true);
5366
5369
  selection.removeAllRanges();
5367
5370
  selection.addRange(newRange);
5371
+ this.moveCursor(spaceNode);
5368
5372
  } else {
5369
5373
  editorContent.appendChild(topicElement);
5370
5374
  }
@@ -5909,6 +5913,7 @@
5909
5913
  insertHotTopic(topic) {
5910
5914
  if (this.$refs.topicManager) {
5911
5915
  this.$refs.topicManager.insertHotTopic(topic);
5916
+ this.updateData(true);
5912
5917
  }
5913
5918
  },
5914
5919
  getHtml(type) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@haluo/biz",
3
3
  "description": "rich text",
4
- "version": "2.0.51-beta.1",
4
+ "version": "2.0.51-beta.2",
5
5
  "type": "module",
6
6
  "module": "./dist/haluo-biz.js",
7
7
  "main": "./dist/haluo-biz.umd.cjs",