fix(Editor): guard calls for unavailable list extensions#6100
fix(Editor): guard calls for unavailable list extensions#6100dropdead619 wants to merge 1 commit intonuxt:v4from
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis change refactors list type handling in the editor utility to support runtime detection of available list extensions rather than relying on hard-coded assumptions. Two new helper functions are introduced: Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
commit: |
🔗 Linked issue
Resolves #6099
❓ Type of change
📚 Description
The
createListHandlerineditor.tsunconditionally calls.lift('taskList')when switching between list types (e.g. bulletList → orderedList. Tiptap's.lift()internally callsgetNodeType(), which throws if the node type is not in the schema:Uncaught (in promise) Error: There is no node type named 'taskList'. Maybe you forgot to add the extension?This happens because
taskListis a separate extension (@tiptap/extension-task-list) not included in StarterKit, so it's not registered unless explicitly added by the user.Fix: Added
getAvailableListTypes()andliftFromLists()helpers that dynamically filter list types to only those registered in the editor's schema before calling.lift(). This ensures list type conversion works correctly regardless of which list extensions are loaded.📝 Checklist