fix: relax split-block IME detection for heading composition#471
Merged
fix: relax split-block IME detection for heading composition#471
Conversation
The splitBlockFix required exact pinyin text to match in the heading at the original position, but by the time requestAnimationFrame fired, the browser had already cleared or transformed the preedit content. This caused the fix to silently fail for all Chinese IME input in headings — abbreviated pinyin, multi-syllable input, and even standard pinyin were all affected. Replace brittle pinyin matching with structural detection: - Check original block is a heading (not just any block) - Remove everything from startPos to heading end (handles any preedit state the browser left behind) - Remove compositionPinyin guard so fix runs even when pinyin is empty
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
splitBlockFixcompositionPinyinemptiness guard so the fix triggers for abbreviated pinyin and browser-cleared preeditRoot cause: The previous fix required exact pinyin text at the original position, but by the time
requestAnimationFramefired aftercompositionend, the browser had already modified or cleared the heading content. The match always failed → fix never triggered.Closes #66
Test plan
pnpm check:allpasses