-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix IME input in Vue 3 mark views by preventing DOM destruction #7450
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
Conversation
Fixes #6982 by adding a destroyed flag to VueRenderer, similar to the React implementation. This prevents race conditions when ProseMirror attempts to access DOM elements during IME composition events (Chinese, Japanese, Korean input). The fix ensures that: - Multiple destroy() calls are idempotent - No rendering operations occur after destroy is called - DOM elements remain accessible during composition events Includes comprehensive unit tests for VueMarkViewRenderer.
🦋 Changeset detectedLatest commit: 64c5fed The changes in this PR will be included in the next version bump. This PR includes changesets to release 72 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for tiptap-embed ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a race condition that causes crashes when using IME input (Chinese, Japanese, Korean) in Vue 3 mark views. The issue occurs when ProseMirror destroys a mark view during IME composition, causing queued operations to access a now-null DOM element.
Changes:
- Added a
destroyedflag toVueRendererto track lifecycle state - Guard all rendering operations with destroyed checks to prevent post-destruction operations
- Made the
destroy()method idempotent to safely handle multiple calls - Added comprehensive unit tests for IME-related scenarios
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/vue-3/src/VueRenderer.ts | Added destroyed flag and guard checks in renderComponent(), updateProps(), and destroy() to prevent race conditions during mark view destruction |
| packages/vue-3/tests/VueMarkViewRenderer.spec.ts | New unit test file with 3 tests covering rapid content changes, multiple destroy calls, and content replacement scenarios |
| .changeset/fix-chinese-input-ime-vue3.md | Changeset documenting the patch-level fix for IME input in Vue 3 mark views |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
- Remove redundant condition checks in renderComponent() - Add comprehensive unit tests for VueRenderer destroyed flag behavior - Test idempotent destroy, props updates after destroy, and render blocking - Verify all 10 tests pass (7 VueRenderer + 3 VueMarkViewRenderer)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@tiptap/core
@tiptap/extension-blockquote
@tiptap/extension-audio
@tiptap/extension-bold
@tiptap/extension-bubble-menu
@tiptap/extension-bullet-list
@tiptap/extension-code
@tiptap/extension-code-block
@tiptap/extension-code-block-lowlight
@tiptap/extension-collaboration-caret
@tiptap/extension-collaboration
@tiptap/extension-color
@tiptap/extension-document
@tiptap/extension-details
@tiptap/extension-drag-handle
@tiptap/extension-drag-handle-vue-2
@tiptap/extension-drag-handle-react
@tiptap/extension-drag-handle-vue-3
@tiptap/extension-file-handler
@tiptap/extension-emoji
@tiptap/extension-floating-menu
@tiptap/extension-hard-break
@tiptap/extension-font-family
@tiptap/extension-heading
@tiptap/extension-highlight
@tiptap/extension-horizontal-rule
@tiptap/extension-invisible-characters
@tiptap/extension-italic
@tiptap/extension-image
@tiptap/extension-link
@tiptap/extension-list
@tiptap/extension-mathematics
@tiptap/extension-mention
@tiptap/extension-node-range
@tiptap/extension-ordered-list
@tiptap/extension-paragraph
@tiptap/extension-strike
@tiptap/extension-subscript
@tiptap/extension-superscript
@tiptap/extension-table
@tiptap/extension-table-of-contents
@tiptap/extension-text
@tiptap/extension-text-align
@tiptap/extension-twitch
@tiptap/extension-text-style
@tiptap/extension-typography
@tiptap/extension-underline
@tiptap/extension-unique-id
@tiptap/extension-youtube
@tiptap/extensions
@tiptap/html
@tiptap/markdown
@tiptap/react
@tiptap/pm
@tiptap/starter-kit
@tiptap/static-renderer
@tiptap/suggestion
@tiptap/vue-2
@tiptap/vue-3
@tiptap/extension-character-count
@tiptap/extension-dropcursor
@tiptap/extension-focus
@tiptap/extension-gapcursor
@tiptap/extension-history
@tiptap/extension-list-item
@tiptap/extension-placeholder
@tiptap/extension-list-keymap
@tiptap/extension-table-cell
@tiptap/extension-table-header
@tiptap/extension-task-item
@tiptap/extension-table-row
@tiptap/extension-task-list
commit: |
Changes Overview
Fixed Chinese/Japanese/Korean IME (Input Method Editor) input causing crashes in Vue 3 mark views by preventing DOM element destruction during composition events.
Implementation Approach
Added a
destroyedflag toVueRendererfollowing the same pattern used inReactRenderer(commit d8ca9bf). This prevents race conditions where:render(null, el), removing the DOM elementCannot read property 'parentNode' of nullerrorsKey changes:
destroyedboolean flag to track renderer lifecycle staterender(),updateProps()) with destroyed checkdestroy()idempotent (safe to call multiple times)renderComponent()Testing Done
Unit tests added (
packages/vue-3/__tests__/VueMarkViewRenderer.spec.ts):Full test suite:
Verification Steps
pnpm test:unit packages/vue-3/__tests__/VueMarkViewRenderer.spec.tsVueMarkViewRenderer<p>Text <mark>marked text</mark> here</p>)Additional Notes
This issue manifests specifically when using
VueMarkViewRendererwith IME input methods. The root cause is identical to the React race condition fixed in #7362 (commit d8ca9bf), so this implementation mirrors that proven solution.Why Vue 2 doesn't need this fix: Vue 2 doesn't have
VueMarkViewRenderer- onlyVueNodeViewRenderer- so it's unaffected by this mark view-specific issue.Checklist
Related Issues
Fixes #6982