Skip to content
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

fix: update link menububble on editor updates #2872

Merged
merged 2 commits into from
Sep 8, 2022

Conversation

max-nextcloud
Copy link
Collaborator

Summary

Ensure the menububble always shows the correct entries.

The menububble shows different buttons if the selected text is a link. However its content often became out of sync with the editor:

  • when new text was selected the bubble was still cached
  • when the selection stayed active but was expanded / shrinked the menu bubble also stayed the same
  • when someone else editing the same page changed the current selection into a link

Recompute the menububbles active data on every editor change.

The code used for this is mostly taken from the menu bars mechanism for the same purpose.
See updateState in src/components/Menu/BaseActionEntry.js.

Ensure the menububble always shows the correct entries.

The menububble shows different buttons if the selected text is a link.
However its content often became out of sync with the editor:
* when new text was selected the bubble was still cached
* when the selection stayed active but was expanded / shrinked
  the menu bubble also stayed the same
* when someone else editing the same page changed the current selection into a link

Recompute the menububbles `active` data on every editor change.

The code used for this is mostly taken from the menu bars mechanism
for the same purpose.
See updateState in src/components/Menu/BaseActionEntry.js.

Signed-off-by: Max <[email protected]>
@max-nextcloud
Copy link
Collaborator Author

/compile

@max-nextcloud
Copy link
Collaborator Author

/backport to stable24

Signed-off-by: nextcloud-command <[email protected]>
Copy link
Member

@mejo- mejo- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot, works nicely. I really like the approach with listening to changes from the editor.

@max-nextcloud max-nextcloud merged commit 5353e5d into master Sep 8, 2022
@delete-merged-branch delete-merged-branch bot deleted the fix/2869-link-detection branch September 8, 2022 09:16
@backportbot-nextcloud
Copy link

The backport to stable24 failed. Please do this backport manually.

@max-nextcloud
Copy link
Collaborator Author

/backport 7bd2e54 to stable24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MenuBubble: Detection whether link is active or not is broken
3 participants