Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

fix(ui): shortcut cropped content in kbd component (#5891)

Roman Sergeev143327521560
diff --git a/packages/design/src/components/kbd/Kbd.tsx b/packages/design/src/components/kbd/Kbd.tsx
index 49ae7278ec..82071567a9 100644
--- a/packages/design/src/components/kbd/Kbd.tsx
+++ b/packages/design/src/components/kbd/Kbd.tsx
@@ -31,8 +31,8 @@ export function KBD(props: IKBDProps) {
return (
<span
className={clsx(`
- univer-inline-block univer-h-6 univer-select-none univer-rounded-md univer-bg-gray-50 univer-px-2
- univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700
+ univer-inline-block univer-h-6 univer-select-none univer-whitespace-nowrap univer-rounded-md
+ univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700
dark:!univer-bg-gray-700 dark:!univer-text-white
`, borderClassName, className)}
>
diff --git a/packages/design/src/components/kbd/__tests__/__snapshots__/index.spec.tsx.snap b/packages/design/src/components/kbd/__tests__/__snapshots__/index.spec.tsx.snap
index 86ab6ad5e1..7c2729347a 100644
--- a/packages/design/src/components/kbd/__tests__/__snapshots__/index.spec.tsx.snap
+++ b/packages/design/src/components/kbd/__tests__/__snapshots__/index.spec.tsx.snap
@@ -3,7 +3,7 @@
exports[`KBD > should render with default props 1`] = `
<div>
<span
- class="univer-inline-block univer-h-6 univer-select-none univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-white univer-border-gray-200 dark:!univer-border-gray-600 univer-border-solid univer-border"
+ class="univer-inline-block univer-h-6 univer-select-none univer-whitespace-nowrap univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-white univer-border-gray-200 dark:!univer-border-gray-600 univer-border-solid univer-border"
>
<kbd
class="univer-inline-block univer-h-full"
@@ -17,7 +17,7 @@ exports[`KBD > should render with default props 1`] = `
exports[`KBD > should render with multiple keys 1`] = `
<div>
<span
- class="univer-inline-block univer-h-6 univer-select-none univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-white univer-border-gray-200 dark:!univer-border-gray-600 univer-border-solid univer-border"
+ class="univer-inline-block univer-h-6 univer-select-none univer-whitespace-nowrap univer-rounded-md univer-bg-gray-50 univer-px-2 univer-font-mono univer-text-xs/6 univer-font-medium univer-text-gray-700 dark:!univer-bg-gray-700 dark:!univer-text-white univer-border-gray-200 dark:!univer-border-gray-600 univer-border-solid univer-border"
>
<kbd
class="univer-inline-block univer-h-full"
diff --git a/packages/ui/src/locale/ru-RU.ts b/packages/ui/src/locale/ru-RU.ts
index 4791a6d7ba..795c1d6747 100644
--- a/packages/ui/src/locale/ru-RU.ts
+++ b/packages/ui/src/locale/ru-RU.ts
@@ -65,7 +65,7 @@ const locale: typeof enUS = {
Pacifico: 'Pacifico',
},
'shortcut-panel': {
- title: 'Ярлыки',
+ title: 'Сочетания клавиш',
},
shortcut: {
undo: 'Отменить',
@@ -73,10 +73,10 @@ const locale: typeof enUS = {
cut: 'Вырезать',
copy: 'Копировать',
paste: 'Вставить',
- 'shortcut-panel': 'Переключить панель ярлыков',
+ 'shortcut-panel': 'Переключить панель сочетания клавиш',
},
'common-edit': 'Общие команды редактирования',
- 'toggle-shortcut-panel': 'Переключить панель ярлыков',
+ 'toggle-shortcut-panel': 'Переключить панель сочетания клавиш',
clipboard: {
authentication: {
title: 'Доступ запрещен',
@@ -95,7 +95,7 @@ const locale: typeof enUS = {
confirm: 'Подтвердить',
cancel: 'Отменить',
},
- 'global-shortcut': 'Глобальные ярлыки',
+ 'global-shortcut': 'Сочетания клавиш',
'zoom-slider': {
resetTo: 'Сбросить до',
},
diff --git a/packages/ui/src/views/components/shortcut-panel/ShortcutPanel.tsx b/packages/ui/src/views/components/shortcut-panel/ShortcutPanel.tsx
index bfb86358ef..7469557be1 100644
--- a/packages/ui/src/views/components/shortcut-panel/ShortcutPanel.tsx
+++ b/packages/ui/src/views/components/shortcut-panel/ShortcutPanel.tsx
@@ -108,11 +108,12 @@ export function ShortcutPanel() {
<li
key={`${item.title}-${item.shortcut}`}
className={`
- univer-flex univer-h-10 univer-items-center univer-justify-between univer-text-sm
+ univer-flex univer-h-10 univer-items-center univer-justify-between univer-py-0.5
+ univer-text-sm
last:univer-border-b-0
`}
>
- <span className="univer-line-clamp-1">{item.title}</span>
+ <span className="univer-line-clamp-2">{item.title}</span>
{item.shortcut && <KBD keyboard={item.shortcut} />}
</li>
))}