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/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' && } ); }); 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 + }); +}); 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({