dragon-editor 3.2.1 → 3.2.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 +1 -1
- package/dist/module.mjs +6 -1
- package/dist/runtime/components/DragonEditor.vue +2 -2
- package/dist/runtime/plugin.d.mts +2 -0
- package/dist/runtime/plugin.mjs +6 -0
- package/dist/runtime/store.mjs +6 -4
- package/dist/runtime/utils/controlBar.mjs +4 -0
- package/package.json +1 -1
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineNuxtModule, createResolver, addComponent, addTypeTemplate, installModule } from '@nuxt/kit';
|
|
1
|
+
import { defineNuxtModule, createResolver, addComponent, addTypeTemplate, installModule, addPluginTemplate } from '@nuxt/kit';
|
|
2
2
|
|
|
3
3
|
const module = defineNuxtModule({
|
|
4
4
|
meta: {
|
|
@@ -20,6 +20,11 @@ const module = defineNuxtModule({
|
|
|
20
20
|
write: true
|
|
21
21
|
});
|
|
22
22
|
await installModule("@pinia/nuxt");
|
|
23
|
+
addPluginTemplate({
|
|
24
|
+
src: resolver.resolve("./runtime/plugin.mjs"),
|
|
25
|
+
filename: "hljs.plugin.mjs"
|
|
26
|
+
});
|
|
27
|
+
nuxt.options.build.transpile.push("highlight.js");
|
|
23
28
|
}
|
|
24
29
|
});
|
|
25
30
|
|
|
@@ -92,14 +92,14 @@
|
|
|
92
92
|
<option v-for="(item, i) in _getCodeBlockTheme()" :value="item.code" :key="`codeBlockTheme-${i}`">{{ item.text }}</option>
|
|
93
93
|
</select>
|
|
94
94
|
</div>
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
<div v-if="['code'].includes(curruntType) === true" class="de-col">
|
|
97
97
|
<p class="de-name">Language :</p>
|
|
98
98
|
<select class="de-selector" v-model="codeblockLanguage" @change="codeblockLanguageChangeEvent">
|
|
99
99
|
<option v-for="(item, i) in _getCodeBlockLanguage()" :value="item.code" :key="`codeBlockLanuage-${i}`">{{ item.text }}</option>
|
|
100
100
|
</select>
|
|
101
101
|
</div>
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
<div v-if="['list'].includes(curruntType) === true" class="de-col">
|
|
104
104
|
<p class="de-name">List Style :</p>
|
|
105
105
|
<select class="de-selector" v-model="listBlockStyle" @change="listBlockStyleChangeEvent">
|
package/dist/runtime/store.mjs
CHANGED
|
@@ -37,10 +37,12 @@ export const useEditorStore = defineStore("editorStore", {
|
|
|
37
37
|
this.controlBar.$element = value;
|
|
38
38
|
},
|
|
39
39
|
controlBarActive() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (this.$currentBlock !== null) {
|
|
41
|
+
const currentRect = this.$currentBlock.getBoundingClientRect();
|
|
42
|
+
this.controlBar.active = true;
|
|
43
|
+
this.controlBar.x = Math.floor(currentRect.x + currentRect.width / 2);
|
|
44
|
+
this.controlBar.y = Math.floor(currentRect.y - 50);
|
|
45
|
+
}
|
|
44
46
|
},
|
|
45
47
|
controlBarDeactive() {
|
|
46
48
|
this.controlBar.active = false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { _getBlockType } from "./block.mjs";
|
|
2
|
+
import hljs from "highlight.js";
|
|
2
3
|
import "../type.d.ts";
|
|
3
4
|
export function _getCodeBlockTheme() {
|
|
4
5
|
return [
|
|
@@ -134,6 +135,9 @@ export function _setCodeBlockLanguage(store, lang) {
|
|
|
134
135
|
if (type === "code") {
|
|
135
136
|
const $langText = $element.querySelector(".de-language");
|
|
136
137
|
const $code = $element.querySelector(".de-code-content");
|
|
138
|
+
const convert = hljs.highlight($code.textContent ?? "", { language: lang });
|
|
139
|
+
$langText.textContent = convert._top.name ?? "";
|
|
140
|
+
$code.innerHTML = convert.value;
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
}
|