Progress
This commit is contained in:
@@ -170,11 +170,13 @@ const updateSuggestionTags = (state, token) => {
|
||||
};
|
||||
|
||||
const insertEmoji = (state, position, emojiData, needsSpace) => {
|
||||
const oldText = state.get('text');
|
||||
const emoji = needsSpace ? ' ' + emojiData.native : emojiData.native;
|
||||
const oldText = state.get('text')
|
||||
const emoji = needsSpace ? ' ' + emojiData.native : emojiData.native
|
||||
const text = `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}`
|
||||
console.log("insertEmoji reducer:", emoji, position, emojiData, needsSpace, text)
|
||||
|
||||
return state.merge({
|
||||
text: `${oldText.slice(0, position)}${emoji} ${oldText.slice(position)}`,
|
||||
text,
|
||||
focusDate: new Date(),
|
||||
caretPosition: position + emoji.length + 1,
|
||||
idempotencyKey: uuid(),
|
||||
@@ -248,10 +250,14 @@ export default function compose(state = initialState, action) {
|
||||
.set('privacy', action.value)
|
||||
.set('idempotencyKey', uuid());
|
||||
case COMPOSE_CHANGE:
|
||||
return state
|
||||
.set('text', action.text)
|
||||
.set('markdown', action.markdown)
|
||||
.set('idempotencyKey', uuid());
|
||||
return state.withMutations(map => {
|
||||
map.set('text', action.text)
|
||||
map.set('markdown', action.markdown)
|
||||
map.set('idempotencyKey', uuid())
|
||||
if (action.replyId) {
|
||||
map.set('in_reply_to', action.replyId)
|
||||
}
|
||||
})
|
||||
case COMPOSE_COMPOSING_CHANGE:
|
||||
return state.set('is_composing', action.value);
|
||||
case COMPOSE_REPLY:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
GIFS_CLEAR_RESULTS,
|
||||
GIF_SET_SELECTED,
|
||||
GIF_CLEAR_SELECTED,
|
||||
GIF_CHANGE_SEARCH_TEXT,
|
||||
GIF_RESULTS_FETCH_REQUEST,
|
||||
GIF_RESULTS_FETCH_SUCCESS,
|
||||
@@ -14,11 +15,15 @@ import { Map as ImmutableMap } from 'immutable'
|
||||
const initialState = ImmutableMap({
|
||||
categories: [],
|
||||
results: [],
|
||||
chosenUrl: '',
|
||||
searchText: '',
|
||||
next: 0,
|
||||
loading: false,
|
||||
error: false,
|
||||
selectedGif: ImmutableMap({
|
||||
id: '',
|
||||
title: '',
|
||||
src: '',
|
||||
})
|
||||
})
|
||||
|
||||
export default function (state = initialState, action) {
|
||||
@@ -48,7 +53,13 @@ export default function (state = initialState, action) {
|
||||
case GIFS_CLEAR_RESULTS:
|
||||
return state.set('results', [])
|
||||
case GIF_SET_SELECTED:
|
||||
return state.set('chosenUrl', action.url)
|
||||
return state.set('selectedGif', ImmutableMap({
|
||||
id: action.result.id,
|
||||
title: action.result.title,
|
||||
src: action.result.media[0].gif.url,
|
||||
}))
|
||||
case GIF_CLEAR_SELECTED:
|
||||
return state.set('selectedGif', ImmutableMap())
|
||||
case GIF_CHANGE_SEARCH_TEXT:
|
||||
return state.set('searchText', action.text.trim());
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user