From 7378c4a9d8c8c48a8ecf043d7a8e27b0d013f335 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 15 Apr 2021 12:37:58 +0900 Subject: fix #7444 --- src/client/components/mfm.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/client/components') diff --git a/src/client/components/mfm.ts b/src/client/components/mfm.ts index b8e948a188..3b08c83c7f 100644 --- a/src/client/components/mfm.ts +++ b/src/client/components/mfm.ts @@ -58,10 +58,13 @@ export default defineComponent({ const text = token.props.text.replace(/(\r\n|\n|\r)/g, '\n'); if (!this.plain) { - const x = text.split('\n') - .map(t => t == '' ? [h('br')] : [t, h('br')]); - x[x.length - 1].pop(); - return x; + const res = []; + for (const t of text.split('\n')) { + res.push(h('br')); + res.push(t); + } + res.shift(); + return res; } else { return [text.replace(/\n/g, ' ')]; } -- cgit v1.2.3-freya From c2b3436770eef87b82626ca785449e38b9af5c8a Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 15 Apr 2021 20:26:02 +0900 Subject: better list rendering --- src/client/components/date-separated-list.vue | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/client/components') diff --git a/src/client/components/date-separated-list.vue b/src/client/components/date-separated-list.vue index 433655d6ed..833cdfc898 100644 --- a/src/client/components/date-separated-list.vue +++ b/src/client/components/date-separated-list.vue @@ -24,11 +24,9 @@ export default defineComponent({ methods: { focus() { this.$slots.default[0].elm.focus(); - } - }, + }, - render() { - const getDateText = (time: string) => { + getDateText(time: string) { const date = new Date(time).getDate(); const month = new Date(time).getMonth() + 1; return this.$t('monthAndDay', { @@ -36,9 +34,13 @@ export default defineComponent({ day: date.toString() }); } + }, + render() { const noGap = [...document.querySelectorAll('._noGap_')].some(el => el.contains(this.$parent.$el)); + if (this.items.length === 0) return; + return h(this.$store.state.animation ? TransitionGroup : 'div', this.$store.state.animation ? { class: 'sqadhkmv' + (noGap ? ' _block' : ''), name: 'list', @@ -72,10 +74,10 @@ export default defineComponent({ class: 'icon', icon: faAngleUp, }), - getDateText(item.createdAt) + this.getDateText(item.createdAt) ]), h('span', [ - getDateText(this.items[i + 1].createdAt), + this.getDateText(this.items[i + 1].createdAt), h(FontAwesomeIcon, { class: 'icon', icon: faAngleDown, -- cgit v1.2.3-freya From 05ba1d0fd458e92f63a2d979117e11ff7270267e Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 15 Apr 2021 20:55:54 +0900 Subject: fix style --- src/client/components/notifications.vue | 5 ++--- src/client/pages/page.vue | 6 ++---- src/client/pages/timeline.vue | 5 ++--- src/client/style.scss | 10 ++++++---- 4 files changed, 12 insertions(+), 14 deletions(-) (limited to 'src/client/components') diff --git a/src/client/components/notifications.vue b/src/client/components/notifications.vue index baafa86f4d..0891108d8b 100644 --- a/src/client/components/notifications.vue +++ b/src/client/components/notifications.vue @@ -1,7 +1,6 @@