dragon-editor 2.1.2 → 3.0.0

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.
Files changed (58) hide show
  1. package/README.md +82 -96
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +10 -12
  4. package/dist/runtime/components/DragonEditor.vue +457 -0
  5. package/dist/runtime/components/DragonEditorViewer.vue +228 -0
  6. package/dist/runtime/plugin.d.ts +2 -0
  7. package/dist/runtime/plugin.mjs +10 -0
  8. package/dist/runtime/scss/editor.css +261 -0
  9. package/dist/runtime/scss/viewer.css +198 -0
  10. package/dist/runtime/store.d.ts +7 -0
  11. package/dist/runtime/store.mjs +27 -0
  12. package/dist/runtime/type.d.ts +24 -0
  13. package/dist/runtime/utils/block.d.ts +9 -0
  14. package/dist/runtime/utils/block.mjs +70 -0
  15. package/dist/runtime/utils/convertor.d.ts +2 -0
  16. package/dist/runtime/utils/convertor.mjs +86 -0
  17. package/dist/runtime/utils/cursor.d.ts +6 -0
  18. package/dist/runtime/utils/cursor.mjs +132 -0
  19. package/dist/runtime/utils/element.d.ts +3 -0
  20. package/dist/runtime/utils/element.mjs +39 -0
  21. package/dist/runtime/utils/keyboardEvent.d.ts +10 -0
  22. package/dist/runtime/utils/keyboardEvent.mjs +781 -0
  23. package/dist/runtime/utils/style.d.ts +1 -0
  24. package/dist/runtime/utils/style.mjs +330 -0
  25. package/dist/runtime/utils/ui.d.ts +1 -0
  26. package/dist/runtime/utils/ui.mjs +35 -0
  27. package/package.json +10 -4
  28. package/README_en.md +0 -30
  29. package/dist/runtime/core/components/SvgIcon.d.ts +0 -10
  30. package/dist/runtime/core/components/SvgIcon.mjs +0 -98
  31. package/dist/runtime/core/components/editor/ImageBlock.vue +0 -175
  32. package/dist/runtime/core/components/editor/OlBlock.vue +0 -162
  33. package/dist/runtime/core/components/editor/TextBlock.vue +0 -172
  34. package/dist/runtime/core/components/editor/UlBlock.vue +0 -162
  35. package/dist/runtime/core/style/common.css +0 -496
  36. package/dist/runtime/core/style/viewer.css +0 -205
  37. package/dist/runtime/core/utils/converter.d.ts +0 -2
  38. package/dist/runtime/core/utils/converter.mjs +0 -90
  39. package/dist/runtime/core/utils/cursor.d.ts +0 -4
  40. package/dist/runtime/core/utils/cursor.mjs +0 -84
  41. package/dist/runtime/core/utils/element.d.ts +0 -3
  42. package/dist/runtime/core/utils/element.mjs +0 -40
  43. package/dist/runtime/core/utils/global.d.ts +0 -3
  44. package/dist/runtime/core/utils/global.mjs +0 -81
  45. package/dist/runtime/core/utils/index.d.ts +0 -7
  46. package/dist/runtime/core/utils/index.mjs +0 -7
  47. package/dist/runtime/core/utils/keyboard.d.ts +0 -6
  48. package/dist/runtime/core/utils/keyboard.mjs +0 -565
  49. package/dist/runtime/core/utils/style.d.ts +0 -6
  50. package/dist/runtime/core/utils/style.mjs +0 -374
  51. package/dist/runtime/core/utils/ui.d.ts +0 -4
  52. package/dist/runtime/core/utils/ui.mjs +0 -13
  53. package/dist/runtime/shared/components/DragonEditor.vue +0 -695
  54. package/dist/runtime/shared/components/DragonEditorComment.vue +0 -172
  55. package/dist/runtime/shared/components/DragonEditorNew.d.ts +0 -16
  56. package/dist/runtime/shared/components/DragonEditorNew.mjs +0 -62
  57. package/dist/runtime/shared/components/DragonEditorViewer.d.ts +0 -14
  58. package/dist/runtime/shared/components/DragonEditorViewer.mjs +0 -15
package/README.md CHANGED
@@ -8,142 +8,128 @@
8
8
  [language-href]: https://github.com/lovefields/dragonEditor/
9
9
  [hits-src]: https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fgithub.com%2Flovefields%2FdragonEditor&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false
10
10
  [hits-href]: https://hits.seeyoufarm.com
11
- [npm-version-src]: https://img.shields.io/npm/v/my-module/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
11
+ [npm-version-src]: https://img.shields.io/npm/v/dragon-editor/latest.svg?style=flat&colorA=18181B&colorB=28CF8D
12
12
  [npm-version-href]: https://www.npmjs.com/package/dragon-editor
