Improve compose form performance, upgrade JS dependencies. LightingBox

now allows to cycle through multiple images
This commit is contained in:
Eugen Rochko 2017-02-26 01:23:44 +01:00
parent 3e9d794ea5
commit 2c50687279
14 changed files with 1251 additions and 713 deletions

View file

@ -116,7 +116,10 @@ export default function compose(state = initialState, action) {
case COMPOSE_SENSITIVITY_CHANGE:
return state.set('sensitive', action.checked);
case COMPOSE_SPOILERNESS_CHANGE:
return (action.checked ? state : state.set('spoiler_text', '')).set('spoiler', action.checked);
return state.withMutations(map => {
map.set('spoiler_text', '');
map.set('spoiler', action.checked);
});
case COMPOSE_SPOILER_TEXT_CHANGE:
return state.set('spoiler_text', action.text);
case COMPOSE_VISIBILITY_CHANGE:

View file

@ -23,9 +23,9 @@ export default function modal(state = initialState, action) {
case MODAL_CLOSE:
return state.set('open', false);
case MODAL_INDEX_DECREASE:
return state.update('index', index => Math.max(index - 1, 0));
return state.update('index', index => (index - 1) % state.get('media').size);
case MODAL_INDEX_INCREASE:
return state.update('index', index => Math.min(index + 1, state.get('media').size - 1));
return state.update('index', index => (index + 1) % state.get('media').size);
default:
return state;
}