Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(frontend): tms: ノートの下書き機能など #136

Merged
merged 133 commits into from
Apr 26, 2023
Merged
Show file tree
Hide file tree
Changes from 100 commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
26986b1
feat(frontend): tms: drafts
taiyme Apr 8, 2023
7ff8fac
enhance(frontend): 投稿フォームの改修
taiyme Apr 10, 2023
fb108cc
fix: 投稿フォームの改修
taiyme Apr 10, 2023
7b7a901
tweak: 投稿フォームの改修
taiyme Apr 10, 2023
4a8c03e
fix: 投稿フォーム
taiyme Apr 10, 2023
91ef959
fix (indent, anime)
taiyme Apr 10, 2023
b32feef
tweak お気に入りカラム
taiyme Apr 10, 2023
bb7af0d
tweak メンションカラム
taiyme Apr 10, 2023
fba2629
fix watch callback
taiyme Apr 10, 2023
3fb6d74
feat(frontend): tms: ノートの下書き機能
taiyme Apr 10, 2023
0ba56f3
fix
taiyme Apr 10, 2023
f430bb5
test
taiyme Apr 10, 2023
e3fe253
Revert "test"
taiyme Apr 10, 2023
abc8f0d
tweak
taiyme Apr 10, 2023
b1e5963
test
taiyme Apr 10, 2023
d631fb9
fix
taiyme Apr 10, 2023
86e6afe
fix drafts.ts
taiyme Apr 12, 2023
3309bac
fix
taiyme Apr 12, 2023
41067da
tweak TmsDraftsList.draft
taiyme Apr 13, 2023
f2b5b6f
fix
taiyme Apr 13, 2023
c5349e9
tweak
taiyme Apr 13, 2023
a0affda
refactor TmsDraftsList
taiyme Apr 13, 2023
b88a71e
tweak
taiyme Apr 13, 2023
66f8646
fix: MkPollEditor
taiyme Apr 13, 2023
901409d
feat: TmsPostForm
taiyme Apr 14, 2023
0f97ff3
fix TmsPostForm
taiyme Apr 14, 2023
619844e
fix
taiyme Apr 14, 2023
095af9c
fix
taiyme Apr 14, 2023
88b1046
fix
taiyme Apr 14, 2023
8ac466d
fix
taiyme Apr 14, 2023
9c4035f
fix
taiyme Apr 14, 2023
793a11a
fix
taiyme Apr 14, 2023
ea00ea0
fix
taiyme Apr 14, 2023
2c375da
fix
taiyme Apr 14, 2023
22166f7
fix
taiyme Apr 14, 2023
3baebf3
fix
taiyme Apr 14, 2023
d9a69fe
tweak
taiyme Apr 14, 2023
22bd6ba
fix
taiyme Apr 14, 2023
e9ff34f
fix
taiyme Apr 14, 2023
185e503
tweak
taiyme Apr 15, 2023
25bb467
fix
taiyme Apr 15, 2023
a8d4102
test
taiyme Apr 16, 2023
e02ca70
fix
taiyme Apr 16, 2023
c62ee8f
fix
taiyme Apr 16, 2023
ff13379
fix
taiyme Apr 16, 2023
4cffadf
fix
taiyme Apr 16, 2023
192032f
tweak
taiyme Apr 16, 2023
6739d99
fix
taiyme Apr 16, 2023
c9f8b73
fix
taiyme Apr 16, 2023
95e3e36
tweak
taiyme Apr 16, 2023
d884c79
fix
taiyme Apr 16, 2023
086feda
tweak
taiyme Apr 16, 2023
d141c91
tweak
taiyme Apr 16, 2023
2298bb2
fix
taiyme Apr 16, 2023
4012c45
Merge branch 'taiyme-v12' into feat/tms-drafts
taiyme Apr 16, 2023
6318a45
refactor: trimming trailing spaces
taiyme Apr 16, 2023
4ae2ad5
test(frontend/router): history api
taiyme Apr 16, 2023
7c55698
hotfix: history state
taiyme Apr 16, 2023
d5b8c93
fix
taiyme Apr 16, 2023
fc08fcd
fix
taiyme Apr 16, 2023
1eb4a9b
fix
taiyme Apr 16, 2023
33d16d8
fix
taiyme Apr 16, 2023
a21fdc6
test
taiyme Apr 16, 2023
c777cb7
test
taiyme Apr 16, 2023
9a39b64
test
taiyme Apr 16, 2023
c6641bc
test
taiyme Apr 16, 2023
e615a97
test
taiyme Apr 16, 2023
0fecb8f
Revert "test"
taiyme Apr 16, 2023
d3a815b
Revert "test"
taiyme Apr 16, 2023
b95f49f
Revert "test"
taiyme Apr 16, 2023
1ac546b
Revert "test"
taiyme Apr 16, 2023
f667831
Revert "test"
taiyme Apr 16, 2023
0542cb5
Revert "fix"
taiyme Apr 16, 2023
cdb69e4
Revert "fix"
taiyme Apr 16, 2023
03871cf
Revert "fix"
taiyme Apr 16, 2023
1de69de
Revert "fix"
taiyme Apr 16, 2023
c0b695d
Revert "hotfix: history state"
taiyme Apr 16, 2023
50a13a1
Revert "test(frontend/router): history api"
taiyme Apr 16, 2023
61c26b4
fix className
taiyme Apr 16, 2023
a67952e
fix
taiyme Apr 16, 2023
ef74946
tweak MkReactionsViewer
taiyme Apr 17, 2023
6120bd0
fix
taiyme Apr 17, 2023
92dad7a
tweak
taiyme Apr 17, 2023
01f86d9
fix
taiyme Apr 17, 2023
c4f2c2f
refactor(frontend): remove $, rename comp imports, fix types
taiyme Apr 18, 2023
b7c4139
tweak draftslist
taiyme Apr 18, 2023
e80d49f
fix
taiyme Apr 18, 2023
ae72cf1
fix
taiyme Apr 18, 2023
21339c2
fix
taiyme Apr 18, 2023
3bb033e
fix
taiyme Apr 18, 2023
269d564
tweak
taiyme Apr 18, 2023
77806ba
fix
taiyme Apr 18, 2023
be8c0e8
fix
taiyme Apr 18, 2023
2401b89
fix 通知が表示されなくなる問題, connectionの調整
taiyme Apr 18, 2023
21e12bb
refactor: 文字数カウンターを関数化
taiyme Apr 18, 2023
3e196ab
Revert "refactor: 文字数カウンターを関数化"
taiyme Apr 18, 2023
8aa0f23
tweak
taiyme Apr 18, 2023
4d7ba08
refactor: 文字数カウンターを関数化(リベンジ)
taiyme Apr 18, 2023
7b92789
enhance: escキーでpwspを閉じられるように, esc判定に'Esc'を追加
taiyme Apr 18, 2023
45bf312
動いてなさそうなのでいまのなし
taiyme Apr 18, 2023
3c5df01
test(frontend): タイムラインの位置を記憶する
taiyme Apr 19, 2023
6040f04
Revert "test(frontend): タイムラインの位置を記憶する"
taiyme Apr 19, 2023
356bed9
fix 文字数カウンターが改行される, MkMediaCaptionにも適用
taiyme Apr 19, 2023
761ee57
enhance/refactor: MkFileCaptionEditWindow, MkPostFormAttachesなど
taiyme Apr 19, 2023
701af88
refactor: use slice/substring
taiyme Apr 19, 2023
5fd87b1
enhance(frontend): 公開範囲の引き継ぎを強化
taiyme Apr 21, 2023
056c80a
fix
taiyme Apr 21, 2023
0a0cd26
fix
taiyme Apr 21, 2023
9bbe422
fix types
taiyme Apr 21, 2023
e9e40bd
fix types
taiyme Apr 21, 2023
62318e4
tweak
taiyme Apr 22, 2023
988643c
refactor: MkPagination
taiyme Apr 22, 2023
62e8f9d
test(client/vite): generateScopedName
taiyme Apr 22, 2023
1574e43
tweak(client/vite): generateScopedName
taiyme Apr 22, 2023
cd12f90
tweak
taiyme Apr 22, 2023
268f477
fix
taiyme Apr 22, 2023
a6a67af
tweak
taiyme Apr 22, 2023
73386fa
test(frontend/MkPagination): スクロール系
taiyme Apr 22, 2023
c47464a
tweak
taiyme Apr 22, 2023
8515874
enhance(frontend/MkWindow): upgrade MkWindow
taiyme Apr 22, 2023
130830e
fix: ウィンドウで画面がガタガタしてしまうのを修正
taiyme Apr 22, 2023
bb01372
refactor: $emit to emit
taiyme Apr 22, 2023
f2a7c36
refactor: MkContainer
taiyme Apr 23, 2023
ba54316
Update i18n
taiyme Apr 23, 2023
9397cb3
enhance(frontend/pakuru): nyaizeの警告表示を追加
taiyme Apr 24, 2023
2ee5ac4
fix ja-CJP.yml
taiyme Apr 24, 2023
697682c
feat(frontend/TmsRenoteForm): tms: Renoteで公開範囲や投稿アカウントを指定できるように
taiyme Apr 25, 2023
eb0f4d4
fix
taiyme Apr 25, 2023
a836cfb
fix
taiyme Apr 25, 2023
5110b19
Revert "fix"
taiyme Apr 25, 2023
7eb42b6
fix
taiyme Apr 25, 2023
94ef700
fix XListのborderを修正, アロー関数
taiyme Apr 25, 2023
d10cc3a
refactor(frontend): directives
taiyme Apr 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2212,3 +2212,5 @@ _tms:
unreact: "Unreact"
pakuru: "Pakuru"
numberquote: "Numberquote"
drafts: "Drafts"
loadDraft: "Load from draft"
2 changes: 2 additions & 0 deletions locales/ja-CJP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2304,3 +2304,5 @@ _tms:
unreact: "刂マケツ゚彐ソを解除"
pakuru: "八゜ケゑ"
numberquote: "数字引用ずゑ"
drafts: "草稿"
loadDraft: "草稿を読み込む"
2 changes: 2 additions & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2304,3 +2304,5 @@ _tms:
unreact: "リアクションを解除"
pakuru: "パクる"
numberquote: "数字引用する"
drafts: "下書き"
loadDraft: "下書きを読み込む"
2 changes: 2 additions & 0 deletions locales/ja-KS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2304,3 +2304,5 @@ _tms:
unreact: "リアクションやめる"
pakuru: "パクる"
numberquote: "数字引用する"
drafts: "下書き"
loadDraft: "下書きを読み込む"
18 changes: 9 additions & 9 deletions packages/client/src/components/MkAbuseReportWindow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<XWindow ref="uiWindow" :initial-width="400" :initial-height="500" :can-resize="true" @closed="emit('closed')">
<MkWindow ref="uiWindow" :initial-width="400" :initial-height="500" :can-resize="true" @closed="emit('closed')">
<template #header>
<i class="ti ti-exclamation-circle" style="margin-right: 0.5em;"></i>
<I18n :src="i18n.ts.reportAbuseOf" tag="span">
Expand All @@ -19,13 +19,13 @@
<MkButton primary full :disabled="comment.length === 0" @click="send">{{ i18n.ts.send }}</MkButton>
</div>
</div>
</XWindow>
</MkWindow>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import * as Misskey from 'misskey-js';
import XWindow from '@/components/MkWindow.vue';
import MkWindow from '@/components/MkWindow.vue';
import MkTextarea from '@/components/form/textarea.vue';
import MkButton from '@/components/MkButton.vue';
import * as os from '@/os';
Expand All @@ -40,22 +40,22 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();

