diff --git a/src/extensions/Mention.js b/src/extensions/Mention.js index 5f5fdffe6c7..792b754c8e1 100644 --- a/src/extensions/Mention.js +++ b/src/extensions/Mention.js @@ -40,8 +40,6 @@ export default TipTapMention.extend({ }, toMarkdown(state, node) { - state.write(' ') state.write(`@[${node.attrs.label}](mention://user/${encodeURIComponent(node.attrs.id)})`) - state.write(' ') }, }) diff --git a/src/tests/markdown.spec.js b/src/tests/markdown.spec.js index e80d2112817..2342236c169 100644 --- a/src/tests/markdown.spec.js +++ b/src/tests/markdown.spec.js @@ -123,8 +123,9 @@ describe('Markdown though editor', () => { expect(markdownThroughEditor('---\n---')).toBe('---\n---') }) - test('mentions', () => { - expect(markdownThroughEditor('@[username](mention://user/id)')).toBe(' @[username](mention://user/id) ') + test.only('mentions', () => { + expect(markdownThroughEditor('@[username](mention://user/id)')).toBe('@[username](mention://user/id)') + expect(markdownThroughEditor('pretext @[username](mention://user/id) posttext')).toBe('pretext @[username](mention://user/id) posttext') }) test('details', () => { @@ -196,9 +197,10 @@ describe('Markdown serializer from html', () => { expect(markdownThroughEditorHtml('
---