13
- [npm-downloads-src]: https://img.shields.io/npm/dm/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
13
+ [npm-downloads-src]: https://img.shields.io/npm/dm/dragon-editor.svg?style=flat&colorA=18181B&colorB=28CF8D
14
14
  [npm-downloads-href]: https://www.npmjs.com/package/dragon-editor
15
- [license-src]: https://img.shields.io/npm/l/my-module.svg?style=flat&colorA=18181B&colorB=28CF8D
16
- [license-href]: https://www.npmjs.com/package/dragon-editor
15
+ [license-src]: https://img.shields.io/npm/l/dragon-editor
17
16
  [nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js
18
17
  [nuxt-href]: https://nuxt.com
19
- [readme-ko]: https://github.com/lovefields/dragonEditor/blob/main/README.md
20
- [readme-en]: https://github.com/lovefields/dragonEditor/blob/main/README_en.md
21
-
22
- [![Github stars](stars-src)](stars-href)
23
- [![Github issues](issues-src)](issues-href)
24
- [![Github forks](forks-src)](forks-href)
25
- [![Github top language](language-src)](language-href)
26
- [![Hits](hits-src)](hits-href)
27
- [![npm version][npm-version-src]][npm-version-href]
28
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
29
- [![License][license-src]][license-href]
30
- [![Nuxt][nuxt-src]][nuxt-href]
31
18
 
32
- [KO](readme-ko) / [EN](readme-en)
19
+ [![stars-src]](stars-href)
20
+ [![forks-src]](forks-href)
21
+ [![language-src]](language-href)
22
+ [![hits-src]](hits-href)
23
+ [![issues-src]](issues-href)
24
+ [![npm-version-src]][npm-version-href]
25
+ [![npm-downloads-src]][npm-downloads-href]
26
+ ![NPM][license-src]
27
+ [![Nuxt][nuxt-src]][nuxt-href]
33
28
 
34
29
  # DragonEditor
35
30
 
36
- 드래곤 에디터는 그냥 블로그에 이지윅 에디터가 필요해서 만들었습니다.<br>
37
- 커스터마이징이 가능하며 Nuxt.js만 지원합니다.
31
+ I just made the DragonEditor because I needed the WYSIWYG Editor to write on my [blog](https://dico.me).
38
32
 
39
- ## 사용법
33
+ This module support Nuxt3 only.
40
34
 
41
- ### 에디터
35
+ # Dependencies
42
36
 
43
- ```vue
44
- <tempalte>
45
- <DragonEditor v-model="contentData" :option="option" ref="editor" />
46
- </tempalte>
37
+ - @pinia/nuxt
47
38
 
48
- <script setup lang="ts">
49
- const editor = ref();
50
- const contentData = ref([]);
51
- const option = ref({}); // 선택사항
52
- </script>
39
+ ## Install
40
+
41
+ ```shell
42
+ mpm i dragon-edtior
43
+ # or
44
+ yarn add dragon-editor
45
+ # or
46
+ bun add dragon-editor
53
47
  ```
54
48
 
55
- #### 컴포넌트 명령어
49
+ ## Using
56
50
 
57
- 1. 이미지 삽입
51
+ First. Set module
58
52
 
59
53
  ```typescript
60
- editor.value.addImageBlock({
61
- src: string;
62
- width: number;
63
- height: number;
64
- webp: boolean;
54
+ export default defineNuxtConfig({
55
+ modules: ["dragon-editor"],
65
56
  });
66
57
  ```
67
58
 
68
- 2. 저장
59
+ Second. Use Component
69
60
 
70
- ```typescript
71
- editor.value.updateBlockData();
72
- // do save
73
- ```
74
-
75
- ### 코멘트
76
-
77
- ```vue
78
- <tempalte>
79
- <DragonEditorComment v-model="commentData" ref="editor" />
80
- </tempalte>
61
+ ```html
62
+ <template>
63
+ <div class="editor-area">
64
+ <ClientOnly>
65
+ <DragonEditor ref="$editor" />
66
+ </ClientOnly>
67
+ </div>
68
+ </template>
81
69
 
82
70
  <script setup lang="ts">
83
- const editor = ref();
84
- const commentData = ref({
85
- classList: [],
86
- content: "",
87
- });
71
+ const $editor = ref<any>();
88
72
  </script>
89
73
  ```
90
74
 
91
- #### 컴포넌트 명령어
75
+ Done!
92
76
 
93
- 1. 스타일 설정
77
+ ## View Page
94
78
 
95
- 스타일의 경우 컴포넌트에서 다음과 같이 명령어를 사용할 수 있습니다.<br>
96
- 해당되는 스타일이 존재하지 않을 경우 클레스에 값을 부여합니다.
79
+ ```html
80
+ <template>
81
+ <div class="view-area">
82
+ <DragonEditorViewer :content="data" />
83
+ </div>
84
+ </template>
97
85
 
98
- ```typescript
99
- editor.value.setStyles("decorationBold");
86
+ <script setup lang="ts">
87
+ const data = ref([]); // content data
88
+ </script>
100
89
  ```
101
90
 
102
- 2. 스타일 리스트
91
+ ## Method
103
92
 
104
- - `alignLeft` : 왼쪽 정렬
105
- - `alignCenter` : 가운데 정렬
106
- - `alignRight` : 오른쪽 정렬
107
- - `decorationBold` : 볼드
108
- - `decorationItalic` : 이텔릭
109
- - `decorationUnderline` : 밑줄
110
- - `decorationStrikethrough` : 취소선
93
+ ### getContentData
111
94
 
112
- 2. 저장
95
+ ```html
96
+ <template>
97
+ <div class="editor-area">
98
+ <ClientOnly>
99
+ <DragonEditor ref="$editor" />
100
+ </ClientOnly>
101
+ <button @click="getData()">Get Data</button>
102
+ </div>
103
+ </template>
113
104
 
114
- ```typescript
115
- editor.value.updateBlockData();
116
- // do save
117
- ```
118
-
119
- 3. 포커스
105
+ <script setup lang="ts">
106
+ const $editor = ref<any>();
120
107
 
121
- ```typescript
122
- editor.value.focus();
108
+ function getData() {
109
+ console.log($editor.value.getContentData());
110
+ }
111
+ </script>
123
112
  ```
124
113
 
125
- ### Viewer
114
+ ### setContentData
126
115
 
127
- ```vue
128
- <tempalte>
129
- <DragonEditorViewer :content="contentData"/>
130
- </tempalte>
116
+ ```html
117
+ <template>
118
+ <div class="editor-area">
119
+ <ClientOnly>
120
+ <DragonEditor ref="$editor" />
121
+ </ClientOnly>
122
+ <button @click="setData()">Set Data</button>
123
+ </div>
124
+ </template>
131
125
 
132
126
  <script setup lang="ts">
133
- const contentData = ref([]); // Save Data for Editor
127
+ const $editor = ref<any>();
128
+
129
+ function setData() {
130
+ $editor.value.getContentData([...]);
131
+ }
134
132
  </script>
135
133
  ```
136
134
 
137
- #### Props
138
-
139
- - content : This props is must be Array in Editor data.
140
- - mediaURL (Option) : This props is pre URL in Media.
141
-
142
-
143
- <!-- ## 데모 페이지
144
-
145
- [Demo page](https://lovefields.github.io/dragonEditor/examples)
146
-
147
- ## 문서
148
-
149
- - [DragonEditor Document](https://lovefields.github.io/dragonEditor-doc/) -->
135
+ <!-- More information is here [Document](123) -->
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "dragon-editor",
3
3
  "configKey": "dragon-editor",
4
- "version": "2.1.2"
4
+ "version": "3.0.0"
5
5
  }
package/dist/module.mjs CHANGED
@@ -1,27 +1,25 @@
1
- import { defineNuxtModule, createResolver, addComponent } from '@nuxt/kit';
1
+ import { defineNuxtModule, createResolver, addComponent, addTypeTemplate, installModule } from '@nuxt/kit';
2
2
 
3
3
  const module = defineNuxtModule({
4
4
  meta: {
5
5
  name: "dragon-editor"
6
6
  },
7
- setup(options, nuxt) {
7
+ async setup(options, nuxt) {
8
8
  const resolver = createResolver(import.meta.url);
9
9
  addComponent({
10
10
  name: "DragonEditor",
11
- filePath: resolver.resolve("./runtime/shared/components/DragonEditor")
12
- });
13
- addComponent({
14
- name: "DragonEditorNew",
15
- filePath: resolver.resolve("./runtime/shared/components/DragonEditorNew")
16
- });
17
- addComponent({
18
- name: "DragonEditorComment",
19
- filePath: resolver.resolve("./runtime/shared/components/DragonEditorComment")
11
+ filePath: resolver.resolve("./runtime/components/DragonEditor")
20
12
  });
21
13
  addComponent({
22
14
  name: "DragonEditorViewer",
23
- filePath: resolver.resolve("./runtime/shared/components/DragonEditorViewer")
15
+ filePath: resolver.resolve("./runtime/components/DragonEditorViewer")
16
+ });
17
+ addTypeTemplate({
18
+ filename: "types/dragonEditor.d.ts",
19
+ src: resolver.resolve("./runtime/type.d.ts"),
20
+ write: true
24
21
  });
22
+ await installModule("@pinia/nuxt");
25
23
  }
26
24
  });
27
25