Skip to content

Chinese IME candidate window disappears when typing in the first paragraph after YAML front matter #6554

@blaxisomu

Description

@blaxisomu

Description

When editing a Markdown file with YAML front matter, Chinese IME input breaks in the first paragraph immediately after the YAML block.

After pressing Enter to leave the YAML/front matter area, Typora creates an empty paragraph directly after the meta block. When typing Chinese pinyin in that first body paragraph, the IME candidate window disappears as soon as the second pinyin letter is entered, and the caret also disappears.

This reproduces across multiple Typora themes, so it does not appear to be caused by a custom theme.

Steps to reproduce

  1. Create or open a Markdown file with YAML front matter.
  2. Edit the YAML/front matter block.
  3. Press Enter to leave the YAML area and move into the first body paragraph immediately below it.
  4. Start typing Chinese with a pinyin IME in that first empty paragraph.
  5. Type at least two pinyin letters.

Actual behavior

After the second pinyin letter is typed:

  • the IME candidate window disappears;
  • the text caret disappears;
  • composition is interrupted, making Chinese input unusable in that first paragraph.

Expected behavior

Chinese IME composition should continue normally in the first paragraph after the YAML front matter. The candidate window and caret should remain visible while typing pinyin.

Observed DOM structure

At the time of reproduction, the editor DOM looks like this:

<div id="write" class="write enable-diagrams" role="textbox" aria-placeholder="Start writing..." aria-multiline="true" contenteditable="true" spellcheck="true" tabindex="-1">
  <pre cid="n0" mdtype="meta_block" contenteditable="true" class="md-meta-block md-end-block">

地方都是第三方

  </pre>
  <p cid="n6" mdtype="paragraph" contenteditable="true" class="md-end-block md-p md-focus"></p>
  <p cid="n4" mdtype="paragraph" contenteditable="true" class="md-end-block md-p"></p>
</div>

The issue seems tied to the empty focused paragraph immediately following pre.md-meta-block:

<p mdtype="paragraph" contenteditable="true" class="md-end-block md-p md-focus"></p>

Environment

  • OS: Windows
  • Typora version: 1.13.4
  • Input method: Chinese pinyin IME

Related issue

Possibly related to #4171, but the behavior is different. In this issue, the caret does not jump back to YAML; instead, the IME candidate window and caret disappear when composing in the first paragraph after YAML front matter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions