upd: expandAllCws also expands all long posts on first click

this mimics glitch-soc behavior
This commit is contained in:
ShittyKopper 2024-02-03 14:55:20 +03:00
parent bffac25c57
commit c61adcf61d
5 changed files with 10 additions and 5 deletions

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll" @click.stop/> <MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll" @click.stop/>
</p> </p>
<div v-show="note.cw == null || showContent"> <div v-show="note.cw == null || showContent">
<MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note"/> <MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note" :expandAllCws="props.expandAllCws"/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -16,7 +16,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll"/> <MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll"/>
</p> </p>
<div v-show="note.cw == null || showContent"> <div v-show="note.cw == null || showContent">
<MkSubNoteContent :class="$style.text" :note="note" :translating="translating" :translation="translation"/> <MkSubNoteContent :class="$style.text" :note="note" :translating="translating" :translation="translation" :expandAllCws="props.expandAllCws"/>
</div> </div>
</div> </div>
<footer :class="$style.footer"> <footer :class="$style.footer">

View file

@ -39,7 +39,7 @@ SPDX-License-Identifier: AGPL-3.0-only
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, computed } from 'vue'; import { ref, computed, watch } from 'vue';
import * as Misskey from 'misskey-js'; import * as Misskey from 'misskey-js';
import * as mfm from '@transfem-org/sfm-js'; import * as mfm from '@transfem-org/sfm-js';
import MkMediaList from '@/components/MkMediaList.vue'; import MkMediaList from '@/components/MkMediaList.vue';
@ -57,6 +57,7 @@ const props = defineProps<{
translating?: boolean; translating?: boolean;
translation?: any; translation?: any;
hideFiles?: boolean; hideFiles?: boolean;
expandAllCws?: boolean;
}>(); }>();
const router = useRouter(); const router = useRouter();
@ -87,6 +88,10 @@ function animatedMFM() {
} }
const collapsed = ref(isLong); const collapsed = ref(isLong);
watch(() => props.expandAllCws, (expandAllCws) => {
if (expandAllCws) collapsed.value = false;
});
</script> </script>
<style lang="scss" module> <style lang="scss" module>

View file

@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll" @click.stop/> <MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll" @click.stop/>
</p> </p>
<div v-show="note.cw == null || showContent"> <div v-show="note.cw == null || showContent">
<MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note"/> <MkSubNoteContent :hideFiles="hideFiles" :class="$style.text" :note="note" :expandAllCws="props.expandAllCws"/>
</div> </div>
</div> </div>
</div> </div>

View file

@ -24,7 +24,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll"/> <MkCwButton v-model="showContent" :text="note.text" :files="note.files" :poll="note.poll"/>
</p> </p>
<div v-show="note.cw == null || showContent"> <div v-show="note.cw == null || showContent">
<MkSubNoteContent :class="$style.text" :note="note" :translating="translating" :translation="translation"/> <MkSubNoteContent :class="$style.text" :note="note" :translating="translating" :translation="translation" :expandAllCws="props.expandAllCws"/>
</div> </div>
</div> </div>
<MkReactionsViewer ref="reactionsViewer" :note="note"/> <MkReactionsViewer ref="reactionsViewer" :note="note"/>