Commit 6de244705bce6e59073c89482a177fea2fdde7d6
1 parent
ff7f283b
register global support components
Showing
7 changed files
with
28 additions
and
32 deletions
front-end/h5/src/components/core/editor/edit-panel/props.js
| ... | ... | @@ -42,6 +42,7 @@ export default { |
| 42 | 42 | * 将插件属性的 自定义增强编辑器注入 属性编辑面板中 |
| 43 | 43 | */ |
| 44 | 44 | mixinEnhancedPropsEditor (editingElement) { |
| 45 | + if (!this.editingElementEditorConfig || !this.editingElementEditorConfig.components) return | |
| 45 | 46 | const { components } = this.editingElementEditorConfig |
| 46 | 47 | for (const key in components) { |
| 47 | 48 | if (this.$options.components[key]) return | ... | ... |
front-end/h5/src/components/core/support/image-gallery/gallery.js
front-end/h5/src/components/core/support/index.js
0 → 100644
| 1 | +// register-global-support-component | |
| 2 | +import Vue from 'vue' | |
| 3 | +import PropMultiTextItemsEditor from './prop-multi-items-editor/text.js' | |
| 4 | +import ImageGallery from './image-gallery/gallery.js' | |
| 5 | + | |
| 6 | +export default { | |
| 7 | + mounted () { | |
| 8 | + Vue.component(PropMultiTextItemsEditor.name, PropMultiTextItemsEditor) | |
| 9 | + Vue.component(ImageGallery.name, ImageGallery) | |
| 10 | + } | |
| 11 | +} | ... | ... |
front-end/h5/src/components/plugins/lbp-background.js
| 1 | -import ImageGallery from '@/components/core/support/image-gallery/gallery.js' | |
| 2 | - | |
| 3 | 1 | export default { |
| 4 | 2 | name: 'lbp-background', |
| 5 | 3 | render () { |
| ... | ... | @@ -32,26 +30,21 @@ export default { |
| 32 | 30 | props: { |
| 33 | 31 | imgSrc: { |
| 34 | 32 | type: String, |
| 35 | - default: '' | |
| 36 | - }, | |
| 37 | - backgroundColor: { | |
| 38 | - type: String, | |
| 39 | - // TODO 为什么 transparent 无效? | |
| 40 | - default: '#ffffff' | |
| 41 | - } | |
| 42 | - }, | |
| 43 | - editorConfig: { | |
| 44 | - propsConfig: { | |
| 45 | - imgSrc: { | |
| 46 | - type: 'image-gallery', | |
| 47 | - // type: 'a-input', | |
| 33 | + default: '', | |
| 34 | + editor: { | |
| 35 | + type: 'lbs-image-gallery', | |
| 48 | 36 | label: '图片url', |
| 49 | 37 | prop: { |
| 50 | 38 | type: 'textarea' |
| 51 | 39 | }, |
| 52 | 40 | defaultPropValue: '' |
| 53 | - }, | |
| 54 | - backgroundColor: { | |
| 41 | + } | |
| 42 | + }, | |
| 43 | + backgroundColor: { | |
| 44 | + type: String, | |
| 45 | + // TODO 为什么 transparent 无效? | |
| 46 | + default: '#ffffff', | |
| 47 | + editor: { | |
| 55 | 48 | type: 'a-input', // lbs-color-picker |
| 56 | 49 | label: '背景颜色', |
| 57 | 50 | prop: { |
| ... | ... | @@ -60,9 +53,6 @@ export default { |
| 60 | 53 | require: true, |
| 61 | 54 | defaultPropValue: '#ffffff' // TODO why logogram for color does't work? |
| 62 | 55 | } |
| 63 | - }, | |
| 64 | - components: { | |
| 65 | - 'image-gallery': ImageGallery | |
| 66 | 56 | } |
| 67 | 57 | } |
| 68 | 58 | } | ... | ... |
front-end/h5/src/components/plugins/lbp-picture.js
| 1 | -import ImageGallery from '@/components/core/support/image-gallery/gallery.js' | |
| 2 | 1 | import placeholderImg from './lbp-picture-placeholder.png' // issue #34 |
| 3 | 2 | export default { |
| 4 | 3 | name: 'lbp-picture', |
| ... | ... | @@ -10,7 +9,7 @@ export default { |
| 10 | 9 | type: String, |
| 11 | 10 | default: placeholderImg, |
| 12 | 11 | editor: { |
| 13 | - type: 'image-gallery', | |
| 12 | + type: 'lbs-image-gallery', | |
| 14 | 13 | label: '图片url', |
| 15 | 14 | prop: { |
| 16 | 15 | type: 'textarea' |
| ... | ... | @@ -21,10 +20,5 @@ export default { |
| 21 | 20 | }, |
| 22 | 21 | data: () => ({ |
| 23 | 22 | placeholderImg |
| 24 | - }), | |
| 25 | - editorConfig: { | |
| 26 | - components: { | |
| 27 | - 'image-gallery': ImageGallery | |
| 28 | - } | |
| 29 | - } | |
| 23 | + }) | |
| 30 | 24 | } | ... | ... |
front-end/h5/src/components/plugins/lbp-slide__editor.js
| 1 | -import ImageGallery from '@/components/core/support/image-gallery/gallery.js' | |
| 2 | - | |
| 3 | 1 | export default { |
| 4 | 2 | props: { |
| 5 | 3 | elementProps: { |
| ... | ... | @@ -79,7 +77,7 @@ export default { |
| 79 | 77 | itemRender={this.itemRender} |
| 80 | 78 | /> |
| 81 | 79 | } |
| 82 | - <ImageGallery | |
| 80 | + <lbs-image-gallery | |
| 83 | 81 | style={{ margin: '16px 0' }} |
| 84 | 82 | value={currentItem.image} |
| 85 | 83 | onChange={url => { | ... | ... |
front-end/h5/src/views/Editor.vue
| 1 | 1 | <script> |
| 2 | 2 | import CoreEditor from '../components/core/editor/index.js' |
| 3 | 3 | import loadPluginMixin from '../mixins/load-plugins.js' |
| 4 | +import loadEnhancePropsEditorMixin from '../components/core/support/index.js' | |
| 4 | 5 | |
| 5 | 6 | export default { |
| 6 | 7 | extends: CoreEditor, |
| 7 | - mixins: [loadPluginMixin] | |
| 8 | + mixins: [loadPluginMixin, loadEnhancePropsEditorMixin] | |
| 8 | 9 | } |
| 9 | 10 | </script> |
| 10 | 11 | <style lang="scss"> | ... | ... |