Skip to content

Suggestions: Allow more dynamic triggers #2882

Description

@Anatoly03

What problem are you facing?

I'm looking for a way to use the Suggestions/Mention Plugin, but without the trigger being the @-character, rather the entire word. For example if you were to start writing A, Alice would show up. In other words, I'm looking for a more dynamic way to trigger the suggestions. This could include only triggering when two letters of the word where added, or n, or instantly triggering after the first letter.

What’s the solution you would like to see?

Making Suggestion.char regex-based, so @ wouldn't be affected, but allowing more freedom for the trigger. You could then allow it to trigger upon words that start with a capital letter [A-Z], or words that start with a capital letter and have two letters [A-Z][a-z], or perhaps words that have exactly three characters [A-Za-z]{3}.

What alternatives did you consider?

I tried writing a custom extension, for that I've cloned suggestion.ts, findSuggestionMatch.ts and mention.ts into my repository, to see how they work, however a bug occured in lines 244 and 255 in suggestion.ts: Property 'getState' does not exist on type 'EditorProps'.ts(2339) that I do not know how to fix. It seemed to be a bug with the plugin's prose mirror being out of date, perhaps?

Anything to add? (optional)

No response

Are you sponsoring us?

  • Yes, I’m a sponsor. 💖

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: staleNo activity for an extended period, may be closed automatically

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions