diff --git a/frontend/src/components/pure/ms-rich-text/MsRichText.vue b/frontend/src/components/pure/ms-rich-text/MsRichText.vue index 895684a1c9..82f2ce41ee 100644 --- a/frontend/src/components/pure/ms-rich-text/MsRichText.vue +++ b/frontend/src/components/pure/ms-rich-text/MsRichText.vue @@ -12,7 +12,6 @@ * import rehypeStringify from 'rehype-stringify'; * return unified().use(rehypeParse).use(rehypeFormat).use(rehypeStringify).processSync(content.value); */ - import { useRoute } from 'vue-router'; import { useDebounceFn, useVModel } from '@vueuse/core'; import type { MsFileItem } from '@/components/pure/ms-upload/types'; @@ -71,7 +70,6 @@ import * as fastq from 'fastq'; const { t } = useI18n(); - const route = useRoute(); type Task = { file: File; process: (permalink: string, fileId: string) => void; @@ -91,6 +89,7 @@ previewUrl?: string; editable?: boolean; limitLength?: number; + autoFocus?: boolean; }>(), { raw: '', @@ -109,6 +108,8 @@ (event: 'update:filedIds', value: string[]): void; (event: 'update', value: string): void; (event: 'update:commentIds', value: string): void; + (event: 'blur', eveValue: FocusEvent): void; + (event: 'focus', eveValue: FocusEvent): void; }>(); const imagesNodesIds = useVModel(props, 'filedIds', emit); @@ -149,6 +150,16 @@ } ); + watch( + () => props.autoFocus, + (val) => { + editor.value?.setOptions({ autofocus: val }); + }, + { + immediate: true, + } + ); + const attachmentSelectorModal = ref(false); const selectedImagesNode = ref(); const selectedCommentNode = ref(); @@ -385,11 +396,20 @@ limit: props.limitLength || null, }), ], - autofocus: false, + autofocus: props.autoFocus, editable: props.editable, onUpdate: () => { debounceOnUpdate(); }, + onBlur: ({ event }) => { + // 避免移动到菜单上触发失去焦点切换视图 + if (!event.relatedTarget) { + emit('blur', event); + } + }, + onFocus: ({ event }) => { + emit('focus', event); + }, editorProps: { handleDrop: (view, event: DragEvent, _, moved) => { if (!moved && event.dataTransfer && event.dataTransfer.files) { diff --git a/frontend/src/views/test-plan/testPlan/detail/featureCase/components/executeForm.vue b/frontend/src/views/test-plan/testPlan/detail/featureCase/components/executeForm.vue index 2f1e29c196..e55b6fb436 100644 --- a/frontend/src/views/test-plan/testPlan/detail/featureCase/components/executeForm.vue +++ b/frontend/src/views/test-plan/testPlan/detail/featureCase/components/executeForm.vue @@ -1,15 +1,29 @@