2025-05-03 13:02:35 +03:00
|
|
|
import "ckeditor5/ckeditor5.css";
|
2025-05-26 12:35:30 +03:00
|
|
|
import "./theme/code_block_toolbar.css";
|
2025-05-05 22:42:00 +03:00
|
|
|
import { COMMON_PLUGINS, CORE_PLUGINS, POPUP_EDITOR_PLUGINS } from "./plugins";
|
2025-05-10 01:52:42 +03:00
|
|
|
import { BalloonEditor, DecoupledEditor, FindAndReplaceEditing, FindCommand } from "ckeditor5";
|
2025-05-05 15:43:14 +03:00
|
|
|
export { EditorWatchdog } from "ckeditor5";
|
2025-05-10 01:52:42 +03:00
|
|
|
export type { EditorConfig, MentionFeed, MentionFeedObjectItem, Node, Position, Element, WatchdogConfig } from "ckeditor5";
|
2025-05-05 15:43:14 +03:00
|
|
|
|
2025-05-05 21:44:27 +03:00
|
|
|
/**
|
|
|
|
* Short-hand for the CKEditor classes supported by Trilium for text editing.
|
|
|
|
* Specialized editors such as the {@link AttributeEditor} are not included.
|
|
|
|
*/
|
2025-05-07 22:29:11 +03:00
|
|
|
export type CKTextEditor = (ClassicEditor | PopupEditor) & {
|
|
|
|
getSelectedHtml(): string;
|
|
|
|
removeSelection(): Promise<void>;
|
|
|
|
};
|
2025-05-05 21:44:27 +03:00
|
|
|
|
2025-05-10 01:52:42 +03:00
|
|
|
export type FindAndReplaceState = FindAndReplaceEditing["state"];
|
|
|
|
export type FindCommandResult = ReturnType<FindCommand["execute"]>;
|
|
|
|
|
2025-05-05 21:44:27 +03:00
|
|
|
/**
|
|
|
|
* The text editor that can be used for editing attributes and relations.
|
|
|
|
*/
|
2025-05-05 15:43:14 +03:00
|
|
|
export class AttributeEditor extends BalloonEditor {
|
|
|
|
static override get builtinPlugins() {
|
2025-05-05 22:42:00 +03:00
|
|
|
return CORE_PLUGINS;
|
2025-05-05 15:43:14 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-05-05 21:44:27 +03:00
|
|
|
/**
|
|
|
|
* A text editor configured as a {@link DecoupledEditor} (fixed toolbar mode), as well as its preconfigured plugins.
|
|
|
|
*/
|
2025-05-05 15:43:14 +03:00
|
|
|
export class ClassicEditor extends DecoupledEditor {
|
|
|
|
static override get builtinPlugins() {
|
|
|
|
return COMMON_PLUGINS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-05-05 21:44:27 +03:00
|
|
|
/**
|
|
|
|
* A text editor configured as a {@link BalloonEditor} (floating toolbar mode), as well as its preconfigured plugins.
|
|
|
|
*/
|
2025-05-05 15:43:14 +03:00
|
|
|
export class PopupEditor extends BalloonEditor {
|
|
|
|
static override get builtinPlugins() {
|
|
|
|
return POPUP_EDITOR_PLUGINS;
|
|
|
|
}
|
|
|
|
}
|