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

feat: Move search highlighting to editor API #6199

Merged
merged 10 commits into from
Aug 13, 2024
Merged

Conversation

elzody
Copy link
Contributor

@elzody elzody commented Aug 11, 2024

📝 Summary

Previously, Text would emit and subscribe to events using @nextcloud/event-bus and other apps which wanted to use search highlighting would need to subscribe and emit their own corresponding events to trigger it. This was not ideal since it required apps to use some unknown / undocumented API for triggering search highlighting. This PR moves away from using the event bus for cross-app communication in this case, and allows apps to just call some search methods on the editor itself.

Please note, the event bus is still used in one area, but it is not used for cross-app communication in that case. It is used only for communicating with deeply-nested Prosemirror plugins and the editor class itself, and is thusly not exposed as something other apps can use. They must still use the editor API.

🏁 Checklist

  • Code is properly formatted (npm run lint / npm run stylelint / composer run cs:check)
  • Sign-off message is added to all commits
  • Tests (unit, integration and/or end-to-end) passing and the changes are covered with tests
  • Documentation (README or documentation) has been updated or is not required

@elzody elzody changed the title Refactor/search highlight feat: Move search highlighting to editor API instead of event bus Aug 11, 2024
@elzody elzody self-assigned this Aug 11, 2024
@elzody elzody added this to the Nextcloud 30 milestone Aug 11, 2024
@elzody elzody changed the title feat: Move search highlighting to editor API instead of event bus feat: Move search highlighting to editor API Aug 11, 2024
@elzody elzody marked this pull request as ready for review August 12, 2024 17:15
@elzody elzody linked an issue Aug 12, 2024 that may be closed by this pull request
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.

Really nice, looks great @elzody! Also extra kudos for the cypress component tests ❤️

I didn't test, but I guess you already tested this with corresponding code changes in Collectives?

I only have one nitpicking comment, otherwise good to be merged from my side.

cypress/component/editor/search.cy.js Outdated Show resolved Hide resolved
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Signed-off-by: Elizabeth Danzberger <lizzy7128@tutanota.de>
Copy link
Member

@juliusknorr juliusknorr left a comment

Choose a reason for hiding this comment

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

Nice and clean 🚀

@elzody elzody merged commit 3a4d611 into main Aug 13, 2024
59 of 61 checks passed
@elzody elzody deleted the refactor/search-highlight branch August 13, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move search highlighting to editor API Implement tests for search highlighting
3 participants