mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 00:05:50 +01:00
feat(admonitions): start implementing autoformat
This commit is contained in:
20
packages/ckeditor5-admonition/src/admonitionautoformat.ts
Normal file
20
packages/ckeditor5-admonition/src/admonitionautoformat.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import Plugin from "@ckeditor/ckeditor5-core/src/plugin";
|
||||
import Autoformat from "@ckeditor/ckeditor5-autoformat/src/autoformat";
|
||||
import blockAutoformatEditing from "@ckeditor/ckeditor5-autoformat/src/blockautoformatediting";
|
||||
|
||||
export default class AdmonitionAutoformat extends Plugin {
|
||||
static get requires() {
|
||||
return [ Autoformat ];
|
||||
}
|
||||
|
||||
afterInit() {
|
||||
if (!this.editor.commands.get("admonition")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const instance = (this as any);
|
||||
blockAutoformatEditing(this.editor, instance, /^\!\!\[*\! (.+) $/, (match) => {
|
||||
console.log("Got match ", match);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user