From aa318cc744ff4e3be36fb4ac1dbd4bb7519364b5 Mon Sep 17 00:00:00 2001 From: wwsun Date: Fri, 2 Aug 2024 15:37:08 +0800 Subject: [PATCH 1/3] fix: update templatePattern regex to allow for multiline code wrapping --- apps/playground/src/helpers/mock-files.ts | 2 +- packages/helpers/src/helpers/code-helper.ts | 2 +- packages/helpers/tests/code-helper.test.ts | 13 +++++++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 packages/helpers/tests/code-helper.test.ts diff --git a/apps/playground/src/helpers/mock-files.ts b/apps/playground/src/helpers/mock-files.ts index b5fa605..3f36dc6 100644 --- a/apps/playground/src/helpers/mock-files.ts +++ b/apps/playground/src/helpers/mock-files.ts @@ -166,7 +166,7 @@ import { OutButton } from "../components"; class App extends React.Component { render() { return ( - + }>
your input: diff --git a/packages/helpers/src/helpers/code-helper.ts b/packages/helpers/src/helpers/code-helper.ts index 0ffed10..140bf9a 100644 --- a/packages/helpers/src/helpers/code-helper.ts +++ b/packages/helpers/src/helpers/code-helper.ts @@ -32,7 +32,7 @@ export function isValidFunctionCode(str: string) { } } -const templatePattern = /^{{(.+)}}$/; +const templatePattern = /^{{([\s\S]+)}}$/; /** * 判断给定代码是否被双花括号包裹 diff --git a/packages/helpers/tests/code-helper.test.ts b/packages/helpers/tests/code-helper.test.ts new file mode 100644 index 0000000..84f377e --- /dev/null +++ b/packages/helpers/tests/code-helper.test.ts @@ -0,0 +1,13 @@ +import { isWrappedCode } from '../src/helpers'; + +describe('helpers/codeHelper', () => { + it('isWrappedCode', () => { + expect(isWrappedCode('{{[]}}')).toBeTruthy(); // true + expect(isWrappedCode('{{{}}}')).toBeTruthy(); // true + expect(isWrappedCode('{{this.foo}}')).toBeTruthy(); // true + expect(isWrappedCode('{{123}}')).toBeTruthy(); // true + expect(isWrappedCode('{{() => {}}}')).toBeTruthy(); // true + expect(isWrappedCode('{{}}')).toBeTruthy(); // true + expect(isWrappedCode('{{<>\n\n}}')).toBeTruthy(); // true + }); +}); From 3772f404865810a778a334aeed7fc55af9bde684 Mon Sep 17 00:00:00 2001 From: wwsun Date: Mon, 5 Aug 2024 11:11:09 +0800 Subject: [PATCH 2/3] fix: update error overlay display to use designer.activeView instead of mode --- packages/designer/src/workspace-view.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/designer/src/workspace-view.tsx b/packages/designer/src/workspace-view.tsx index 7e206c3..8ee0276 100644 --- a/packages/designer/src/workspace-view.tsx +++ b/packages/designer/src/workspace-view.tsx @@ -31,7 +31,7 @@ export const WorkspaceView = observer((props: WorkspaceViewProps) => { {children} {/* 添加组件弹层 */} {display === 'block' && } - {mode === 'design' && } + {designer.activeView === 'design' && } ); }); From de84dda61a9f715919f21d62d586db6cfcb7436c Mon Sep 17 00:00:00 2001 From: wwsun Date: Mon, 5 Aug 2024 11:11:47 +0800 Subject: [PATCH 3/3] fix: update maxRows to 6 in TextAreaSetter --- packages/setting-form/src/setters/text-setter.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/setting-form/src/setters/text-setter.tsx b/packages/setting-form/src/setters/text-setter.tsx index b53fb42..96b0817 100644 --- a/packages/setting-form/src/setters/text-setter.tsx +++ b/packages/setting-form/src/setters/text-setter.tsx @@ -34,7 +34,7 @@ export function TextSetter({ const autoSize = { minRows: 2, - maxRows: 5, + maxRows: 6, }; export function TextAreaSetter({