|
|
@@ -25,6 +25,12 @@ const titleEditor = ref<HTMLInputElement | null>(null);
|
|
|
|
|
|
const titleEditing = ref(false);
|
|
|
|
|
|
+const keywordsInChapter = ref<string[]>([])
|
|
|
+
|
|
|
+const keywordsEditor = ref<HTMLInputElement | null>(null);
|
|
|
+
|
|
|
+const keywordsEditing = ref(false);
|
|
|
+
|
|
|
const fullTitle = ref('');
|
|
|
|
|
|
const referenceDraw = ref<InstanceType<typeof ReferenceDraw> | null>(null);
|
|
|
@@ -49,16 +55,31 @@ function onEditTitle() {
|
|
|
titleEditing.value = true;
|
|
|
}
|
|
|
|
|
|
+function onEditKeywords() {
|
|
|
+ keywordsInChapter.value = props.data.keywords;
|
|
|
+ keywordsEditing.value = true;
|
|
|
+}
|
|
|
+
|
|
|
function onTitleChange() {
|
|
|
titleEditing.value = false;
|
|
|
emits("change", {...props.data, title: fullTitle.value})
|
|
|
}
|
|
|
|
|
|
+function onKeywordsChange() {
|
|
|
+ keywordsEditing.value = false;
|
|
|
+ emits("change", {...props.data, keywords: keywordsInChapter.value.split(",")})
|
|
|
+}
|
|
|
+
|
|
|
function onTitleChangeCancel() {
|
|
|
fullTitle.value = props.data.title;
|
|
|
titleEditing.value = false;
|
|
|
}
|
|
|
|
|
|
+function onKeywordsChangeCancel(){
|
|
|
+ keywordsInChapter.value = props.data.keywords;
|
|
|
+ keywordsEditing.value = false;
|
|
|
+}
|
|
|
+
|
|
|
function onContentChange(value: string) {
|
|
|
emits("change", {...props.data, content: value});
|
|
|
}
|
|
|
@@ -87,6 +108,7 @@ function searchReference() {
|
|
|
<a-row type="flex" justify="space-between">
|
|
|
<a-col>
|
|
|
<a-space>
|
|
|
+ <label>关键词:</label>
|
|
|
<a-input
|
|
|
v-if="titleEditing"
|
|
|
v-model:value="fullTitle"
|
|
|
@@ -96,10 +118,24 @@ function searchReference() {
|
|
|
ref="titleEditor"
|
|
|
class="title-editor"
|
|
|
/>
|
|
|
+
|
|
|
<h1 v-else>
|
|
|
<span>{{ data.fullTitle }}</span>
|
|
|
</h1>
|
|
|
<a-button type="text" @click="onEditTitle" class="edit-btn"><edit-outlined /></a-button>
|
|
|
+ <a-input
|
|
|
+ v-if="keywordsEditing"
|
|
|
+ v-model:value="keywordsInChapter"
|
|
|
+ @blur="onKeywordsChange"
|
|
|
+ @pressEnter="onKeywordsChange"
|
|
|
+ @keyup.esc="onKeywordsChangeCancel"
|
|
|
+ ref="keywordsEditor"
|
|
|
+ class="keywords-editor"
|
|
|
+ />
|
|
|
+ <h2 v-else-if="data.chapterType=='USER_DEFINED'">
|
|
|
+ 关键词:<span>{{data.keywords}}</span>
|
|
|
+ </h2>
|
|
|
+ <a-button v-if="data.chapterType=='USER_DEFINED'" type="text" @click="onEditKeywords" class="edit-btn"><edit-outlined /></a-button>
|
|
|
</a-space>
|
|
|
</a-col>
|
|
|
<a-col>
|