toast-ui.react-editor
toast-ui.react-editor copied to clipboard
무한루프에 빠지는 경우가 있는데 이유를 잘 모르겠네요
Version 1.0.1
Test Environment
브라우저 : 크롬, OS : 윈도우 10, 에디터 : Intellij, 프로그램 : react.js, antd 사용
<Modal title="Create New Notice"
width={800}
bodyStyle={{bottom: '50'}}
visible={this.state.modal.notice.visible}
onOk={function (e) {
this.saveNotice();
}.bind(this)}
onCancel={function (e) {
this.setState({
modal: {
...this.state.modal,
notice: {
...this.state.modal.notice,
visible: false
}
}
});
}.bind(this)}
okText="Submit"
<div className="container-col">
<div className="form-wrapper">
<Form
layout="horizontal"
labelCol={{span: 6}}
wrapperCol={{span: 18}}
>
<Form.Item label="Contents">
{getFieldDecorator("contents", {
initialValue: this.state.modal.notice.contents,
rules: [
{
required: true,
message: "Please enter a Contents."
}
]
}
)(
<Editor
initialValue="hello react editor world!"
previewStyle="vertical"
height="600px"
initialEditType="markdown"
useCommandShortcut={true}
exts={[
{
name: 'chart',
minWidth: 100,
maxWidth: 600,
minHeight: 100,
maxHeight: 300
},
'scrollSync',
'colorSyntax',
'uml',
'mark',
'table'
]}
/>
)}
</Form.Item>
...
antd의 modal로 form을 래핑한 상태에서 html에디터에 텍스트가 입력되었는지를 확인하여 validation 체크할 수 있는 코드입니다. 이 상황에서 무한루프에 빠지는 문제가 발생하더군요 보안상 자세히 설명드릴 수는 없는점 이해 부탁드립니다.
// Write example code