@@ -51,6 +51,7 @@ import {
5151import supports from '../utils/supports' ;
5252import useCloseWatcher from '../utils/useCloseWatcher' ;
5353import useInterval from '../utils/useInterval' ;
54+ import contentTypesIconMap from '../utils/content-types-icon-map.js' ;
5455import visibilityIconsMap from '../utils/visibility-icons-map' ;
5556
5657import AccountBlock from './account-block' ;
@@ -248,6 +249,7 @@ function Compose({
248249 const textareaRef = useRef ( ) ;
249250 const spoilerTextRef = useRef ( ) ;
250251 const [ visibility , setVisibility ] = useState ( 'public' ) ;
252+ const [ contentType , setContentType ] = useState ( 'text/plain' ) ;
251253 const [ sensitive , setSensitive ] = useState ( false ) ;
252254 const [ language , setLanguage ] = useState (
253255 store . session . get ( 'currentLanguage' ) || DEFAULT_LANG ,
@@ -1064,6 +1066,9 @@ function Compose({
10641066 // params.inReplyToId = replyToStatus?.id || undefined;
10651067 params . in_reply_to_id = replyToStatus ?. id || undefined ;
10661068 }
1069+ if ( supports ( '@akkoma/post-content-type' ) ) {
1070+ params . content_type = contentType ;
1071+ }
10671072 params = removeNullUndefined ( params ) ;
10681073 console . log ( 'POST' , params ) ;
10691074
@@ -1150,6 +1155,38 @@ function Compose({
11501155 />
11511156 < Icon icon = { `eye-${ sensitive ? 'close' : 'open' } ` } />
11521157 </ label > { ' ' }
1158+ { supports ( '@akkoma/post-content-type' ) && (
1159+ < >
1160+ < label class = { `toolbar-button ${ contentType !== 'text/plain' && ! sensitive ? 'show-field' : '' } ${ contentType !== 'text/plain' ? 'highlight' : '' } ` } >
1161+ < Icon icon = { contentTypesIconMap [ contentType ] } alt = { visibility } />
1162+ < select
1163+ name = { 'contentType' }
1164+ value = { contentType }
1165+ onChange = { ( e ) => {
1166+ setContentType ( e . target . value ) ;
1167+ } }
1168+ disabled = { uiState === 'loading' }
1169+ dir = { 'auto' }
1170+ >
1171+ < option value = "text/plain" >
1172+ < Trans > Plain text</ Trans >
1173+ </ option >
1174+ < option value = "text/html" >
1175+ < Trans > HTML</ Trans >
1176+ </ option >
1177+ < option value = "text/markdown" >
1178+ < Trans > Markdown</ Trans >
1179+ </ option >
1180+ < option value = "text/bbcode" >
1181+ < Trans > BBCode</ Trans >
1182+ </ option >
1183+ < option value = "text/x.misskeymarkdown" >
1184+ < Trans > MFM</ Trans >
1185+ </ option >
1186+ </ select >
1187+ </ label > { ' ' }
1188+ </ >
1189+ ) }
11531190 < label
11541191 class = { `toolbar-button ${
11551192 visibility !== 'public' && ! sensitive ? 'show-field' : ''
0 commit comments