mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 00:35:50 +01:00
chore(ckeditor5/plugins): integrate markdown inline
This commit is contained in:
@@ -17,6 +17,7 @@ declare global {
|
||||
getHeaders(): Promise<Record<string, string>>;
|
||||
getReferenceLinkTitle(href: string): Promise<string>;
|
||||
getReferenceLinkTitleSync(href: string): string;
|
||||
importMarkdownInline(): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
1
packages/ckeditor5/src/icons/markdown-mark.svg
Normal file
1
packages/ckeditor5/src/icons/markdown-mark.svg
Normal 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 |
@@ -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,
|
||||
|
||||
25
packages/ckeditor5/src/plugins/markdownimport.ts
Normal file
25
packages/ckeditor5/src/plugins/markdownimport.ts
Normal 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;
|
||||
} );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user