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