dragon-editor 3.5.7 → 3.5.9

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/README.md CHANGED
@@ -54,11 +54,6 @@ First. Set module
54
54
  ```typescript
55
55
  export default defineNuxtConfig({
56
56
  modules: ["dragon-editor"],
57
- vite: {
58
- optimizeDeps: {
59
- include: ["highlight.js/lib/core"],
60
- },
61
- },
62
57
  });
63
58
  ```
64
59
 
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "nuxt": ">=3.0.0"
5
5
  },
6
6
  "configKey": "dragon-editor",
7
- "version": "3.5.7",
7
+ "version": "3.5.9",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { defineNuxtModule, createResolver, addComponent, addTypeTemplate, addPlugin } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addComponent, addTypeTemplate } from '@nuxt/kit';
2
2
 
3
3
 
4
4
 
@@ -31,7 +31,6 @@ const module = defineNuxtModule({
31
31
  src: resolver.resolve(__dirname, "./runtime/type.d.ts"),
32
32
  write: true
33
33
  });
34
- addPlugin(resolver.resolve(__dirname, "./runtime/plugin"));
35
34
  nuxt.options.build.transpile.push("highlight.js");
36
35
  }
37
36
  });
@@ -9,6 +9,7 @@ import { _eidtorMountEvent, _eidtorUnmountEvent, _editorMousemoveEvent, _editorM
9
9
  import { _addBlock } from "../utils/node";
10
10
  import { _setDecoration, _setTextAlign } from "../utils/style";
11
11
  import type { VNode } from "vue";
12
+ import hljs from "highlight.js";
12
13
  import "../type.d.ts";
13
14
 
14
15
  interface DEOption {
@@ -113,6 +114,7 @@ const editorStore = ref<DragonEditorStore>({
113
114
  $body: null,
114
115
  $controlBar: null,
115
116
  $parentWrap: null,
117
+ hljs: hljs,
116
118
  emit: emit,
117
119
  windowClickEvent: function (event: MouseEvent) {
118
120
  _checkOthersideClick(event, editorStore);
@@ -1,3 +1,5 @@
1
+ import type { HLJSApi } from "highlight.js";
2
+
1
3
  type DEContentData = DEBlockData[];
2
4
 
3
5
  type DEBlockData = DETextBlock | DEHeadingBlock | DEListBlock | DEImageBlock | DECodeBlock | DECustomBlock;
@@ -62,6 +64,7 @@ interface DragonEditorStore {
62
64
  $anchorInput: HTMLInputElement | null;
63
65
  $currentBlock: HTMLDivElement | null;
64
66
  };
67
+ hljs: HLJSApi;
65
68
  codeBlockTheme: DECodeItem<DECodeblockTheme>[];
66
69
  listUlType: DECodeItem<DEListStyle>[];
67
70
  listOlType: DECodeItem<DEListStyle>[];
@@ -1,5 +1,4 @@
1
1
  import { _getDefaultBlockData, _generateId, _updateModelData, _updateCursorData, _decideWhetherOpenControlBar, _updateControlBarStatus, CODEBLOCKLANG } from "../event/index.js";
2
- import hljs from "highlight.js";
3
2
  export function _addBlock(type, store, data) {
4
3
  const blockData = data === void 0 ? _getDefaultBlockData(type) : data;
5
4
  let $block = _createTextBlock(_getDefaultBlockData("text"));
@@ -219,7 +218,7 @@ export function _setCodeBlockLanguage(language, store) {
219
218
  if ($target !== null && $code !== null) {
220
219
  const targetValue = CODEBLOCKLANG.find((item) => item.code === language);
221
220
  if (targetValue !== void 0) {
222
- const convert = hljs.highlight($code.textContent ?? "", { language });
221
+ const convert = store.value.hljs.highlight($code.textContent ?? "", { language });
223
222
  $target.textContent = targetValue.text;
224
223
  $code.innerHTML = convert.value;
225
224
  store.value.controlStatus.codeBlockLang = targetValue.code;
@@ -1,4 +0,0 @@
1
- export declare function _findScrollingElement($target: HTMLElement): HTMLElement | Window;
2
- export declare function _getParentElementIfNodeIsText($target: Node, $block: HTMLElement): Node;
3
- export declare function _findContentEditableElement($target: Node): HTMLElement | null;
4
- export declare function _findPoverTextNode(node: Element, idx: number): number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
- "version": "3.5.7",
3
+ "version": "3.5.9",
4
4
  "description": "Javascript WYSIWYG editor in Nuxt3!",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +0,0 @@
1
- declare const _default: import("nuxt/app").Plugin<Record<string, unknown>> & import("nuxt/app").ObjectPlugin<Record<string, unknown>>;
2
- export default _default;
@@ -1,6 +0,0 @@
1
- import hljs from "highlight.js";
2
- import { defineNuxtPlugin } from "nuxt/app";
3
- export default defineNuxtPlugin((nuxtApp) => {
4
- nuxtApp.vueApp.provide("hljs", hljs);
5
- nuxtApp.provide("hljs", hljs);
6
- });