Skip to content

Improve suggestion handling for chinese input#1292

Closed
mehul-m-prajapati wants to merge 2 commits intoTypeCellOS:mainfrom
mehul-m-prajapati:composition-event-fix
Closed

Improve suggestion handling for chinese input#1292
mehul-m-prajapati wants to merge 2 commits intoTypeCellOS:mainfrom
mehul-m-prajapati:composition-event-fix

Conversation

@mehul-m-prajapati
Copy link
Copy Markdown

fixes #1283

/claim #1283

@vercel
Copy link
Copy Markdown

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

@vercel
Copy link
Copy Markdown

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.

@algora-pbc
Copy link
Copy Markdown

algora-pbc bot commented Nov 29, 2024

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

this.pluginState = stopped ? prev : next;

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

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

Labels

None yet

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