Merge branch 'feature/rich_text_editor' of https://code.gab.com/gab/social/gab-social into develop

This commit is contained in:
mgabdev
2020-06-17 16:45:45 -04:00
23 changed files with 1181 additions and 293 deletions

View File

@@ -100,6 +100,7 @@ function clearAll(state) {
return state.withMutations(map => {
map.set('id', null);
map.set('text', '');
map.set('markdown', null);
map.set('spoiler', false);
map.set('spoiler_text', '');
map.set('is_submitting', false);
@@ -112,6 +113,8 @@ function clearAll(state) {
map.set('poll', null);
map.set('idempotencyKey', uuid());
map.set('scheduled_at', null);
map.set('rte_controls_visible', false);
map.set('gif', false);
});
};
@@ -271,6 +274,7 @@ export default function compose(state = initialState, action) {
map.set('idempotencyKey', uuid());
map.set('spoiler', false);
map.set('spoiler_text', '');
map.set('rte_controls_visible', false);
if (action.text) {
map.set('text', `${statusToTextMentions(state, action.status)}${action.text}`);
} else {
@@ -289,6 +293,7 @@ export default function compose(state = initialState, action) {
map.set('idempotencyKey', uuid());
map.set('spoiler', false);
map.set('spoiler_text', '');
map.set('rte_controls_visible', '');
});
case COMPOSE_REPLY_CANCEL:
case COMPOSE_RESET:
@@ -361,9 +366,11 @@ export default function compose(state = initialState, action) {
return item;
}));
case STATUS_EDIT:
const hasMarkdown = !!action.status.get('plain_markdown')
return state.withMutations(map => {
map.set('id', action.status.get('id'));
map.set('text', unescapeHTML(expandMentions(action.status)));
map.set('markdown', action.status.get('plain_markdown'));
map.set('in_reply_to', action.status.get('in_reply_to_id'));
map.set('quote_of_id', action.status.get('quote_of_id'));
map.set('privacy', action.status.get('visibility'));
@@ -371,6 +378,7 @@ export default function compose(state = initialState, action) {
map.set('focusDate', new Date());
map.set('caretPosition', null);
map.set('idempotencyKey', uuid());
map.set('rte_controls_visible', hasMarkdown);
if (action.status.get('spoiler_text').length > 0) {
map.set('spoiler', true);
@@ -396,7 +404,7 @@ export default function compose(state = initialState, action) {
return state.set('scheduled_at', action.date);
case COMPOSE_RICH_TEXT_EDITOR_CONTROLS_VISIBILITY:
return state.withMutations(map => {
map.set('rte_controls_visible', !state.get('rte_controls_visible'));
map.set('rte_controls_visible', action.open || !state.get('rte_controls_visible'));
});
default:
return state;