
--- client/views/component/editor/EditorComponent.vue
+++ client/views/component/editor/EditorComponent.vue
... | ... | @@ -1,5 +1,5 @@ |
1 | 1 |
<template> |
2 |
- <ckeditor v-if="editor && config" :model-value="editorContent" :editor="editor" :config="config" @update:model-value="updateContents" /> |
|
2 |
+ <ckeditor v-if="editor && config" :model-value="editorContent" :editor="editor" :config="config" @ready="onReady" @update:model-value="updateContents" /> |
|
3 | 3 |
</template> |
4 | 4 |
<script> |
5 | 5 |
/** |
... | ... | @@ -54,11 +54,12 @@ |
54 | 54 |
default: '' |
55 | 55 |
} |
56 | 56 |
}, |
57 |
- emits: ['update:contents'], |
|
57 |
+ emits: ['update:contents', 'update:plainContents'], |
|
58 | 58 |
data() { |
59 | 59 |
return { |
60 | 60 |
isLayoutReady: false, |
61 | 61 |
editor: ClassicEditor, |
62 |
+ editorInstance: null, // 에디터 인스턴스 저장용 변수 추가 |
|
62 | 63 |
}; |
63 | 64 |
}, |
64 | 65 |
computed: { |
... | ... | @@ -152,8 +153,24 @@ |
152 | 153 |
this.isLayoutReady = true; |
153 | 154 |
}, |
154 | 155 |
methods: { |
156 |
+ onReady(editor) { |
|
157 |
+ // 에디터가 준비되면 인스턴스 저장 |
|
158 |
+ this.editorInstance = editor; |
|
159 |
+ }, |
|
155 | 160 |
updateContents(data) { |
156 | 161 |
this.$emit('update:contents', data); |
162 |
+ |
|
163 |
+ // 순수 텍스트 추출 (방법 2) |
|
164 |
+ if (this.editorInstance) { |
|
165 |
+ const plainText = Array.from(this.editorInstance.model.document.getRoot().getChildren()) |
|
166 |
+ .map(rootChild => this.editorInstance.data.processor.toData( |
|
167 |
+ this.editorInstance.editing.mapper.toViewElement(rootChild) |
|
168 |
+ )) |
|
169 |
+ .join('\n') |
|
170 |
+ .replace(/<[^>]*>?/gm, ''); |
|
171 |
+ |
|
172 |
+ this.$emit('update:plainContents', plainText); |
|
173 |
+ } |
|
157 | 174 |
} |
158 | 175 |
} |
159 | 176 |
}; |
--- client/views/pages/bbsDcry/photo/PicHistoryInsert.vue
+++ client/views/pages/bbsDcry/photo/PicHistoryInsert.vue
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 |
<dd> |
34 | 34 |
<label for="text">내용</label> |
35 | 35 |
<div class="wfull"> |
36 |
- <EditorComponent v-model:contents="requestDTO.cn" /> |
|
36 |
+ <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" /> |
|
37 | 37 |
</div> |
38 | 38 |
</dd> |
39 | 39 |
<div class="hr"></div> |
... | ... | @@ -160,6 +160,7 @@ |
160 | 160 |
dcryId: null, |
161 | 161 |
sj: null, |
162 | 162 |
cn: null, |
163 |
+ searchCn: null, |
|
163 | 164 |
adres: null, |
164 | 165 |
prdctnYear: null, |
165 | 166 |
ty: 'P', |
... | ... | @@ -410,6 +411,9 @@ |
410 | 411 |
|
411 | 412 |
if (!this.$isEmpty(this.requestDTO.cn)) { |
412 | 413 |
formData.append('cn', this.requestDTO.cn); |
414 |
+ if (!this.$isEmpty(this.requestDTO.searchCn)) { |
|
415 |
+ formData.append('searchCn', this.requestDTO.searchCn); |
|
416 |
+ } |
|
413 | 417 |
} |
414 | 418 |
|
415 | 419 |
// 파일 아이디 |
--- client/views/pages/bbsDcry/video/VideoHistoryInsert.vue
+++ client/views/pages/bbsDcry/video/VideoHistoryInsert.vue
... | ... | @@ -32,7 +32,7 @@ |
32 | 32 |
<dd> |
33 | 33 |
<label for="text">내용</label> |
34 | 34 |
<div class="wfull"> |
35 |
- <EditorComponent v-model:contents="requestDTO.cn" /> |
|
35 |
+ <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" /> |
|
36 | 36 |
</div> |
37 | 37 |
</dd> |
38 | 38 |
<div class="hr"></div> |
... | ... | @@ -141,6 +141,7 @@ |
141 | 141 |
dcryId: null, |
142 | 142 |
sj: null, |
143 | 143 |
cn: null, |
144 |
+ searchCn: null, |
|
144 | 145 |
adres: null, |
145 | 146 |
prdctnYear: null, |
146 | 147 |
ty: 'V', |
... | ... | @@ -340,6 +341,9 @@ |
340 | 341 |
|
341 | 342 |
if (!this.$isEmpty(this.requestDTO.cn)) { |
342 | 343 |
formData.append('cn', this.requestDTO.cn); |
344 |
+ if (!this.$isEmpty(this.requestDTO.searchCn)) { |
|
345 |
+ formData.append('searchCn', this.requestDTO.searchCn); |
|
346 |
+ } |
|
343 | 347 |
} |
344 | 348 |
|
345 | 349 |
// 파일 아이디 |
--- client/views/pages/bbsMediaVido/MediaVideoInsert.vue
+++ client/views/pages/bbsMediaVido/MediaVideoInsert.vue
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 |
<dd> |
37 | 37 |
<label for="text">내용</label> |
38 | 38 |
<div class="wfull"> |
39 |
- <EditorComponent v-model:contents="requestDTO.cn" /> |
|
39 |
+ <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" /> |
|
40 | 40 |
</div> |
41 | 41 |
</dd> |
42 | 42 |
<div class="hr"></div> |
... | ... | @@ -96,6 +96,7 @@ |
96 | 96 |
mediaVidoId: null, // 미디어영상 아이디 |
97 | 97 |
sj: null, // 제목 |
98 | 98 |
cn: null, // 내용 |
99 |
+ searchCn: null, |
|
99 | 100 |
link: null, // 주소 |
100 | 101 |
prdctnYear: null, // 생산연도 |
101 | 102 |
ctgryIds: [], // 카테고리 정보 |
--- client/views/pages/bbsNesDta/NewsReleaseInsert.vue
+++ client/views/pages/bbsNesDta/NewsReleaseInsert.vue
... | ... | @@ -33,7 +33,7 @@ |
33 | 33 |
<dd> |
34 | 34 |
<label for="text">내용</label> |
35 | 35 |
<div class="wfull"> |
36 |
- <EditorComponent v-model:contents="requestDTO.cn" /> |
|
36 |
+ <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" /> |
|
37 | 37 |
</div> |
38 | 38 |
</dd> |
39 | 39 |
<div class="hr"></div> |
... | ... | @@ -136,6 +136,7 @@ |
136 | 136 |
nesDtaId: null, |
137 | 137 |
sj: null, |
138 | 138 |
cn: null, |
139 |
+ searchCn: null, |
|
139 | 140 |
link: null, |
140 | 141 |
prdctnYear: null, |
141 | 142 |
fileId: null, |
... | ... | @@ -320,6 +321,9 @@ |
320 | 321 |
|
321 | 322 |
if (!this.$isEmpty(this.requestDTO.cn)) { |
322 | 323 |
formData.append('cn', this.requestDTO.cn); |
324 |
+ if (!this.$isEmpty(this.requestDTO.searchCn)) { |
|
325 |
+ formData.append('searchCn', this.requestDTO.searchCn); |
|
326 |
+ } |
|
323 | 327 |
} |
324 | 328 |
|
325 | 329 |
// 파일 아이디 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?