chore: hotkey tip i18n

This commit is contained in:
Joel 2025-08-29 11:07:34 +08:00
parent 19e152fd0c
commit 7920b89714
3 changed files with 24 additions and 2 deletions

View File

@ -5,7 +5,7 @@ import React, { useEffect, useState } from 'react'
import useAvailableVarList from '../../_base/hooks/use-available-var-list'
import { BlockEnum } from '../../../types'
import { useWorkflowVariableType } from '../../../hooks'
import { useTranslation } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import type { FormInputItem } from '../types'
import AddInputField from './add-input-field'
import { INSERT_HITL_INPUT_BLOCK_COMMAND } from '@/app/components/base/prompt-editor/plugins/hitl-input-block'
@ -26,6 +26,14 @@ type Props = {
editorKey: number
}
const Key: FC<{ children: React.ReactNode, className?: string }> = ({ children, className }) => {
return <span className={cn('system-kbd mx-0.5 inline-flex size-4 items-center justify-center rounded-[4px] bg-components-kbd-bg-gray text-text-placeholder ', className)}>{children}</span>
}
const CtrlKey: FC = () => {
return <Key className={cn('mr-0', !isMac() && 'w-7')}>{isMac() ? '⌘' : 'Ctrl'}</Key>
}
const FormContent: FC<Props> = ({
nodeId,
nodeTitle,
@ -132,7 +140,19 @@ const FormContent: FC<Props> = ({
),
}]}
/>
<div className='system-xs-regular flex h-8 items-center text-components-input-text-placeholder'>Press / to insert variable, {isMac() ? '⌘' : 'Ctrl'} / to insert input field</div>
{isFocus && (
<div className='system-xs-regular flex h-8 items-center text-components-input-text-placeholder'>
<Trans
i18nKey='workflow.nodes.humanInput.formContent.hotkeyTip'
components={
{
Key: <Key>/</Key>,
CtrlKey: <CtrlKey />,
}
}
/>
</div>
)}
</div>
)
}

View File

@ -964,6 +964,7 @@ const translation = {
formContent: {
title: 'Form Content',
tooltip: 'What users will see after opening the form. Supports Markdown formatting.',
hotkeyTip: 'Press <Key/> to insert variable, <CtrlKey/><Key/> to insert input field',
},
userActions: {
title: 'User Actions',

View File

@ -964,6 +964,7 @@ const translation = {
formContent: {
title: '表单内容',
tooltip: '用户打开表单后看到的内容。支持 Markdown 格式。',
hotkeyTip: '按 <Key/> 插入变量,按 <CtrlKey/><Key/> 插入输入字段',
},
userActions: {
title: '用户操作',