mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-03 19:42:03 +03:00
Merge pull request #1474 from esteemapp/mmore
Fix tag input issues, try post renderer on comments
This commit is contained in:
commit
017ba6bd28
@ -11,4 +11,9 @@ export default EStyleSheet.create({
|
|||||||
borderBottomWidth: 1,
|
borderBottomWidth: 1,
|
||||||
borderBottomColor: '$primaryLightGray',
|
borderBottomColor: '$primaryLightGray',
|
||||||
},
|
},
|
||||||
|
warning: {
|
||||||
|
color: '$primaryRed',
|
||||||
|
fontSize: 12,
|
||||||
|
fontFamily: '$editorFont',
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import React, { useState, useEffect } from 'react';
|
import React, { useState, useEffect } from 'react';
|
||||||
import { View, Alert } from 'react-native';
|
import { View, Text } from 'react-native';
|
||||||
// Constants
|
// Constants
|
||||||
|
|
||||||
// Components
|
// Components
|
||||||
@ -12,7 +12,6 @@ import globalStyles from '../../../../globalStyles';
|
|||||||
const TagInput = ({
|
const TagInput = ({
|
||||||
value,
|
value,
|
||||||
onChange,
|
onChange,
|
||||||
handleIsValid,
|
|
||||||
componentID,
|
componentID,
|
||||||
handleTagChanged,
|
handleTagChanged,
|
||||||
intl,
|
intl,
|
||||||
@ -20,6 +19,7 @@ const TagInput = ({
|
|||||||
autoFocus,
|
autoFocus,
|
||||||
}) => {
|
}) => {
|
||||||
const [text, setText] = useState('');
|
const [text, setText] = useState('');
|
||||||
|
const [warning, setWarning] = useState(null);
|
||||||
const [height, setHeight] = useState(0);
|
const [height, setHeight] = useState(0);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -33,60 +33,56 @@ const TagInput = ({
|
|||||||
// Component Functions
|
// Component Functions
|
||||||
const _handleOnChange = _text => {
|
const _handleOnChange = _text => {
|
||||||
setText(_text.replace(/,/g, ' ').replace(/#/g, ''));
|
setText(_text.replace(/,/g, ' ').replace(/#/g, ''));
|
||||||
|
|
||||||
|
let cats = _text.split(' ');
|
||||||
|
if (handleTagChanged && cats.length > 0) {
|
||||||
|
cats.length > 10
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_tags' })), setHeight(60))
|
||||||
|
: cats.find(c => c.length > 24)
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_length' })), setHeight(60))
|
||||||
|
: cats.find(c => c.split('-').length > 2)
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_dash' })), setHeight(60))
|
||||||
|
: cats.find(c => c.indexOf(',') >= 0)
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_space' })), setHeight(60))
|
||||||
|
: cats.find(c => /[A-Z]/.test(c))
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_lowercase' })), setHeight(60))
|
||||||
|
: cats.find(c => !/^[a-z0-9-#]+$/.test(c))
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_characters' })), setHeight(60))
|
||||||
|
: cats.find(c => !/^[a-z-#]/.test(c))
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_firstchar' })), setHeight(60))
|
||||||
|
: cats.find(c => !/[a-z0-9]$/.test(c))
|
||||||
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_lastchar' })), setHeight(60))
|
||||||
|
: setWarning(null);
|
||||||
|
|
||||||
|
handleTagChanged([...cats]);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
const _handleOnBlur = () => {
|
const _handleOnBlur = () => {
|
||||||
|
let cats = [];
|
||||||
if (onChange) {
|
if (onChange) {
|
||||||
let cats = text.trim().split(' ');
|
cats = text.trim().split(' ');
|
||||||
if (handleTagChanged && cats.length > 0) {
|
if (handleTagChanged && cats.length > 0) {
|
||||||
cats.length > 10
|
cats.length > 10
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_tags' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_tags' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => c.length > 24)
|
: cats.find(c => c.length > 24)
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_length' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_length' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => c.split('-').length > 2)
|
: cats.find(c => c.split('-').length > 2)
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_dash' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_dash' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => c.indexOf(',') >= 0)
|
: cats.find(c => c.indexOf(',') >= 0)
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_space' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_space' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => /[A-Z]/.test(c))
|
: cats.find(c => /[A-Z]/.test(c))
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_lowercase' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_lowercase' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => !/^[a-z0-9-#]+$/.test(c))
|
: cats.find(c => !/^[a-z0-9-#]+$/.test(c))
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_characters' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_characters' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => !/^[a-z-#]/.test(c))
|
: cats.find(c => !/^[a-z-#]/.test(c))
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_firstchar' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
|
||||||
intl.formatMessage({ id: 'editor.limited_firstchar' }),
|
|
||||||
)
|
|
||||||
: cats.find(c => !/[a-z0-9]$/.test(c))
|
: cats.find(c => !/[a-z0-9]$/.test(c))
|
||||||
? Alert.alert(
|
? (setWarning(intl.formatMessage({ id: 'editor.limited_lastchar' })), setHeight(60))
|
||||||
intl.formatMessage({ id: 'alert.error' }),
|
: setWarning(null);
|
||||||
intl.formatMessage({ id: 'editor.limited_lastchar' }),
|
|
||||||
)
|
|
||||||
: null;
|
|
||||||
handleTagChanged([...cats]);
|
handleTagChanged([...cats]);
|
||||||
}
|
}
|
||||||
onChange(text);
|
onChange(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handleIsValid) {
|
|
||||||
handleIsValid(componentID, !!(text && text.length));
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<View style={[globalStyles.containerHorizontal16, { height: Math.max(35, height) }]}>
|
<View style={[globalStyles.containerHorizontal16, { height: Math.max(35, height) }]}>
|
||||||
@ -108,6 +104,7 @@ const TagInput = ({
|
|||||||
onBlur={() => _handleOnBlur()}
|
onBlur={() => _handleOnBlur()}
|
||||||
value={text}
|
value={text}
|
||||||
/>
|
/>
|
||||||
|
{warning && <Text style={styles.warning}>{warning}</Text>}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Dimensions, Linking, Alert, TouchableOpacity, Text } from 'react-native';
|
import { Dimensions, Linking, Alert, TouchableOpacity, Text, View } from 'react-native';
|
||||||
import { useIntl } from 'react-intl';
|
import { useIntl } from 'react-intl';
|
||||||
import HTML from '@esteemapp/react-native-render-html';
|
import HTML from '@esteemapp/react-native-render-html';
|
||||||
import { getParentsTagsRecursively } from '@esteemapp/react-native-render-html/src/HTMLUtils';
|
import { getParentsTagsRecursively } from '@esteemapp/react-native-render-html/src/HTMLUtils';
|
||||||
|
import AutoHeightWebView from 'react-native-autoheight-webview';
|
||||||
|
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||||
|
import get from 'lodash/get';
|
||||||
import { navigate } from '../../../../navigation/service';
|
import { navigate } from '../../../../navigation/service';
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
import { default as ROUTES } from '../../../../constants/routeNames';
|
import { default as ROUTES } from '../../../../constants/routeNames';
|
||||||
|
|
||||||
|
import DEFAULT_IMAGE from '../../../../assets/no_image.png';
|
||||||
|
import { CommentPlaceHolder } from '../../../basicUIElements';
|
||||||
|
import script from './config';
|
||||||
|
|
||||||
// Styles
|
// Styles
|
||||||
import styles from './postBodyStyles';
|
import styles from './postBodyStyles';
|
||||||
|
|
||||||
@ -19,6 +26,7 @@ const CommentBody = ({
|
|||||||
handleOnUserPress,
|
handleOnUserPress,
|
||||||
handleOnPostPress,
|
handleOnPostPress,
|
||||||
created,
|
created,
|
||||||
|
commentDepth,
|
||||||
}) => {
|
}) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
@ -146,6 +154,22 @@ const CommentBody = ({
|
|||||||
</Text>
|
</Text>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (passProps.parentWrapper === 'View') {
|
||||||
|
return (
|
||||||
|
<AutoHeightWebView
|
||||||
|
key={passProps.key}
|
||||||
|
source={{
|
||||||
|
html: passProps.html,
|
||||||
|
}}
|
||||||
|
allowsFullscreenVideo={true}
|
||||||
|
style={{ width: WIDTH - (32 + 29 * 1) }}
|
||||||
|
customScript={script.toString()}
|
||||||
|
startInLoadingState={true}
|
||||||
|
onShouldStartLoadWithRequest={false}
|
||||||
|
scrollEnabled={false}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
key={passProps.key}
|
key={passProps.key}
|
||||||
@ -163,8 +187,112 @@ const CommentBody = ({
|
|||||||
|
|
||||||
const _initialDimensions = { width: WIDTH - 50, height: 80 };
|
const _initialDimensions = { width: WIDTH - 50, height: 80 };
|
||||||
|
|
||||||
|
const customStyle = `
|
||||||
|
* {
|
||||||
|
color: ${EStyleSheet.value('$primaryBlack')};
|
||||||
|
font-family: Roboto, sans-serif;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
body {
|
||||||
|
color: ${EStyleSheet.value('$primaryBlack')};
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: ${EStyleSheet.value('$primaryBlue')};
|
||||||
|
cursor: pointer;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
align-self: 'center';
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
center {
|
||||||
|
text-align: 'center';
|
||||||
|
align-items: 'center';
|
||||||
|
justify-content: 'center';
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
flex: 1;
|
||||||
|
justify-content: 'center';
|
||||||
|
font-weight: 'bold';
|
||||||
|
color: ${EStyleSheet.value('$primaryBlack')};
|
||||||
|
font-size: 14;
|
||||||
|
padding: 5;
|
||||||
|
}
|
||||||
|
tr {
|
||||||
|
background-color: ${EStyleSheet.value('$darkIconColor')};
|
||||||
|
flex-direction: 'row';
|
||||||
|
}
|
||||||
|
td {
|
||||||
|
border-width: 0.5;
|
||||||
|
border-color: ${EStyleSheet.value('$tableBorderColor')};
|
||||||
|
flex: 1;
|
||||||
|
padding: 10;
|
||||||
|
background-color: ${EStyleSheet.value('$tableTrColor')};
|
||||||
|
}
|
||||||
|
blockquote {
|
||||||
|
border-left-width: 5;
|
||||||
|
border-left-style: solid;
|
||||||
|
border-color: ${EStyleSheet.value('$darkIconColor')};
|
||||||
|
padding-left: 5;
|
||||||
|
}
|
||||||
|
code {
|
||||||
|
background-color: ${EStyleSheet.value('$darkIconColor')};
|
||||||
|
font-family: ${EStyleSheet.value('$editorFont')};
|
||||||
|
}
|
||||||
|
center {
|
||||||
|
text-align: 'center';
|
||||||
|
align-items: 'center';
|
||||||
|
justify-content: 'center';
|
||||||
|
}
|
||||||
|
.markdown-video-link {
|
||||||
|
max-width: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.markdown-video-play {
|
||||||
|
position: absolute;
|
||||||
|
width: 100px;
|
||||||
|
height: 100px;
|
||||||
|
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAACo1JREFUeAHlm02IHMcVx/trZrEDwsImvggCklYrxRAslhykQLyRFodI2g/ZFjnKsojBxJBbfPAaRJJD4ot1iQI+xArJKcpa3p1VZMPGWiUgQUC2T1ovIZCAwNiRUbDARjPT3fn/aro6vbPz1bOaj0UFPT3dXR/v/96rV69eVbnO/UvuxMSEv7KyUs1WeeTI8T2eF+13XedJ1/XGHCfeof9fj+P4McdxH6rljb9yXfd2HDuf6fst3dd0feQ4wQdLS/P/yNanNgK1EepdnH3f7X+324K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9YjDN8Xm9H5MEtSXHeVz3R/VMlyF9qU70ufB/qvstPZvj88TtCV2bHMkPLq1GJtRqU8Btnf8DPtmgstMt+csAAAAASUVORK5CYII=') no-repeat center center;
|
||||||
|
z-index: 20;
|
||||||
|
opacity: 0.9;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
margin-top: -100px;
|
||||||
|
transform: translateX(-50%) translateY(-50%);
|
||||||
|
-webkit-transform: translateX(-50%) translateY(-50%);
|
||||||
|
-moz-transform: translateX(-50%) translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe {
|
||||||
|
width: 100%;
|
||||||
|
height: 240px;
|
||||||
|
}
|
||||||
|
.pull-right {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.pull-left {
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
.pull-left,
|
||||||
|
.pull-right {
|
||||||
|
max-width: calc(50% - 10px);
|
||||||
|
padding-left: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
.phishy {
|
||||||
|
display: inline;
|
||||||
|
color: red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text-justify {
|
||||||
|
text-align: justify;
|
||||||
|
text-justify: inter-word;
|
||||||
|
letter-spacing: 0px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
return (
|
return (
|
||||||
<HTML
|
/*<HTML
|
||||||
html={body}
|
html={body}
|
||||||
onLinkPress={(evt, href, hrefAtr) => _handleOnLinkPress(evt, href, hrefAtr)}
|
onLinkPress={(evt, href, hrefAtr) => _handleOnLinkPress(evt, href, hrefAtr)}
|
||||||
containerStyle={styles.commentContainer}
|
containerStyle={styles.commentContainer}
|
||||||
@ -179,6 +307,20 @@ const CommentBody = ({
|
|||||||
alterNode={_alterNode}
|
alterNode={_alterNode}
|
||||||
alterData={_alterData}
|
alterData={_alterData}
|
||||||
renderers={_customRenderer}
|
renderers={_customRenderer}
|
||||||
|
/>*/
|
||||||
|
<AutoHeightWebView
|
||||||
|
key={created.toString()}
|
||||||
|
source={{
|
||||||
|
html: body,
|
||||||
|
}}
|
||||||
|
allowsFullscreenVideo={true}
|
||||||
|
style={{ width: WIDTH - (32 + 29 * commentDepth) }}
|
||||||
|
customStyle={customStyle}
|
||||||
|
renderLoading={() => <CommentPlaceHolder />}
|
||||||
|
customScript={script.toString()}
|
||||||
|
startInLoadingState={true}
|
||||||
|
onShouldStartLoadWithRequest={false}
|
||||||
|
scrollEnabled={false}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -282,6 +282,10 @@ class EditorContainer extends Component {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.setState({ isPostSending: false });
|
||||||
|
|
||||||
|
setDraftPost({ title: '', body: '', tags: '' }, currentAccount.name);
|
||||||
|
|
||||||
navigation.navigate({
|
navigation.navigate({
|
||||||
routeName: ROUTES.SCREENS.POST,
|
routeName: ROUTES.SCREENS.POST,
|
||||||
params: {
|
params: {
|
||||||
@ -291,10 +295,6 @@ class EditorContainer extends Component {
|
|||||||
},
|
},
|
||||||
key: permlink,
|
key: permlink,
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({ isPostSending: false });
|
|
||||||
|
|
||||||
setDraftPost({ title: '', body: '', tags: '' }, currentAccount.name);
|
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
this._handleSubmitFailure(error);
|
this._handleSubmitFailure(error);
|
||||||
@ -410,12 +410,11 @@ class EditorContainer extends Component {
|
|||||||
_handleSubmitSuccess = () => {
|
_handleSubmitSuccess = () => {
|
||||||
const { navigation } = this.props;
|
const { navigation } = this.props;
|
||||||
|
|
||||||
if (navigation) {
|
|
||||||
navigation.goBack();
|
|
||||||
navigation.state.params.fetchPost();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.stateTimer = setTimeout(() => {
|
this.stateTimer = setTimeout(() => {
|
||||||
|
if (navigation) {
|
||||||
|
navigation.goBack();
|
||||||
|
navigation.state.params.fetchPost();
|
||||||
|
}
|
||||||
this.setState({ isPostSending: false });
|
this.setState({ isPostSending: false });
|
||||||
clearTimeout(this.stateTimer);
|
clearTimeout(this.stateTimer);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
@ -131,8 +131,10 @@ class EditorScreen extends Component {
|
|||||||
} else {
|
} else {
|
||||||
isFormValid =
|
isFormValid =
|
||||||
get(fields, 'title', '') &&
|
get(fields, 'title', '') &&
|
||||||
|
get(fields, 'title', '').length < 255 &&
|
||||||
(get(fields, 'body', '') || (bodyText && bodyText > 0)) &&
|
(get(fields, 'body', '') || (bodyText && bodyText > 0)) &&
|
||||||
get(fields, 'tags', null);
|
get(fields, 'tags', null) &&
|
||||||
|
get(fields, 'tags', null).length < 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({ isFormValid });
|
this.setState({ isFormValid });
|
||||||
@ -167,10 +169,9 @@ class EditorScreen extends Component {
|
|||||||
|
|
||||||
_handleOnTagAdded = async tags => {
|
_handleOnTagAdded = async tags => {
|
||||||
const { fields: _fields } = this.state;
|
const { fields: _fields } = this.state;
|
||||||
const _tags = tags.filter(tag => tag && tag !== ' ');
|
const _tags = tags; //.filter(tag => tag && tag !== ' ');
|
||||||
const __tags = _tags.map(t => t.toLowerCase());
|
const __tags = _tags.map(t => t.toLowerCase());
|
||||||
const __fields = { ..._fields, tags: [...__tags] };
|
const __fields = { ..._fields, tags: [...__tags] };
|
||||||
|
|
||||||
this.setState({ fields: __fields, isRemoveTag: false }, () => {
|
this.setState({ fields: __fields, isRemoveTag: false }, () => {
|
||||||
this._handleFormUpdate('tag-area', __fields.tags);
|
this._handleFormUpdate('tag-area', __fields.tags);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user