Skip to content

Conversation

@john-traas
Copy link
Contributor

@john-traas john-traas commented Nov 18, 2024

Add's a function to the inserterFactory called stopTrigger which the consumer can access via the TextEditor (TriggerFunction) interface.

Fixes: https://github.com/Lundalogik/crm-feature/issues/4474

@john-traas john-traas requested a review from a team as a code owner November 18, 2024 14:37
@john-traas john-traas changed the title Prevent default keypress actions Prevent default keypress actions - Add function to inserter to stopTrigger Nov 18, 2024
@github-actions
Copy link

Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3305/

@john-traas john-traas marked this pull request as draft November 18, 2024 14:57
export interface TextEditor {
insert: (input: TextEditorNode | string) => void;
// (undocumented)
stopTrigger: () => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

(I know this PR is still WIP, I just happened to see it.)

This change should be part of the first commit, not a separate commit 🤗

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll fix that up 🤗

Copy link
Contributor

Choose a reason for hiding this comment

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

Are you okey with the interface @adrianschmidt ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I've got no problem with it 😄

Maybe it ought to be documented? But it's still @alpha, so not a show-stopper I guess 🙂

@civing
Copy link
Contributor

civing commented Nov 22, 2024

Within the text-editor in lime-elements, while the popup is open and there is an active trigger, the default behaviour for TAB - ENTER - ARROW_UP - ARROW_DOWN should be prevented.

I think the consumer should handle this cases. I talked to @jgroth and if we configure the event to capture we can prevent certain keyboard events to ever reach the text editor. I will create a PR that updates the example.

@civing
Copy link
Contributor

civing commented Nov 22, 2024

Within the text-editor in lime-elements, while the popup is open and there is an active trigger, the default behaviour for TAB - ENTER - ARROW_UP - ARROW_DOWN should be prevented.

I think the consumer should handle this cases. I talked to @jgroth and if we configure the event to capture we can prevent certain keyboard events to ever reach the text editor. I will create a PR that updates the example.

You can find an example here. I don't think this PR are needed.

@john-traas john-traas force-pushed the prevent-default-keypress-actions branch 2 times, most recently from 8437fec to f50658d Compare November 25, 2024 12:12
@john-traas
Copy link
Contributor Author

Within the text-editor in lime-elements, while the popup is open and there is an active trigger, the default behaviour for TAB - ENTER - ARROW_UP - ARROW_DOWN should be prevented.

I think the consumer should handle this cases. I talked to @jgroth and if we configure the event to capture we can prevent certain keyboard events to ever reach the text editor. I will create a PR that updates the example.

You can find an example here. I don't think this PR are needed.

I would still like to add a specific function to stop the trigger that the consumer can access that isn't tied directly to the functionality of creating a mention.

I think it will be useful when handling some keyboard navigation cases such as the user pressing ESC to close the popup without selecting anything.

@john-traas john-traas changed the title Prevent default keypress actions - Add function to inserter to stopTrigger Add function to inserter to stopTrigger Nov 25, 2024
@civing
Copy link
Contributor

civing commented Nov 25, 2024

Within the text-editor in lime-elements, while the popup is open and there is an active trigger, the default behaviour for TAB - ENTER - ARROW_UP - ARROW_DOWN should be prevented.

I think the consumer should handle this cases. I talked to @jgroth and if we configure the event to capture we can prevent certain keyboard events to ever reach the text editor. I will create a PR that updates the example.

You can find an example here. I don't think this PR are needed.

I would still like to add a specific function to stop the trigger that the consumer can access that isn't tied directly to the functionality of creating a mention.

I think it will be useful when handling some keyboard navigation cases such as the user pressing ESC to close the popup without selecting anything.

Fully agree!

@john-traas john-traas marked this pull request as ready for review November 26, 2024 07:59
Copy link
Contributor

@civing civing left a comment

Choose a reason for hiding this comment

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

I'm okey with the PR. Just waiting for a go from @adrianschmidt

@civing civing force-pushed the prevent-default-keypress-actions branch from f50658d to d18a2e9 Compare November 26, 2024 13:09
adrianschmidt
adrianschmidt previously approved these changes Nov 26, 2024
Copy link
Contributor

@adrianschmidt adrianschmidt left a comment

Choose a reason for hiding this comment

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

External API approved 😊

@adrianschmidt adrianschmidt enabled auto-merge (rebase) November 26, 2024 16:29
@adrianschmidt adrianschmidt merged commit 94a7aef into main Nov 26, 2024
11 checks passed
@adrianschmidt adrianschmidt deleted the prevent-default-keypress-actions branch November 26, 2024 16:29
@lime-opensource
Copy link
Collaborator

🎉 This PR is included in version 37.71.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

5 participants