Skip to content

Commit

Permalink
fix: #250
Browse files Browse the repository at this point in the history
  • Loading branch information
ly525 committed Oct 18, 2020
1 parent 7f41c9d commit d1dcd2a
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion front-end/h5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"resize-detector": "^0.2.2",
"strapi-sdk-javascript": "^0.3.1",
"v-charts": "^1.19.0",
"v-click-outside": "^2.1.4",
"v-click-outside": "^3.1.2",
"vant": "^2.2.12",
"vue": "^2.6.10",
"vue-i18n": "^8.14.1",
Expand Down
14 changes: 13 additions & 1 deletion front-end/h5/src/components/core/plugins/lbp-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
* @Author: ly525
* @Date: 2019-11-24 18:51:58
* @LastEditors: ly525
* @LastEditTime: 2020-10-10 23:33:50
* @LastEditTime: 2020-10-18 14:09:11
* @FilePath: /luban-h5/front-end/h5/src/components/core/plugins/lbp-text.js
* @Github: https://github.com/ly525/luban-h5
* @Description: luban-h5 text component/plugin
* @Copyright 2018 - 2020 luban-h5. All Rights Reserved
*/
import vClickOutside from 'v-click-outside'
import PropTypes from '@luban-h5/plugin-common-props'
import { quillEditor } from 'vue-quill-editor'
// require styles
Expand All @@ -17,6 +18,9 @@ import './styles/text-overwrite-quil-snow-theme.scss'
// https://github.com/luban-h5-components/plugin-common-props

export default {
directives: {
clickOutside: vClickOutside.directive
},
render (h) {
const canEdit = this.canEdit && this.editorMode === 'edit'
const style = {
Expand Down Expand Up @@ -48,6 +52,14 @@ export default {
this.canEdit = false
}}
style={style}
onKeydown={event => {
const key = event.keyCode || event.charCode
// #!en: backspace/delete key should only delete letter in textarea, do not delete element in canvas
// #!zh: 键盘删除,应该只删除文字组件里面的文字,而不是删除画布上的元素
if (key === 8 || key === 46) {
event.stopPropagation()
}
}}
>
{
canEdit
Expand Down
2 changes: 1 addition & 1 deletion front-end/h5/src/components/core/support/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
*
* TODO: 增加 确认删除 拦截操作
*/
handleDeleteByKeyboard (e) {
handleDeleteByKeyboard (event) {
const key = event.keyCode || event.charCode
if (key === 8 || key === 46) {
this.$emit('delete')
Expand Down
8 changes: 4 additions & 4 deletions front-end/h5/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10780,10 +10780,10 @@ v-charts@^1.19.0:
numerify "1.2.9"
utils-lite "0.1.10"

v-click-outside@^2.1.4:
version "2.1.5"
resolved "https://registry.npm.taobao.org/v-click-outside/download/v-click-outside-2.1.5.tgz#aa69172fb41fcc79b26b9a4bc72a30ccf03f7a3c"
integrity sha1-qmkXL7QfzHmya5pLxyowzPA/ejw=
v-click-outside@^3.1.2:
version "3.1.2"
resolved "https://registry.npm.taobao.org/v-click-outside/download/v-click-outside-3.1.2.tgz#1dbaa14bf09a21bd16f23a38f03bfa3988f71281"
integrity sha1-HbqhS/CaIb0W8jo48Dv6OYj3EoE=

validate-npm-package-license@^3.0.1:
version "3.0.4"
Expand Down

0 comments on commit d1dcd2a

Please sign in to comment.