const uiWindow = ref<InstanceType<typeof XWindow>>();
const comment = ref(props.initialComment || '');
const uiWindow = ref<InstanceType<typeof MkWindow>>();
const comment = ref(props.initialComment ?? '');

function send() {
const send = (): void => {
os.apiWithDialog('users/report-abuse', {
userId: props.user.id,
comment: comment.value,
}, undefined).then(res => {
}, undefined).then(() => {
os.alert({
type: 'success',
text: i18n.ts.abuseReported
text: i18n.ts.abuseReported,
});
uiWindow.value?.close();
emit('closed');
});
}
};
</script>

<style lang="scss" scoped>
Expand Down
1 change: 1 addition & 0 deletions packages/client/src/components/MkAutocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ function onKeydown(event: KeyboardEvent) {
break;

case 'Escape':
case 'Esc':
cancel();
props.close();
break;
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/components/MkChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@

<script lang="ts" setup>
/* eslint-disable id-denylist --
Chart.js has a `data` attribute in most chart definitions, which triggers the
id-denylist violation when setting it. This is causing about 60+ lint issues.
As this is part of Chart.js's API it makes sense to disable the check here.
Chart.js has a `data` attribute in most chart definitions, which triggers the
id-denylist violation when setting it. This is causing about 60+ lint issues.
As this is part of Chart.js's API it makes sense to disable the check here.
*/
import { onMounted, ref, watch, PropType } from 'vue';
import {
Expand Down
8 changes: 6 additions & 2 deletions packages/client/src/components/MkContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</div>
</header>
<Transition
:name="$store.state.animation ? 'container-toggle' : ''"
:name="defaultStore.state.animation ? 'container-toggle' : ''"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
Expand All @@ -20,7 +20,7 @@
<div v-show="showBody" ref="content" class="content" :class="{ omitted }">
<slot></slot>
<button v-if="omitted" class="fade _button" @click="() => { ignoreOmit = true; omitted = false; }">
<span>{{ $ts.showMore }}</span>
<span>{{ i18n.ts.showMore }}</span>
</button>
</div>
</Transition>
Expand All @@ -29,6 +29,8 @@

<script lang="ts">
import { defineComponent } from 'vue';
import { defaultStore } from '@/store';
import { i18n } from '@/i18n';

export default defineComponent({
props: {
Expand Down Expand Up @@ -73,6 +75,8 @@ export default defineComponent({
showBody: this.expanded,
omitted: null,
ignoreOmit: false,
defaultStore,
i18n,
};
},
mounted() {
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/components/MkContextMenu.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Transition :name="$store.state.animation ? 'fade' : ''" appear>
<Transition :name="defaultStore.state.animation ? 'fade' : ''" appear>
<div ref="rootEl" class="nvlagfpb" :style="{ zIndex }" @contextmenu.prevent.stop="() => {}">
<MkMenu :items="items" :align="'left'" @close="$emit('closed')"/>
</div>
Expand All @@ -12,6 +12,7 @@ import MkMenu from './MkMenu.vue';
import { MenuItem } from '@/types/menu';
import contains from '@/scripts/contains';
import * as os from '@/os';
import { defaultStore } from '@/store';

const props = defineProps<{
items: MenuItem[];
Expand Down
44 changes: 24 additions & 20 deletions packages/client/src/components/MkCropperDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<XModalWindow
<MkModalWindow
ref="dialogEl"
:width="800"
:height="500"
Expand All @@ -22,15 +22,15 @@
</div>
</div>
</template>
</XModalWindow>
</MkModalWindow>
</template>

<script lang="ts" setup>
import { onMounted } from 'vue';
import * as misskey from 'misskey-js';
import Cropper from 'cropperjs';
import tinycolor from 'tinycolor2';
import XModalWindow from '@/components/MkModalWindow.vue';
import MkModalWindow from '@/components/MkModalWindow.vue';
import * as os from '@/os';
import { $i } from '@/account';
import { defaultStore } from '@/store';
Expand All @@ -52,18 +52,22 @@ const props = defineProps<{
const imgUrl = `${url}/proxy/image.webp?${query({
url: props.file.url,
})}`;
let dialogEl = $ref<InstanceType<typeof XModalWindow>>();
let imgEl = $ref<HTMLImageElement>();
const dialogEl = $ref<InstanceType<typeof MkModalWindow>>();
const imgEl = $ref<HTMLImageElement>();
let cropper: Cropper | null = null;
let loading = $ref(true);

const ok = async () => {
const ok = async (): Promise<void> => {
const promise = new Promise<misskey.entities.DriveFile>(async (res) => {
const croppedCanvas = await cropper?.getCropperSelection()?.$toCanvas();
if (!croppedCanvas) return;

croppedCanvas.toBlob(blob => {
if (!blob) return;

const formData = new FormData();
formData.append('file', blob);
formData.append('i', $i.token);
formData.append('i', $i?.token);
if (defaultStore.state.uploadFolder) {
formData.append('folderId', defaultStore.state.uploadFolder);
}
Expand All @@ -84,43 +88,43 @@ const ok = async () => {
const f = await promise;

emit('ok', f);
dialogEl.close();
dialogEl?.close();
};

const cancel = () => {
const cancel = (): void => {
emit('cancel');
dialogEl.close();
dialogEl?.close();
};

const onImageLoad = () => {
const onImageLoad = (): void => {
loading = false;

if (cropper) {
cropper.getCropperImage()!.$center('contain');
cropper.getCropperSelection()!.$center();
}
cropper?.getCropperImage()?.$center('contain');
cropper?.getCropperSelection()?.$center();
};

onMounted(() => {
cropper = new Cropper(imgEl, {
});
if (!imgEl) return;
cropper = new Cropper(imgEl, {});

const computedStyle = getComputedStyle(document.documentElement);

const selection = cropper.getCropperSelection()!;
const selection = cropper.getCropperSelection();
if (!selection) return;

selection.themeColor = tinycolor(computedStyle.getPropertyValue('--accent')).toHexString();
selection.aspectRatio = props.aspectRatio;
selection.initialAspectRatio = props.aspectRatio;
selection.outlined = true;

window.setTimeout(() => {
cropper.getCropperImage()!.$center('contain');
cropper?.getCropperImage()?.$center('contain');
selection.$center();
}, 100);

// モーダルオープンアニメーションが終わったあとで再度調整
window.setTimeout(() => {
cropper.getCropperImage()!.$center('contain');
cropper?.getCropperImage()?.$center('contain');
selection.$center();
}, 500);
});
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/components/MkDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function onBgClick() {
}
*/
function onKeydown(evt: KeyboardEvent) {
if (evt.key === 'Escape') cancel();
if (evt.key === 'Escape' || evt.key === 'Esc') cancel();
}

function onInputKeydown(evt: KeyboardEvent) {
Expand Down
3 changes: 2 additions & 1 deletion packages/client/src/components/MkDrive.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
<button class="menu _button" @click="showMenu"><i class="ti ti-dots"></i></button>
</nav>
<div
ref="main" class="main"
ref="main"
class="main"
:class="{ uploading: uploadings.length > 0, fetching }"
@dragover.prevent.stop="onDragover"
@dragenter="onDragenter"
Expand Down
12 changes: 6 additions & 6 deletions packages/client/src/components/MkDriveSelectDialog.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<XModalWindow
<MkModalWindow
ref="dialog"
:width="800"
:height="500"
Expand All @@ -14,15 +14,15 @@
{{ multiple ? ((type === 'file') ? i18n.ts.selectFiles : i18n.ts.selectFolders) : ((type === 'file') ? i18n.ts.selectFile : i18n.ts.selectFolder) }}
<span v-if="selected.length > 0" style="margin-left: 8px; opacity: 0.5;">({{ number(selected.length) }})</span>
</template>
<XDrive :multiple="multiple" :select="type" @change-selection="onChangeSelection" @selected="ok()"/>
</XModalWindow>
<MkDrive :multiple="multiple" :select="type" @change-selection="onChangeSelection" @selected="ok()"/>
</MkModalWindow>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
import { DriveFile } from 'misskey-js/built/entities';
import XDrive from '@/components/MkDrive.vue';
import XModalWindow from '@/components/MkModalWindow.vue';
import MkDrive from '@/components/MkDrive.vue';
import MkModalWindow from '@/components/MkModalWindow.vue';
import number from '@/filters/number';
import { i18n } from '@/i18n';

Expand All @@ -38,7 +38,7 @@ const emit = defineEmits<{
(ev: 'closed'): void;
}>();

const dialog = ref<InstanceType<typeof XModalWindow>>();
const dialog = ref<InstanceType<typeof MkModalWindow>>();

const selected = ref<DriveFile[]>([]);

Expand Down
10 changes: 5 additions & 5 deletions packages/client/src/components/MkDriveWindow.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<XWindow
<MkWindow
ref="window"
:initial-width="800"
:initial-height="500"
Expand All @@ -9,15 +9,15 @@
<template #header>
{{ i18n.ts.drive }}
</template>
<XDrive :initial-folder="initialFolder"/>
</XWindow>
<MkDrive :initial-folder="initialFolder"/>
</MkWindow>
</template>

<script lang="ts" setup>
import { } from 'vue';
import * as Misskey from 'misskey-js';
import XDrive from '@/components/MkDrive.vue';
import XWindow from '@/components/MkWindow.vue';
import MkDrive from '@/components/MkDrive.vue';
import MkWindow from '@/components/MkWindow.vue';
import { i18n } from '@/i18n';

defineProps<{
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/components/MkFileListForAdmin.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const props = defineProps<{
> .file {
position: relative;
aspect-ratio: 1;

> .thumbnail {
width: 100%;
height: 100%;
Expand Down
5 changes: 4 additions & 1 deletion packages/client/src/components/MkFolder.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</button>
</header>
<Transition
:name="$store.state.animation ? 'folder-toggle' : ''"
:name="defaultStore.state.animation ? 'folder-toggle' : ''"
@enter="enter"
@after-enter="afterEnter"
@leave="leave"
Expand All @@ -25,6 +25,7 @@
<script lang="ts">
import { defineComponent } from 'vue';
import tinycolor from 'tinycolor2';
import { defaultStore } from '@/store';

const localStoragePrefix = 'ui:folder:';

Expand All @@ -44,10 +45,12 @@ export default defineComponent({
data(): ({
bg: string | null;
showBody: boolean;
defaultStore: typeof defaultStore;
}) {
return {
bg: null,
showBody: (this.persistKey && localStorage.getItem(localStoragePrefix + this.persistKey)) ? localStorage.getItem(localStoragePrefix + this.persistKey) === 't' : this.expanded,
defaultStore,
};
},
watch: {
Expand Down
Loading