chore(ckeditor5/plugins): integrate remove format links

This commit is contained in:
Elian Doran 2025-05-03 17:05:50 +03:00
parent 2dcd37001f
commit bf45720f21
No known key found for this signature in database
3 changed files with 22 additions and 9 deletions

View File

@ -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
} );
}

View File

@ -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,

View File

@ -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
});
}
}