Commit d1dcd2a209710f189400d1fe939972ea6f987ea1

Authored by ly525
1 parent 7f41c9d5

fix: #250

front-end/h5/package.json
... ... @@ -34,7 +34,7 @@
34 34 "resize-detector": "^0.2.2",
35 35 "strapi-sdk-javascript": "^0.3.1",
36 36 "v-charts": "^1.19.0",
37   - "v-click-outside": "^2.1.4",
  37 + "v-click-outside": "^3.1.2",
38 38 "vant": "^2.2.12",
39 39 "vue": "^2.6.10",
40 40 "vue-i18n": "^8.14.1",
... ...
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
... ... @@ -148,7 +148,7 @@ export default {
148 148 *
149 149 * TODO: 增加 确认删除 拦截操作
150 150 */
151   - handleDeleteByKeyboard (e) {
  151 + handleDeleteByKeyboard (event) {
152 152 const key = event.keyCode || event.charCode
153 153 if (key === 8 || key === 46) {
154 154 this.$emit('delete')
... ...
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"
... ...