박정하 박정하 04-14
250414 박정하 html 코드가 삽입되지 않은 내용 컬럼 추가
@7fe0424093258a0dd0c7f3288db8ed0ef5ba6874
client/views/component/editor/EditorComponent.vue
--- client/views/component/editor/EditorComponent.vue
+++ client/views/component/editor/EditorComponent.vue
@@ -1,5 +1,5 @@
 <template>
-  <ckeditor v-if="editor && config" :model-value="editorContent" :editor="editor" :config="config" @update:model-value="updateContents" />
+  <ckeditor v-if="editor && config" :model-value="editorContent" :editor="editor" :config="config" @ready="onReady" @update:model-value="updateContents" />
 </template>
 <script>
 /**
@@ -54,11 +54,12 @@
       default: ''
     }
   },
-  emits: ['update:contents'],
+  emits: ['update:contents', 'update:plainContents'],
   data() {
     return {
       isLayoutReady: false,
       editor: ClassicEditor,
+      editorInstance: null,  // 에디터 인스턴스 저장용 변수 추가
     };
   },
   computed: {
@@ -152,8 +153,24 @@
     this.isLayoutReady = true;
   },
   methods: {
+    onReady(editor) {
+      // 에디터가 준비되면 인스턴스 저장
+      this.editorInstance = editor;
+    },
     updateContents(data) {
       this.$emit('update:contents', data);
+
+      // 순수 텍스트 추출 (방법 2)
+      if (this.editorInstance) {
+        const plainText = Array.from(this.editorInstance.model.document.getRoot().getChildren())
+          .map(rootChild => this.editorInstance.data.processor.toData(
+            this.editorInstance.editing.mapper.toViewElement(rootChild)
+          ))
+          .join('\n')
+          .replace(/<[^>]*>?/gm, '');
+
+        this.$emit('update:plainContents', plainText);
+      }
     }
   }
 };
client/views/pages/bbsDcry/photo/PicHistoryInsert.vue
--- client/views/pages/bbsDcry/photo/PicHistoryInsert.vue
+++ client/views/pages/bbsDcry/photo/PicHistoryInsert.vue
@@ -33,7 +33,7 @@
         <dd>
           <label for="text">내용</label>
           <div class="wfull">
-            <EditorComponent v-model:contents="requestDTO.cn" />
+            <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" />
           </div>
         </dd>
         <div class="hr"></div>
@@ -160,6 +160,7 @@
         dcryId: null,
         sj: null,
         cn: null,
+        searchCn: null,
         adres: null,
         prdctnYear: null,
         ty: 'P',
@@ -410,6 +411,9 @@
 
         if (!this.$isEmpty(this.requestDTO.cn)) {
           formData.append('cn', this.requestDTO.cn);
+          if (!this.$isEmpty(this.requestDTO.searchCn)) {
+            formData.append('searchCn', this.requestDTO.searchCn);
+          }
         }
 
         // 파일 아이디
client/views/pages/bbsDcry/video/VideoHistoryInsert.vue
--- client/views/pages/bbsDcry/video/VideoHistoryInsert.vue
+++ client/views/pages/bbsDcry/video/VideoHistoryInsert.vue
@@ -32,7 +32,7 @@
         <dd>
           <label for="text">내용</label>
           <div class="wfull">
-            <EditorComponent v-model:contents="requestDTO.cn" />
+            <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" />
           </div>
         </dd>
         <div class="hr"></div>
@@ -141,6 +141,7 @@
         dcryId: null,
         sj: null,
         cn: null,
+        searchCn: null,
         adres: null,
         prdctnYear: null,
         ty: 'V',
@@ -340,6 +341,9 @@
 
         if (!this.$isEmpty(this.requestDTO.cn)) {
           formData.append('cn', this.requestDTO.cn);
+          if (!this.$isEmpty(this.requestDTO.searchCn)) {
+            formData.append('searchCn', this.requestDTO.searchCn);
+          }
         }
 
         // 파일 아이디
client/views/pages/bbsMediaVido/MediaVideoInsert.vue
--- client/views/pages/bbsMediaVido/MediaVideoInsert.vue
+++ client/views/pages/bbsMediaVido/MediaVideoInsert.vue
@@ -36,7 +36,7 @@
         <dd>
           <label for="text">내용</label>
           <div class="wfull">
-            <EditorComponent v-model:contents="requestDTO.cn" />
+            <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" />
           </div>
         </dd>
         <div class="hr"></div>
@@ -96,6 +96,7 @@
         mediaVidoId: null, // 미디어영상 아이디
         sj: null, // 제목
         cn: null, // 내용
+        searchCn: null,
         link: null, // 주소
         prdctnYear: null, // 생산연도
         ctgryIds: [], // 카테고리 정보
client/views/pages/bbsNesDta/NewsReleaseInsert.vue
--- client/views/pages/bbsNesDta/NewsReleaseInsert.vue
+++ client/views/pages/bbsNesDta/NewsReleaseInsert.vue
@@ -33,7 +33,7 @@
         <dd>
           <label for="text">내용</label>
           <div class="wfull">
-            <EditorComponent v-model:contents="requestDTO.cn" />
+            <EditorComponent v-model:contents="requestDTO.cn" v-model:plainContents="requestDTO.searchCn" />
           </div>
         </dd>
         <div class="hr"></div>
@@ -136,6 +136,7 @@
         nesDtaId: null,
         sj: null,
         cn: null,
+        searchCn: null,
         link: null,
         prdctnYear: null,
         fileId: null,
@@ -320,6 +321,9 @@
 
         if (!this.$isEmpty(this.requestDTO.cn)) {
           formData.append('cn', this.requestDTO.cn);
+          if (!this.$isEmpty(this.requestDTO.searchCn)) {
+            formData.append('searchCn', this.requestDTO.searchCn);
+          }
         }
 
         // 파일 아이디
Add a comment
List