Skip to content

Build your personal knowledge base with Trilium Notes

chore(ckeditor5/plugins): integrate remove format links

Elian Doranbf45720f2147
diff --git a/_regroup/ckeditor5-build-trilium/packages/ckeditor5-build-trilium/src/remove_format_links.js b/_regroup/ckeditor5-build-trilium/packages/ckeditor5-build-trilium/src/remove_format_links.js
deleted file mode 100644
index 9cae18dbdb..0000000000
--- a/_regroup/ckeditor5-build-trilium/packages/ckeditor5-build-trilium/src/remove_format_links.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// A simple plugin that extends the remove format feature to consider links.
-export default function removeFormatLinksPlugin( editor ) {
- // Extend the editor schema and mark the "linkHref" model attribute as formatting.
- editor.model.schema.setAttributeProperties( 'linkHref', {
- isFormatting: true
- } );
-}
diff --git a/packages/ckeditor5/src/plugins.ts b/packages/ckeditor5/src/plugins.ts
index ef0f15e0ec..7c6da435e5 100644
--- a/packages/ckeditor5/src/plugins.ts
+++ b/packages/ckeditor5/src/plugins.ts
@@ -6,6 +6,7 @@ import ItalicAsEmPlugin from "./plugins/italic_as_em.js";
import StrikethroughAsDel from "./plugins/strikethrough_as_del.js";
import InternalLinkPlugin from "./plugins/internallink.js";
import ReferenceLink from "./plugins/referencelink.js";
+import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js";
const TRILIUM_PLUGINS: typeof Plugin[] = [
CutToNotePlugin,
@@ -13,7 +14,8 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
StrikethroughAsDel,
ReferenceLink,
UploadimagePlugin,
- InternalLinkPlugin
+ InternalLinkPlugin,
+ RemoveFormatLinksPlugin
];
export const COMMON_PLUGINS: typeof Plugin[] = [
@@ -74,7 +76,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
// MentionCustomization,
// IncludeNote,
// indentBlockShortcutPlugin,
- // removeFormatLinksPlugin,
PageBreak,
GeneralHtmlSupport,
TextPartLanguage,
diff --git a/packages/ckeditor5/src/plugins/remove_format_links.ts b/packages/ckeditor5/src/plugins/remove_format_links.ts
new file mode 100644
index 0000000000..224a8dad2c
--- /dev/null
+++ b/packages/ckeditor5/src/plugins/remove_format_links.ts
@@ -0,0 +1,19 @@
+import { Plugin, RemoveFormat } from "ckeditor5";
+
+/**
+ * A simple plugin that extends the remove format feature to consider links.
+ */
+export default class RemoveFormatLinksPlugin extends Plugin {
+
+ static get requires() {
+ return [ RemoveFormat ]
+ }
+
+ init() {
+ // Extend the editor schema and mark the "linkHref" model attribute as formatting.
+ this.editor.model.schema.setAttributeProperties( 'linkHref', {
+ isFormatting: true
+ });
+ }
+
+}