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.
- package/README.md +82 -96
- package/dist/module.json +1 -1
- package/dist/module.mjs +10 -12
- package/dist/runtime/components/DragonEditor.vue +457 -0
- package/dist/runtime/components/DragonEditorViewer.vue +228 -0
- package/dist/runtime/plugin.d.ts +2 -0
- package/dist/runtime/plugin.mjs +10 -0
- package/dist/runtime/scss/editor.css +261 -0
- package/dist/runtime/scss/viewer.css +198 -0
- package/dist/runtime/store.d.ts +7 -0
- package/dist/runtime/store.mjs +27 -0
- package/dist/runtime/type.d.ts +24 -0
- package/dist/runtime/utils/block.d.ts +9 -0
- package/dist/runtime/utils/block.mjs +70 -0
- package/dist/runtime/utils/convertor.d.ts +2 -0
- package/dist/runtime/utils/convertor.mjs +86 -0
- package/dist/runtime/utils/cursor.d.ts +6 -0
- package/dist/runtime/utils/cursor.mjs +132 -0
- package/dist/runtime/utils/element.d.ts +3 -0
- package/dist/runtime/utils/element.mjs +39 -0
- package/dist/runtime/utils/keyboardEvent.d.ts +10 -0
- package/dist/runtime/utils/keyboardEvent.mjs +781 -0
- package/dist/runtime/utils/style.d.ts +1 -0
- package/dist/runtime/utils/style.mjs +330 -0
- package/dist/runtime/utils/ui.d.ts +1 -0
- package/dist/runtime/utils/ui.mjs +35 -0
- package/package.json +10 -4
- package/README_en.md +0 -30
- package/dist/runtime/core/components/SvgIcon.d.ts +0 -10
- package/dist/runtime/core/components/SvgIcon.mjs +0 -98
- package/dist/runtime/core/components/editor/ImageBlock.vue +0 -175
- package/dist/runtime/core/components/editor/OlBlock.vue +0 -162
- package/dist/runtime/core/components/editor/TextBlock.vue +0 -172
- package/dist/runtime/core/components/editor/UlBlock.vue +0 -162
- package/dist/runtime/core/style/common.css +0 -496
- package/dist/runtime/core/style/viewer.css +0 -205
- package/dist/runtime/core/utils/converter.d.ts +0 -2
- package/dist/runtime/core/utils/converter.mjs +0 -90
- package/dist/runtime/core/utils/cursor.d.ts +0 -4
- package/dist/runtime/core/utils/cursor.mjs +0 -84
- package/dist/runtime/core/utils/element.d.ts +0 -3
- package/dist/runtime/core/utils/element.mjs +0 -40
- package/dist/runtime/core/utils/global.d.ts +0 -3
- package/dist/runtime/core/utils/global.mjs +0 -81
- package/dist/runtime/core/utils/index.d.ts +0 -7
- package/dist/runtime/core/utils/index.mjs +0 -7
- package/dist/runtime/core/utils/keyboard.d.ts +0 -6
- package/dist/runtime/core/utils/keyboard.mjs +0 -565
- package/dist/runtime/core/utils/style.d.ts +0 -6
- package/dist/runtime/core/utils/style.mjs +0 -374
- package/dist/runtime/core/utils/ui.d.ts +0 -4
- package/dist/runtime/core/utils/ui.mjs +0 -13
- package/dist/runtime/shared/components/DragonEditor.vue +0 -695
- package/dist/runtime/shared/components/DragonEditorComment.vue +0 -172
- package/dist/runtime/shared/components/DragonEditorNew.d.ts +0 -16
- package/dist/runtime/shared/components/DragonEditorNew.mjs +0 -62
- package/dist/runtime/shared/components/DragonEditorViewer.d.ts +0 -14
- 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/
|
|
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/
|
|
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/
|
|
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
|
-
[](stars-href)
|
|
23
|
-
[](issues-href)
|
|
24
|
-
[](forks-href)
|
|
25
|
-
[](language-href)
|
|
26
|
-
[](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
|
-
[
|
|
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
|
-
|
|
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
|
-
|
|
44
|
-
<tempalte>
|
|
45
|
-
<DragonEditor v-model="contentData" :option="option" ref="editor" />
|
|
46
|
-
</tempalte>
|
|
37
|
+
- @pinia/nuxt
|
|
47
38
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
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
|
-
|
|
51
|
+
First. Set module
|
|
58
52
|
|
|
59
53
|
```typescript
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
width: number;
|
|
63
|
-
height: number;
|
|
64
|
-
webp: boolean;
|
|
54
|
+
export default defineNuxtConfig({
|
|
55
|
+
modules: ["dragon-editor"],
|
|
65
56
|
});
|
|
66
57
|
```
|
|
67
58
|
|
|
68
|
-
|
|
59
|
+
Second. Use Component
|
|
69
60
|
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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
|
-
|
|
77
|
+
## View Page
|
|
94
78
|
|
|
95
|
-
|
|
96
|
-
|
|
79
|
+
```html
|
|
80
|
+
<template>
|
|
81
|
+
<div class="view-area">
|
|
82
|
+
<DragonEditorViewer :content="data" />
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
97
85
|
|
|
98
|
-
|
|
99
|
-
|
|
86
|
+
<script setup lang="ts">
|
|
87
|
+
const data = ref([]); // content data
|
|
88
|
+
</script>
|
|
100
89
|
```
|
|
101
90
|
|
|
102
|
-
|
|
91
|
+
## Method
|
|
103
92
|
|
|
104
|
-
|
|
105
|
-
- `alignCenter` : 가운데 정렬
|
|
106
|
-
- `alignRight` : 오른쪽 정렬
|
|
107
|
-
- `decorationBold` : 볼드
|
|
108
|
-
- `decorationItalic` : 이텔릭
|
|
109
|
-
- `decorationUnderline` : 밑줄
|
|
110
|
-
- `decorationStrikethrough` : 취소선
|
|
93
|
+
### getContentData
|
|
111
94
|
|
|
112
|
-
|
|
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
|
-
|
|
115
|
-
editor
|
|
116
|
-
// do save
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
3. 포커스
|
|
105
|
+
<script setup lang="ts">
|
|
106
|
+
const $editor = ref<any>();
|
|
120
107
|
|
|
121
|
-
|
|
122
|
-
editor.value.
|
|
108
|
+
function getData() {
|
|
109
|
+
console.log($editor.value.getContentData());
|
|
110
|
+
}
|
|
111
|
+
</script>
|
|
123
112
|
```
|
|
124
113
|
|
|
125
|
-
###
|
|
114
|
+
### setContentData
|
|
126
115
|
|
|
127
|
-
```
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
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
|
|
127
|
+
const $editor = ref<any>();
|
|
128
|
+
|
|
129
|
+
function setData() {
|
|
130
|
+
$editor.value.getContentData([...]);
|
|
131
|
+
}
|
|
134
132
|
</script>
|
|
135
133
|
```
|
|
136
134
|
|
|
137
|
-
|
|
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
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/
|
|
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/
|
|
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
|
|