mirror of
https://github.com/NetEase/tango.git
synced 2026-08-31 00:59:32 +08:00
fix: parse template code & update maxRow of TextAreaSetter (#192)
* fix: update templatePattern regex to allow for multiline code wrapping * fix: update error overlay display to use designer.activeView instead of mode * fix: update maxRows to 6 in TextAreaSetter
This commit is contained in:
@@ -166,7 +166,7 @@ import { OutButton } from "../components";
|
||||
class App extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<Page title={tango.stores.app.title} subTitle={111}>
|
||||
<Page title={tango.stores.app.title} subTitle={<><Button>hello</Button></>}>
|
||||
<Section tid="section0" />
|
||||
<Section tid="section1" title="Section Title">
|
||||
your input: <Input tid="input1" defaultValue="hello" />
|
||||
|
||||
@@ -31,7 +31,7 @@ export const WorkspaceView = observer((props: WorkspaceViewProps) => {
|
||||
{children}
|
||||
{/* 添加组件弹层 */}
|
||||
{display === 'block' && <ComponentsPopover type="inner" isControlled />}
|
||||
{mode === 'design' && <FileErrorsOverlay />}
|
||||
{designer.activeView === 'design' && <FileErrorsOverlay />}
|
||||
</Box>
|
||||
);
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ export function isValidFunctionCode(str: string) {
|
||||
}
|
||||
}
|
||||
|
||||
const templatePattern = /^{{(.+)}}$/;
|
||||
const templatePattern = /^{{([\s\S]+)}}$/;
|
||||
|
||||
/**
|
||||
* 判断给定代码是否被双花括号包裹
|
||||
|
||||
@@ -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('{{<Button>button</Button>}}')).toBeTruthy(); // true
|
||||
expect(isWrappedCode('{{<>\n<Button>hello</Button>\n</>}}')).toBeTruthy(); // true
|
||||
});
|
||||
});
|
||||
@@ -34,7 +34,7 @@ export function TextSetter({
|
||||
|
||||
const autoSize = {
|
||||
minRows: 2,
|
||||
maxRows: 5,
|
||||
maxRows: 6,
|
||||
};
|
||||
|
||||
export function TextAreaSetter({
|
||||
|
||||
Reference in New Issue
Block a user