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