From a0fd77abd9cb5bc693cef7c62f5915964c196d2d Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 06 一月 2022 14:01:26 +0800 Subject: [PATCH] 2022-01-06 --- src/templates/modalconfig/index.jsx | 32 +++++++++++++++++++++++++++++++- 1 files changed, 31 insertions(+), 1 deletions(-) diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx index e0f7258..6b01727 100644 --- a/src/templates/modalconfig/index.jsx +++ b/src/templates/modalconfig/index.jsx @@ -128,6 +128,35 @@ }) } + componentDidMount() { + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } + if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + if (_shortcut === 'ctrl+83') { + let node = document.getElementById('save-config') + if (node && node.click) { + node.click() + } + return false + } + } + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -135,6 +164,7 @@ this.setState = () => { return } + document.onkeydown = () => {} } // 椤甸潰杩斿洖 @@ -730,7 +760,7 @@ <Versions MenuId={editAction.uuid} open_edition={openEdition} updateConfig={this.refreshConfig}/> <ReplaceField type="form" config={config} updateConfig={this.updateconfig}/> <EditComponent dict={dict} options={['form']} config={this.state.config} plusFields={this.plusFields}/> - <Button type="primary" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['model.save']}</Button> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={this.state.menuloading}>{dict['model.save']}</Button> <Button onClick={this.cancelConfig}>{dict['model.back']}</Button> </div> } style={{ width: '100%' }}> -- Gitblit v1.8.0