chore(ckeditor5/plugins): integrate markdown inline

This commit is contained in:
Elian Doran
2025-05-03 17:22:49 +03:00
parent 2f09411c0d
commit a44eaeaf10
4 changed files with 6 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ declare global {
getHeaders(): Promise<Record<string, string>>;
getReferenceLinkTitle(href: string): Promise<string>;
getReferenceLinkTitleSync(href: string): string;
importMarkdownInline(): void;
}
}

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="208" height="128" viewBox="0 0 208 128"><rect width="198" height="118" x="5" y="5" ry="10" stroke="#000" stroke-width="10" fill="none"/><path d="M30 98V30h20l20 25 20-25h20v68H90V59L70 84 50 59v39zm125 0l-30-33h20V30h20v35h20z"/></svg>

After

Width:  |  Height:  |  Size: 282 B

View File

@@ -9,6 +9,7 @@ import ReferenceLink from "./plugins/referencelink.js";
import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js";
import SpecialCharactersEmojiPlugin from "./plugins/special_characters_emoji.js";
import IndentBlockShortcutPlugin from "./plugins/indent_block_shortcut.js";
import MarkdownImportPlugin from "./plugins/markdownimport.js";
const TRILIUM_PLUGINS: typeof Plugin[] = [
CutToNotePlugin,
@@ -19,7 +20,8 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
InternalLinkPlugin,
RemoveFormatLinksPlugin,
SpecialCharactersEmojiPlugin,
IndentBlockShortcutPlugin
IndentBlockShortcutPlugin,
MarkdownImportPlugin
];
export const COMMON_PLUGINS: typeof Plugin[] = [
@@ -77,7 +79,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
SpecialCharactersEssentials,
FindAndReplace,
Mention,
// MarkdownImportPlugin,
// MentionCustomization,
// IncludeNote,
PageBreak,

View File

@@ -0,0 +1,25 @@
import { ButtonView, Plugin } from 'ckeditor5';
import markdownIcon from '../icons/markdown-mark.svg?raw';
export default class MarkdownImportPlugin extends Plugin {
init() {
const editor = this.editor;
editor.ui.componentFactory.add( 'markdownImport', locale => {
const view = new ButtonView( locale );
view.set( {
label: 'Markdown import from clipboard',
icon: markdownIcon,
tooltip: true
} );
// Callback executed once the image is clicked.
view.on( 'execute', () => {
glob.importMarkdownInline();
} );
return view;
} );
}
}