You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(Editor): call onCreate and onUpdate props - #7470
📖 Documentation (updates to the documentation or readme)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhancement (improving an existing functionality)
✨ New feature (a non-breaking change that adds functionality)
🧹 Chore (updates to the build process or auxiliary tools and libraries)
⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
The Editor spreads its props into useEditor, but then sets its own onCreate (placeholder refresh) and onUpdate (v-model sync) after the spread, so the onCreate and onUpdate passed as props were silently dropped. Other callbacks like onFocus worked because the component does not override them.
The internal handlers now call the user's callbacks too. onUpdate is called before the doc-changed check, so it still fires for every update Tiptap emits, same as using Tiptap directly.
No actionable comments were generated in the recent review.
Walkthrough
The editor now forwards Tiptap’s onCreate and onUpdate events to the corresponding supplied callbacks. The onCreate handler retains the placeholder refresh. The onUpdate handler invokes the callback before the existing document-change check and model-value update logic. A test checks both callback invocations and the updated HTML emitted through update:modelValue.
This change makes UEditor call the onCreate and onUpdate props, as users expect. It leaves the existing placeholder and v-model behavior unchanged, and no merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the fix (Editor forwarding the onCreate and onUpdate props), which matches the changeset: Editor.vue now calls the user callbacks, and the spec covers them. It is specific and concise,…
Description check
The description explains the cause: internal onCreate and onUpdate handlers overrode the user props after the spread into useEditor. It states the fix, which calls the user callbacks, and links issue …
Linked Issues check
[#7469] Objective: UEditor must invoke the user-supplied onCreate and onUpdate props. At the reviewed head, src/runtime/components/Editor.vue calls props.onCreate?.(event) inside the internal onCreate…
Out of Scope Changes check
The whole-PR diff against the merge base changes only src/runtime/components/Editor.vue (+8/-3 lines) and test/components/Editor.spec.ts (adds coverage for onCreate and onUpdate). Both changes impleme…
Full details: Title check
Explanation
The title names the fix (Editor forwarding the onCreate and onUpdate props), which matches the changeset: Editor.vue now calls the user callbacks, and the spec covers them. It is specific and concise, so it passes.
Full details: Description check
Explanation
The description explains the cause: internal onCreate and onUpdate handlers overrode the user props after the spread into useEditor. It states the fix, which calls the user callbacks, and links issue #7469. It is related to the changeset, so it passes.
Full details: Linked Issues check
Explanation
[#7469] Objective: UEditor must invoke the user-supplied onCreate and onUpdate props. At the reviewed head, src/runtime/components/Editor.vue calls props.onCreate?.(event) inside the internal onCreate handler, after the existing placeholder refresh. The internal onUpdate handler calls props.onUpdate?.(event) before the docChanged check, so it runs for every update Tiptap emits. The v-model sync (update:modelValue) remains behind the same docChanged check, as before. The diff touches no other behaviour. The PR adds a test in test/components/Editor.spec.ts that checks onCreate runs once and onUpdate runs once after a content change, with update:modelValue emitted. The test was read only through the summary; its execution was not verified. The objective is met by the code.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against the merge base changes only src/runtime/components/Editor.vue (+8/-3 lines) and test/components/Editor.spec.ts (adds coverage for onCreate and onUpdate). Both changes implement the linked objective. The onCreate handler rename from editor to event is a direct part of forwarding the callback. No unrelated changes were identified in the summary or the Editor.vue diff.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Reviewing files that changed from the base of the PR and between 422d015 and e75156b.
Files selected for processing: 2
src/runtime/components/Editor.vue
test/components/Editor.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
Merging this PR will improve performance by 41.38%
2 warnings
⚠️1 benchmark with a significant change ran on different hardware
Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.
⚠️1 benchmark with a significant change ran in a different software environment
Its base and head results were measured with a different OS or toolchain, such as compiler, runtime or library versions, so the change might come from this difference rather than from the code. Open the benchmark to see what changed.
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
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.
🔗 Linked issue
Resolves #7469
❓ Type of change
📚 Description
The Editor spreads its props into
useEditor, but then sets its ownonCreate(placeholder refresh) andonUpdate(v-model sync) after the spread, so theonCreateandonUpdatepassed as props were silently dropped. Other callbacks likeonFocusworked because the component does not override them.The internal handlers now call the user's callbacks too.
onUpdateis called before the doc-changed check, so it still fires for every update Tiptap emits, same as using Tiptap directly.📝 Checklist