feat(plugins): add InlineCodeNoSpellcheck plugin to disable spellcheck for inline code

This commit is contained in:
lzinga
2025-12-03 10:02:35 -08:00
parent 286a8626d1
commit 52bb83e878
2 changed files with 22 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
import { Plugin } from "ckeditor5";
export default class InlineCodeNoSpellcheck extends Plugin {
init() {
const editor = this.editor;
editor.conversion.for('downcast').attributeToElement({
model: 'code',
view: (modelAttributeValue, conversionApi) => {
const { writer } = conversionApi;
return writer.createAttributeElement('code', {
spellcheck: 'false'
}, { priority: 5 });
},
converterPriority: 'high'
});
}
}