용어집 수정사항 없을떄 저장 x
This commit is contained in:
parent
d792253292
commit
c4b40dea79
@ -51,7 +51,7 @@
|
||||
<div>
|
||||
<QEditor class="" @keyup="ValidHandler('content')" @update:data="handleContentUpdate" @update:imageUrls="imageUrls = $event" :is-alert="wordContentAlert" :initialData="contentValue"/>
|
||||
<div class="text-end mt-5">
|
||||
<button class="btn btn-primary" @click="saveWord" :disabled="titleValue ? !changed : false" >
|
||||
<button class="btn btn-primary" @click="saveWord" :disabled="titleValue ? !changed : false">
|
||||
<i class="bx bx-check"></i>
|
||||
</button>
|
||||
</div>
|
||||
@ -150,6 +150,16 @@ const ValidHandler = (field) => {
|
||||
}
|
||||
const handleContentUpdate = (newContent) => {
|
||||
content.value = newContent;
|
||||
|
||||
const oldContent = typeof props.contentValue === 'string'? JSON.parse(props.contentValue) : props.contentValue;
|
||||
const newContentOps = newContent?.ops || [];
|
||||
|
||||
const oldContentJson = JSON.stringify(oldContent);
|
||||
const newContentJson = JSON.stringify(newContentOps);
|
||||
|
||||
// 기존 데이터와 새 데이터가 다를 경우 changed = true;
|
||||
changed.value = oldContentJson !== newContentJson;
|
||||
|
||||
ValidHandler("content"); // 유효성 검사 실행
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user