logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git
commit: 8cc1ad67dff93b5faa1ed1bab663d16748eec68d
parent f16658adfc897a3b07ed7f79d872acd2c3837cc8
Author: Henry Jameson <me@hjkos.com>
Date:   Sun, 15 Aug 2021 18:11:38 +0300

fix links sticking to mentionsline

Diffstat:

Msrc/components/mentions_line/mentions_line.scss2+-
Msrc/components/rich_content/rich_content.jsx7+++++++
Mtest/unit/specs/components/rich_content.spec.js4++--
3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/components/mentions_line/mentions_line.scss b/src/components/mentions_line/mentions_line.scss @@ -4,7 +4,7 @@ color: var(--link); } - .mention-link:not(:last-child) { + .mention-link { margin-right: 0.25em; } } diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx @@ -121,6 +121,13 @@ export default Vue.component('RichContent', { // in MentionsLine return currentMentions !== null ? item.trim() : item } + // We add space with mentionsLine, otherwise non-text elements will + // stick to them. + if (currentMentions !== null) { + // single whitespace trim + item = item[0].match(/\s/) ? item.slice(1) : item + } + currentMentions = null if (item.includes(':')) { item = ['', processTextForEmoji( diff --git a/test/unit/specs/components/rich_content.spec.js b/test/unit/specs/components/rich_content.spec.js @@ -59,7 +59,7 @@ describe('RichContent', () => { it('replaces mention with mentionsline', () => { const html = p( makeMention('John'), - ' how are you doing today?' + ' how are you doing today?' // also testing single-trimming function ) const wrapper = shallowMount(RichContent, { localVue, @@ -74,7 +74,7 @@ describe('RichContent', () => { expect(wrapper.html()).to.eql(compwrap(p( mentionsLine(1), - ' how are you doing today?' + ' how are you doing today?' // space removed to compensate for <ML> padding ))) })