From d0e8c7cb64d7d219f7cfec8bc87cf699b9cfe7b2 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 08 十一月 2022 12:35:25 +0800
Subject: [PATCH] 2022-11-08

---
 src/menu/components/code/sandbox/index.jsx |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff --git a/src/menu/components/code/sandbox/index.jsx b/src/menu/components/code/sandbox/index.jsx
index 3c13f57..53856d4 100644
--- a/src/menu/components/code/sandbox/index.jsx
+++ b/src/menu/components/code/sandbox/index.jsx
@@ -9,8 +9,6 @@
 import { resetStyle } from '@/utils/utils-custom.js'
 import MKEmitter from '@/utils/events.js'
 import getWrapForm from './options'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 
 import './index.scss'
 
@@ -29,7 +27,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     card: null,
     back: false
   }
@@ -41,9 +38,6 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        tabId: card.tabId || '',
-        parentId: card.parentId || '',
-        dataName: card.dataName || '',
         format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
@@ -83,10 +77,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitStyle', this.getStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -98,7 +88,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitStyle', this.getStyle)
   }
 
   /**
@@ -136,15 +125,11 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', [card.uuid], ['background', 'border', 'padding', 'margin', 'shadow'], card.style)
+    MKEmitter.emit('changeStyle', ['background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle)
   }
 
-  getStyle = (comIds, style) => {
-    const { card } = this.state
-
-    if (comIds[0] !== card.uuid || comIds.length !== 1) return
-
-    let _card = {...card, style}
+  getStyle = (style) => {
+    let _card = {...this.state.card, style}
     
     this.updateComponent(_card)
   }
@@ -162,7 +147,13 @@
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
-      MKEmitter.emit('clickComponent', this.state.card)
+      MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => {
+        let _card = {...this.state.card}
+        _card.style = {..._card.style, ...style}
+
+        this.setState({ card: _card })
+        this.props.updateConfig(_card)
+      })
     }
   }
 

--
Gitblit v1.8.0