Add ability to reorder uploaded media before posting in web UI (#28456)
This commit is contained in:
parent
6c381f20b1
commit
8e7e86ee35
10 changed files with 159 additions and 171 deletions
|
@ -45,6 +45,7 @@ import {
|
|||
INIT_MEDIA_EDIT_MODAL,
|
||||
COMPOSE_CHANGE_MEDIA_DESCRIPTION,
|
||||
COMPOSE_CHANGE_MEDIA_FOCUS,
|
||||
COMPOSE_CHANGE_MEDIA_ORDER,
|
||||
COMPOSE_SET_STATUS,
|
||||
COMPOSE_FOCUS,
|
||||
} from '../actions/compose';
|
||||
|
@ -536,6 +537,14 @@ export default function compose(state = initialState, action) {
|
|||
return state.set('language', action.language);
|
||||
case COMPOSE_FOCUS:
|
||||
return state.set('focusDate', new Date()).update('text', text => text.length > 0 ? text : action.defaultText);
|
||||
case COMPOSE_CHANGE_MEDIA_ORDER:
|
||||
return state.update('media_attachments', list => {
|
||||
const indexA = list.findIndex(x => x.get('id') === action.a);
|
||||
const moveItem = list.get(indexA);
|
||||
const indexB = list.findIndex(x => x.get('id') === action.b);
|
||||
|
||||
return list.splice(indexA, 1).splice(indexB, 0, moveItem);
|
||||
});
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue