fix(extension-link): make links exitable resolving #3293 (#5181)

This commit is contained in:
Nick Perez 2024-06-07 16:38:54 +02:00 committed by GitHub
parent ff6e00a356
commit a95ba3fa6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 0 deletions

View File

@ -52,6 +52,15 @@ context('/src/Marks/Link/React/', () => {
})
})
it('should allow exiting the link once set', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.setContent('<p><a href="#" target="_self">Example Text2</a></p>')
cy.get('.tiptap').type('{rightArrow}')
cy.get('button:first').should('not.have.class', 'is-active')
})
})
it('detects autolinking', () => {
cy.get('.tiptap').type('https://example.com ').find('a').should('contain', 'https://example.com')
.should('have.attr', 'href', 'https://example.com')

View File

@ -63,6 +63,15 @@ context('/src/Marks/Link/Vue/', () => {
.should('have.attr', 'href', 'https://example2.com')
})
it('should allow exiting the link once set', () => {
cy.get('.tiptap').then(([{ editor }]) => {
editor.commands.setContent('<p><a href="#" target="_self">Example Text2</a></p>')
cy.get('.tiptap').type('{rightArrow}')
cy.get('button:first').should('not.have.class', 'is-active')
})
})
it('detects autolinking', () => {
cy.get('.tiptap').type('https://example.com ').find('a').should('contain', 'https://example.com')
.should('have.attr', 'href', 'https://example.com')

View File

@ -120,6 +120,8 @@ export const Link = Mark.create<LinkOptions>({
keepOnSplit: false,
exitable: true,
onCreate() {
this.options.protocols.forEach(protocol => {
if (typeof protocol === 'string') {