diff --git a/docs/src/demos/Extensions/Link/index.spec.js b/docs/src/demos/Extensions/Link/index.spec.js index 6fcc747c..72b305f6 100644 --- a/docs/src/demos/Extensions/Link/index.spec.js +++ b/docs/src/demos/Extensions/Link/index.spec.js @@ -9,4 +9,28 @@ context('/api/extensions/link', () => { editor.selectAll() }) }) + + it('the button should add a link to the selected text', () => { + cy.window().then(win => { + cy.stub(win, 'prompt').returns('https://tiptap.dev') + + cy.get('.demo__preview button:first') + .click() + + cy.get('.ProseMirror') + .find('a') + .should('contain', 'Example Text') + .should('have.attr', 'href', 'https://tiptap.dev') + }) + }) + + it.skip('links should be auto detected', () => { + cy.get('.ProseMirror') + .then($span => { + $span.text('https://example.com') + }) + .find('a') + .should('contain', 'https://example.com') + .should('have.attr', 'href', 'https://example.com') + }) }) diff --git a/docs/src/demos/Extensions/Link/index.vue b/docs/src/demos/Extensions/Link/index.vue index 79521730..9d22c73f 100644 --- a/docs/src/demos/Extensions/Link/index.vue +++ b/docs/src/demos/Extensions/Link/index.vue @@ -39,7 +39,10 @@ export default { ], content: `

- Try to add some links to the world wide web. By default every link will get a rel="noopener noreferrer nofollow" attribute. + Wow, this editor has support for links to the whole world wide web. We tested a lot of URLs and I think you can add *every URL* you want. Isn’t that cool? Let’s try another one! Yep, seems to work. +

+

+ By default every link will get a \`rel="noopener noreferrer nofollow"\` attribute. It’s configurable though.

`, }) diff --git a/docs/src/docPages/api/extensions/link.md b/docs/src/docPages/api/extensions/link.md index 5756507a..d2af3beb 100644 --- a/docs/src/docPages/api/extensions/link.md +++ b/docs/src/docPages/api/extensions/link.md @@ -18,9 +18,9 @@ yarn add @tiptap/extension-link | Option | Type | Default | Description | | ----------- | ------- | ---------------------------- | -------------------------------------------- | | class | string | – | Add a custom class to the rendered HTML tag. | -| openOnClick | Boolean | true | If enabled, links will be opened on click. | +| openOnClick | boolean | true | If enabled, links will be opened on click. | | rel | string | noopener noreferrer nofollow | Configure the `rel` attribute. | -| target | _self | | Set the default `target` of links. | +| target | string | _self | Set the default `target` of links. | ## Commands | Command | Options | Description |