Skip to content

Support directional key commands - #227

Open
hontd wants to merge 7 commits into
rajdeep:mainfrom
hontd:support-key-commands
Open

Support directional key commands#227
hontd wants to merge 7 commits into
rajdeep:mainfrom
hontd:support-key-commands

Conversation

@hontd

@hontd hontd commented Oct 5, 2023

Copy link
Copy Markdown

No description provided.

@rajdeep rajdeep left a comment

Copy link
Copy Markdown
Owner

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
Copy Markdown
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
Copy Markdown
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.

@hontd
hontd force-pushed the support-key-commands branch from 0a36d11 to 566fe54 Compare October 9, 2023 02:21
Comment thread Proton/Tests/Core/RichTextViewContextTests.swift
Comment thread Proton/Tests/Core/EditorKeyTests.swift
@hontd
hontd force-pushed the support-key-commands branch from 566fe54 to be3e8af Compare October 9, 2023 03:35
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.

3 participants