mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +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 { 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
|
// essentials package expanded to allow selectively disable Enter and ShiftEnter
|
||||||
Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo,
|
Clipboard, Enter, SelectAll, ShiftEnter, Typing, Undo,
|
||||||
CKFinderUploadAdapter,
|
CKFinderUploadAdapter,
|
||||||
@ -59,7 +65,6 @@ export const COMMON_PLUGINS = [
|
|||||||
// ItalicAsEmPlugin,
|
// ItalicAsEmPlugin,
|
||||||
// StrikethroughAsDel,
|
// StrikethroughAsDel,
|
||||||
// MarkdownImportPlugin,
|
// MarkdownImportPlugin,
|
||||||
// CuttonotePlugin,
|
|
||||||
// MentionCustomization,
|
// MentionCustomization,
|
||||||
// IncludeNote,
|
// IncludeNote,
|
||||||
// ReferenceLink,
|
// ReferenceLink,
|
||||||
@ -77,6 +82,8 @@ export const COMMON_PLUGINS = [
|
|||||||
// Mermaid,
|
// Mermaid,
|
||||||
// Kbd,
|
// Kbd,
|
||||||
// Admonition
|
// Admonition
|
||||||
|
|
||||||
|
...TRILIUM_PLUGINS
|
||||||
];
|
];
|
||||||
|
|
||||||
export const COMMON_SETTINGS = { };
|
export const COMMON_SETTINGS = { };
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
import Plugin from '@ckeditor/ckeditor5-core/src/plugin';
|
import scissorsIcon from '../icons/scissors.svg?raw';
|
||||||
import scissorsIcon from './icons/scissors.svg';
|
import { ButtonView, HtmlDataProcessor, Plugin } from 'ckeditor5';
|
||||||
import ButtonView from '@ckeditor/ckeditor5-ui/src/button/buttonview';
|
|
||||||
import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';
|
|
||||||
|
|
||||||
export default class CutToNotePlugin extends Plugin {
|
export default class CutToNotePlugin extends Plugin {
|
||||||
|
|
||||||
|
private htmlDataProcessor!: HtmlDataProcessor;
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
// @ts-ignore Not sure why we need to pass a document.
|
||||||
this.htmlDataProcessor = new HtmlDataProcessor();
|
this.htmlDataProcessor = new HtmlDataProcessor();
|
||||||
|
|
||||||
this.editor.ui.componentFactory.add( 'cutToNote', locale => {
|
this.editor.ui.componentFactory.add( 'cutToNote', locale => {
|
||||||
const view = new ButtonView( locale );
|
const view = new ButtonView( locale );
|
||||||
|
|
||||||
|
console.log("Got ", scissorsIcon);
|
||||||
view.set( {
|
view.set( {
|
||||||
label: 'Cut & paste selection to sub-note',
|
label: 'Cut & paste selection to sub-note',
|
||||||
icon: scissorsIcon,
|
// icon: scissorsIcon,
|
||||||
tooltip: true
|
tooltip: true
|
||||||
} );
|
} );
|
||||||
|
|
@ -1,6 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "dist",
|
"outDir": "dist",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user