mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	chore(ckeditor5/plugins): integrate remove format links
This commit is contained in:
		
							parent
							
								
									2dcd37001f
								
							
						
					
					
						commit
						bf45720f21
					
				@ -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
 | 
					 | 
				
			||||||
	} );
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -6,6 +6,7 @@ import ItalicAsEmPlugin from "./plugins/italic_as_em.js";
 | 
				
			|||||||
import StrikethroughAsDel from "./plugins/strikethrough_as_del.js";
 | 
					import StrikethroughAsDel from "./plugins/strikethrough_as_del.js";
 | 
				
			||||||
import InternalLinkPlugin from "./plugins/internallink.js";
 | 
					import InternalLinkPlugin from "./plugins/internallink.js";
 | 
				
			||||||
import ReferenceLink from "./plugins/referencelink.js";
 | 
					import ReferenceLink from "./plugins/referencelink.js";
 | 
				
			||||||
 | 
					import RemoveFormatLinksPlugin from "./plugins/remove_format_links.js";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TRILIUM_PLUGINS: typeof Plugin[] = [
 | 
					const TRILIUM_PLUGINS: typeof Plugin[] = [
 | 
				
			||||||
    CutToNotePlugin,
 | 
					    CutToNotePlugin,
 | 
				
			||||||
@ -13,7 +14,8 @@ const TRILIUM_PLUGINS: typeof Plugin[] = [
 | 
				
			|||||||
	StrikethroughAsDel,
 | 
						StrikethroughAsDel,
 | 
				
			||||||
    ReferenceLink,
 | 
					    ReferenceLink,
 | 
				
			||||||
    UploadimagePlugin,
 | 
					    UploadimagePlugin,
 | 
				
			||||||
    InternalLinkPlugin
 | 
					    InternalLinkPlugin,
 | 
				
			||||||
 | 
					    RemoveFormatLinksPlugin
 | 
				
			||||||
];
 | 
					];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const COMMON_PLUGINS: typeof Plugin[] = [
 | 
					export const COMMON_PLUGINS: typeof Plugin[] = [
 | 
				
			||||||
@ -74,7 +76,6 @@ export const COMMON_PLUGINS: typeof Plugin[] = [
 | 
				
			|||||||
	// MentionCustomization,
 | 
						// MentionCustomization,
 | 
				
			||||||
	// IncludeNote,
 | 
						// IncludeNote,
 | 
				
			||||||
	// indentBlockShortcutPlugin,
 | 
						// indentBlockShortcutPlugin,
 | 
				
			||||||
	// removeFormatLinksPlugin,
 | 
					 | 
				
			||||||
	PageBreak,
 | 
						PageBreak,
 | 
				
			||||||
	GeneralHtmlSupport,
 | 
						GeneralHtmlSupport,
 | 
				
			||||||
	TextPartLanguage,
 | 
						TextPartLanguage,
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										19
									
								
								packages/ckeditor5/src/plugins/remove_format_links.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								packages/ckeditor5/src/plugins/remove_format_links.ts
									
									
									
									
									
										Normal 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
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user