mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 22:03:21 +03:00
merged with master
This commit is contained in:
commit
4dcaa6b1c4
@ -58,9 +58,11 @@ class PostDropdownContainer extends PureComponent {
|
|||||||
case '0':
|
case '0':
|
||||||
await writeToClipboard(getPostUrl(content.url));
|
await writeToClipboard(getPostUrl(content.url));
|
||||||
this.alertTimer = setTimeout(() => {
|
this.alertTimer = setTimeout(() => {
|
||||||
Alert.alert(intl.formatMessage({
|
Alert.alert(
|
||||||
id: 'alert.copied',
|
intl.formatMessage({
|
||||||
}));
|
id: 'alert.copied',
|
||||||
|
}),
|
||||||
|
);
|
||||||
this.alertTimer = 0;
|
this.alertTimer = 0;
|
||||||
}, 300);
|
}, 300);
|
||||||
break;
|
break;
|
||||||
@ -104,12 +106,12 @@ class PostDropdownContainer extends PureComponent {
|
|||||||
const { currentAccount, content, intl } = this.props;
|
const { currentAccount, content, intl } = this.props;
|
||||||
addBookmark(currentAccount.name, content.author, content.permlink)
|
addBookmark(currentAccount.name, content.author, content.permlink)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
Alert.alert(intl.formatMessage({ id: 'bookmarks.added' }));
|
Alert.alert(intl.formatMessage({ id: 'bookmarks.added' }));
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
|
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
_reblog = () => {
|
_reblog = () => {
|
||||||
const {
|
const {
|
||||||
@ -163,12 +165,17 @@ class PostDropdownContainer extends PureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { intl } = this.props;
|
const { intl, currentAccount, content } = this.props;
|
||||||
|
let _OPTIONS = OPTIONS;
|
||||||
|
|
||||||
|
if (content.author === currentAccount.name) {
|
||||||
|
_OPTIONS = OPTIONS.filter(item => item !== 'reblog');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<PostDropdownView
|
<PostDropdownView
|
||||||
options={OPTIONS.map(item => intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase())}
|
options={_OPTIONS.map(item => intl.formatMessage({ id: `post_dropdown.${item}` }).toUpperCase())}
|
||||||
handleOnDropdownSelect={this._handleOnDropdownSelect}
|
handleOnDropdownSelect={this._handleOnDropdownSelect}
|
||||||
{...this.props}
|
{...this.props}
|
||||||
/>
|
/>
|
||||||
|
@ -54,6 +54,7 @@ class TransactionView extends PureComponent {
|
|||||||
{transactions
|
{transactions
|
||||||
&& transactions.map((item, index) => {
|
&& transactions.map((item, index) => {
|
||||||
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
|
const transactionData = groomingTransactionData(item, steemPerMVests, formatNumber);
|
||||||
|
const value = transactionData.value.split(' ');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CollapsibleCard
|
<CollapsibleCard
|
||||||
@ -75,9 +76,9 @@ class TransactionView extends PureComponent {
|
|||||||
isBlackText
|
isBlackText
|
||||||
iconName={transactionData.icon}
|
iconName={transactionData.icon}
|
||||||
iconType="MaterialIcons"
|
iconType="MaterialIcons"
|
||||||
rightText={transactionData.value}
|
rightText={`${Math.round(value[0] * 1000) / 1000} ${value[1]}`}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
{(!!transactionData.details || !!transactionData.memo) && (
|
{(!!transactionData.details || !!transactionData.memo) && (
|
||||||
<WalletLineItem
|
<WalletLineItem
|
||||||
|
@ -6,6 +6,7 @@ const md = new Remarkable({ html: true, breaks: true, linkify: true });
|
|||||||
// const onlyImageLinkRegex = /([\n]http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png|PNG|GIF|JPG)/g;
|
// const onlyImageLinkRegex = /([\n]http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png|PNG|GIF|JPG)/g;
|
||||||
// const onlyImageDoubleLinkRegex = /(\nhttps)(.*)(?=jpg|gif|png|PNG|GIF|JPG|)/g;
|
// const onlyImageDoubleLinkRegex = /(\nhttps)(.*)(?=jpg|gif|png|PNG|GIF|JPG|)/g;
|
||||||
// const pullRightLeftRegex = /(<div class="[^"]*?pull-[^"]*?">(.*?)(<[/]div>))/g;
|
// const pullRightLeftRegex = /(<div class="[^"]*?pull-[^"]*?">(.*?)(<[/]div>))/g;
|
||||||
|
// const markdownLinkRegex = /(?:__|[])|\[(.*?)\]\(.*?\)/g;
|
||||||
const copiedPostRegex = /\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
|
const copiedPostRegex = /\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
|
||||||
const postRegex = /^https?:\/\/(.*)\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
|
const postRegex = /^https?:\/\/(.*)\/(.*)\/(@[\w.\d-]+)\/(.*)/i;
|
||||||
const youTubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g;
|
const youTubeRegex = /(?:https?:\/\/)?(?:www\.)?(?:youtube\.com\/watch\?v=|youtu\.be\/)([^& \n<]+)(?:[^ \n<]+)?/g;
|
||||||
@ -15,13 +16,12 @@ const authorNameRegex = /(^|[^a-zA-Z0-9_!#$%&*@@\/]|(^|[^a-zA-Z0-9_+~.-\/]))[@
|
|||||||
const tagsRegex = /(^|\s|>)(#[-a-z\d]+)/gi;
|
const tagsRegex = /(^|\s|>)(#[-a-z\d]+)/gi;
|
||||||
const centerRegex = /(<center>)/g;
|
const centerRegex = /(<center>)/g;
|
||||||
const imgRegex = /(https?:\/\/.*\.(?:tiff?|jpe?g|gif|png|svg|ico|PNG|GIF|JPG))/g;
|
const imgRegex = /(https?:\/\/.*\.(?:tiff?|jpe?g|gif|png|svg|ico|PNG|GIF|JPG))/g;
|
||||||
const linkRegex = /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi;
|
const linkRegex = /[-a-zA-Z0-9@:%+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%+.~#?&//=]*)?/gi;
|
||||||
const markdownImageRegex = /!\[[^\]]*\]\((.*?)\s*("(?:.*[^"])")?\s*\)/g;
|
const markdownImageRegex = /!\[[^\]]*\]\((.*?)\s*("(?:.*[^"])")?\s*\)/g;
|
||||||
const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm;
|
const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm;
|
||||||
const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g;
|
const aTagRegex = /(<\s*a[^>]*>(.*?)<\s*[/]\s*a>)/g;
|
||||||
const imgTagRegex = /(<img[^>]*>)/g;
|
const imgTagRegex = /(<img[^>]*>)/g;
|
||||||
const iframeRegex = /(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/g;
|
const iframeRegex = /(?:<iframe[^>]*)(?:(?:\/>)|(?:>.*?<\/iframe>))/g;
|
||||||
//const markdownLinkRegex = /(?:__|[])|\[(.*?)\]\(.*?\)/g;
|
|
||||||
|
|
||||||
export const markDown2Html = (input) => {
|
export const markDown2Html = (input) => {
|
||||||
if (!input) {
|
if (!input) {
|
||||||
@ -77,7 +77,7 @@ export const markDown2Html = (input) => {
|
|||||||
output = handleATag(output);
|
output = handleATag(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (markdownLinkRegex.test(output)) {
|
// if (copiedPostRegex.test(output)) {
|
||||||
// output = handleMarkdownLink(output);
|
// output = handleMarkdownLink(output);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -126,7 +126,7 @@ const handleATag = input => input.replace(aTagRegex, (link) => {
|
|||||||
return link;
|
return link;
|
||||||
});
|
});
|
||||||
|
|
||||||
const handleMarkdownLink = input => input.replace(markdownLinkRegex, (link) => {
|
const handleMarkdownLink = input => input.replace(copiedPostRegex, (link) => {
|
||||||
const postMatch = link.match(copiedPostRegex);
|
const postMatch = link.match(copiedPostRegex);
|
||||||
|
|
||||||
if (postMatch) {
|
if (postMatch) {
|
||||||
@ -156,11 +156,21 @@ const handleLinks = input => input.replace(linkRegex, (link) => {
|
|||||||
) {
|
) {
|
||||||
const imageMatch = link.match(imgRegex);
|
const imageMatch = link.match(imgRegex);
|
||||||
|
|
||||||
if (imageMatch[0].indexOf('.gif') > 0) return gifBody(imageMatch[0]);
|
if (imageMatch) {
|
||||||
|
if (imageMatch[0].indexOf('.gif') > 0) {
|
||||||
|
return gifBody(imageMatch[0]);
|
||||||
|
}
|
||||||
|
|
||||||
if (imageMatch && imageMatch[0]) {
|
if (imageMatch[0]) {
|
||||||
return imageBody(imageMatch[0]);
|
return imageBody(imageMatch[0]);
|
||||||
|
}
|
||||||
|
} else if (link.trim().indexOf('ipfs.busy.org') > 0) {
|
||||||
|
return imageBody(link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return link;
|
||||||
|
} if (link.trim().indexOf('ipfs.busy.org') > 0) {
|
||||||
|
return imageBody(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user