mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-15 16:42:10 +03:00
working on current save draft
This commit is contained in:
parent
4c8da5c9fd
commit
0191682c34
@ -213,6 +213,31 @@ class EditorContainer extends Component {
|
|||||||
// Media select functions <- END ->
|
// Media select functions <- END ->
|
||||||
|
|
||||||
_handleOnSaveButtonPress = (fields) => {
|
_handleOnSaveButtonPress = (fields) => {
|
||||||
|
// const { isDraftSaved } = this.state;
|
||||||
|
// if (!isDraftSaved) {
|
||||||
|
// const { currentAccount } = this.props;
|
||||||
|
// const username = currentAccount && currentAccount.name ? currentAccount.name : '';
|
||||||
|
|
||||||
|
// this.setState({ isDraftSaving: true });
|
||||||
|
// const draftField = {
|
||||||
|
// ...fields,
|
||||||
|
// tags: fields.tags.toString(),
|
||||||
|
// };
|
||||||
|
|
||||||
|
// setDraftPost(draftField, username)
|
||||||
|
// .then(() => {
|
||||||
|
// this.setState({
|
||||||
|
// isDraftSaving: false,
|
||||||
|
// isDraftSaved: true,
|
||||||
|
// });
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// alert(error);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
_saveCurrentDraft = (fields) => {
|
||||||
const { isDraftSaved } = this.state;
|
const { isDraftSaved } = this.state;
|
||||||
if (!isDraftSaved) {
|
if (!isDraftSaved) {
|
||||||
const { currentAccount } = this.props;
|
const { currentAccount } = this.props;
|
||||||
@ -418,21 +443,22 @@ class EditorContainer extends Component {
|
|||||||
draftPost={draftPost}
|
draftPost={draftPost}
|
||||||
handleFormChanged={this._handleFormChanged}
|
handleFormChanged={this._handleFormChanged}
|
||||||
handleOnImagePicker={this._handleRoutingAction}
|
handleOnImagePicker={this._handleRoutingAction}
|
||||||
|
handleOnPressBackButton={this._handleOnPressBackButton}
|
||||||
handleOnSaveButtonPress={this._handleOnSaveButtonPress}
|
handleOnSaveButtonPress={this._handleOnSaveButtonPress}
|
||||||
handleOnSubmit={this._handleSubmit}
|
handleOnSubmit={this._handleSubmit}
|
||||||
isCameraOrPickerOpen={isCameraOrPickerOpen}
|
isCameraOrPickerOpen={isCameraOrPickerOpen}
|
||||||
isDarkTheme={isDarkTheme}
|
isDarkTheme={isDarkTheme}
|
||||||
isDraftSaved={isDraftSaved}
|
isDraftSaved={isDraftSaved}
|
||||||
isDraftSaving={isDraftSaving}
|
isDraftSaving={isDraftSaving}
|
||||||
|
isEdit={isEdit}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
isOpenCamera={isOpenCamera}
|
isOpenCamera={isOpenCamera}
|
||||||
isPostSending={isPostSending}
|
isPostSending={isPostSending}
|
||||||
isReply={isReply}
|
isReply={isReply}
|
||||||
isEdit={isEdit}
|
|
||||||
isUploading={isUploading}
|
isUploading={isUploading}
|
||||||
post={post}
|
post={post}
|
||||||
|
saveCurrentDraft={this._saveCurrentDraft}
|
||||||
uploadedImage={uploadedImage}
|
uploadedImage={uploadedImage}
|
||||||
handleOnPressBackButton={this._handleOnPressBackButton}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -74,6 +74,19 @@ class EditorScreen extends Component {
|
|||||||
handleOnSaveButtonPress(fields);
|
handleOnSaveButtonPress(fields);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
_saveCurrentDraft = () => {
|
||||||
|
const { saveCurrentDraft } = this.props;
|
||||||
|
const { fields } = this.state;
|
||||||
|
|
||||||
|
if (this.changeTimer) {
|
||||||
|
clearTimeout(this.changeTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.changeTimer = setTimeout(() => {
|
||||||
|
saveCurrentDraft(fields);
|
||||||
|
}, 300);
|
||||||
|
};
|
||||||
|
|
||||||
_handleOnSubmit = () => {
|
_handleOnSubmit = () => {
|
||||||
const { handleOnSubmit } = this.props;
|
const { handleOnSubmit } = this.props;
|
||||||
const { fields } = this.state;
|
const { fields } = this.state;
|
||||||
@ -117,6 +130,7 @@ class EditorScreen extends Component {
|
|||||||
handleFormChanged();
|
handleFormChanged();
|
||||||
|
|
||||||
this._handleIsFormValid();
|
this._handleIsFormValid();
|
||||||
|
this._saveCurrentDraft();
|
||||||
};
|
};
|
||||||
|
|
||||||
_handleOnTagAdded = (tags) => {
|
_handleOnTagAdded = (tags) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user