revert "shouldCollapsed -> shouldCollapse"
This commit is contained in:
parent
83b44155e3
commit
51ec1914f9
|
@ -125,7 +125,7 @@ import EmUserName from '@/components/EmUserName.vue';
|
|||
import EmTime from '@/components/EmTime.vue';
|
||||
import { userPage } from '@/utils.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { shouldCollapse } from '@@/js/collapsed.js';
|
||||
import { shouldCollapsed } from '@@/js/collapsed.js';
|
||||
|
||||
function getAppearNote(note: Misskey.entities.Note) {
|
||||
return Misskey.note.isPureRenote(note) ? note.renote : note;
|
||||
|
@ -153,7 +153,7 @@ const renoteTime = shallowRef<HTMLElement>();
|
|||
const appearNote = computed(() => getAppearNote(note.value));
|
||||
const showContent = ref(false);
|
||||
const parsed = computed(() => appearNote.value.text ? mfm.parse(appearNote.value.text) : null);
|
||||
const isLong = shouldCollapse(appearNote.value, 13.5, parsed.value);
|
||||
const isLong = shouldCollapsed(appearNote.value, 13.5, parsed.value);
|
||||
const collapsed = ref(appearNote.value.cw == null && isLong);
|
||||
const isDeleted = ref(false);
|
||||
</script>
|
||||
|
|
|
@ -145,7 +145,7 @@ import { userPage } from '@/utils.js';
|
|||
import { notePage } from '@/utils.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { DI } from '@/di.js';
|
||||
import { shouldCollapse } from '@@/js/collapsed.js';
|
||||
import { shouldCollapsed } from '@@/js/collapsed.js';
|
||||
import { url } from '@@/js/config.js';
|
||||
import EmMfm from '@/components/EmMfm.js';
|
||||
|
||||
|
@ -172,7 +172,7 @@ const appearNote = computed(() => isRenote ? note.value.renote as Misskey.entiti
|
|||
const showContent = ref(false);
|
||||
const isDeleted = ref(false);
|
||||
const parsed = appearNote.value.text ? mfm.parse(appearNote.value.text) : null;
|
||||
const isLong = shouldCollapse(appearNote.value, 13.5, parsed.value);
|
||||
const isLong = shouldCollapsed(appearNote.value, 13.5, parsed.value);
|
||||
const collapsed = ref(appearNote.value.cw == null && isLong);
|
||||
</script>
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import EmMediaList from '@/components/EmMediaList.vue';
|
|||
import EmPoll from '@/components/EmPoll.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
import { url } from '@@/js/config.js';
|
||||
import { shouldCollapse } from '@@/js/collapsed.js';
|
||||
import { shouldCollapsed } from '@@/js/collapsed.js';
|
||||
import EmA from '@/components/EmA.vue';
|
||||
import EmMfm from '@/components/EmMfm.js';
|
||||
|
||||
|
@ -44,7 +44,7 @@ const props = defineProps<{
|
|||
note: Misskey.entities.Note;
|
||||
}>();
|
||||
|
||||
const isLong = shouldCollapse(props.note, 13.5);
|
||||
const isLong = shouldCollapsed(props.note, 13.5);
|
||||
|
||||
const collapsed = ref(isLong);
|
||||
</script>
|
||||
|
|
|
@ -13,7 +13,7 @@ function safeParseFloat(str: unknown): number | null {
|
|||
return num;
|
||||
}
|
||||
|
||||
export function shouldCollapseLegacy(note: Misskey.entities.Note, urls: string[]): boolean {
|
||||
export function shouldCollapsedLegacy(note: Misskey.entities.Note, urls: string[]): boolean {
|
||||
const collapsed = note.cw == null && (
|
||||
(note.text != null && (
|
||||
(note.text.includes('$[x2')) ||
|
||||
|
@ -29,7 +29,7 @@ export function shouldCollapseLegacy(note: Misskey.entities.Note, urls: string[]
|
|||
return collapsed;
|
||||
}
|
||||
|
||||
export function shouldCollapse(note: Misskey.entities.Note, limitY: number, ast?: mfm.MfmNode[] | null, urls?: string[]): boolean {
|
||||
export function shouldCollapsed(note: Misskey.entities.Note, limitY: number, ast?: mfm.MfmNode[] | null, urls?: string[]): boolean {
|
||||
if (note.cw != null) return false;
|
||||
if (note.text == null) return false;
|
||||
if (note.files && note.files.length >= 5) return true;
|
||||
|
|
|
@ -218,7 +218,7 @@ import { claimAchievement } from '@/utility/achievements.js';
|
|||
import { getNoteSummary } from '@/utility/get-note-summary.js';
|
||||
import MkRippleEffect from '@/components/MkRippleEffect.vue';
|
||||
import { showMovedDialog } from '@/utility/show-moved-dialog.js';
|
||||
import { shouldCollapseLegacy, shouldCollapse } from '@@/js/collapsed.js';
|
||||
import { shouldCollapsedLegacy, shouldCollapsed } from '@@/js/collapsed.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
import { focusPrev, focusNext } from '@/utility/focus.js';
|
||||
import { getAppearNote } from '@/utility/get-appear-note.js';
|
||||
|
@ -315,14 +315,14 @@ const collapseSize = defaultStore.state.collapsingNoteSize;
|
|||
const isLong = ref(true);
|
||||
switch (collapsingNoteCondition) {
|
||||
case 'detailedCalculation':
|
||||
isLong.value = shouldCollapse(appearNote.value, collapseSize, parsed.value, urls.value ?? []);
|
||||
isLong.value = shouldCollapsed(appearNote.value, collapseSize, parsed.value, urls.value ?? []);
|
||||
break;
|
||||
case 'seeRenderedSize':
|
||||
break;
|
||||
// fail safe
|
||||
case 'legacyCalculation':
|
||||
default:
|
||||
isLong.value = shouldCollapseLegacy(appearNote.value, urls.value ?? []);
|
||||
isLong.value = shouldCollapsedLegacy(appearNote.value, urls.value ?? []);
|
||||
break;
|
||||
}
|
||||
const collapsed = ref(appearNote.value.cw == null && isLong.value);
|
||||
|
|
|
@ -35,7 +35,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
import { ref, computed, onMounted } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as mfm from 'mfm-js';
|
||||
import { shouldCollapseLegacy, shouldCollapse } from '@@/js/collapsed.js';
|
||||
import { shouldCollapsedLegacy, shouldCollapsed } from '@@/js/collapsed.js';
|
||||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
import MkPoll from '@/components/MkPoll.vue';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
@ -63,7 +63,7 @@ const isLong = ref(true);
|
|||
switch (collapsingNoteCondition) {
|
||||
case 'detailedCalculation':
|
||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||
isLong.value = shouldCollapse(props.note, collapseSize, ast.value);
|
||||
isLong.value = shouldCollapsed(props.note, collapseSize, ast.value);
|
||||
break;
|
||||
case 'seeRenderedSize':
|
||||
break;
|
||||
|
@ -71,7 +71,7 @@ switch (collapsingNoteCondition) {
|
|||
case 'legacyCalculation':
|
||||
default:
|
||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||
isLong.value = shouldCollapseLegacy(props.note, []);
|
||||
isLong.value = shouldCollapsedLegacy(props.note, []);
|
||||
break;
|
||||
}
|
||||
const collapsed = ref(isLong.value);
|
||||
|
|
|
@ -15,7 +15,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else ref="noteTextEl" :class="[$style.text, { [$style.collapsed]: shouldCollapse }]">
|
||||
<div v-else ref="noteTextEl" :class="[$style.text, { [$style.collapsed]: shouldCollapsed }]">
|
||||
<MkA v-if="note.replyId" class="reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></MkA>
|
||||
<Mfm v-if="note.text" :text="note.text" :author="note.user"/>
|
||||
<MkA v-if="note.renoteId" class="rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
|
||||
|
@ -46,14 +46,14 @@ defineProps<{
|
|||
}>();
|
||||
|
||||
const noteTextEl = useTemplateRef('noteTextEl');
|
||||
const shouldCollapse = ref(false);
|
||||
const shouldCollapsed = ref(false);
|
||||
const showContent = ref(false);
|
||||
|
||||
function calcCollapse() {
|
||||
if (noteTextEl.value) {
|
||||
const height = noteTextEl.value.scrollHeight;
|
||||
if (height > 200) {
|
||||
shouldCollapse.value = true;
|
||||
shouldCollapsed.value = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue