|
|
@@ -30,8 +30,10 @@ const keywordsEditor = ref<HTMLInputElement | null>(null);
|
|
|
const keywordsEditing = ref(false);
|
|
|
|
|
|
const fullTitle = ref('');
|
|
|
-
|
|
|
+// 参考文献抽屉组件ref
|
|
|
const referenceDraw = ref<InstanceType<typeof ReferenceDraw> | null>(null);
|
|
|
+// 内容编辑器组件ref
|
|
|
+const contentEditor = ref<InstanceType<typeof ContentEditor> | null>(null)
|
|
|
|
|
|
const emits = defineEmits<{
|
|
|
(e: "update:data", data: Chapter): void;
|
|
|
@@ -99,6 +101,14 @@ function onMenuClick(e: { key: string }) {
|
|
|
function searchReference() {
|
|
|
referenceDraw.value?.show();
|
|
|
}
|
|
|
+
|
|
|
+function onInsert(text: string) {
|
|
|
+ contentEditor.value?.insert(text)
|
|
|
+}
|
|
|
+
|
|
|
+function onReferenceDrawClose() {
|
|
|
+ contentEditor.value?.focus()
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -158,7 +168,7 @@ function searchReference() {
|
|
|
</a-col>
|
|
|
</a-row>
|
|
|
<p v-if="contentEditorVisible">
|
|
|
- <ContentEditor :data="data.content" @change="onContentChange" />
|
|
|
+ <ContentEditor :data="data.content" @change="onContentChange" ref="contentEditor" />
|
|
|
</p>
|
|
|
<div class="chapter-button-group" v-if="contentEditorVisible">
|
|
|
<a-space>
|
|
|
@@ -167,7 +177,7 @@ function searchReference() {
|
|
|
</a-space>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <ReferenceDraw :keywords="data.keywords || []" ref="referenceDraw" />
|
|
|
+ <ReferenceDraw :keywords="data.keywords || []" ref="referenceDraw" @insert="onInsert" @close="onReferenceDrawClose" />
|
|
|
</template>
|
|
|
|
|
|
<style scoped lang="scss">
|