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

Sanity locks up when using accented characters, typing words like "café" or "citroën" #2436

Closed
asundlihardig opened this issue Apr 16, 2021 · 12 comments

Comments

@asundlihardig
Copy link

Describe the bug
If you write text using accented characters like: "kafé", "òg" or "vêr" (Norwegian Nynorsk) the editor locks up. The only way to continue typing is to refresh the window.

Our client reports this as being a big problem. The editor freezes several times for each article

A clear and concise description of what the bug is.

To Reproduce
Load up a Studio with portable text. Write text containing accented characters. After a while the editor freezes.

Expected behavior
The editor should handle accented characters and not freeze.

Which versions of Sanity are you using?
@sanity/cli 2.7.4 (latest: 2.8.0)
@sanity/base 2.8.0 (up to date)
@sanity/code-input 2.2.6 (up to date)
@sanity/components 2.2.6 (up to date)
@sanity/core 2.8.0 (up to date)
@sanity/dashboard 2.7.0 (up to date)
@sanity/default-layout 2.8.0 (up to date)
@sanity/default-login 2.8.0 (up to date)
@sanity/desk-tool 2.8.0 (up to date)
@sanity/production-preview 2.2.6 (up to date)
@sanity/vision 2.8.0 (up to date)

What operating system are you using?
Mac OS 11.2.3

Which versions of Node.js / npm are you running?
6.14.11
v14.15.0

Additional context
Our client uses Norwegian Nynorsk in all content. First time for us, so never experienced this problem before.

@geball
Copy link
Contributor

geball commented Apr 20, 2021

I'm getting a similar issue when typing é in a portable text field. I get the error:

Error: Cannot resolve a Slate point from DOM point: [object Text],0
    toSlatePoint index.es.js:2104
    toSlateRange index.es.js:2150
    onDOMSelectionChange index.es.js:1178

If I try to highlight and delete the text containing the é, the studio crashes. Refreshing and returning to the post, I can delete it.

@sanity/cli 2.8.0 (up to date)
@sanity/base 2.8.0 (up to date)
@sanity/client 2.8.0 (up to date)
@sanity/code-input 2.2.6 (up to date)
@sanity/components 2.2.6 (up to date)
@sanity/core 2.8.0 (up to date)
@sanity/default-layout 2.8.0 (up to date)
@sanity/default-login 2.8.0 (up to date)
@sanity/desk-tool 2.8.0 (up to date)
@sanity/vision 2.8.0 (up to date)

@asundlihardig
Copy link
Author

asundlihardig commented Apr 20, 2021

I'm getting a similar issue when typing é in a portable text field. I get the error:

Error: Cannot resolve a Slate point from DOM point: [object Text],0
    toSlatePoint index.es.js:2104
    toSlateRange index.es.js:2150
    onDOMSelectionChange index.es.js:1178

If I try to highlight and delete the text containing the é, the studio crashes. Refreshing and returning to the post, I can delete it.

Thank you!

@francisprovost
Copy link

Also having the problem with 2.10.

What I notice having the problem:

  • The problem seems intermittent and seen on Chrome and Edge on MacOS.
  • The cursor goes back to the beginning of the line and you can't delete or move it but you sometimes can type some characters
  • Pasting words with those characters seems to be working (reported by my wife who's the main user/editor)

Full version list:

    "@sanity/base": "^2.10.0",
    "@sanity/components": "^2.2.6",
    "@sanity/core": "^2.10.0",
    "@sanity/default-layout": "^2.10.0",
    "@sanity/default-login": "^2.8.0",
    "@sanity/desk-tool": "^2.10.1",
    "@sanity/production-preview": "^2.2.6",
    "@sanity/vision": "^2.10.0",

I wouldn't mind giving a shot to fixing it if I could have some pointers.

@tocteman
Copy link

Hello, breaks for me as well. For now only way to get around it is copy-pasting our spanish texts from another editor; same "cannot resolve Slate point" bug. If I type an accent, Studio gets starts misbehaving seriously or outright crashes.

@skogsmaskin
Copy link
Member

Hi! I'm not able to reproduce this, it seem to be fixed as far as I can tell. Can you please try our latest version?

@francisprovost
Copy link

Hi!

I was able to still reproduce the problem on 2.22.x

Here's what sanity upgrade gave me

✔ Modules upgraded:
@sanity/base            2.21.9 → 2.22.0
@sanity/core            2.21.8 → 2.22.0
@sanity/default-layout  2.21.9 → 2.22.0
@sanity/default-login   2.21.9 → 2.22.0
@sanity/desk-tool       2.21.9 → 2.22.2
@sanity/vision          2.21.9 → 2.22.0

Configs for that specific field

    {
      name: 'content',
      title: 'Contenu',
      type: 'array',
      of: [{ type: 'block' }, inlineImage],
    },

const inlineImage = {
  type: 'image',
  options: {
    hotspot: true,
  },
  fields: [
    {
      name: 'size',
      title: 'Grandeur',
      type: 'string',
      placeholder: 'grande ou petite',
    },
    {
      name: 'credit',
      title: 'Crédit',
      type: 'string',
    },
  ],
}

And a screen capture of what is happening. It does happen all the time but often enough that it causes problem when writting and breaking your text. Notice the carret position that goes back to the beggining of the line and some times doesn't want to move from there unless you refresh.

Screen.Recording.2021-11-18.at.1.56.55.PM.mov

@skogsmaskin
Copy link
Member

Dang! We will find a solution to this soon. Thank you for the excellent report!

@francisprovost
Copy link

If I can provide anything more or help in any way I'll be happy to!

@skogsmaskin
Copy link
Member

This should be fixed in the latest version. Can you confirm please?

@francisprovost
Copy link

Thanks I couldn't reproduce on the latest.

I had an error when adding an emoji though and typing after produce this stacktrace on loop. Do you want me to create a new issue specific for this issue?

Screen Shot 2022-01-20 at 1 13 36 PM

@skogsmaskin
Copy link
Member

Thanks @francisprovost!

Yeah that's an issue we already know about. It's actually a bug in Google's DiffMatchPatch JS-library.

See #1643 (comment)

Closing this then.

@francisprovost
Copy link

Perfect thanks @skogsmaskin

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

No branches or pull requests

5 participants