diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/Pods/Pods.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist index a174ad651..cb66d67ad 100644 --- a/ios/Pods/Pods.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist @@ -93,28 +93,28 @@ isShown orderHint - 18 + 19 RSKImageCropper.xcscheme isShown orderHint - 19 + 20 SDWebImage.xcscheme isShown orderHint - 20 + 21 SSZipArchive.xcscheme isShown orderHint - 21 + 23 glog.xcscheme diff --git a/ios/eSteem.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/eSteem.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist index 860692ff3..3cffac506 100644 --- a/ios/eSteem.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/ios/eSteem.xcodeproj/xcuserdata/ue.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ eSteem.xcscheme_^#shared#^_ orderHint - 27 + 26 diff --git a/ios/eSteem.xcworkspace/xcuserdata/ue.xcuserdatad/UserInterfaceState.xcuserstate b/ios/eSteem.xcworkspace/xcuserdata/ue.xcuserdatad/UserInterfaceState.xcuserstate index 4733538f0..b2d7d3067 100644 Binary files a/ios/eSteem.xcworkspace/xcuserdata/ue.xcuserdatad/UserInterfaceState.xcuserstate and b/ios/eSteem.xcworkspace/xcuserdata/ue.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/src/components/editorElements/tagArea/view/tagAreaView.js b/src/components/editorElements/tagArea/view/tagAreaView.js index 2cbe18390..96d2ec3da 100644 --- a/src/components/editorElements/tagArea/view/tagAreaView.js +++ b/src/components/editorElements/tagArea/view/tagAreaView.js @@ -26,7 +26,7 @@ export default class TagAreaView extends Component { // Component Life Cycles componentWillReceiveProps(nextProps) { - const { draftChips } = this.props; + const { draftChips, isRemoveTag } = this.props; if (nextProps.draftChips && nextProps.draftChips !== draftChips) { const _chips = [...nextProps.draftChips, ' ']; @@ -34,6 +34,10 @@ export default class TagAreaView extends Component { chips: _chips, }); } + + if (isRemoveTag !== nextProps.isRemoveTag && nextProps.isRemoveTag) { + this.setState({ chips: [' '], currentText: '' }); + } } // Component Functions diff --git a/src/components/markdownEditor/view/markdownEditorStyles.js b/src/components/markdownEditor/view/markdownEditorStyles.js index b1131dfb1..418821a73 100644 --- a/src/components/markdownEditor/view/markdownEditorStyles.js +++ b/src/components/markdownEditor/view/markdownEditorStyles.js @@ -32,7 +32,6 @@ export default EStyleSheet.create({ maxWidth: '$deviceWidth / 2', }, rightButtonsWrapper: { - marginRight: 16, flexDirection: 'row', alignItems: 'center', }, @@ -53,4 +52,14 @@ export default EStyleSheet.create({ icon: { color: '$editorButtonColor', }, + clearButtonWrapper: { + justifyContent: 'center', + alignItems: 'center', + height: 50, + width: 56, + backgroundColor: '$primaryBlue', + }, + clearIcon: { + color: '$white', + }, }); diff --git a/src/components/markdownEditor/view/markdownEditorView.js b/src/components/markdownEditor/view/markdownEditorView.js index cd820be0c..2821b0f91 100644 --- a/src/components/markdownEditor/view/markdownEditorView.js +++ b/src/components/markdownEditor/view/markdownEditorView.js @@ -94,10 +94,7 @@ export default class MarkdownEditorView extends Component { } }; - _getState = () => { - return this.state; - }; - + _getState = () => this.state; _renderPreview = () => { const { text } = this.state; @@ -128,9 +125,7 @@ export default class MarkdownEditorView extends Component { index !== 9 - && this._renderMarkupButton({ item, getState, setState }) + renderItem={({ item, index }) => index !== 9 && this._renderMarkupButton({ item, getState, setState }) } horizontal /> @@ -152,6 +147,15 @@ export default class MarkdownEditorView extends Component { iconType="FontAwesome" name="image" /> + + this.ClearActionSheet.show()} + size={20} + iconStyle={styles.clearIcon} + iconType="FontAwesome" + name="trash" + /> + {/* TODO: After alpha */} {/* ); + _handleClear = () => { + const { initialFields } = this.props; + + initialFields(); + + this.setState({ text: '' }); + }; + render() { const { - intl, isPreviewActive, isReply, handleOpenImagePicker, + handleOpenImagePicker, intl, isPreviewActive, isReply, } = this.props; const { text, selection } = this.state; @@ -174,7 +186,7 @@ export default class MarkdownEditorView extends Component { {!isPreviewActive ? ( (this.ActionSheet = o)} - options={['Open Gallery', 'Capture a photo', 'Cancel']} + options={[ + intl.formatMessage({ + id: 'editor.open_galery', + }), + intl.formatMessage({ + id: 'editor.capture_photo', + }), + intl.formatMessage({ + id: 'alert.cancel', + }), + ]} cancelButtonIndex={2} onPress={(index) => { handleOpenImagePicker(index === 0 ? 'image' : index === 1 && 'camera'); }} /> + (this.ClearActionSheet = o)} + title={intl.formatMessage({ + id: 'alert.clear_alert', + })} + options={[ + intl.formatMessage({ + id: 'alert.clear', + }), + intl.formatMessage({ + id: 'alert.cancel', + }), + ]} + cancelButtonIndex={1} + onPress={(index) => { + index === 0 && this._handleClear(); + }} + /> ); } diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 7ac7f59c6..963da0e8c 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -113,7 +113,9 @@ "default_placeholder": "What would you like to write about today?", "reply_placeholder": "What would you like to write about above post?", "publish": "Publish", - "reply": "Reply" + "reply": "Reply", + "open_galery": "Open Galery", + "capture_photo": "Capture a photo" }, "pincode": { "enter_text": "Enter PIN to unlock", @@ -134,6 +136,8 @@ "warning": "Warning", "invalid_pincode": "Invalid PIN code, please check and try again.", "remove_alert": "Are you sure you want to remove?", + "clear_alert": "Are you sure you want to clear?", + "clear": "Clear", "cancel": "Cancel", "delete": "Delete", "copied": "Copied!", diff --git a/src/screens/editor/screen/editorScreen.js b/src/screens/editor/screen/editorScreen.js index a121b0dec..7841f9032 100644 --- a/src/screens/editor/screen/editorScreen.js +++ b/src/screens/editor/screen/editorScreen.js @@ -27,6 +27,7 @@ class EditorScreen extends Component { isFormValid: false, isPreviewActive: false, wordsCount: null, + isRemoveTag: false, fields: { title: (props.draftPost && props.draftPost.title) || '', body: (props.draftPost && props.draftPost.body) || '', @@ -50,6 +51,18 @@ class EditorScreen extends Component { }; // Component Functions + _initialFields = () => { + this.setState({ + fields: { + title: '', + body: '', + tags: [], + isValid: false, + }, + isRemoveTag: true, + }); + }; + _handleOnPressPreviewButton = () => { const { isPreviewActive } = this.state; @@ -134,14 +147,14 @@ class EditorScreen extends Component { _handleOnTagAdded = (tags) => { const _tags = tags.filter(tag => tag && tag !== ' '); const fields = { ...this.state.fields }; - + fields.tags = _tags; - this.setState({ fields }); + this.setState({ fields, isRemoveTag: false, }); }; render() { const { - fields, isPreviewActive, wordsCount, isFormValid, + fields, isPreviewActive, wordsCount, isFormValid, isRemoveTag, } = this.state; const { draftPost, @@ -192,6 +205,7 @@ class EditorScreen extends Component { {!isReply && ( 0 ? fields.tags : null} + isRemoveTag={isRemoveTag} componentID="tag-area" handleTagChanged={this._handleOnTagAdded} intl={intl} @@ -204,6 +218,7 @@ class EditorScreen extends Component { handleOpenImagePicker={handleOnImagePicker} intl={intl} uploadedImage={uploadedImage} + initialFields={this._initialFields} isReply={isReply} />