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

Improve suggestion handling for chinese input #1292

Conversation

mehul-m-prajapati
Copy link

fixes #1283

/claim #1283

Copy link

vercel bot commented Nov 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
blocknote ✅ Ready (Inspect) Visit Preview Dec 2, 2024 2:38am

Copy link

vercel bot commented Nov 29, 2024

@mehul-m-prajapati is attempting to deploy a commit to the TypeCell Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

algora-pbc bot commented Nov 29, 2024

💵 To receive payouts, sign up on Algora, link your Github account and connect with Stripe.

@@ -85,7 +85,7 @@ class SuggestionMenuView<

this.pluginState = stopped ? prev : next;

if (stopped || !this.editor.isEditable) {
if (stopped || !this.editor.isEditable || this.pluginState?.composing) {
Copy link

@ClytzeL ClytzeL Dec 2, 2024

Choose a reason for hiding this comment

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

I would like the suggestion menu to always open whenever the user is typing between the compositionStart and compositionEnd events.But here colsed the menu.Maybe like the code follows?

...
let _isComposing = false; 
export class SuggestionMenuProseMirrorPlugin<
...
apply(transaction, prev, _oldState, newState): SuggestionPluginState {
          if (_isComposing) {
            return prev;
          }
...
props: {
        handleDOMEvents:{
          compositionstart:(view)=>{
            console.log('run compositionstart');
            _isComposing = true;
            view.dispatch(view.state.tr.setMeta("isComposing", true));
            return false;
          },
          compositionend:(view)=>{
            console.log('run compositionend');
            _isComposing = false;
            view.dispatch(view.state.tr.setMeta("isComposing", false));
            return false;
          }
        },
        handleTextInput(view, _from, _to, text) {
...

Copy link
Author

Choose a reason for hiding this comment

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

@ClytzeL : I have updated the code. Can you please test again ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

request suggestion menu mentions to support CompositionEvent for chinese input
2 participants