-
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
Backport link fixes to stable24 #2672
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mejo-
force-pushed
the
fix/stable24/link_handling
branch
from
July 5, 2022 09:45
ff3e0a0
to
f488874
Compare
/compile amend |
nextcloud-command
force-pushed
the
fix/stable24/link_handling
branch
from
July 5, 2022 09:49
f488874
to
e8ed2a0
Compare
mejo-
force-pushed
the
fix/stable24/link_handling
branch
2 times, most recently
from
July 6, 2022 10:23
e369f69
to
db2741c
Compare
The Prosemirror plugin with the `handleClick` handler only customizes the prosemirror handling of the click event. In read only mode we are not in a content-editable section. So clicking a link will cause the browser to open the url with a page reload. Allow overwriting this behavior by handling all link clicks via prosemirror. Set `onClick` option on the `Link` mark to customize the behavior. Emit a `click-link` event from `ReadOnlyEditor` with info about the event and the attributes of the link mark. Find the link that was clicked based on the clicked marks rather than the element in the event. This way we can get access to the attributes of the mark without relying on the selection or even changing it. Also add plugin key to link click handler Signed-off-by: Max <max@nextcloud.com> Signed-off-by: Jonas <jonas@nextcloud.com>
* Resolve the position given to the `handleClick` function. * Get the `link` mark from the resolved position. * Use the attrs of this mark. `editor.getAttributes` gets the attributes at the current selection. In Firefox the selection will not move to the clicked position in read only mode. So instead of relying on the selection we now use the `pos` of the click. Signed-off-by: Max <max@nextcloud.com>
We only want our custom link handlers (either the default from Text app or a further customized one, e.g. from Collectives app) to happen if the first mouse button is used, Ctrl key is not pressed and the link points to a local link. Signed-off-by: Jonas <jonas@freesources.org>
Signed-off-by: Jonas <jonas@freesources.org>
mejo-
force-pushed
the
fix/stable24/link_handling
branch
from
July 6, 2022 10:33
db2741c
to
0a5c403
Compare
max-nextcloud
approved these changes
Jul 6, 2022
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 to me. Thanks for taking care of this!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backports several fixes for issues with link handling in editor (especially in Collectives).