mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 02:41:39 +03:00
added support to copy comment text...
This commit is contained in:
parent
c00508ccce
commit
0e91814dfe
@ -4,6 +4,7 @@ import { connect } from 'react-redux';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import get from 'lodash/get';
|
||||
|
||||
import { postBodySummary } from '@ecency/render-helper';
|
||||
import { getComments, deleteComment } from '../../../providers/hive/dhive';
|
||||
// Services and Actions
|
||||
import { writeToClipboard } from '../../../utils/clipboard';
|
||||
@ -212,17 +213,23 @@ const CommentsContainer = ({
|
||||
};
|
||||
|
||||
const _handleOnPressCommentMenu = (index, selectedComment) => {
|
||||
const _showCopiedToast = () => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
id: 'alert.copied',
|
||||
}),
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
if (index === 0) {
|
||||
writeToClipboard(`https://ecency.com${get(selectedComment, 'url')}`).then(() => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
id: 'alert.copied',
|
||||
}),
|
||||
),
|
||||
);
|
||||
});
|
||||
} else if (index === 1) {
|
||||
writeToClipboard(`https://ecency.com${get(selectedComment, 'url')}`).then(_showCopiedToast);
|
||||
}
|
||||
if (index === 1) {
|
||||
const body = postBodySummary(selectedComment.markdownBody);
|
||||
writeToClipboard(body).then(_showCopiedToast);
|
||||
} else if (index === 2) {
|
||||
_openReplyThread(selectedComment);
|
||||
}
|
||||
};
|
||||
|
@ -78,6 +78,7 @@ const CommentsView = ({
|
||||
|
||||
const menuItems = [
|
||||
intl.formatMessage({ id: 'post.copy_link' }),
|
||||
intl.formatMessage({ id: 'post.copy_text' }),
|
||||
intl.formatMessage({ id: 'post.open_thread' }),
|
||||
intl.formatMessage({ id: 'alert.cancel' }),
|
||||
];
|
||||
@ -145,7 +146,7 @@ const CommentsView = ({
|
||||
ref={commentMenu}
|
||||
options={menuItems}
|
||||
title={get(selectedComment, 'summary')}
|
||||
cancelButtonIndex={2}
|
||||
cancelButtonIndex={3}
|
||||
onPress={_onMenuItemPress}
|
||||
/>
|
||||
</Fragment>
|
||||
|
@ -426,6 +426,7 @@
|
||||
"reblog_alert": "Are you sure, you want to reblog?",
|
||||
"removed_hint": "Content is not available",
|
||||
"copy_link": "Copy link",
|
||||
"copy_text": "Copy text",
|
||||
"reblogged": "reblogged by",
|
||||
"sponsored": "SPONSORED",
|
||||
"open_thread": "Open thread",
|
||||
|
Loading…
Reference in New Issue
Block a user