Only display HTML if supported
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
c4d085c767
commit
d30d276a0f
2 changed files with 15 additions and 9 deletions
|
@ -4,7 +4,7 @@ import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { changeComposeContentType } from 'soapbox/actions/compose';
|
import { changeComposeContentType } from 'soapbox/actions/compose';
|
||||||
import DropdownMenu from 'soapbox/components/dropdown-menu';
|
import DropdownMenu from 'soapbox/components/dropdown-menu';
|
||||||
import { Button } from 'soapbox/components/ui';
|
import { Button } from 'soapbox/components/ui';
|
||||||
import { useAppDispatch, useCompose } from 'soapbox/hooks';
|
import { useAppDispatch, useCompose, useInstance } from 'soapbox/hooks';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
content_type_plaintext: { id: 'preferences.options.content_type_plaintext', defaultMessage: 'Plain text' },
|
content_type_plaintext: { id: 'preferences.options.content_type_plaintext', defaultMessage: 'Plain text' },
|
||||||
|
@ -21,6 +21,7 @@ interface IContentTypeButton {
|
||||||
const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
const instance = useInstance();
|
||||||
|
|
||||||
const contentType = useCompose(composeId).content_type;
|
const contentType = useCompose(composeId).content_type;
|
||||||
|
|
||||||
|
@ -36,17 +37,21 @@ const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
||||||
text: intl.formatMessage(messages.content_type_markdown),
|
text: intl.formatMessage(messages.content_type_markdown),
|
||||||
value: 'text/markdown',
|
value: 'text/markdown',
|
||||||
},
|
},
|
||||||
{
|
];
|
||||||
|
|
||||||
|
if (instance.pleroma.metadata.post_formats?.includes('text/html')) {
|
||||||
|
options.push({
|
||||||
icon: require('@tabler/icons/outline/html.svg'),
|
icon: require('@tabler/icons/outline/html.svg'),
|
||||||
text: intl.formatMessage(messages.content_type_html),
|
text: intl.formatMessage(messages.content_type_html),
|
||||||
value: 'text/html',
|
value: 'text/html',
|
||||||
},
|
});
|
||||||
{
|
}
|
||||||
icon: require('@tabler/icons/outline/text-caption.svg'),
|
|
||||||
text: intl.formatMessage(messages.content_type_wysiwyg),
|
options.push({
|
||||||
value: 'wysiwyg',
|
icon: require('@tabler/icons/outline/text-caption.svg'),
|
||||||
},
|
text: intl.formatMessage(messages.content_type_wysiwyg),
|
||||||
];
|
value: 'wysiwyg',
|
||||||
|
});
|
||||||
|
|
||||||
const option = options.find(({ value }) => value === contentType);
|
const option = options.find(({ value }) => value === contentType);
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,7 @@ const pleromaSchema = coerceObject({
|
||||||
.optional(),
|
.optional(),
|
||||||
enabled: z.boolean().catch(false),
|
enabled: z.boolean().catch(false),
|
||||||
}),
|
}),
|
||||||
|
post_formats: z.string().array().optional().catch(undefined),
|
||||||
restrict_unauthenticated: coerceObject({
|
restrict_unauthenticated: coerceObject({
|
||||||
activities: coerceObject({
|
activities: coerceObject({
|
||||||
local: z.boolean().catch(false),
|
local: z.boolean().catch(false),
|
||||||
|
|
Loading…
Reference in a new issue