-
Notifications
You must be signed in to change notification settings - Fork 94
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
Several link handling fixes #5422
Conversation
No longer hide the link bubble when editor looses focus. We just always show the link bubble as long as the selection stays within a link or until it's manually closed. This eliminates possible race-conditions and corner-case bugs. Signed-off-by: Jonas <jonas@freesources.org>
Prevents annoying race conditions when testing the LinkBubble in Cypress. Signed-off-by: Jonas <jonas@freesources.org>
Full URLs have the advantage that they also work when clicking them outside the Nextcloud context, e.g. in a local markdown editor. Their main disadvantage is that they cause trouble on Nextcloud instances with more than one hostname or after changing the hostname of a Nextcloud instance. The first use case (opening a file outside Nextcloud context) is more likely and less of a corner case than the second (changing hostname), so we decided to go for full URLs. Signed-off-by: Jonas <jonas@freesources.org>
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.
Looks good .. just one concern
this.#updateDebounceTimer = window.setTimeout(() => { | ||
this.updateFromSelection(view) | ||
}, updateDelay) | ||
debounce(() => this.updateFromSelection.bind(this)(view), updateDelay, { immediate: true }) |
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.
Does this debounce actually have an effect? As far as I know it would still call every time, unless you would call the returned function
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.
@max-nextcloud to the rescue 😬 I still struggle to understand the different scopes of JS functions 🙈
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.
Ah sorry, now I got what you mean. Indeed, debounce just returns a function that needs to be called. I thought it would be about the scope of this
in updateFromSelection()
. Anyways, should be fixed now
4b7b23f
to
814767f
Compare
814767f
to
4da1454
Compare
Run `updateFromSelection()` immediately on first call and only delay further runs. This fixes a race condition with `this.#hadUpdateFromClick` which gets set when updating from click and gets cleaned up after 200ms. Fixes an issue with the bubble disappearing immediately when clicking on a link after unfocussed browser and editor. Signed-off-by: Jonas <jonas@freesources.org>
Required to allow relative links (and those without origin) to other collectives pages to be resolved by link previews. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
Fixes: #5324 Signed-off-by: Jonas <jonas@freesources.org>
4da1454
to
0dd249c
Compare
Cypress tests also green now 😊 |
Commit "fix(ActionInsertLink): Sync NcActionInput value property" should get backported to stable28, probably also to stable27. |
/backport 0dd249c to stable28 |
/backport 0dd249c to stable27 |
📝 Summary
🏁 Checklist
npm run lint
/npm run stylelint
/composer run cs:check
)