parent
307de890a7
commit
3de0a32d95
1 changed files with 4 additions and 3 deletions
7
ui/src/components/post-form.tsx
vendored
7
ui/src/components/post-form.tsx
vendored
|
@ -20,12 +20,12 @@ import { WebSocketService, UserService } from '../services';
|
||||||
import {
|
import {
|
||||||
msgOp,
|
msgOp,
|
||||||
getPageTitle,
|
getPageTitle,
|
||||||
debounce,
|
|
||||||
validURL,
|
validURL,
|
||||||
capitalizeFirstLetter,
|
capitalizeFirstLetter,
|
||||||
markdownHelpUrl,
|
markdownHelpUrl,
|
||||||
archiveUrl,
|
archiveUrl,
|
||||||
mdToHtml,
|
mdToHtml,
|
||||||
|
debounce,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import * as autosize from 'autosize';
|
import * as autosize from 'autosize';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
|
@ -79,6 +79,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
if (this.props.post) {
|
if (this.props.post) {
|
||||||
this.state.postForm = {
|
this.state.postForm = {
|
||||||
body: this.props.post.body,
|
body: this.props.post.body,
|
||||||
|
// NOTE: debouncing breaks both these for some reason, unless you use defaultValue
|
||||||
name: this.props.post.name,
|
name: this.props.post.name,
|
||||||
community_id: this.props.post.community_id,
|
community_id: this.props.post.community_id,
|
||||||
edit_id: this.props.post.id,
|
edit_id: this.props.post.id,
|
||||||
|
@ -142,7 +143,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
<input
|
<input
|
||||||
type="url"
|
type="url"
|
||||||
class="form-control"
|
class="form-control"
|
||||||
value={this.state.postForm.url}
|
defaultValue={this.state.postForm.url}
|
||||||
onInput={linkEvent(this, this.handlePostUrlChange)}
|
onInput={linkEvent(this, this.handlePostUrlChange)}
|
||||||
/>
|
/>
|
||||||
{this.state.suggestedTitle && (
|
{this.state.suggestedTitle && (
|
||||||
|
@ -208,7 +209,7 @@ export class PostForm extends Component<PostFormProps, PostFormState> {
|
||||||
</label>
|
</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<textarea
|
<textarea
|
||||||
value={this.state.postForm.name}
|
defaultValue={this.state.postForm.name}
|
||||||
onInput={linkEvent(this, this.handlePostNameChange)}
|
onInput={linkEvent(this, this.handlePostNameChange)}
|
||||||
class="form-control"
|
class="form-control"
|
||||||
required
|
required
|
||||||
|
|
Reference in a new issue