Commit b39f638279761bf314816a13b58ffd01f060c0c0

Authored by ly525
1 parent 2a3a7dff

fix: #185 #145 !#zh: 修正预览页文字模块双击后出现富文本编辑问题

front-end/h5/package.json
... ... @@ -17,7 +17,7 @@
17 17 "@luban-h5/lbc-button": "^0.0.3",
18 18 "@luban-h5/lbp-slide": "^0.0.7",
19 19 "@luban-h5/lbs-text-align": "^0.0.3",
20   - "@luban-h5/plugin-common-props": "^0.1.3",
  20 + "@luban-h5/plugin-common-props": "^0.1.6",
21 21 "animate.css": "^3.7.2",
22 22 "ant-design-vue": "^1.3.14",
23 23 "core-js": "^2.6.5",
... ...
front-end/h5/src/components/core/editor/edit-panel/props.js
... ... @@ -138,7 +138,7 @@ export default {
138 138 {
139 139 Object
140 140 .entries(props)
141   - .filter(([propKey, propConfig]) => propConfig.editor && !propConfig.editor.custom)
  141 + .filter(([propKey, propConfig]) => propConfig.visible && propConfig.editor && !propConfig.editor.custom)
142 142 .map(([propKey, propConfig]) => this.renderPropFormItem(h, { propKey, propConfig }))
143 143 }
144 144 </a-form>
... ...
front-end/h5/src/components/plugins/lbp-text.js
... ... @@ -18,6 +18,7 @@ import &#39;./styles/text-overwrite-quil-snow-theme.scss&#39;
18 18  
19 19 export default {
20 20 render (h) {
  21 + const canEdit = this.canEdit && this.editorMode === 'edit'
21 22 const style = {
22 23 position: 'relative',
23 24 color: `${this.color} !important`,
... ... @@ -49,7 +50,7 @@ export default {
49 50 style={style}
50 51 >
51 52 {
52   - this.canEdit
  53 + canEdit
53 54 ? <quillEditor
54 55 content={this.text}
55 56 options={{
... ... @@ -87,11 +88,16 @@ export default {
87 88 }
88 89 },
89 90 props: {
90   - backgroundColor: PropTypes.color({ label: '背景色' }),
91   - borderWidth: PropTypes.number({ label: '边框宽度(px)' }),
  91 + backgroundColor: PropTypes.color({ label: '背景色', defaultValue: 'rgba(0, 0, 0, 0)' }),
  92 + borderWidth: PropTypes.number({ label: '边框宽度(px)', defaultValue: 0 }),
92 93 borderRadius: PropTypes.number({ label: '圆角(px)' }),
93 94 borderColor: PropTypes.color({ label: '边框颜色' }),
94   - text: PropTypes.string({ label: '双击修改文字' })
  95 + text: PropTypes.string({ label: '内容', defaultValue: '双击修改文字', visible: false }),
  96 + editorMode: PropTypes.string({
  97 + defaultValue: 'preview', // 可选值: preview/edit
  98 + label: '模式',
  99 + visible: false
  100 + })
95 101 },
96 102 editorConfig: {
97 103 }
... ...
front-end/h5/yarn.lock
... ... @@ -792,10 +792,10 @@
792 792 resolved "https://registry.yarnpkg.com/@luban-h5/plugin-common-props/-/plugin-common-props-0.0.1.tgz#10fe5d5b2dda1db64912b3b99779aec60b5ea956"
793 793 integrity sha512-D8UEBht2BCJt8YDHqcYj0hQmn3WM3QdX3Rw8eaZP02o0NeNe2oDPKE4mCM3eN9U1ygcrDf9bR48RB9YgHJRHGA==
794 794  
795   -"@luban-h5/plugin-common-props@^0.1.3":
796   - version "0.1.5"
797   - resolved "https://registry.npmjs.org/@luban-h5/plugin-common-props/-/plugin-common-props-0.1.5.tgz#531ff1cbc53284e114a1151a55d0c254c02123ce"
798   - integrity sha512-Jrdl0AhR+cuY56RbmgqW2XmbaGDgFSpVHeGNrEiDsmcC62FSZmVp1XNIs6+0so2+rngvIX/YC6DxpUZ+P3VLSg==
  795 +"@luban-h5/plugin-common-props@^0.1.6":
  796 + version "0.1.6"
  797 + resolved "https://registry.npmjs.org/@luban-h5/plugin-common-props/-/plugin-common-props-0.1.6.tgz#b4d44dd139ac99c58274c909fb61ca6df9051aa4"
  798 + integrity sha512-0+0yuLioozw+wx+3Ui9JYTIT7mKWVtKKrSZAe49ldfmhkA0zsv2phIkAVwqDDtsxuwO0t8a0fA05GwY6WRMjIA==
799 799  
800 800 "@mrmlnc/readdir-enhanced@^2.2.1":
801 801 version "2.2.1"
... ...