Skip to content

Commit 2f99557

Browse files
authored
feat: keyboard shortcut info inside formatter's tooltip (#1103)
1 parent 2401520 commit 2f99557

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed
Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
export const formatter = [
2-
{ name: 'bold', pattern: '*{{text}}*', tooltip: 'Bold' },
3-
{ name: 'italic', pattern: '_{{text}}_', tooltip: 'Italic' },
4-
{ name: 'strike', pattern: '~{{text}}~', tooltip: 'Strikethrough' },
5-
{ name: 'code', pattern: '`{{text}}`', tooltip: 'Inline code' },
6-
{
7-
name: 'multiline',
8-
pattern: '```\n{{text}}\n```',
9-
tooltip: 'Multi-line code',
10-
},
2+
{ name: 'bold', pattern: '*{{text}}*', tooltip: 'Bold', shortcut: 'Ctrl + B' },
3+
{ name: 'italic', pattern: '_{{text}}_', tooltip: 'Italic', shortcut: 'Ctrl + I' },
4+
{ name: 'strike', pattern: '~{{text}}~', tooltip: 'Strikethrough', shortcut: '' },
5+
{ name: 'code', pattern: '`{{text}}`', tooltip: 'Inline code', shortcut: '' },
6+
{ name: 'multiline', pattern: '```\n{{text}}\n```', tooltip: 'Multi-line code', shortcut: ''}
117
];

packages/react/src/views/ChatInput/ChatInputFormattingToolbar.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ const ChatInputFormattingToolbar = ({
216216
</React.Fragment>
217217
) : (
218218
<Tooltip
219-
text={item.name}
219+
text={`${item.name} ${item.shortcut && `(${item.shortcut})`}`}
220220
position="top"
221221
key={`formatter-${item.name}`}
222222
>
@@ -296,7 +296,7 @@ const ChatInputFormattingToolbar = ({
296296
if (itemInFormatter) {
297297
return (
298298
<Tooltip
299-
text={itemInFormatter.name}
299+
text={`${itemInFormatter.name} ${itemInFormatter.shortcut && `(${itemInFormattershortcut})`}`}
300300
position="top"
301301
key={`formatter-${itemInFormatter.name}`}
302302
>

0 commit comments

Comments
 (0)