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

Desktop: Fixes #10538: Fix wrong text selected when adding a link in the beta editor #10542

Conversation

personalizedrefrigerator
Copy link
Collaborator

Summary

This pull request fixes #10538 by migrating wrapSelections away from legacy CodeMirror 5 APIs.

Note

Although this pull request does some refactoring in the editor package, additional refactoring should be done in a follow-up PR

Testing plan

This pull request contains automated tests that partially test this change. As such, this pull request has also been tested manually by:

  1. Opening an existing note in the beta editor.
  2. Clicking the "hyperlink" button.
  3. Typing "http://example.com/" into the dialog box.
  4. Clicking "OK"
  5. Verifying that the cursor is placed in the middle of the [ ]s for the new link.

This has been tested successfully on Ubuntu 24.04.

… link in the beta editor

This pull request migrates `wrapSelections` away from CodeMirror 5 APIs
and makes it instead reuse code written for the same purpose on mobile.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Most of markdownReformatter isn't specific to markdown. As such, this commit renames it to editorStateUtils and uses one of its utility functions to implement wrapSelections (which also isn't markdown-specific).

A follow-up pull request should break editorStateUtils into separate files in the util folder.

@laurent22 laurent22 merged commit b17f28c into laurent22:dev Jun 11, 2024
10 checks passed
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.

Adding a link in beta editor selects random text
2 participants