mirror of
https://github.com/zadam/trilium.git
synced 2025-12-23 00:29:59 +01:00
feat(plugins): add InlineCodeNoSpellcheck plugin to disable spellcheck for inline code
This commit is contained in:
19
packages/ckeditor5/src/plugins/inline_code_no_spellcheck.ts
Normal file
19
packages/ckeditor5/src/plugins/inline_code_no_spellcheck.ts
Normal 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'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user