Răsfoiți Sursa

text editor

bianjiang 1 an în urmă
părinte
comite
5deff25156

+ 16 - 28
src/modules/editor/components/CompUI/basicUI/Text/TextToolComp.tsx

@@ -328,10 +328,20 @@ export const TextStroke = defineComponent({
       }
       state.visible = true;
       const colorReg = /#[a-zA-Z0-9]{6}/g;
-      const color = value.match(colorReg)[0];
+      let color = value.match(colorReg);
+      if (color) {
+        color = color[0];
+      } else {
+        color = "#666666";
+      }
       state.color = color;
       const widthReg = /\d+px/g;
-      const width = value.match(widthReg)[0];
+      let width = value.match(widthReg);
+      if (width) {
+        width = width[0];
+      } else {
+        width = 1;
+      }
       state.width = parseInt(width);
     };
     const colorChange = (v: string) => {
@@ -366,6 +376,7 @@ export const TextStroke = defineComponent({
                 <div class={"flex-1 px-20px"}>
                   <Tooltip title={"描边宽度"} placement="top">
                     <InputNumber
+                      class={StrokeStyle}
                       min={1}
                       max={5}
                       step={1}
@@ -512,32 +523,9 @@ const currStyle = css`
     color: @inf-primary-color;
   }
 `;
-const ColorPicker = css`
-  position: relative;
-  width: 32px;
-  height: 32px;
-  border-radius: 2px;
-  cursor: pointer;
-  .color_picker {
-    width: 100%;
-    height: 100%;
-    border-radius: 2px;
-    border: 1px solid transparent;
-    &:focus,
-    &:hover {
-      border-color: @inf-primary-color;
-      box-shadow: 0 0 0 2px rgba(232, 139, 0, 0.2);
-    }
-  }
-  .color_input {
-    position: absolute;
-    left: 0;
-    bottom: 0;
-    width: 100%;
-    height: 0;
-    padding: 0;
-    border: none;
-    visibility: hidden;
+const StrokeStyle = css`
+  input {
+    height: 28px;
   }
 `;