-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bugfix: add support to auto link #2316
Conversation
auto link is included in original tiptap extension-link. We should keep the original behavior as much as possible. Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
Signed-off-by: Vinicius Reis <vinicius.reis@nextcloud.com>
const linkElement = event.target.parentElement instanceof HTMLAnchorElement | ||
? event.target.parentElement | ||
: event.target | ||
|
||
const isLink = linkElement && linkElement instanceof HTMLAnchorElement | ||
|
||
const htmlHref = linkElement?.href |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've changed this part of the original code to make it possible to run tests inside Cypress.
Originally we used editor.getAttributes('link')
but it not works in cypress
When we interact natively/manually with the editor, the original events "bubble" from the span
tag, but in cypress tests, the event comes from a
tag, and this tag doesn't have attributes in the editor.
It makes the automated test impossible to work, because of this I've changed the code to use the native properties of the link.
/compile |
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm!
|
||
cy.get('@winOpen') | ||
.should('have.been.calledOnce') | ||
.should('have.been.calledWith', `/index.php/f/${id}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails if NC is accessible with a sub path as the call will be like /sub/path/index.php/f/${id}
. Not a big deal but this test may fail in the future if we change how NC is deployed in the CI job.
We could either check that the target of @winOpen
ends with /index.php/f/${id}
or get the sub path and include it in the expected value.
/backport to stable24 |
The backport to stable24 failed. Please do this backport manually. |
@vinicius73 Mind to take care of the manual backport then? :) |
Summary
Auto-link is included in the original tiptap extension-link.
We should keep the original behavior as much as possible.