|
|
@ -25,6 +25,7 @@ interface MarkdownTextAreaProps {
|
|
|
|
onSubmit?(msg: { val: string; formId: string }): any;
|
|
|
|
onSubmit?(msg: { val: string; formId: string }): any;
|
|
|
|
onContentChange?(val: string): any;
|
|
|
|
onContentChange?(val: string): any;
|
|
|
|
onReplyCancel?(): any;
|
|
|
|
onReplyCancel?(): any;
|
|
|
|
|
|
|
|
hideNavigationWarnings?: boolean;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface MarkdownTextAreaState {
|
|
|
|
interface MarkdownTextAreaState {
|
|
|
@ -78,7 +79,7 @@ export class MarkdownTextArea extends Component<
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
componentDidUpdate() {
|
|
|
|
componentDidUpdate() {
|
|
|
|
if (this.state.content) {
|
|
|
|
if (!this.props.hideNavigationWarnings && this.state.content) {
|
|
|
|
window.onbeforeunload = () => true;
|
|
|
|
window.onbeforeunload = () => true;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
window.onbeforeunload = undefined;
|
|
|
|
window.onbeforeunload = undefined;
|
|
|
@ -110,7 +111,10 @@ export class MarkdownTextArea extends Component<
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<form id={this.formId} onSubmit={linkEvent(this, this.handleSubmit)}>
|
|
|
|
<form id={this.formId} onSubmit={linkEvent(this, this.handleSubmit)}>
|
|
|
|
<Prompt when={this.state.content} message={i18n.t('block_leaving')} />
|
|
|
|
<Prompt
|
|
|
|
|
|
|
|
when={!this.props.hideNavigationWarnings && this.state.content}
|
|
|
|
|
|
|
|
message={i18n.t('block_leaving')}
|
|
|
|
|
|
|
|
/>
|
|
|
|
<div class="form-group row">
|
|
|
|
<div class="form-group row">
|
|
|
|
<div className={`col-sm-12`}>
|
|
|
|
<div className={`col-sm-12`}>
|
|
|
|
<textarea
|
|
|
|
<textarea
|
|
|
|