mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-03-21 03:30:42 +00:00
enhance(frontend): いくつかのtodoの解消 (#17154)
This commit is contained in:
@@ -114,7 +114,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, useTemplateRef, onUnmounted } from 'vue';
|
||||
import { watch, nextTick, onMounted, defineAsyncComponent, provide, shallowRef, ref, computed, useTemplateRef, onUnmounted, onBeforeUnmount } from 'vue';
|
||||
import * as mfm from 'mfm-js';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import insertTextAtCursor from 'insert-text-at-cursor';
|
||||
@@ -227,6 +227,10 @@ const targetChannel = shallowRef(props.channel);
|
||||
const serverDraftId = ref<string | null>(null);
|
||||
const postFormActions = getPluginHandlers('post_form_action');
|
||||
|
||||
let textAutocomplete: Autocomplete | null = null;
|
||||
let cwAutocomplete: Autocomplete | null = null;
|
||||
let hashtagAutocomplete: Autocomplete | null = null;
|
||||
|
||||
const uploader = useUploader({
|
||||
multiple: true,
|
||||
});
|
||||
@@ -1408,10 +1412,9 @@ onMounted(() => {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: detach when unmount
|
||||
if (textareaEl.value) new Autocomplete(textareaEl.value, text);
|
||||
if (cwInputEl.value) new Autocomplete(cwInputEl.value, cw);
|
||||
if (hashtagsInputEl.value) new Autocomplete(hashtagsInputEl.value, hashtags);
|
||||
if (textareaEl.value) textAutocomplete = new Autocomplete(textareaEl.value, text);
|
||||
if (cwInputEl.value) cwAutocomplete = new Autocomplete(cwInputEl.value, cw);
|
||||
if (hashtagsInputEl.value) hashtagAutocomplete = new Autocomplete(hashtagsInputEl.value, hashtags);
|
||||
|
||||
nextTick(() => {
|
||||
// 書きかけの投稿を復元
|
||||
@@ -1468,6 +1471,19 @@ onMounted(() => {
|
||||
});
|
||||
});
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
uploader.abortAll();
|
||||
if (textAutocomplete) {
|
||||
textAutocomplete.detach();
|
||||
}
|
||||
if (cwAutocomplete) {
|
||||
cwAutocomplete.detach();
|
||||
}
|
||||
if (hashtagAutocomplete) {
|
||||
hashtagAutocomplete.detach();
|
||||
}
|
||||
});
|
||||
|
||||
async function canClose() {
|
||||
if (!uploader.allItemsUploaded.value) {
|
||||
const { canceled } = await os.confirm({
|
||||
|
||||
@@ -18,7 +18,6 @@ let lastHeartbeatCall = 0;
|
||||
export function useStream(): Misskey.IStream {
|
||||
if (stream) return stream;
|
||||
|
||||
// TODO: No Websocketモードもここで判定
|
||||
stream = markRaw(new Misskey.Stream(wsOrigin, $i ? {
|
||||
token: $i.token,
|
||||
} : null));
|
||||
|
||||
Reference in New Issue
Block a user