mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 10:02:59 +08:00
chore(ckeditor5/plugins): integrate cuttonote
This commit is contained in:
parent
f664efacbf
commit
ae85ec6ca6
16
packages/ckeditor5/src/augmentation.ts
Normal file
16
packages/ckeditor5/src/augmentation.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import "ckeditor5";
|
||||
|
||||
declare global {
|
||||
var glob: {
|
||||
getComponentByEl(el: unknown): {
|
||||
triggerCommand(command: string): void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
declare module "ckeditor5" {
|
||||
interface Editor {
|
||||
getSelectedHtml(): string;
|
||||
removeSelection(): Promise<void>;
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 1.7 KiB After Width: | Height: | Size: 1.7 KiB |
@ -1,6 +1,12 @@
|
||||
import { Autoformat, AutoLink, BlockQuote, Bold, CKFinderUploadAdapter, Clipboard, Code, CodeBlock, Enter, FindAndReplace, Font, FontBackgroundColor, FontColor, GeneralHtmlSupport, Heading, HeadingButtonsUI, HorizontalLine, Image, ImageCaption, ImageInline, ImageResize, ImageStyle, ImageToolbar, ImageUpload, Indent, IndentBlock, Italic, Link, List, ListProperties, Mention, PageBreak, Paragraph, ParagraphButtonUI, PasteFromOffice, PictureEditing, RemoveFormat, SelectAll, ShiftEnter, SpecialCharacters, SpecialCharactersEssentials, Strikethrough, Style, Subscript, Superscript, Table, TableCaption, TableCellProperties, TableColumnResize, TableProperties, TableSelection, TableToolbar, TextPartLanguage, TextTransformation, TodoList, Typing, Underline, Undo } from "ckeditor5";
|
||||
import type { Plugin } from "ckeditor5";
|
||||
import CutToNotePlugin from "./plugins/cuttonote.js";
|
||||
|
||||
export const COMMON_PLUGINS = [
|
||||
const TRILIUM_PLUGINS: typeof Plugin[] = [
|
||||
CutToNotePlugin
|
||||
];
|
||||
|
||||
export const COMMON_PLUGINS: typeof Plugin[] = [
|
||||
// essentials package expanded to allow selectively disable Enter and ShiftEnter
|
||||
Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo,
|
||||
CKFinderUploadAdapter,
|
||||
@ -59,7 +65,6 @@ export const COMMON_PLUGINS = [
|
||||
// ItalicAsEmPlugin,
|
||||
// StrikethroughAsDel,
|
||||
// MarkdownImportPlugin,
|
||||
// CuttonotePlugin,
|
||||
// MentionCustomization,
|
||||
// IncludeNote,
|
||||
// ReferenceLink,
|
||||
@ -77,6 +82,8 @@ export const COMMON_PLUGINS = [
|
||||
// Mermaid,
|
||||
// Kbd,
|
||||
// Admonition
|
||||
|
||||
...TRILIUM_PLUGINS
|
||||
];
|
||||
|
||||
export const COMMON_SETTINGS = { };
|
||||
|
@ -1,18 +1,21 @@
|
||||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
||||
import scissorsIcon from './icons/scissors.svg';
|
||||
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
|
||||
import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
|
||||
import scissorsIcon from '../icons/scissors.svg?raw';
|
||||
import { ButtonView, HtmlDataProcessor, Plugin } from 'ckeditor5';
|
||||
|
||||
export default class CutToNotePlugin extends Plugin {
|
||||
|
||||
private htmlDataProcessor!: HtmlDataProcessor;
|
||||
|
||||
init() {
|
||||
// @ts-ignore Not sure why we need to pass a document.
|
||||
this.htmlDataProcessor = new HtmlDataProcessor();
|
||||
|
||||
this.editor.ui.componentFactory.add( 'cutToNote', locale => {
|
||||
const view = new ButtonView( locale );
|
||||
|
||||
console.log("Got ", scissorsIcon);
|
||||
view.set( {
|
||||
label: 'Cut & paste selection to sub-note',
|
||||
icon: scissorsIcon,
|
||||
// icon: scissorsIcon,
|
||||
tooltip: true
|
||||
} );
|
||||
|
@ -1,6 +1,8 @@
|
||||
{
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"baseUrl": ".",
|
||||
"rootDir": "src",
|
||||
"outDir": "dist",
|
||||
|
Loading…
x
Reference in New Issue
Block a user