Merge branch 'feature/add-an-option-for-a-default-formatting' into 'develop'

#301 - add an option for a default formatting

See merge request pleroma/pleroma-fe!541
This commit is contained in:
Shpuld Shpludson 2019-02-07 15:55:54 +00:00
commit 85e281d406
9 changed files with 43 additions and 3 deletions

View file

@ -84,6 +84,7 @@ const afterStoreSetup = ({ store, i18n }) => {
copyInstanceOption('loginMethod') copyInstanceOption('loginMethod')
copyInstanceOption('scopeCopy') copyInstanceOption('scopeCopy')
copyInstanceOption('subjectLineBehavior') copyInstanceOption('subjectLineBehavior')
copyInstanceOption('postContentType')
copyInstanceOption('alwaysShowSubjectInput') copyInstanceOption('alwaysShowSubjectInput')
copyInstanceOption('noAttachmentLinks') copyInstanceOption('noAttachmentLinks')

View file

@ -65,7 +65,6 @@ const PostStatusForm = {
newStatus: { newStatus: {
spoilerText: this.subject || '', spoilerText: this.subject || '',
status: statusText, status: statusText,
contentType: 'text/plain',
nsfw: false, nsfw: false,
files: [], files: [],
visibility: scope visibility: scope
@ -167,6 +166,11 @@ const PostStatusForm = {
}, },
formattingOptionsEnabled () { formattingOptionsEnabled () {
return this.$store.state.instance.formattingOptionsEnabled return this.$store.state.instance.formattingOptionsEnabled
},
defaultPostContentType () {
return typeof this.$store.state.config.postContentType === 'undefined'
? this.$store.state.instance.postContentType
: this.$store.state.config.postContentType
} }
}, },
methods: { methods: {

View file

@ -35,7 +35,7 @@
<div class="visibility-tray"> <div class="visibility-tray">
<span class="text-format" v-if="formattingOptionsEnabled"> <span class="text-format" v-if="formattingOptionsEnabled">
<label for="post-content-type" class="select"> <label for="post-content-type" class="select">
<select id="post-content-type" v-model="newStatus.contentType" class="form-control"> <select id="post-content-type" v-model="defaultPostContentType" class="form-control">
<option value="text/plain">{{$t('post_status.content_type.plain_text')}}</option> <option value="text/plain">{{$t('post_status.content_type.plain_text')}}</option>
<option value="text/html">HTML</option> <option value="text/html">HTML</option>
<option value="text/markdown">Markdown</option> <option value="text/markdown">Markdown</option>

View file

@ -46,6 +46,11 @@ const settings = {
: user.subjectLineBehavior, : user.subjectLineBehavior,
subjectLineBehaviorDefault: instance.subjectLineBehavior, subjectLineBehaviorDefault: instance.subjectLineBehavior,
postContentTypeLocal: typeof user.postContentType === 'undefined'
? instance.postContentType
: user.postContentType,
postContentTypeDefault: instance.postContentType,
alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined' alwaysShowSubjectInputLocal: typeof user.alwaysShowSubjectInput === 'undefined'
? instance.alwaysShowSubjectInput ? instance.alwaysShowSubjectInput
: user.alwaysShowSubjectInput, : user.alwaysShowSubjectInput,
@ -157,6 +162,9 @@ const settings = {
subjectLineBehaviorLocal (value) { subjectLineBehaviorLocal (value) {
this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value }) this.$store.dispatch('setOption', { name: 'subjectLineBehavior', value })
}, },
postContentTypeLocal (value) {
this.$store.dispatch('setOption', { name: 'postContentType', value })
},
stopGifs (value) { stopGifs (value) {
this.$store.dispatch('setOption', { name: 'stopGifs', value }) this.$store.dispatch('setOption', { name: 'stopGifs', value })
}, },

View file

@ -100,6 +100,28 @@
</label> </label>
</div> </div>
</li> </li>
<li>
<div>
{{$t('settings.post_status_content_type')}}
<label for="postContentType" class="select">
<select id="postContentType" v-model="postContentTypeLocal">
<option value="text/plain">
{{$t('settings.status_content_type_plain')}}
{{postContentTypeDefault == 'text/plain' ? $t('settings.instance_default_simple') : ''}}
</option>
<option value="text/html">
HTML
{{postContentTypeDefault == 'text/html' ? $t('settings.instance_default_simple') : ''}}
</option>
<option value="text/markdown">
Markdown
{{postContentTypeDefault == 'text/markdown' ? $t('settings.instance_default_simple') : ''}}
</option>
</select>
<i class="icon-down-open"/>
</label>
</div>
</li>
</ul> </ul>
</div> </div>

View file

@ -193,6 +193,8 @@
"subject_line_email": "Like email: \"re: subject\"", "subject_line_email": "Like email: \"re: subject\"",
"subject_line_mastodon": "Like mastodon: copy as is", "subject_line_mastodon": "Like mastodon: copy as is",
"subject_line_noop": "Do not copy", "subject_line_noop": "Do not copy",
"post_status_content_type": "Post status content type",
"status_content_type_plain": "Plain text",
"stop_gifs": "Play-on-hover GIFs", "stop_gifs": "Play-on-hover GIFs",
"streaming": "Enable automatic streaming of new posts when scrolled to the top", "streaming": "Enable automatic streaming of new posts when scrolled to the top",
"text": "Text", "text": "Text",

View file

@ -31,7 +31,8 @@ const defaultState = {
scopeCopy: undefined, // instance default scopeCopy: undefined, // instance default
subjectLineBehavior: undefined, // instance default subjectLineBehavior: undefined, // instance default
alwaysShowSubjectInput: undefined, // instance default alwaysShowSubjectInput: undefined, // instance default
showFeaturesPanel: true showFeaturesPanel: true,
postContentType: undefined // instance default
} }
const config = { const config = {

View file

@ -24,6 +24,7 @@ const defaultState = {
disableChat: false, disableChat: false,
scopeCopy: true, scopeCopy: true,
subjectLineBehavior: 'email', subjectLineBehavior: 'email',
postContentType: 'text/plain',
loginMethod: 'password', loginMethod: 'password',
nsfwCensorImage: undefined, nsfwCensorImage: undefined,
vapidPublicKey: undefined, vapidPublicKey: undefined,

View file

@ -13,6 +13,7 @@
"collapseMessageWithSubject": false, "collapseMessageWithSubject": false,
"scopeCopy": true, "scopeCopy": true,
"subjectLineBehavior": "email", "subjectLineBehavior": "email",
"postContentType": "text/plain",
"alwaysShowSubjectInput": true, "alwaysShowSubjectInput": true,
"hidePostStats": false, "hidePostStats": false,
"hideUserStats": false, "hideUserStats": false,