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

Input methods (e.g. Chinese) don't work on empty line #11

Closed
danqing opened this issue Apr 11, 2021 · 14 comments
Closed

Input methods (e.g. Chinese) don't work on empty line #11

danqing opened this issue Apr 11, 2021 · 14 comments
Labels

Comments

@danqing
Copy link

danqing commented Apr 11, 2021

For languages that require an input method to enter, the first letter isn't picked up:

CleanShot 2021-04-11 at 15 43 50

@dminkovsky
Copy link
Collaborator

dminkovsky commented Apr 12, 2021

Hi @danqing. Thank you for reporting this. Have you tried this on ProseMirror without use-prosemirror? For example, in the editor on the homepage: https://prosemirror.net/?

@danqing
Copy link
Author

danqing commented Apr 12, 2021

Yes I did - it worked fine on prosemirror's site. Thank you @dminkovsky !

@dminkovsky
Copy link
Collaborator

Thanks for confirming @danqing.

I would like to replicate this. Some more questions:

  • The GIF looks like it was recorded on macOS using the CodeSandbox from the README?
  • If I add Chinese in the keyboard settings and enable it, I will be able to enter characters as pinyin using the keyboard as you show in the GIF?
  • When you say "input methods" do you mean this also happens for other forms of entry?
  • Does this only happen on an empty line?
  • Did you try this with iOS?

@danqing
Copy link
Author

danqing commented Apr 13, 2021

The GIF looks like it was recorded on macOS using the CodeSandbox from the README?

That's right.

If I add Chinese in the keyboard settings and enable it, I will be able to enter characters as pinyin using the keyboard as you show in the GIF?

Yup.

When you say "input methods" do you mean this also happens for other forms of entry?

I mean it also happens for other languages that require input methods (e.g. Japanese). But if you are just copy-pasting text, things work fine.

Does this only happen on an empty line?

Yes.

Did you try this with iOS?

iOS works fine.

@dminkovsky
Copy link
Collaborator

@danqing Cool. Pretty important for me to correct this behavior. Thanks again for reporting this.

@dminkovsky dminkovsky pinned this issue Apr 17, 2021
@stale
Copy link

stale bot commented May 13, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label May 13, 2021
@dminkovsky
Copy link
Collaborator

Hmm please ignore this. I thought I had configured this bot not to mark pinned issues stale.

@stale stale bot removed the stale label May 13, 2021
@stale
Copy link

stale bot commented Jun 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 12, 2021
@dminkovsky dminkovsky removed the stale label Jun 12, 2021
@stale
Copy link

stale bot commented Jul 12, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 12, 2021
@stale stale bot closed this as completed Jul 19, 2021
@dakhipp
Copy link

dakhipp commented Jul 29, 2021

Would you guys be interested in updating the Prosemirror deps, more specifically prosemirror-view? I think it would resolve this issue. It was mentioned here with a patch in v1.18.11. https://discuss.prosemirror.net/t/prosemirror-view-upgrade-caused-chinese-to-be-affected-by-decoration-widget-during-input/2452/7

It would also add better Android support as mentioned here. ProseMirror/prosemirror-view@1a3faa9

I can PR it if you want, but I was unsure how open to it you'd be.

@dminkovsky
Copy link
Collaborator

dminkovsky commented Jul 29, 2021 via email

@dakhipp
Copy link

dakhipp commented Jul 29, 2021

Yeah, good point. I wasn't seeing the expected updates which made me consider updating, but no need with peerDependencies. I'm still seeing the issue, but I think it may be specific to how I'm using it in a webview. I'll leave the comment though, maybe updating prosemirror-view can help the OP. Thanks for the library!

@dminkovsky dminkovsky reopened this Jul 30, 2021
@stale stale bot removed the stale label Jul 30, 2021
@stale
Copy link

stale bot commented Aug 29, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 29, 2021
@stale stale bot closed this as completed Sep 5, 2021
@mmmulani
Copy link
Contributor

Was running into this issue with a Japanese IME and found it to be caused by the dispatchTransaction/onChange loop. Solved it by manually calling updateState on the view like this:

import { ProseMirror, Handle } from "use-prosemirror";

function Editor(...) {
  const handleRef = useRef<Handle>(null);
  const [proseState, setProseState] = useState(() => EditorState.create(...));
  return (
    <ProseMirror
      ref={handleRef}
      state={proseState}
      onChange={(state) => {
        setProseState(state);
        handleRef.current?.view?.updateState(state);
      }}
    />
  );
}

possibly changing the API for onChange/dispatchTransaction to return the new state that can be imperatively set on the view could fix this issue.

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

No branches or pull requests

4 participants