Commit f9bb6cc4 authored by tyyin lan's avatar tyyin lan

chore(编辑器): 多语言补充

parent 896134e7
<script setup lang="ts"> <script setup lang="ts">
import { useI18n } from 'vue-i18n'
import { type ToolbarAllConfig } from './config/editor-toolbar-config' import { type ToolbarAllConfig } from './config/editor-toolbar-config'
interface Props { interface Props {
...@@ -13,6 +14,8 @@ const emit = defineEmits<{ ...@@ -13,6 +14,8 @@ const emit = defineEmits<{
onSubmenuCmdClick: [toolItemChildCmd: NonNullable<ToolbarAllConfig['key']['submenuCmd']>[0]] onSubmenuCmdClick: [toolItemChildCmd: NonNullable<ToolbarAllConfig['key']['submenuCmd']>[0]]
}>() }>()
const { t } = useI18n()
function handleExecuteCommand(toolItem: ToolbarAllConfig['key']) { function handleExecuteCommand(toolItem: ToolbarAllConfig['key']) {
emit('onExecuteCommand', toolItem) emit('onExecuteCommand', toolItem)
} }
...@@ -92,12 +95,12 @@ function handleSubmenuCmdClick(toolItemChildCmd: NonNullable<ToolbarAllConfig['k ...@@ -92,12 +95,12 @@ function handleSubmenuCmdClick(toolItemChildCmd: NonNullable<ToolbarAllConfig['k
@mouseenter="handleToolItemMouseenter(toolItem)" @mouseenter="handleToolItemMouseenter(toolItem)"
@mouseleave="handleToolItemMouseleave(toolItem)" @mouseleave="handleToolItemMouseleave(toolItem)"
> >
标题1 {{ t('editor_module.title') }}1
</button> </button>
</template> </template>
<div> <div>
<h1>标题1</h1> <h1>{{ t('editor_module.title') }}1</h1>
</div> </div>
</NPopover> </NPopover>
</template> </template>
......
...@@ -4,12 +4,14 @@ import { nanoid } from 'nanoid' ...@@ -4,12 +4,14 @@ import { nanoid } from 'nanoid'
import { onMounted, ref, toRaw } from 'vue' import { onMounted, ref, toRaw } from 'vue'
import { type ToolbarAllConfig, useEditorToolbarConfig } from './config/editor-toolbar-config' import { type ToolbarAllConfig, useEditorToolbarConfig } from './config/editor-toolbar-config'
import EditorToolItem from './editor-tool-item.vue' import EditorToolItem from './editor-tool-item.vue'
import { useI18n } from 'vue-i18n'
const emit = defineEmits<{ const emit = defineEmits<{
downloadFile: [] downloadFile: []
}>() }>()
const { toolbarAllConfig } = useEditorToolbarConfig() const { toolbarAllConfig } = useEditorToolbarConfig()
const { t } = useI18n()
const currentToolbarString = 'ndo redo removeFormat | blocks bold italic underline strikethrough | align' const currentToolbarString = 'ndo redo removeFormat | blocks bold italic underline strikethrough | align'
...@@ -204,7 +206,7 @@ function handleDownloadFile() { ...@@ -204,7 +206,7 @@ function handleDownloadFile() {
<i class="iconfont icon-download"></i> <i class="iconfont icon-download"></i>
</div> </div>
</template> </template>
下载 {{ t('common_module.download') }}
</n-tooltip> </n-tooltip>
</div> </div>
</div> </div>
......
...@@ -94,7 +94,12 @@ function handleShowReasoningContentSwitch() { ...@@ -94,7 +94,12 @@ function handleShowReasoningContentSwitch() {
function handleContentEdit() { function handleContentEdit() {
isShowEditorDrawer.value = true isShowEditorDrawer.value = true
editorDrawerContent.value = props.messageItem.textContent || ''
let content = ''
markdownRenderRef.value && (content = markdownRenderRef.value.getRenderTextContent())
editorDrawerContent.value = content
} }
const handleContentCopy = throttle( const handleContentCopy = throttle(
...@@ -296,5 +301,5 @@ const handleContentCopy = throttle( ...@@ -296,5 +301,5 @@ const handleContentCopy = throttle(
</div> </div>
</div> </div>
<EditorDrawer v-model:is-show-editor-drawer="isShowEditorDrawer" :content="editorDrawerContent" /> <EditorDrawer v-model:is-show-editor-drawer="isShowEditorDrawer" v-model:content-edit="editorDrawerContent" />
</template> </template>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment