mirror of
https://github.com/zadam/trilium.git
synced 2025-12-04 14:34:24 +01:00
Disable spell-check on code-snippets (#7929)
This commit is contained in:
commit
7cc20600e7
@ -29,6 +29,7 @@ import CodeBlockToolbar from "./plugins/code_block_toolbar.js";
|
||||
import CodeBlockLanguageDropdown from "./plugins/code_block_language_dropdown.js";
|
||||
import MoveBlockUpDownPlugin from "./plugins/move_block_updown.js";
|
||||
import ScrollOnUndoRedoPlugin from "./plugins/scroll_on_undo_redo.js"
|
||||
import InlineCodeNoSpellcheck from "./plugins/inline_code_no_spellcheck.js";
|
||||
|
||||
/**
|
||||
* Plugins that are specific to Trilium and not part of the CKEditor 5 core, included in both text editors but not in the attribute editor.
|
||||
@ -49,7 +50,8 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
|
||||
CodeBlockLanguageDropdown,
|
||||
CodeBlockToolbar,
|
||||
MoveBlockUpDownPlugin,
|
||||
ScrollOnUndoRedoPlugin
|
||||
ScrollOnUndoRedoPlugin,
|
||||
InlineCodeNoSpellcheck,
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
18
packages/ckeditor5/src/plugins/inline_code_no_spellcheck.ts
Normal file
18
packages/ckeditor5/src/plugins/inline_code_no_spellcheck.ts
Normal file
@ -0,0 +1,18 @@
|
||||
import { Plugin } from "ckeditor5";
|
||||
|
||||
export default class InlineCodeNoSpellcheck extends Plugin {
|
||||
|
||||
init() {
|
||||
this.editor.conversion.for('downcast').attributeToElement({
|
||||
model: 'code',
|
||||
view: (modelAttributeValue, conversionApi) => {
|
||||
const { writer } = conversionApi;
|
||||
return writer.createAttributeElement('code', {
|
||||
spellcheck: 'false'
|
||||
});
|
||||
},
|
||||
converterPriority: 'high'
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user