dragon-editor 2.0.0-beta.2.1 → 2.0.0-beta.2.1.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/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
3
  "configKey": "dragon-editor",
4
- "version": "2.0.0-beta.2.1"
4
+ "version": "2.0.0-beta.2.1.2"
5
5
  }
@@ -49,16 +49,41 @@ function updateBlockData() {
49
49
 
50
50
  // 커서위치 재지정
51
51
  if ($block.value.innerHTML.length > 0) {
52
- const cursorData = getArrangementCursorData(props.cursorData);
53
-
54
- data.value.content = $block.value.innerHTML;
55
- emit("update:modelValue", data.value);
56
-
57
- setTimeout(() => {
52
+ if (props.cursorData.endOffset !== null) {
53
+ const cursorData = getArrangementCursorData(props.cursorData);
54
+
55
+ data.value.content = $block.value.innerHTML;
56
+ emit("update:modelValue", data.value);
57
+
58
+ setTimeout(() => {
59
+ if ($block.value) {
60
+ setCursor($block.value.childNodes[cursorData.childCount], cursorData.length);
61
+
62
+ // 구조 검수
63
+ $block.value.childNodes.forEach((child: ChildNode) => {
64
+ const $child = child as HTMLElement;
65
+
66
+ if (child.constructor.name !== "Text") {
67
+ // 텍스트가 아닐경우
68
+ if (child.constructor.name !== "HTMLBRElement") {
69
+ // br 태그 유지
70
+ if (child.textContent === "") {
71
+ // 빈 태그 삭제
72
+ child.remove();
73
+ } else if ($child.classList.length === 0) {
74
+ // 클레스 없는 엘리먼트 처리
75
+ $child.insertAdjacentHTML("afterend", $child.innerHTML);
76
+ child.remove();
77
+ }
78
+ } else {
79
+ $child.removeAttribute("class");
80
+ }
81
+ }
82
+ });
83
+ }
84
+ }, 100);
85
+ } else {
58
86
  if ($block.value) {
59
- setCursor($block.value.childNodes[cursorData.childCount], cursorData.length);
60
-
61
- // 구조 검수
62
87
  $block.value.childNodes.forEach((child: ChildNode) => {
63
88
  const $child = child as HTMLElement;
64
89
 
@@ -79,8 +104,11 @@ function updateBlockData() {
79
104
  }
80
105
  }
81
106
  });
107
+
108
+ data.value.content = $block.value.innerHTML;
109
+ emit("update:modelValue", data.value);
82
110
  }
83
- }, 100);
111
+ }
84
112
  } else {
85
113
  emit("update:modelValue", data.value);
86
114
  }
@@ -675,6 +675,7 @@ function addImageBlock({ src, width, height, webp, caption }: { src: string; wid
675
675
  // 함수 내보내기
676
676
  defineExpose({
677
677
  addImageBlock,
678
+ dataUpdateAction
678
679
  });
679
680
 
680
681
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
- "version": "2.0.0-beta.2.1",
3
+ "version": "2.0.0-beta.2.1.2",
4
4
  "description": "WYSIWYG editor on Nuxt.js",
5
5
  "repository": {
6
6
  "type": "git",