sibiraj-s / ngx-editor

🖋️ Rich Text Editor for angular using ProseMirror
https://sibiraj-s.github.io/ngx-editor/
MIT License
458 stars 191 forks source link

[Bug]: Mentions keyboard controls not working #390

Closed kikemarquez8 closed 1 year ago

kikemarquez8 commented 2 years ago

What happened?

When using the mentions & tags when I begin writing and get a suggestion hitting "Enter" should select the first suggestion on the list.

This is not happening, instead the editor it's just printing a new line.

Version

v12.2.2

What browsers are you seeing the problem on?

No response

Link to reproduce

https://stackblitz.com/edit/ngx-editor-mentions

Potential workaround

A workaround I found was not including the plugin in the constructor, but adding it afterwards as the first plugin. Which is the same the author of the plugin does in his demo. https://github.com/joelewis/prosemirror-mentions/tree/master#usage

I modified the original stackblitz https://stackblitz.com/edit/ngx-editor-mentions-tkxusj

Willing to submit a PR?

Yes

sibiraj-s commented 2 years ago

Sure. Yeah. Prosemirror bindings happens in the order which it got registered. What would be the fix for this?

DatKyle commented 2 years ago

I've run into this issue recently, the issue is with the plugin orders in Editor.ts

And specifically with the KeyboardShortcut plugin, as it inserts a new line and returns true before the Mention plugin can run.

flipping the order the default and passed in plugins are added to the list resolves the issue.

sibiraj-s commented 2 years ago

flipping the order the default and passed in plugins are added to the list resolves the issue.

Yeah. Since the order defines how the bindings are registered, We could do that.

PR welcome.

And note, this is a breaking change. though it may not break much. Still the nature of changes calls for a new major.

sibiraj-s commented 1 year ago

Closing this as the issue is quite old. PR's welcome.

Thank you.

github-actions[bot] commented 1 year ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in the thread.