Commit d1dcd2a209710f189400d1fe939972ea6f987ea1
1 parent
7f41c9d5
fix: #250
Showing
4 changed files
with
19 additions
and
7 deletions
front-end/h5/package.json
| @@ -34,7 +34,7 @@ | @@ -34,7 +34,7 @@ | ||
| 34 | "resize-detector": "^0.2.2", | 34 | "resize-detector": "^0.2.2", |
| 35 | "strapi-sdk-javascript": "^0.3.1", | 35 | "strapi-sdk-javascript": "^0.3.1", |
| 36 | "v-charts": "^1.19.0", | 36 | "v-charts": "^1.19.0", |
| 37 | - "v-click-outside": "^2.1.4", | 37 | + "v-click-outside": "^3.1.2", |
| 38 | "vant": "^2.2.12", | 38 | "vant": "^2.2.12", |
| 39 | "vue": "^2.6.10", | 39 | "vue": "^2.6.10", |
| 40 | "vue-i18n": "^8.14.1", | 40 | "vue-i18n": "^8.14.1", |
front-end/h5/src/components/core/plugins/lbp-text.js
| @@ -2,12 +2,13 @@ | @@ -2,12 +2,13 @@ | ||
| 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: 2020-10-10 23:33:50 | 5 | + * @LastEditTime: 2020-10-18 14:09:11 |
| 6 | * @FilePath: /luban-h5/front-end/h5/src/components/core/plugins/lbp-text.js | 6 | * @FilePath: /luban-h5/front-end/h5/src/components/core/plugins/lbp-text.js |
| 7 | * @Github: https://github.com/ly525/luban-h5 | 7 | * @Github: https://github.com/ly525/luban-h5 |
| 8 | * @Description: luban-h5 text component/plugin | 8 | * @Description: luban-h5 text component/plugin |
| 9 | * @Copyright 2018 - 2020 luban-h5. All Rights Reserved | 9 | * @Copyright 2018 - 2020 luban-h5. All Rights Reserved |
| 10 | */ | 10 | */ |
| 11 | +import vClickOutside from 'v-click-outside' | ||
| 11 | import PropTypes from '@luban-h5/plugin-common-props' | 12 | import PropTypes from '@luban-h5/plugin-common-props' |
| 12 | import { quillEditor } from 'vue-quill-editor' | 13 | import { quillEditor } from 'vue-quill-editor' |
| 13 | // require styles | 14 | // require styles |
| @@ -17,6 +18,9 @@ import './styles/text-overwrite-quil-snow-theme.scss' | @@ -17,6 +18,9 @@ import './styles/text-overwrite-quil-snow-theme.scss' | ||
| 17 | // https://github.com/luban-h5-components/plugin-common-props | 18 | // https://github.com/luban-h5-components/plugin-common-props |
| 18 | 19 | ||
| 19 | export default { | 20 | export default { |
| 21 | + directives: { | ||
| 22 | + clickOutside: vClickOutside.directive | ||
| 23 | + }, | ||
| 20 | render (h) { | 24 | render (h) { |
| 21 | const canEdit = this.canEdit && this.editorMode === 'edit' | 25 | const canEdit = this.canEdit && this.editorMode === 'edit' |
| 22 | const style = { | 26 | const style = { |
| @@ -48,6 +52,14 @@ export default { | @@ -48,6 +52,14 @@ export default { | ||
| 48 | this.canEdit = false | 52 | this.canEdit = false |
| 49 | }} | 53 | }} |
| 50 | style={style} | 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 | canEdit | 65 | canEdit |
front-end/h5/src/components/core/support/shape.js
| @@ -148,7 +148,7 @@ export default { | @@ -148,7 +148,7 @@ export default { | ||
| 148 | * | 148 | * |
| 149 | * TODO: 增加 确认删除 拦截操作 | 149 | * TODO: 增加 确认删除 拦截操作 |
| 150 | */ | 150 | */ |
| 151 | - handleDeleteByKeyboard (e) { | 151 | + handleDeleteByKeyboard (event) { |
| 152 | const key = event.keyCode || event.charCode | 152 | const key = event.keyCode || event.charCode |
| 153 | if (key === 8 || key === 46) { | 153 | if (key === 8 || key === 46) { |
| 154 | this.$emit('delete') | 154 | this.$emit('delete') |
front-end/h5/yarn.lock
| @@ -10780,10 +10780,10 @@ v-charts@^1.19.0: | @@ -10780,10 +10780,10 @@ v-charts@^1.19.0: | ||
| 10780 | numerify "1.2.9" | 10780 | numerify "1.2.9" |
| 10781 | utils-lite "0.1.10" | 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 | validate-npm-package-license@^3.0.1: | 10788 | validate-npm-package-license@^3.0.1: |
| 10789 | version "3.0.4" | 10789 | version "3.0.4" |