From 88f178df654b08411470a7eab75b3d5fed8817c0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 03 十一月 2023 01:37:45 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/menu/stylecontroller/index.jsx |   98 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 95 insertions(+), 3 deletions(-)

diff --git a/src/menu/stylecontroller/index.jsx b/src/menu/stylecontroller/index.jsx
index 163a7c6..b60a0b0 100644
--- a/src/menu/stylecontroller/index.jsx
+++ b/src/menu/stylecontroller/index.jsx
@@ -415,13 +415,105 @@
     if (res.copyType !== 'style') {
       message.warning('閰嶇疆淇℃伅鏍煎紡閿欒锛�', 5)
       return
-    } else if (JSON.stringify(res.options) !== JSON.stringify(options)) {
-      message.warning('鏍峰紡閫夐」涓嶄竴鑷达紝涓嶅彲绮樿创锛�', 5)
-      return
     }
 
     let style = res.data || {}
 
+    if (JSON.stringify(res.options) !== JSON.stringify(options)) {
+      res.options.forEach(n => {
+        if (options.includes(n)) return
+
+        if (n === 'width') {
+          delete style.width
+        } else if (n === 'height') {
+          delete style.height
+        } else if (n === 'font') {
+          if (options.includes('font1')) {
+            ['lineHeight', 'letterSpacing', 'fontStyle', 'textAlign', 'textDecoration'].forEach(m => {
+              delete style[m]
+            })
+          } else if (options.includes('font2')) {
+
+          } else {
+            ['fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'color', 'fontStyle', 'textAlign', 'textDecoration'].forEach(m => {
+              delete style[m]
+            })
+          }
+        } else if (n === 'font1') {
+          if (options.includes('font') || options.includes('font2')) {
+
+          } else {
+            ['fontSize', 'fontWeight', 'color'].forEach(m => {
+              delete style[m]
+            })
+          }
+        } else if (n === 'font2') {
+          if (options.includes('font')) {
+            ['textIndent', 'wordBreak'].forEach(m => {
+              delete style[m]
+            })
+          } else if (options.includes('font1')) {
+            ['lineHeight', 'letterSpacing', 'fontStyle', 'textAlign', 'textDecoration', 'textIndent', 'wordBreak'].forEach(m => {
+              delete style[m]
+            })
+          } else {
+            ['fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'color', 'fontStyle', 'textAlign', 'textDecoration', 'textIndent', 'wordBreak'].forEach(m => {
+              delete style[m]
+            })
+          }
+        } else if (n === 'background') {
+          if (!options.includes('backgroundColor')) {
+            delete style.backgroundColor
+          }
+          delete style.backgroundImage
+          delete style.backgroundSize
+          delete style.backgroundRepeat
+          delete style.backgroundPosition
+        } else if (n === 'backgroundColor') {
+          if (!options.includes('background')) {
+            delete style.backgroundColor
+          }
+        } else if (n === 'border') {
+          Object.keys(style).forEach(key => {
+            if (!/border/.test(key)) return
+            delete style[key]
+          })
+        } else if (n === 'shadow') {
+          delete style.boxShadow
+          delete style.hShadow
+          delete style.vShadow
+          delete style.shadowBlur
+          delete style.shadowColor
+        } else if (n === 'margin') {
+          delete style.marginTop
+          delete style.marginBottom
+          delete style.marginLeft
+          delete style.marginRight
+        } else if (n === 'padding') {
+          delete style.paddingTop
+          delete style.paddingBottom
+          delete style.paddingLeft
+          delete style.paddingRight
+        } else if (n === 'float') {
+          delete style.float
+        } else if (n === 'minHeight') {
+          delete style.minHeight
+        } else if (n === 'clear') {
+          delete style.clear
+        } else if (n === 'display') {
+          delete style.display
+        } else if (n === 'position') {
+          delete style.position
+          delete style.top
+          delete style.bottom
+          delete style.left
+          delete style.right
+        } else if (n === 'transform') {
+          delete style.transform
+        }
+      })
+    }
+
     let backgroundImage = ''
     if (style.backgroundImage && /^url/ig.test(style.backgroundImage)) {
       backgroundImage = style.backgroundImage.replace(/^url\(/ig, '').replace(/\)$/ig, '')

--
Gitblit v1.8.0