@@ -26,7 +26,6 @@ const { TextArea } = Input;
2626const CONTENT_ATTACHMENT_THRESHOLD = 2048 ;
2727
2828interface FormFields {
29- title : string ;
3029 note : string ;
3130 /** 发送内容(仅文本类型时显示,可手动输入覆盖剪切板原文) */
3231 content : string ;
@@ -68,57 +67,6 @@ const FileList = ({ files }: { files: string[] }) => {
6867 ) ;
6968} ;
7069
71- // 内容预览(纯文本类型)
72- const ContentPreview = ( { item } : { item ?: DatabaseSchemaHistory | null } ) => {
73- if ( ! item ) return null ;
74-
75- const hasText =
76- item . type === "text" || item . type === "html" || item . type === "rtf" ;
77-
78- if ( ! hasText ) return null ;
79-
80- let preview = "" ;
81- const value = item . value as unknown ;
82- if ( isString ( value ) ) {
83- preview = value ;
84- } else if ( Array . isArray ( value ) ) {
85- preview = value . join ( ", " ) ;
86- }
87-
88- const isLarge =
89- new TextEncoder ( ) . encode ( preview ) . length > CONTENT_ATTACHMENT_THRESHOLD ;
90-
91- return (
92- < div className = "content-preview-section" >
93- < div className = "section-label" >
94- < UnoIcon name = "i-lucide:file-text" size = { 14 } />
95- < span > 内容</ span >
96- { isLarge && (
97- < Tooltip
98- title = { t (
99- "component.send_modal.work_queue.hint.large_content_as_attachment" ,
100- "内容超过 2KB,将作为文本附件发送" ,
101- ) }
102- >
103- < span className = "content-size-badge" >
104- < UnoIcon name = "i-lucide:paperclip" size = { 12 } />
105- < span >
106- { t (
107- "component.send_modal.work_queue.hint.as_attachment" ,
108- "附件" ,
109- ) }
110- </ span >
111- </ span >
112- </ Tooltip >
113- ) }
114- </ div >
115- < div className = "content-preview-box" >
116- < pre className = "preview-text" > { preview } </ pre >
117- </ div >
118- </ div >
119- ) ;
120- } ;
121-
12270// 内容字段标签(带超大内容附件提示)
12371const ContentFieldLabel = ( { value } : { value : string } ) => {
12472 const isLarge =
@@ -358,14 +306,29 @@ const WorkQueueForm = () => {
358306 const currentItem = getCurrentSendItem ( ) ;
359307 setItem ( currentItem ) ;
360308
309+ // 将剪切板文本内容填入 content 字段作为默认值
310+ let defaultContent = "" ;
311+ if ( currentItem ) {
312+ const isTextType =
313+ currentItem . type === "text" ||
314+ currentItem . type === "html" ||
315+ currentItem . type === "rtf" ;
316+ if ( isTextType ) {
317+ const value = currentItem . value as unknown ;
318+ if ( isString ( value ) ) {
319+ defaultContent = value ;
320+ } else if ( Array . isArray ( value ) ) {
321+ defaultContent = value . join ( ", " ) ;
322+ }
323+ }
324+ }
325+
361326 form . setFieldsValue ( {
362- content : "" ,
327+ content : defaultContent ,
363328 note : effectiveConfig ?. defaults ?. note || "" ,
364329 queueName : effectiveConfig ?. queueName || "" ,
365- title : effectiveConfig ?. defaults ?. title || "" ,
366330 } ) ;
367331 } ;
368-
369332 // 初始加载
370333 loadItem ( ) ;
371334
@@ -379,18 +342,17 @@ const WorkQueueForm = () => {
379342 } ;
380343 } , [ form , effectiveConfig ] ) ;
381344
382- // OCR 结果填入 content 字段,并附加提示词前缀
345+ // OCR 结果填入 note(备注) 字段,并附加提示词前缀
383346 const handleOcrResult = ( text : string ) => {
384- const current = form . getFieldValue ( "content " ) || "" ;
347+ const current = form . getFieldValue ( "note " ) || "" ;
385348 const prefix = current
386349 ? ""
387350 : t (
388351 "component.send_modal.work_queue.ocr_prefix" ,
389352 "以下是图片中识别到的文字内容:\n" ,
390353 ) ;
391354 const newValue = `${ prefix } ${ current } ${ current ? "\n" : "" } ${ text } ` ;
392- form . setFieldValue ( "content" , newValue ) ;
393- contentRef . current ?. focus ( ) ;
355+ form . setFieldValue ( "note" , newValue ) ;
394356 } ;
395357
396358 const handleSubmit = useCallback ( async ( ) => {
@@ -471,7 +433,6 @@ const WorkQueueForm = () => {
471433 content,
472434 files,
473435 note : values . note ,
474- title : values . title ,
475436 } ) ;
476437
477438 // 显示成功弹窗,用户关闭后再关闭窗口
@@ -537,10 +498,6 @@ const WorkQueueForm = () => {
537498 await closeCurrentSendModal ( ) ;
538499 } ;
539500
540- // 判断是否有文本内容(用于显示预览)
541- const hasContent =
542- item ?. type === "text" || item ?. type === "html" || item ?. type === "rtf" ;
543-
544501 // 判断是否有文件内容(附件模式)
545502 const hasFiles = item ?. type === "files" || item ?. type === "image" ;
546503
@@ -571,9 +528,6 @@ const WorkQueueForm = () => {
571528 < div className = "work-queue-form-container" >
572529 { /* 可滚动的内容区域 */ }
573530 < div className = "work-queue-form-content" >
574- { /* 内容预览区域(仅文本类型) */ }
575- { hasContent && < ContentPreview item = { item } /> }
576-
577531 { /* 文件列表区域(仅图片/文件类型),图片时支持 OCR 填入 content */ }
578532 { hasFiles && (
579533 < FilesSection
@@ -637,19 +591,6 @@ const WorkQueueForm = () => {
637591 </ Form . Item >
638592 ) }
639593
640- < Form . Item
641- label = { t ( "component.send_modal.work_queue.label.title" , "标题" ) }
642- name = "title"
643- >
644- < Input
645- autoComplete = "off"
646- placeholder = { t (
647- "component.send_modal.work_queue.placeholder.optional" ,
648- "可选" ,
649- ) }
650- />
651- </ Form . Item >
652-
653594 < Form . Item
654595 label = { t ( "component.send_modal.work_queue.label.note" , "备注" ) }
655596 name = "note"
0 commit comments