GitbookIO / GitbookIO/gitbook

Issue with online editor when writing Chinese characters

Open
#3,374 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
29k
Forks
4k
Avg merge
1d 2h
Merged PRs (30d)
71

Description

Bug description

When writing in Chinese, the slate's (the editor implementation behind gitbook) internal data structure is randomly corrupted, leading to unstability like:

  • Unable to delete characters using Backspace
  • Unable to insert new lines using Enter
  • Editor stop responding to keyboard events
  • Web page refreshes itself (possibly a js exception occurred)

In some cases a F5 will help but in other cases the entire page is corrupted and I have to screenshot everything, create new page and retype them (copy & paste can stop working, too).

How to reproduce

I didn't find a determined path to reproduce a slate internal corruption but these steps may help:

  1. Use a Chinese IME
  2. Type both Chinese and English
  3. Do some delete and insert
  4. Then the problem will be very likely to appear

Additional context

  • This happens every 2 lines of text in average.
  • Any Chinese IME is ok - for example, the Windows 11 builtin IME.
  • I can write original markdown or HTML and sync content to git book but it's far less convenient.
  • Not all slate-based editors have this problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the online editor and its Slate integration, then reproduce the corruption using a Windows 11 Chinese IME while mixing Chinese and English text with deletion and insertion. Compare the behavior with the reported keyboard failures and page refreshes; done means the editor remains responsive and its content stays intact during these actions.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.