fix(editor): partially disable at mention in code block#8564
fix(editor): partially disable at mention in code block#8564chloelee767 wants to merge 6 commits intoTriliumNext:mainfrom
Conversation
Summary of ChangesHello @chloelee767, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses an undesirable behavior in CKEditor 5 where the mention plugin, used for note links and slash commands, would incorrectly activate within code blocks. By introducing a dedicated plugin, Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
Thank you for this contribution. This PR introduces a clever solution to disable mentions within code blocks by creating a custom CKEditor plugin that modifies the schema. The approach is sound and the inclusion of unit tests with the new Vitest setup is excellent, ensuring the change is robust.
I've found one critical issue in package.json with a duplicate dependency that needs to be addressed. Otherwise, the changes look great. Well done!
Hello, this is a PR to disable the at-symbol to insert note links and slash commands inside code blocks, by disabling the mention plugin in code blocks. Note that this fix only affects code blocks, not inline code. Ideally I would like to disable the plugin for inline code too, but I haven't figured how to do that.
Known issues:
There still seems to be some kind of race condition that causes the at-symbol or slash commands to trigger inside the code block sometimes, when moving quickly from a text region to a code block using the mouse or arrow keys – see the video below.
Screen.Recording.2026-01-31.at.11.53.21.PM.mov
Scenarios tested:
~and#inside the note attributes popup section still works (since my understanding is they are also implemented using the mention plugin)I frankly don't know much about ckeditor, so I'm too not sure if this approach is a good idea or have any unintended side effects (I also notice there's already an upstream issue ckeditor/ckeditor5#19146 , so I'm not sure if the preference is to wait for the issue to be fixed upstream instead), but I personally haven't noticed any issues in the couple of weeks I've been test driving this.
Partially solves #8322