pl-fe: allow writing mfm
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
f13a7649e3
commit
5b07c47f68
3 changed files with 12 additions and 4 deletions
|
@ -11,6 +11,7 @@ import { useInstance } from 'pl-fe/hooks/use-instance';
|
|||
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_mfm: { id: 'preferences.options.content_type_mfm', defaultMessage: 'MFM' },
|
||||
content_type_html: { id: 'preferences.options.content_type_html', defaultMessage: 'HTML' },
|
||||
content_type_wysiwyg: { id: 'preferences.options.content_type_wysiwyg', defaultMessage: 'WYSIWYG' },
|
||||
change_content_type: { id: 'compose_form.content_type.change', defaultMessage: 'Change content type' },
|
||||
|
@ -29,7 +30,7 @@ const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
|||
|
||||
const handleChange = (contentType: string) => () => dispatch(changeComposeContentType(composeId, contentType));
|
||||
|
||||
const postFormats = instance.pleroma.metadata.post_formats;
|
||||
const postFormats = instance.configuration.statuses.supported_mime_types;
|
||||
|
||||
const options = [];
|
||||
|
||||
|
@ -49,6 +50,14 @@ const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
|||
});
|
||||
}
|
||||
|
||||
if (postFormats.includes('text/x.misskeymarkdown')) {
|
||||
options.push({
|
||||
icon: require('@tabler/icons/outline/sparkles.svg'),
|
||||
text: intl.formatMessage(messages.content_type_mfm),
|
||||
value: 'text/x.misskeymarkdown',
|
||||
});
|
||||
}
|
||||
|
||||
if (postFormats.includes('text/html')) {
|
||||
options.push({
|
||||
icon: require('@tabler/icons/outline/html.svg'),
|
||||
|
@ -86,7 +95,6 @@ const ContentTypeButton: React.FC<IContentTypeButton> = ({ composeId }) => {
|
|||
/>
|
||||
</DropdownMenu>
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
export { ContentTypeButton as default };
|
||||
|
|
|
@ -125,7 +125,7 @@ const Preferences = () => {
|
|||
}), [settings.locale]);
|
||||
|
||||
const defaultContentTypeOptions = React.useMemo(() => {
|
||||
const postFormats = instance.pleroma.metadata.post_formats;
|
||||
const postFormats = instance.configuration.statuses.supported_mime_types;
|
||||
|
||||
const options = Object.entries({
|
||||
'text/plain': intl.formatMessage(messages.content_type_plaintext),
|
||||
|
|
|
@ -311,7 +311,7 @@ const importAccount = (compose: Compose, account: CredentialAccount) => {
|
|||
// };
|
||||
|
||||
const updateDefaultContentType = (compose: Compose, instance: Instance) => {
|
||||
const postFormats = instance.pleroma.metadata.post_formats;
|
||||
const postFormats = instance.configuration.statuses.supported_mime_types;
|
||||
|
||||
compose.content_type = postFormats.includes(compose.content_type) ? compose.content_type : postFormats.includes('text/markdown') ? 'text/markdown' : postFormats[0];
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue