Skip to content

Commit

Permalink
feat: 노트의 텍스트 소스를 볼 수 있음
Browse files Browse the repository at this point in the history
  • Loading branch information
noridev committed Nov 14, 2023
1 parent a3ce80f commit 5b406d5
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_CHERRYPICK.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2023xx](CHANGE
- Feat: 본문 미리보기의 프로필을 표시하지 않도록 설정할 수 있음
- Feat: 이모티콘 피커의 카테고리를 다중 계층 폴더로 분류할 수 있음 (misskey-dev/misskey#12132)
- Feat: 열람 주의로 설정된 미디어를 두 번 탭 하여 표시하도록 할 수 있음 #392
- Feat: 노트의 텍스트 소스를 볼 수 있음
- Enhance: 스와이프하여 타임라인을 다시 불러올 수 있음 (misskey-dev/misskey#12113)
- PC의 경우 오른쪽 상단의 버튼을 통해서도 다시 불러올 수 있습니다
- Enhance: 타임라인 자동 업데이트를 비활성화할 수 있음 (misskey-dev/misskey#12113)
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
_lang_: "English"
viewTextSource: "View text source"
disableNoteEditConfirm: "Really continue editing the note?"
disableNoteEditConfirmWarn: "Only software that supports note editing<small>(Mastodon, CherryPick, FireFish, etc.)</small> will be able to see the edits and history.\nSoftware that doesn't support note editing will only show what was in the note before you edited it, so if you want it to reflect your edits across all federated servers, rewrite the note with <b>\"delete and edit\"</b>."
disableNoteEditOk: "Edit a note"
Expand Down
1 change: 1 addition & 0 deletions locales/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Do not edit this file directly.
export interface Locale {
"_lang_": string;
"viewTextSource": string;
"disableNoteEditConfirm": string;
"disableNoteEditConfirmWarn": string;
"disableNoteEditOk": string;
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
_lang_: "日本語"

viewTextSource: "テキストのソースを表示する"
disableNoteEditConfirm: "ノート編集を続行しますか?"
disableNoteEditConfirmWarn: "ノート編集に対応しているソフトウェア<small>(Mastodon、CherryPick、FireFishなど)</small>でのみ、編集された内容と履歴を見ることができます。\nノート編集に対応していないソフトウェアでは、ノートを編集する前の内容が表示されるので、すべての連合サーバーで修正した内容を反映させたい場合は、<b>「削除して編集」</b>でノートを書き直してください。"
disableNoteEditOk: "ノートを編集する"
Expand Down
1 change: 1 addition & 0 deletions locales/ko-KR.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
_lang_: "한국어"
viewTextSource: "텍스트 소스 보기"
disableNoteEditConfirm: "노트 편집을 계속 진행할까요?"
disableNoteEditConfirmWarn: "노트 편집을 대응하는 소프트웨어<small>(Mastodon, CherryPick, FireFish 등)</small>에서만 편집된 내용과 이력을 볼 수 있어요.\n노트 편집이 지원되지 않는 소프트웨어에서는 노트를 편집하기 전의 내용으로 표시되므로, 모든 연합된 서버에서 수정된 내용을 반영하고 싶은 경우, <b>'삭제 후 편집'</b>으로 노트를 재작성해 주세요."
disableNoteEditOk: "노트 편집하기"
Expand Down
9 changes: 7 additions & 2 deletions packages/frontend/src/components/MkNote.vue
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ SPDX-License-Identifier: AGPL-3.0-only
</div>
</div>
</div>
<div v-if="viewTextSource">
<hr style="margin: 10px 0;">
<pre style="margin: initial;"><small>{{ appearNote.text }}</small></pre>
</div>
</div>
<div v-if="appearNote.files.length > 0">
<MkMediaList v-if="appearNote.disableRightClick" :mediaList="appearNote.files" @contextmenu.prevent/>
Expand Down Expand Up @@ -288,6 +292,7 @@ const isDeleted = ref(false);
const muted = ref($i ? checkWordMute(appearNote, $i, $i.mutedWords) : false);
const translation = ref<any>(null);
const translating = ref(false);
const viewTextSource = ref(false);
const canRenote = computed(() => ['public', 'home'].includes(appearNote.visibility) || (appearNote.visibility === 'followers' && appearNote.userId === $i.id));
let renoteCollapsed = $ref(defaultStore.state.collapseRenotes && isRenote && (($i && ($i.id === note.userId || $i.id === appearNote.userId)) || (appearNote.myReaction != null)));

Expand Down Expand Up @@ -526,7 +531,7 @@ function onContextmenu(ev: MouseEvent): void {
ev.preventDefault();
react();
} else {
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, menuButton, isDeleted, currentClip: currentClip?.value });
os.contextMenu(menu, ev).then(focus).finally(cleanup);
}
}
Expand All @@ -536,7 +541,7 @@ function menu(viaKeyboard = false): void {
return;
}

const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, menuButton, isDeleted, currentClip: currentClip?.value });
const { menu, cleanup } = getNoteMenu({ note: note, translating, translation, viewTextSource, menuButton, isDeleted, currentClip: currentClip?.value });
os.popupMenu(menu, menuButton.value, {
viaKeyboard,
}).then(focus).finally(cleanup);
Expand Down
11 changes: 11 additions & 0 deletions packages/frontend/src/scripts/get-note-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export function getNoteMenu(props: {
menuButton: Ref<HTMLElement>;
translation: Ref<any>;
translating: Ref<boolean>;
viewTextSource: Ref<boolean>;
isDeleted: Ref<boolean>;
currentClip?: Misskey.entities.Clip;
}) {
Expand Down Expand Up @@ -311,6 +312,10 @@ export function getNoteMenu(props: {
props.translation.value = res;
}

function showViewTextSource(): void {
props.viewTextSource.value = true;
}

let menu: MenuItem[];
if ($i) {
const statePromise = os.api('notes/state', {
Expand Down Expand Up @@ -370,6 +375,12 @@ export function getNoteMenu(props: {
action: translate,
} : undefined,
null,
{
icon: 'ti ti-file-text',
text: i18n.ts.viewTextSource,
action: showViewTextSource,
},
null,
statePromise.then(state => state.isFavorited ? {
icon: 'ti ti-star-off',
text: i18n.ts.unfavorite,
Expand Down

0 comments on commit 5b406d5

Please sign in to comment.