mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 13:22:02 +03:00
making cache comment entry from rich editor
This commit is contained in:
parent
9e690517ba
commit
8c284a905c
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import { Alert } from 'react-native';
|
import { Alert, Platform } from 'react-native';
|
||||||
import ImagePicker from 'react-native-image-crop-picker';
|
import ImagePicker from 'react-native-image-crop-picker';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
import AsyncStorage from '@react-native-community/async-storage';
|
import AsyncStorage from '@react-native-community/async-storage';
|
||||||
@ -47,6 +47,8 @@ import EditorScreen from '../screen/editorScreen';
|
|||||||
import bugsnapInstance from '../../../config/bugsnag';
|
import bugsnapInstance from '../../../config/bugsnag';
|
||||||
import { removeBeneficiaries, setBeneficiaries } from '../../../redux/actions/editorActions';
|
import { removeBeneficiaries, setBeneficiaries } from '../../../redux/actions/editorActions';
|
||||||
import { TEMP_BENEFICIARIES_ID } from '../../../redux/constants/constants';
|
import { TEMP_BENEFICIARIES_ID } from '../../../redux/constants/constants';
|
||||||
|
import { updateCommentCache } from '../../../redux/actions/cacheActions';
|
||||||
|
import { markdown2Html } from '@ecency/render-helper/lib/markdown-2-html';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Props Name Description Value
|
* Props Name Description Value
|
||||||
@ -737,7 +739,7 @@ class EditorContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_submitReply = async (fields) => {
|
_submitReply = async (fields) => {
|
||||||
const { currentAccount, pinCode } = this.props;
|
const { currentAccount, pinCode, dispatch } = this.props;
|
||||||
const { isPostSending } = this.state;
|
const { isPostSending } = this.state;
|
||||||
|
|
||||||
if (isPostSending) {
|
if (isPostSending) {
|
||||||
@ -769,6 +771,24 @@ class EditorContainer extends Component {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
AsyncStorage.setItem('temp-reply', '');
|
AsyncStorage.setItem('temp-reply', '');
|
||||||
this._handleSubmitSuccess();
|
this._handleSubmitSuccess();
|
||||||
|
|
||||||
|
//create a cache entry
|
||||||
|
const createdAt = new Date();
|
||||||
|
dispatch(
|
||||||
|
updateCommentCache(
|
||||||
|
`${parentAuthor}/${parentPermlink}`,
|
||||||
|
{
|
||||||
|
author:currentAccount.name,
|
||||||
|
permlink,
|
||||||
|
parent_author:parentAuthor,
|
||||||
|
parent_permlink:parentPermlink,
|
||||||
|
body: markdown2Html(fields.body, true, Platform.OS === 'android'),
|
||||||
|
created: createdAt.toISOString(),
|
||||||
|
expiresAt: createdAt.getTime() + 600000
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
this._handleSubmitFailure(error);
|
this._handleSubmitFailure(error);
|
||||||
|
Loading…
Reference in New Issue
Block a user