Commit d1dcd2a209710f189400d1fe939972ea6f987ea1
1 parent
7f41c9d5
fix: #250
Showing
4 changed files
with
19 additions
and
7 deletions
front-end/h5/package.json
front-end/h5/src/components/core/plugins/lbp-text.js
| ... | ... | @@ -2,12 +2,13 @@ |
| 2 | 2 | * @Author: ly525 |
| 3 | 3 | * @Date: 2019-11-24 18:51:58 |
| 4 | 4 | * @LastEditors: ly525 |
| 5 | - * @LastEditTime: 2020-10-10 23:33:50 | |
| 5 | + * @LastEditTime: 2020-10-18 14:09:11 | |
| 6 | 6 | * @FilePath: /luban-h5/front-end/h5/src/components/core/plugins/lbp-text.js |
| 7 | 7 | * @Github: https://github.com/ly525/luban-h5 |
| 8 | 8 | * @Description: luban-h5 text component/plugin |
| 9 | 9 | * @Copyright 2018 - 2020 luban-h5. All Rights Reserved |
| 10 | 10 | */ |
| 11 | +import vClickOutside from 'v-click-outside' | |
| 11 | 12 | import PropTypes from '@luban-h5/plugin-common-props' |
| 12 | 13 | import { quillEditor } from 'vue-quill-editor' |
| 13 | 14 | // require styles |
| ... | ... | @@ -17,6 +18,9 @@ import './styles/text-overwrite-quil-snow-theme.scss' |
| 17 | 18 | // https://github.com/luban-h5-components/plugin-common-props |
| 18 | 19 | |
| 19 | 20 | export default { |
| 21 | + directives: { | |
| 22 | + clickOutside: vClickOutside.directive | |
| 23 | + }, | |
| 20 | 24 | render (h) { |
| 21 | 25 | const canEdit = this.canEdit && this.editorMode === 'edit' |
| 22 | 26 | const style = { |
| ... | ... | @@ -48,6 +52,14 @@ export default { |
| 48 | 52 | this.canEdit = false |
| 49 | 53 | }} |
| 50 | 54 | style={style} |
| 55 | + onKeydown={event => { | |
| 56 | + const key = event.keyCode || event.charCode | |
| 57 | + // #!en: backspace/delete key should only delete letter in textarea, do not delete element in canvas | |
| 58 | + // #!zh: 键盘删除,应该只删除文字组件里面的文字,而不是删除画布上的元素 | |
| 59 | + if (key === 8 || key === 46) { | |
| 60 | + event.stopPropagation() | |
| 61 | + } | |
| 62 | + }} | |
| 51 | 63 | > |
| 52 | 64 | { |
| 53 | 65 | canEdit | ... | ... |
front-end/h5/src/components/core/support/shape.js
front-end/h5/yarn.lock
| ... | ... | @@ -10780,10 +10780,10 @@ v-charts@^1.19.0: |
| 10780 | 10780 | numerify "1.2.9" |
| 10781 | 10781 | utils-lite "0.1.10" |
| 10782 | 10782 | |
| 10783 | -v-click-outside@^2.1.4: | |
| 10784 | - version "2.1.5" | |
| 10785 | - resolved "https://registry.npm.taobao.org/v-click-outside/download/v-click-outside-2.1.5.tgz#aa69172fb41fcc79b26b9a4bc72a30ccf03f7a3c" | |
| 10786 | - integrity sha1-qmkXL7QfzHmya5pLxyowzPA/ejw= | |
| 10783 | +v-click-outside@^3.1.2: | |
| 10784 | + version "3.1.2" | |
| 10785 | + resolved "https://registry.npm.taobao.org/v-click-outside/download/v-click-outside-3.1.2.tgz#1dbaa14bf09a21bd16f23a38f03bfa3988f71281" | |
| 10786 | + integrity sha1-HbqhS/CaIb0W8jo48Dv6OYj3EoE= | |
| 10787 | 10787 | |
| 10788 | 10788 | validate-npm-package-license@^3.0.1: |
| 10789 | 10789 | version "3.0.4" | ... | ... |