From 08eec9010e21a66081753ace121bfeea514c02cb Mon Sep 17 00:00:00 2001 From: qinhaoyan Date: Wed, 27 Nov 2024 14:26:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E9=80=89=E6=8B=A9=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/renderers/ColorPicker.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/amis-theme-editor-helper/src/renderers/ColorPicker.tsx b/packages/amis-theme-editor-helper/src/renderers/ColorPicker.tsx index 3c3efb1f62b..6b30c37f7e2 100644 --- a/packages/amis-theme-editor-helper/src/renderers/ColorPicker.tsx +++ b/packages/amis-theme-editor-helper/src/renderers/ColorPicker.tsx @@ -671,12 +671,15 @@ function ImageInput(props: ThemeColorProps) { if (imgRes) { let img = imgRes[1]; setImage(img); - let res = value.replace(imgRes[0] + ' ', ''); + let res = value; + !res.endsWith(' ') && (res += ' '); + res = value.replace(imgRes[0] + ' ', ''); let list = res.split(' '); // 解析position let position = list[0] + ' ' + list[1]; const index = POSITION_MAP.findIndex(n => n === position); setPosition(index); + !res.endsWith(' ') && (res += ' '); res = res.replace(position + ' / ', ''); list = res.split(' '); // 解析mode @@ -688,6 +691,7 @@ function ImageInput(props: ThemeColorProps) { mode = '100% 100% no-repeat'; } setMode(mode); + !res.endsWith(' ') && (res += ' '); // 解析color const color = res.replace(mode + ' ', ''); setColor(color); @@ -770,7 +774,7 @@ function ImageInput(props: ThemeColorProps) { value={color} onChange={(value: string) => { onChange( - `url(${image}) ${POSITION_MAP[position]} / ${mode} ${value}` + `url(${image}) ${POSITION_MAP[position]} / ${mode} ${value || ''}` ); }} />