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