Remove unnecessary buttons
This commit is contained in:
parent
ce36014d0c
commit
ef26239ac2
|
@ -145,7 +145,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent, ref, reactive, computed, onMounted, ComponentPublicInstance, nextTick } from 'vue'
|
||||
import { defineComponent, ref, reactive, computed, onMounted, ComponentPublicInstance, nextTick, onBeforeUnmount } from 'vue'
|
||||
import { useI18next } from 'vue3-i18next'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { Entity } from 'megalodon'
|
||||
|
@ -242,6 +242,10 @@ export default defineComponent({
|
|||
spoilerText.value = initialSpoiler.value
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
store.dispatch(`${space}/${ACTION_TYPES.TEARDOWN_LOADING}`)
|
||||
})
|
||||
|
||||
const close = () => {
|
||||
store.dispatch(`${space}/${ACTION_TYPES.RESET_MEDIA_COUNT}`)
|
||||
store.dispatch(`${space}/${ACTION_TYPES.CLOSE_MODAL}`)
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
</ul>
|
||||
<!-- dummy object to open suggest popper -->
|
||||
<template #reference>
|
||||
<el-button type="text" ref="suggestButtonRef" class="dummy-button">dummy</el-button>
|
||||
<span></span>
|
||||
</template>
|
||||
</el-popover>
|
||||
<div>
|
||||
|
@ -73,7 +73,6 @@ import 'emoji-mart-vue-fast/css/emoji-mart.css'
|
|||
import data from 'emoji-mart-vue-fast/data/all.json'
|
||||
import { defineComponent, computed, toRefs, ref, onBeforeUnmount, onMounted } from 'vue'
|
||||
import { Picker, EmojiIndex } from 'emoji-mart-vue-fast/src'
|
||||
import { ElButton } from 'element-plus'
|
||||
|
||||
import suggestText from '@/utils/suggestText'
|
||||
import { useStore } from '@/store'
|
||||
|
@ -109,7 +108,6 @@ export default defineComponent({
|
|||
const { modelValue } = toRefs(props)
|
||||
const highlightedIndex = ref(0)
|
||||
const statusRef = ref<HTMLTextAreaElement>()
|
||||
const suggestButtonRef = ref<InstanceType<typeof ElButton>>()
|
||||
const suggestRef = ref()
|
||||
const suggestOpened = ref<boolean>(false)
|
||||
|
||||
|
@ -152,14 +150,10 @@ export default defineComponent({
|
|||
|
||||
const openSuggest = () => {
|
||||
suggestOpened.value = true
|
||||
// suggestButtonRef.value?.$el.focus()
|
||||
// statusRef.value?.click()
|
||||
}
|
||||
const closeSuggest = () => {
|
||||
store.dispatch(`${space}/${ACTION_TYPES.CLOSE_SUGGEST}`)
|
||||
highlightedIndex.value = 0
|
||||
// suggestButtonRef.value?.$el.blur()
|
||||
// statusRef.value?.focus()
|
||||
suggestOpened.value = false
|
||||
}
|
||||
const suggestAccount = async (start: number, word: string) => {
|
||||
|
@ -282,7 +276,6 @@ export default defineComponent({
|
|||
|
||||
return {
|
||||
statusRef,
|
||||
suggestButtonRef,
|
||||
suggestRef,
|
||||
suggestOpened,
|
||||
emojiIndex,
|
||||
|
@ -372,15 +365,6 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
.dummy-button {
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
border: none;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.emoji-selector {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
|
|
|
@ -158,6 +158,7 @@ const mutations: MutationTree<NewTootState> = {
|
|||
|
||||
export const ACTION_TYPES = {
|
||||
SETUP_LOADING: 'setupLoading',
|
||||
TEARDOWN_LOADING: 'tearDownLoading',
|
||||
START_LOADING: 'startLoading',
|
||||
STOP_LOADING: 'stopLoading',
|
||||
UPDATE_MEDIA: 'updateMedia',
|
||||
|
@ -175,9 +176,10 @@ export const ACTION_TYPES = {
|
|||
FETCH_VISIBILITY: 'fetchVisibility'
|
||||
}
|
||||
|
||||
const axiosLoading = new AxiosLoading()
|
||||
|
||||
const actions: ActionTree<NewTootState, RootState> = {
|
||||
[ACTION_TYPES.SETUP_LOADING]: ({ dispatch }) => {
|
||||
const axiosLoading = new AxiosLoading()
|
||||
axiosLoading.on('start', (_: number) => {
|
||||
dispatch('startLoading')
|
||||
})
|
||||
|
@ -185,6 +187,9 @@ const actions: ActionTree<NewTootState, RootState> = {
|
|||
dispatch('stopLoading')
|
||||
})
|
||||
},
|
||||
[ACTION_TYPES.TEARDOWN_LOADING]: () => {
|
||||
axiosLoading.removeAllListeners()
|
||||
},
|
||||
[ACTION_TYPES.START_LOADING]: ({ commit, state }) => {
|
||||
if (state.modalOpen && !state.loading) {
|
||||
commit(MUTATION_TYPES.CHANGE_LOADING, true)
|
||||
|
|
Loading…
Reference in New Issue