Update toot modal to copy CWs

This commit is contained in:
L. E. Segovia 2018-11-17 18:27:58 +00:00
parent 564cdbd152
commit 5812963f24
No known key found for this signature in database
GPG Key ID: D5D1DC48B52B7AD5
3 changed files with 20 additions and 5 deletions

View File

@ -72,8 +72,8 @@
</el-button>
</div>
<span class="text-count">{{ tootMax - status.length }}</span>
<el-button @click="closeConfirm(close)">{{ $t('modals.new_toot.cancel') }}</el-button>
<el-button type="primary" @click="toot" v-loading="blockSubmit">{{ $t('modals.new_toot.toot') }}</el-button>
<el-button class="toot-action" size="small" @click="closeConfirm(close)">{{ $t('modals.new_toot.cancel') }}</el-button>
<el-button class="toot-action" size="small" type="primary" @click="toot" v-loading="blockSubmit">{{ $t('modals.new_toot.toot') }}</el-button>
<div class="clearfix"></div>
</div>
</el-dialog>
@ -113,6 +113,7 @@ export default {
visibility: state => state.visibility,
sensitive: state => state.sensitive,
initialStatus: state => state.initialStatus,
initialSpoiler: state => state.initialSpoiler,
visibilityIcon: (state) => {
switch (state.visibility) {
case Visibility.Public.value:
@ -158,9 +159,9 @@ export default {
watch: {
newTootModal: function (newState, oldState) {
if (!oldState && newState) {
this.showContentWarning = false
this.spoiler = ''
this.showContentWarning = this.initialSpoiler
this.status = this.initialStatus
this.spoiler = this.initialSpoiler
}
}
},
@ -382,9 +383,15 @@ export default {
}
.text-count {
padding-right: 24px;
padding-right: 10px;
color: #909399;
}
.toot-action {
font-size: var(--base-font-size);
margin-top: 2px;
margin-bottom: 2px;
}
}
}

View File

@ -9,6 +9,8 @@
v-on:input="startSuggest"
:placeholder="$t('modals.new_toot.status')"
role="textbox"
contenteditable="true"
aria-multiline="true"
autofocus>
</textarea>
<el-popover

View File

@ -11,6 +11,7 @@ const NewToot = {
state: {
modalOpen: false,
initialStatus: '',
initialSpoiler: '',
replyToMessage: null,
blockSubmit: false,
attachedMedias: [],
@ -30,6 +31,9 @@ const NewToot = {
updateInitialStatus (state, status) {
state.initialStatus = status
},
updateInitialSpoiler (state, cw) {
state.initialSpoiler = cw
},
changeBlockSubmit (state, value) {
state.blockSubmit = value
},
@ -90,6 +94,7 @@ const NewToot = {
.filter((a, i, self) => self.indexOf(a) === i)
.filter((a) => a !== rootState.TimelineSpace.account.username)
commit('updateInitialStatus', `${mentionAccounts.map(m => `@${m}`).join(' ')} `)
commit('updateInitialSpoiler', message.spoiler_text)
commit('changeModal', true)
let value = Visibility.Public.value
Object.keys(Visibility).map((key, index) => {
@ -110,6 +115,7 @@ const NewToot = {
closeModal ({ commit }) {
commit('changeModal', false)
commit('updateInitialStatus', '')
commit('updateInitialSpoiler', '')
commit('setReplyTo', null)
commit('changeBlockSubmit', false)
commit('clearAttachedMedias')