Commit 4a7ae5709be9f0d2017ebd7894fcf64532b73f5d

Authored by ly525
1 parent 8b27425e

chore(editor): update canvas after editing plugin props

front-end/h5/src/views/Editor.vue
... ... @@ -291,8 +291,6 @@ const defaultProps = {
291 291  
292 292 class Element {
293 293 constructor (ele) {
294   - // TODO 需要处理plugin的prop中是 name 的,会覆盖 this.name,
295   - // 或者将plugin的props赋值给this.pluginProps,这样可以避免冲突,也可以知道哪些是plugin 的props
296 294 this.name = ele.name
297 295 this.editorConfig = ele.editorConfig || {}
298 296 this.init()
... ... @@ -307,6 +305,11 @@ class Element {
307 305 // init prop of plugin
308 306 const propConf = this.editorConfig.propsConfig
309 307 Object.keys(propConf).forEach(key => {
  308 + // #6
  309 + if (key === 'name') {
  310 + console.warn('Please do not use {name} as plugin prop')
  311 + return
  312 + }
310 313 this[key] = propConf[key].defaultPropValue
311 314 })
312 315 }
... ... @@ -381,6 +384,7 @@ const Editor = {
381 384 return (() => {
382 385 const data = {
383 386 style: element.getStyle(),
  387 + props: element, // #6
384 388 nativeOn: {
385 389 click: this.setCurrentEditingElement.bind(this, element)
386 390 }
... ...