Skip to content

Commit

Permalink
無印でも下書きが動くように
Browse files Browse the repository at this point in the history
  • Loading branch information
nakkaa committed May 2, 2024
1 parent 1ad5fd8 commit 6284380
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 223 deletions.
4 changes: 1 addition & 3 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2623,7 +2623,6 @@ _offlineScreen:
title: "オフライン - サーバーに接続できません"
header: "サーバーに接続できません"

<<<<<<< HEAD
_urlPreviewSetting:
title: "URLプレビューの設定"
enable: "URLプレビューを有効にする"
Expand All @@ -2643,7 +2642,7 @@ _mediaControls:
pip: "ピクチャインピクチャ"
playbackRate: "再生速度"
loop: "ループ再生"
=======

_hideReactionCount:
none: "非表示にしない"
self: "自分のノートのみ"
Expand All @@ -2653,4 +2652,3 @@ _hideReactionCount:
_draftSavingBehavior:
auto: "自動的に保存する"
manual: "都度確認する"
>>>>>>> 03d1c493a2 (feat: 下書き機能 (#144))
65 changes: 4 additions & 61 deletions packages/frontend/src/components/MkPostForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<button v-tooltip="i18n.ts.hashtags" class="_button" :class="[$style.footerButton, { [$style.footerButtonActive]: withHashtags }]" @click="withHashtags = !withHashtags"><i class="ti ti-hash"></i></button>
<button v-if="postFormActions.length > 0" v-tooltip="i18n.ts.plugins" class="_button" :class="$style.footerButton" @click="showActions"><i class="ti ti-plug"></i></button>
<button v-tooltip="i18n.ts.emoji" :class="['_button', $style.footerButton]" @click="insertEmoji"><i class="ti ti-mood-happy"></i></button>
<button v-tooltip="i18n.ts.saveAsDraft" :class="['_button', $style.footerButton]" @click="saveDraft(false)"><i class="ti ti-note"></i></button>
<button v-if="showAddMfmFunction" v-tooltip="i18n.ts.addMfmFunction" :class="['_button', $style.footerButton]" @click="insertMfmFunction"><i class="ti ti-palette"></i></button>
</div>
<div :class="$style.footerRight">
Expand Down Expand Up @@ -260,7 +261,6 @@ const canPost = computed((): boolean => {
props.renote != null ||
(props.reply != null && quoteId.value != null)
) &&
(scheduledNoteDelete.value ? scheduledNoteDelete.value.isValid : true) &&
(1 <= textLength.value || 1 <= files.value.length || !!poll.value || !!renote.value) &&
(textLength.value <= maxTextLength.value) &&
(!poll.value || poll.value.choices.length >= 2);
Expand All @@ -269,53 +269,6 @@ const canPost = computed((): boolean => {
const withHashtags = computed(defaultStore.makeGetterSetter('postFormWithHashtags'));
const hashtags = computed(defaultStore.makeGetterSetter('postFormHashtags'));

const bottomItemActionDef: Record<keyof typeof bottomItemDef, {
hide?: boolean;
active?: any;
action?: any;
}> = reactive({
attachFile: {
action: chooseFileFrom,
},
poll: {
active: poll,
action: togglePoll,
},
scheduledNoteDelete: {
active: scheduledNoteDelete,
action: toggleScheduledNoteDelete,
},
useCw: {
active: useCw,
action: () => useCw.value = !useCw.value,
},
mention: {
action: insertMention,
},
hashtags: {
active: withHashtags,
action: () => withHashtags.value = !withHashtags.value,
},
plugins: {
hide: postFormActions.length === 0,
action: showActions,
},
emoji: {
action: insertEmoji,
},
addMfmFunction: {
hide: computed(() => !showAddMfmFunction.value),
action: insertMfmFunction,
},
clearPost: {
action: clear,
},
saveAsDraft: {
action: () => saveDraft(false),
},
});

>>>>>>> 03d1c493a2 (feat: 下書き機能 (#144))
watch(text, () => {
checkMissingMention();
}, { immediate: true });
Expand Down Expand Up @@ -723,7 +676,7 @@ function onDrop(ev: DragEvent): void {
async function saveDraft(auto = true) {
if (props.instant || props.mock) return;

if (auto && defaultStore.state.draftSavingBehavior !== 'auto') return;
if (auto) return;

if (!auto) {
// 手動での保存の場合は自動保存したものを削除した上で保存
Expand All @@ -738,7 +691,6 @@ async function saveDraft(auto = true) {
localOnly: localOnly.value,
files: files.value,
poll: poll.value,
scheduledNoteDelete: scheduledNoteDelete.value,
}, draftAuxId.value as string);

if (!auto) {
Expand Down Expand Up @@ -801,9 +753,6 @@ async function applyDraft(draft: noteDrafts.NoteDraft, native = false) {
if (draft.data.poll) {
poll.value = draft.data.poll;
}
if (draft.data.scheduledNoteDelete) {
scheduledNoteDelete.value = draft.data.scheduledNoteDelete;
}
}

async function post(ev?: MouseEvent) {
Expand Down Expand Up @@ -980,14 +929,8 @@ function cancel() {
}

async function closed() {
if (defaultStore.state.draftSavingBehavior === 'manual' && (text.value !== '' || files.value.length > 0)) {
os.confirm({
type: 'question',
text: i18n.ts.saveConfirm,
}).then(({ canceled }) => {
if (canceled) return;
saveDraft(false);
});
if (text.value !== '' || files.value.length > 0) {
return;
}
}

Expand Down
154 changes: 0 additions & 154 deletions packages/frontend/src/pages/settings/post-form.vue

This file was deleted.

1 change: 0 additions & 1 deletion packages/frontend/src/scripts/note-drafts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export type NoteDraft = {
localOnly: boolean;
files: Misskey.entities.DriveFile[];
poll: PollEditorModelValue | null;
scheduledNoteDelete: DeleteScheduleEditorModelValue | null;
};
};

Expand Down
4 changes: 0 additions & 4 deletions packages/frontend/src/scripts/post-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ export const bottomItemDef = {
title: i18n.ts.poll,
icon: 'ti-chart-arrows',
},
scheduledNoteDelete: {
title: i18n.ts.scheduledNoteDelete,
icon: 'ti-bomb',
},
useCw: {
title: i18n.ts.useCw,
icon: 'ti-eye-off',
Expand Down

0 comments on commit 6284380

Please sign in to comment.