From bf45720f2147e590df9b8376e5410c5e159c948a Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 3 May 2025 17:05:50 +0300 Subject: [PATCH] chore(ckeditor5/plugins): integrate remove format links --- .../src/remove_format_links.js | 7 ------- packages/ckeditor5/src/plugins.ts | 5 +++-- .../src/plugins/remove_format_links.ts | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) delete mode 100644 _regroup/ckeditor5-build-trilium/packages/ckeditor5-build-trilium/src/remove_format_links.js create mode 100644 packages/ckeditor5/src/plugins/remove_format_links.ts 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 9cae18dbd..000000000 --- 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 ef0f15e0e..7c6da435e 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 000000000..224a8dad2 --- /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 + }); + } + +}