diff --git a/cypress/e2e/nodes/Preview.spec.js b/cypress/e2e/nodes/Preview.spec.js index c701f635c4..02135a66cd 100644 --- a/cypress/e2e/nodes/Preview.spec.js +++ b/cypress/e2e/nodes/Preview.spec.js @@ -75,6 +75,12 @@ describe.only('Preview extension', { retries: 0 }, () => { expect(editor.can().setPreview()).to.be.true }) + it('can run the second a paragraph with a link', () => { + prepareEditor('hello\n\n[link text](https://nextcloud.com)\n') + editor.commands.setTextSelection(10) + expect(editor.can().setPreview()).to.be.true + }) + it('results in a preview node with the href and text with link mark', () => { prepareEditor('[link text](https://nextcloud.com)\n') editor.commands.setPreview() diff --git a/src/nodes/ParagraphView.vue b/src/nodes/ParagraphView.vue index 653d5c0b49..6db8c6482b 100644 --- a/src/nodes/ParagraphView.vue +++ b/src/nodes/ParagraphView.vue @@ -79,7 +79,7 @@ export default { console.info(...args) this.$editor.chain() .focus() - .setTextSelection(this.getPos()) + .setTextSelection(this.getPos() + 1) .setPreview() .run() }, diff --git a/src/nodes/Preview.vue b/src/nodes/Preview.vue index efc3df6be6..b3abed0ef7 100644 --- a/src/nodes/Preview.vue +++ b/src/nodes/Preview.vue @@ -59,7 +59,7 @@ export default { console.info(...args) this.$editor.chain() .focus() - .setTextSelection(this.getPos()) + .setTextSelection(this.getPos() + 1) .unsetPreview() .run() },