pl-fe: allow wysiwyg to be the default post format
Signed-off-by: Nicole Mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@ -99,6 +99,7 @@ const messages = defineMessages({
|
||||
content_type_plaintext: { id: 'preferences.options.content_type_plaintext', defaultMessage: 'Plain text' },
|
||||
content_type_markdown: { id: 'preferences.options.content_type_markdown', defaultMessage: 'Markdown' },
|
||||
content_type_html: { id: 'preferences.options.content_type_html', defaultMessage: 'HTML' },
|
||||
content_type_wysiwyg: { id: 'preferences.options.content_type_wysiwyg', defaultMessage: 'WYSIWYG' },
|
||||
brandColor: { id: 'preferences.options.brand_color', defaultMessage: 'Base color' },
|
||||
});
|
||||
|
||||
@ -161,6 +162,8 @@ const Preferences = () => {
|
||||
'text/html': intl.formatMessage(messages.content_type_html),
|
||||
}).filter(([key]) => postFormats.includes(key));
|
||||
|
||||
if (postFormats.includes('text/markdown')) options.push(['wysiwyg', intl.formatMessage(messages.content_type_wysiwyg)]);
|
||||
|
||||
if (options.length > 1) return Object.fromEntries(options);
|
||||
}, [settings.locale]);
|
||||
|
||||
|
||||
@ -313,7 +313,11 @@ const importAccount = (compose: Compose, account: CredentialAccount) => {
|
||||
const updateDefaultContentType = (compose: Compose, instance: Instance) => {
|
||||
const postFormats = instance.pleroma.metadata.post_formats;
|
||||
|
||||
compose.content_type = postFormats.includes(compose.content_type) ? compose.content_type : postFormats.includes('text/markdown') ? 'text/markdown' : postFormats[0];
|
||||
compose.content_type = postFormats.includes(compose.content_type) || (postFormats.includes('text/markdown') && compose.content_type === 'wysiwyg')
|
||||
? compose.content_type
|
||||
: postFormats.includes('text/markdown')
|
||||
? 'text/markdown'
|
||||
: postFormats[0];
|
||||
};
|
||||
|
||||
const updateCompose = (state: State, key: string, updater: (compose: Compose) => void) =>
|
||||
@ -541,7 +545,10 @@ const compose = (state = initialState, action: ComposeAction | EventsAction | In
|
||||
compose.focusDate = new Date();
|
||||
compose.caretPosition = null;
|
||||
compose.idempotencyKey = crypto.randomUUID();
|
||||
compose.content_type = action.contentType || 'text/plain';
|
||||
const contentType = action.contentType === 'text/markdown' && state.default.content_type === 'wysiwyg'
|
||||
? 'wysiwyg'
|
||||
: action.contentType || 'text/plain';
|
||||
compose.content_type = contentType;
|
||||
compose.quote = action.status.quote_id;
|
||||
compose.group_id = action.status.group_id;
|
||||
compose.language = action.status.language;
|
||||
|
||||
@ -19,7 +19,7 @@ const settingsSchema = v.object({
|
||||
deleteModal: v.fallback(v.boolean(), true),
|
||||
missingDescriptionModal: v.fallback(v.boolean(), true),
|
||||
defaultPrivacy: v.fallback(v.picklist(['public', 'unlisted', 'private', 'direct']), 'public'),
|
||||
defaultContentType: v.fallback(v.picklist(['text/plain', 'text/markdown', 'text/html']), 'text/plain'),
|
||||
defaultContentType: v.fallback(v.picklist(['text/plain', 'text/markdown', 'text/html', 'wysiwyg']), 'text/plain'),
|
||||
themeMode: v.fallback(v.picklist(['system', 'light', 'dark', 'black']), 'system'),
|
||||
locale: v.fallback(
|
||||
v.pipe(
|
||||
|
||||
Reference in New Issue
Block a user