dragon-editor 4.0.0 → 4.0.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
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.0.0"
5
5
  },
6
6
  "configKey": "dragon-editor",
7
- "version": "4.0.0",
7
+ "version": "4.0.2",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "3.6.1"
@@ -63,11 +63,11 @@
63
63
  </template>
64
64
 
65
65
  <script setup>
66
- import hljs from "highlight.js";
67
66
  import { useEditorStore } from "../../store/editor";
68
67
  import { ref, computed, nextTick } from "vue";
69
68
  import { onClickOutside } from "@vueuse/core";
70
69
  import { _moveCodeBlockEvent, _codeBlockShiftEnterEvent, _codeBlockTabEvent, _normalPasteEvent } from "../../utils/event";
70
+ import { _highlightingCode } from "../../utils/data";
71
71
  const editorStore = useEditorStore();
72
72
  const props = defineProps({
73
73
  data: { type: null, required: true },
@@ -161,12 +161,11 @@ function contentKeydownEvent(event) {
161
161
  async function setLanguageEvent(lang) {
162
162
  if ($content.value !== null) {
163
163
  const textContent = $content.value.textContent;
164
- const highlights = hljs.highlight(textContent, { language: lang });
165
164
  const newData = JSON.parse(JSON.stringify(props.data));
166
165
  isLanguageListActive.value = false;
167
166
  abortEdit();
168
167
  newData.language = lang;
169
- newData.textContent = highlights.value;
168
+ newData.textContent = _highlightingCode(textContent, lang);
170
169
  emit("update", newData);
171
170
  await nextTick();
172
171
  setEdit();
@@ -175,9 +174,8 @@ async function setLanguageEvent(lang) {
175
174
  function setStyleEvent() {
176
175
  if ($content.value !== null) {
177
176
  const textContent = $content.value.textContent;
178
- const highlights = hljs.highlight(textContent, { language: props.data.language });
179
177
  const newData = JSON.parse(JSON.stringify(props.data));
180
- newData.textContent = highlights.value;
178
+ newData.textContent = _highlightingCode(textContent, props.data.language);
181
179
  emit("update", newData);
182
180
  }
183
181
  }
@@ -1,4 +1,3 @@
1
- import "../scss/editor.scss.js";
2
1
  import { _addBlock, _addImageBlock, _checkDataIsEmpty } from "../utils/data/index.js";
3
2
  import { _editorMountedEvent } from "../utils/event/index.js";
4
3
  import { _setAlign } from "../utils/node/index.js";