diff --git a/package.json b/package.json index b6c2231ce..59576e886 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "dependencies": { "@babel/runtime": "^7.5.5", "@esteemapp/dhive": "^0.15.0", - "@esteemapp/esteem-render-helpers": "^1.5.6", + "@esteemapp/esteem-render-helpers": "^1.5.9", "@esteemapp/react-native-autocomplete-input": "^4.2.1", "@esteemapp/react-native-modal-popover": "^0.0.15", "@esteemapp/react-native-multi-slider": "^1.1.0", diff --git a/src/components/editorElements/titleArea/view/titleAreaView.js b/src/components/editorElements/titleArea/view/titleAreaView.js index 814a3851e..1e0b6ab02 100644 --- a/src/components/editorElements/titleArea/view/titleAreaView.js +++ b/src/components/editorElements/titleArea/view/titleAreaView.js @@ -60,7 +60,8 @@ export default class TitleAreaView extends Component { placeholder={intl.formatMessage({ id: 'editor.title', })} - numberOfLines={1} + multiline + numberOfLines={2} onContentSizeChange={(event) => { this.setState({ height: event.nativeEvent.contentSize.height }); }} diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index 80dc4650f..f9503918e 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -140,7 +140,11 @@ const MarkdownEditorView = ({ const _renderPreview = () => ( - {text ? : ...} + {text ? ( + + ) : ( + ... + )} ); diff --git a/src/components/postElements/body/view/config.js b/src/components/postElements/body/view/config.js index b5cfdeb9a..47348adc3 100644 --- a/src/components/postElements/body/view/config.js +++ b/src/components/postElements/body/view/config.js @@ -31,6 +31,7 @@ document.addEventListener('click', function(event) { return; } if (el.getAttribute('target') === '_external') { + event.preventDefault(); var href = el.getAttribute('href'); var result = { type: '_external', @@ -40,6 +41,7 @@ document.addEventListener('click', function(event) { return true; } if (el.classList.contains('markdown-external-link')) { + event.preventDefault(); var href = el.getAttribute('data-href'); var result = { type: 'markdown-external-link', @@ -168,6 +170,7 @@ document.addEventListener('click', function(event) { return; } if (el.getAttribute('target') === '_external') { + event.preventDefault(); var href = el.getAttribute('href'); var result = { type: '_external', @@ -177,6 +180,7 @@ document.addEventListener('click', function(event) { return true; } if (el.classList.contains('markdown-external-link')) { + event.preventDefault(); var href = el.getAttribute('data-href'); var result = { type: 'markdown-external-link', diff --git a/src/providers/steem/steemConnect.js b/src/providers/steem/steemConnect.js index a429ddf1e..1a9620703 100644 --- a/src/providers/steem/steemConnect.js +++ b/src/providers/steem/steemConnect.js @@ -1,4 +1,5 @@ import steemConnect from './steemConnectAPI'; +import { makeOptions } from '../../utils/editor'; /** * @method to upvote/unvote a content @@ -59,7 +60,7 @@ export const post = (postObj) => { ]; operations.push(commentOp); - const commentOptionsConfig = prepareBeneficiaries(postObj); + const commentOptionsConfig = makeOptions(postObj); operations.push(commentOptionsConfig); diff --git a/src/screens/editor/container/editorContainer.js b/src/screens/editor/container/editorContainer.js index bc74d7bff..bc65834e2 100644 --- a/src/screens/editor/container/editorContainer.js +++ b/src/screens/editor/container/editorContainer.js @@ -309,7 +309,7 @@ class EditorContainer extends Component { } const author = currentAccount.name; - const options = makeOptions(author, permlink); + const options = makeOptions({ author: author, permlink: permlink, operationType: '' }); const parentPermlink = _tags[0] || 'hive-125125'; if (scheduleDate) { @@ -384,7 +384,7 @@ class EditorContainer extends Component { const jsonMeta = makeJsonMetadataReply(post.json_metadata.tags || ['ecency']); const permlink = generateReplyPermlink(post.author); const author = currentAccount.name; - const options = makeOptions(author, permlink); + const options = makeOptions({ author: author, permlink: permlink, operationType: '' }); const parentAuthor = post.author; const parentPermlink = post.permlink; diff --git a/src/utils/editor.js b/src/utils/editor.js index a1da9d60c..cf6b5c3f3 100644 --- a/src/utils/editor.js +++ b/src/utils/editor.js @@ -57,35 +57,38 @@ export const generateReplyPermlink = (toAuthor) => { return `re-${toAuthor.replace(/\./g, '')}-${timeFormat}`; }; -export const makeOptions = (author, permlink, operationType) => { - if (!author || !permlink) { +export const makeOptions = (postObj) => { + if (!postObj.author || !postObj.permlink) { return {}; } const a = { allow_curation_rewards: true, allow_votes: true, - author, - permlink, + author: postObj.author, + permlink: postObj.permlink, max_accepted_payout: '1000000.000 HBD', percent_steem_dollars: 10000, - extensions: [[0, { beneficiaries: [{ account: 'ecency', weight: 100 }] }]], + extensions: [], }; - switch (operationType) { + switch (postObj.operationType) { case 'sp': a.max_accepted_payout = '1000000.000 HBD'; a.percent_steem_dollars = 0; + a.extensions = postObj.beneficiaries || []; break; case 'dp': a.max_accepted_payout = '0.000 HBD'; a.percent_steem_dollars = 10000; + a.extensions = postObj.beneficiaries || []; break; default: a.max_accepted_payout = '1000000.000 HBD'; a.percent_steem_dollars = 10000; + a.extensions = postObj.beneficiaries || []; break; } diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 37f544195..848025ea9 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -1,7 +1,7 @@ import isEmpty from 'lodash/isEmpty'; import forEach from 'lodash/forEach'; import { get, uniqBy } from 'lodash'; - +import { Platform } from 'react-native'; import { postBodySummary, renderPostBody } from '@esteemapp/esteem-render-helpers'; // Dsteem @@ -13,6 +13,8 @@ import { getPostReblogs } from '../providers/esteem/esteem'; import { getReputation } from './reputation'; import { getResizedImage, getResizedAvatar } from './image'; +const webp = Platform.OS === 'ios' ? false : true; + export const parsePosts = async (posts, currentUserName) => { if (posts) { const promises = posts.map((post) => parsePost(post, currentUserName)); @@ -43,7 +45,7 @@ export const parsePost = async (post, currentUserName, isPromoted) => { post.avatar = getResizedAvatar(get(post, 'author')); post.active_votes.sort((a, b) => b.rshares - a.rshares); - post.body = renderPostBody(post); + post.body = renderPostBody(post, true, webp); post.summary = postBodySummary(post, 150); post.is_declined_payout = Number(parseFloat(post.max_accepted_payout)) === 0; @@ -108,7 +110,7 @@ export const parseComments = async (comments, currentUserName) => { comment.author_reputation = getReputation(get(comment, 'author_reputation')); comment.avatar = getResizedAvatar(get(comment, 'author')); comment.markdownBody = get(comment, 'body'); - comment.body = renderPostBody(comment); + comment.body = renderPostBody(comment, true, webp); comment.active_votes = activeVotes; comment.vote_count = activeVotes && activeVotes.length; diff --git a/yarn.lock b/yarn.lock index a49a686dc..0bcb64532 100644 --- a/yarn.lock +++ b/yarn.lock @@ -718,10 +718,10 @@ verror "^1.10.0" whatwg-fetch "^2.0.3" -"@esteemapp/esteem-render-helpers@^1.5.6": - version "1.5.6" - resolved "https://registry.yarnpkg.com/@esteemapp/esteem-render-helpers/-/esteem-render-helpers-1.5.6.tgz#fda35a6052e99e059ae786c4cb6c6afb0c5b5f24" - integrity sha512-uK0Nj1ps8vVBgw39B1lPaRSqXXabwOxIhSbnYyuetOCZVzyKKV//ye3WvblADRyuAUjTve5UZCNTQ1MMBY9f0w== +"@esteemapp/esteem-render-helpers@^1.5.9": + version "1.5.9" + resolved "https://registry.yarnpkg.com/@esteemapp/esteem-render-helpers/-/esteem-render-helpers-1.5.9.tgz#c870322d7b1085f89c648061c1b5d241bb056ac9" + integrity sha512-0cA6KLoNhjA7UbiwoaUhYz6ZGz6vPSWrZGc4KTa0SB2Vq6TS9Ac37iGyiLtuF0YeWR66xapi8TOzqR++iYqnew== dependencies: he "^1.2.0" lru-cache "^5.1.1"