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

Support directional key commands #227

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

hontd
Copy link

@hontd hontd commented Oct 5, 2023

No description provided.

Copy link
Owner

@rajdeep rajdeep left a comment

Choose a reason for hiding this comment

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

@hontd, thank you for making this change.

var handled: Bool = false
presses.forEach { press in
guard let key = press.key else { return }
if key.charactersIgnoringModifiers == UIKeyCommand.inputUpArrow {
Copy link
Owner

Choose a reason for hiding this comment

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

@hontd, if we keep a mapping of UIKeyCommand with EditorKey, we can get this if-else condition down to a single line without duplicating richTextViewDelegate?.richTextView(self, shouldHandle:. It would be easier to maintain then.

Copy link
Owner

Choose a reason for hiding this comment

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

Also, it would be great to add some tests here. Checkout RichTextViewContextTests for examples.

rajdeep
rajdeep previously approved these changes Oct 9, 2023
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.

None yet

3 participants