Commit fc3032be572fd135930f66bab2abe47aa327366e

Authored by ly525
1 parent a968260f

add tooltip for hotkey

front-end/h5/src/components/core/editor/index.js
... ... @@ -47,13 +47,15 @@ const fixedTools = [
47 47 i18nTooltip: 'editor.fixedTool.undo',
48 48 'icon': 'mail-reply',
49 49 'action': () => undoRedoHistory.undo(),
50   - 'hotkey': 'ctrl&z,⌘&z'
  50 + 'hotkey': 'ctrl&z,⌘&z',
  51 + 'hotkeyTooltip': '(ctrl+z)'
51 52 },
52 53 {
53 54 i18nTooltip: 'editor.fixedTool.redo',
54 55 'icon': 'mail-forward',
55 56 'action': () => undoRedoHistory.redo(),
56   - 'hotkey': 'ctrl&y,⌘&u'
  57 + 'hotkey': 'ctrl&y,⌘&u',
  58 + 'hotkeyTooltip': '(ctrl+y)'
57 59 },
58 60 {
59 61 i18nTooltip: 'editor.fixedTool.preview',
... ... @@ -77,13 +79,15 @@ const fixedTools = [
77 79 i18nTooltip: 'editor.fixedTool.zoomOut',
78 80 'icon': 'plus',
79 81 'action': function () { this.scaleRate += 0.25 },
80   - 'hotkey': 'ctrl&=,⌘&='
  82 + 'hotkey': 'ctrl&=,⌘&=',
  83 + 'hotkeyTooltip': '(ctrl +)'
81 84 },
82 85 {
83 86 i18nTooltip: 'editor.fixedTool.zoomIn',
84 87 'icon': 'minus',
85 88 'action': function () { this.scaleRate -= 0.25 },
86   - 'hotkey': 'ctrl&-,⌘&-'
  89 + 'hotkey': 'ctrl&-,⌘&-',
  90 + 'hotkeyTooltip': '(ctrl -)'
87 91 },
88 92 {
89 93 i18nTooltip: 'editor.fixedTool.issues',
... ... @@ -340,7 +344,7 @@ export default {
340 344 <a-button-group style={{ display: 'flex', flexDirection: 'column' }}>
341 345 {
342 346 fixedTools.map(tool => (
343   - <a-tooltip effect="dark" placement="left" title={this.$t(tool.i18nTooltip)}>
  347 + <a-tooltip effect="dark" placement="left" title={this.$t(tool.i18nTooltip, { hotkey: tool.hotkeyTooltip })}>
344 348 <a-button block class="transparent-bg" type="link" size="small" style={{ height: '40px', color: '#000' }} onClick={() => tool.action && tool.action.call(this) } disabled={!!tool.disabled}>
345 349 { tool.icon ? <i class={['shortcut-icon', 'fa', `fa-${tool.icon}`]} aria-hidden='true'/> : (tool.text || this.$t(tool.i18nTooltip)) }
346 350 </a-button>
... ...
front-end/h5/src/locales/lang/en-US.js
... ... @@ -64,13 +64,13 @@ export default {
64 64 }
65 65 },
66 66 fixedTool: {
67   - undo: 'Undo',
68   - redo: 'Redo',
  67 + undo: 'Undo{hotkey}',
  68 + redo: 'Redo{hotkey}',
69 69 preview: 'Preview',
70 70 copyCurrentPage: 'CopyCurrentPage',
71 71 importPSD: 'Import PSD',
72   - zoomIn: 'Zoom In',
73   - zoomOut: 'Zoom Out',
  72 + zoomIn: 'Zoom In{hotkey}',
  73 + zoomOut: 'Zoom Out{hotkey}',
74 74 issues: 'Issues'
75 75 },
76 76 editPanel: {
... ...
front-end/h5/src/locales/lang/zh-CN.js
... ... @@ -2,7 +2,7 @@
2 2 * @Author: ly525
3 3 * @Date: 2019-11-24 18:51:58
4 4 * @LastEditors: ly525
5   - * @LastEditTime: 2019-12-08 16:15:35
  5 + * @LastEditTime: 2020-04-18 00:30:40
6 6 * @FilePath: /luban-h5/front-end/h5/src/locales/lang/zh-CN.js
7 7 * @Github: https://github.com/ly525/luban-h5
8 8 * @Description: Do not edit
... ... @@ -73,13 +73,13 @@ export default {
73 73 }
74 74 },
75 75 fixedTool: {
76   - undo: '撤销',
77   - redo: '重做',
  76 + undo: '撤销{hotkey}',
  77 + redo: '重做{hotkey}',
78 78 preview: '预览',
79 79 copyCurrentPage: '复制当前页面',
80 80 importPSD: '导入PSD',
81   - zoomIn: '缩小',
82   - zoomOut: '放大',
  81 + zoomIn: '缩小{hotkey}',
  82 + zoomOut: '放大{hotkey}',
83 83 issues: '常见问题'
84 84 },
85 85 editPanel: {
... ...