refactor(frontend): Reactivityで型を明示するように (#12791)

* refactor(frontend): Reactivityで型を明示するように

* fix: プロパティの参照が誤っているのを修正

* fix: 初期化の値を空配列に書き換えていた部分をnullに置き換え
This commit is contained in:
zyoshoka
2023-12-26 14:19:35 +09:00
committed by GitHub
parent a9b42765f9
commit 75034d9240
110 changed files with 370 additions and 344 deletions

View File

@@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
/* eslint-disable vue/no-mutating-props */
import { onMounted, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XContainer from '../page-editor.container.vue';
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
import * as os from '@/os.js';
@@ -35,7 +36,7 @@ const emit = defineEmits<{
(ev: 'update:modelValue', value: any): void;
}>();
const file = ref<any>(null);
const file = ref<Misskey.entities.DriveFile | null>(null);
async function choose() {
os.selectDriveFile(false).then((fileResponse) => {

View File

@@ -24,6 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
/* eslint-disable vue/no-mutating-props */
import { watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import XContainer from '../page-editor.container.vue';
import MkInput from '@/components/MkInput.vue';
import MkSwitch from '@/components/MkSwitch.vue';
@@ -41,7 +42,7 @@ const emit = defineEmits<{
}>();
const id = ref<any>(props.modelValue.note);
const note = ref<any>(null);
const note = ref<Misskey.entities.Note | null>(null);
watch(id, async () => {
if (id.value && (id.value.startsWith('http://') || id.value.startsWith('https://'))) {

View File

@@ -16,6 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { defineAsyncComponent } from 'vue';
import * as Misskey from 'misskey-js';
import XSection from './els/page-editor.el.section.vue';
import XText from './els/page-editor.el.text.vue';
import XImage from './els/page-editor.el.image.vue';
@@ -34,11 +35,11 @@ function getComponent(type: string) {
const Sortable = defineAsyncComponent(() => import('vuedraggable').then(x => x.default));
const props = defineProps<{
modelValue: any[];
modelValue: Misskey.entities.Page['content'];
}>();
const emit = defineEmits<{
(ev: 'update:modelValue', value: any[]): void;
(ev: 'update:modelValue', value: Misskey.entities.Page['content']): void;
}>();
function updateItem(v) {

View File

@@ -62,6 +62,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<script lang="ts" setup>
import { computed, provide, watch, ref } from 'vue';
import * as Misskey from 'misskey-js';
import { v4 as uuid } from 'uuid';
import XBlocks from './page-editor.blocks.vue';
import MkButton from '@/components/MkButton.vue';
@@ -85,16 +86,16 @@ const props = defineProps<{
const tab = ref('settings');
const author = ref($i);
const readonly = ref(false);
const page = ref(null);
const pageId = ref(null);
const currentName = ref(null);
const page = ref<Misskey.entities.Page | null>(null);
const pageId = ref<string | null>(null);
const currentName = ref<string | null>(null);
const title = ref('');
const summary = ref(null);
const summary = ref<string | null>(null);
const name = ref(Date.now().toString());
const eyeCatchingImage = ref(null);
const eyeCatchingImageId = ref(null);
const eyeCatchingImage = ref<Misskey.entities.DriveFile | null>(null);
const eyeCatchingImageId = ref<string | null>(null);
const font = ref('sans-serif');
const content = ref([]);
const content = ref<Misskey.entities.Page['content']>([]);
const alignCenter = ref(false);
const hideTitleWhenPinned = ref(false);