View as Markdown

API reference: @salmonui/rich-text

PasteCleanupOptionsinterface

import type { PasteCleanupOptions } from '@salmonui/rich-text';
interface PasteCleanupOptions {
    mode?: PasteCleanupMode;
    allowedTags?: readonly string[];
    deniedTags?: readonly string[];
    allowedAttributes?: readonly string[];
    deniedAttributes?: readonly string[];
    keepWordFormatting?: boolean;
    embedHosts?: readonly string[];
    sanitize?: SanitizeHook;
    allow?: SanitizeAllow | readonly SanitizeAllow[];
}
PasteCleanupOptions members (9)
NameSignatureDescription
modeoptionalmode?: PasteCleanupMode;

'keep': keep all formatting the vocabulary allows (fonts, sizes, colors, alignment); 'clean' (default): keep structure, marks and links, drop presentational styles; 'plainText': text only, paragraphs and line breaks kept; 'prompt': the editor asks; here it behaves as 'clean'.

allowedTagsoptionalallowedTags?: readonly string[];

Only these elements survive (others are unwrapped, text kept). Vocabulary names (strong, not b).

deniedTagsoptionaldeniedTags?: readonly string[];

These elements are unwrapped (text kept).

allowedAttributesoptionalallowedAttributes?: readonly string[];

Only these attributes survive (style counts as one).

deniedAttributesoptionaldeniedAttributes?: readonly string[];

These attributes are removed.

keepWordFormattingoptionalkeepWordFormatting?: boolean;

In 'clean' mode, keep the inline formatting of Word and Google Docs content. Default false.

embedHostsoptionalembedHosts?: readonly string[];

Passed to the sanitizer (see SanitizeHtmlOptions).

sanitizeoptionalsanitize?: SanitizeHook;

Passed to the sanitizer, after the paste filters.

allowoptionalallow?: SanitizeAllow | readonly SanitizeAllow[];

Passed to the sanitizer: extension elements and attributes.