Repository navigation
Conversation
…lock Confirming a language from the code picker with the keyboard could fire the picker callback after the captured paragraph had already been converted into a code block, so getBlock returned null and updateCodeLanguage crashed reading functionType. Bail out when the block no longer exists — the same detached-block guard the @muyajs/core selector gained for marktext#4654. Co-Authored-By: Claude Fable 5 <[email protected]>
niyo-oyin
added a commit
to niyo-oyin/marktext-ja
that referenced
this pull request
Jul 29, 2026
- PR marktext#4946 (includes its base PR marktext#4942): removes the quadratic costs that froze large documents and mounts them progressively — a 2.1 MB document goes from an indefinite freeze to interactive in seconds. Applied verbatim; upstream review addressed 19 findings with 31 regression tests, all passing here. - PR marktext#4931 (marktext#4926): deleting at an offset inside a surrogate pair left a lone surrogate that crashed text-unicode ("Invalid offset - splits unicode bytes"). The content.ts hunk conflicted with our Phase 1 isComposed guards and was integrated by hand; the new cursor snap additionally runs only when no IME composition is open, since moving the DOM selection mid-composition would detach the IME anchor. - PR marktext#4913 (marktext#4899): Shift+Tab outdent with trailing sibling blocks corrupted the state tree (paragraphs appended directly into a list), crashing the next composed op. muya hunks only — the PR's legacy muyajs hunks target the removed engine. - PR marktext#4911 skipped: the equivalent detached-block guard already exists in @muyajs/core's language selector (marktext#4654), verified in source. - PR marktext#4930 (marktext#4921): CodeMirror instance wrapped in a Vue proxy broke source-code mode; markRaw fix applied cleanly. muya suite 1515/1515, tsc/eslint/madge clean. Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Ef4yFuXFbyKNTazkwUtygY
niyo-oyin
added a commit
to niyo-oyin/marktext-ja
that referenced
this pull request
Jul 29, 2026
- PR marktext#4946 (includes its base PR marktext#4942): removes the quadratic costs that froze large documents and mounts them progressively — a 2.1 MB document goes from an indefinite freeze to interactive in seconds. Applied verbatim; upstream review addressed 19 findings with 31 regression tests, all passing here. - PR marktext#4931 (marktext#4926): deleting at an offset inside a surrogate pair left a lone surrogate that crashed text-unicode ("Invalid offset - splits unicode bytes"). The content.ts hunk conflicted with our Phase 1 isComposed guards and was integrated by hand; the new cursor snap additionally runs only when no IME composition is open, since moving the DOM selection mid-composition would detach the IME anchor. - PR marktext#4913 (marktext#4899): Shift+Tab outdent with trailing sibling blocks corrupted the state tree (paragraphs appended directly into a list), crashing the next composed op. muya hunks only — the PR's legacy muyajs hunks target the removed engine. - PR marktext#4911 skipped: the equivalent detached-block guard already exists in @muyajs/core's language selector (marktext#4654), verified in source. - PR marktext#4930 (marktext#4921): CodeMirror instance wrapped in a Vue proxy broke source-code mode; markRaw fix applied cleanly. muya suite 1515/1515, tsc/eslint/madge clean.
Member
|
muyajs is no longer used. |
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.
Description
Fixes #4896 — selecting a code-fence language from the autocomplete with the keyboard (Arrow keys + Enter) crashed the renderer with:
Root cause
The code picker's callback captures the paragraph DOM node when the picker opens (
eventHandler/keyboard.js→muya-code-pickerdispatch). By the time the selection is confirmed via the keyboard, that paragraph can already have been converted into a code block, soselectLanguage'sthis.getBlock(paragraph.id)returnsnull— andupdateCodeLanguagedereferences it (block.functionType). The mouse path happens not to hit the stale window, which matches the report (mouse works, keyboard crashes).This is the legacy-engine analog of #4654, where the
@muyajs/corecode-block language selector gained a detached-block guard (packages/muya/src/ui/codeBlockLanguageSelector). This PR applies the same bail-out topackages/muyajs.Fix
One guard in
ContentState.selectLanguage: if the picked block no longer resolves, return without mutating. This is the single place a null block can enterupdateCodeLanguage— the other callers (enterCtrl,pasteCtrl) already hold non-null blocks.Tests
test/unit/specs/code-picker-select-language.spec.tsdrivesselectLanguageoff a minimal fake ContentState (same approach as muya'sselectItem.spec.ts):TypeErrorpnpm run lintandpnpm run typecheckpass.🤖 Generated with Claude Code