tiptap-extension-resize-image
Version:
A tiptap image resizing extension for React, Vue, Next, and VanillaJS. Additionally, it can align the image position.
23 lines • 1.13 kB
TypeScript
/**
* Whitelist-based CSS style sanitizer.
*
* The image node persists its layout state in the `containerStyle` and
* `wrapperStyle` attributes as raw CSS text. Without sanitization a crafted
* document could embed arbitrary CSS (e.g. `position: fixed; top: 0; ...`,
* `background: url(...)`, expressions, etc.) that would survive load and be
* re-applied on every render, enabling UI redress, data exfiltration through
* CSS, and tracking via remote URLs.
*
* This sanitizer accepts only the small set of properties the extension
* actually uses for sizing/positioning and validates each value against
* conservative patterns. Unknown properties, function calls (url(),
* expression(), calc(), var(), attr(), ...), and unsafe characters are
* stripped silently.
*/
/**
* Returns a sanitized CSS declaration string containing only whitelisted
* properties and validated values. Order is preserved; the output is
* normalized as `prop: value;` declarations separated by single spaces.
*/
export declare function sanitizeStyle(input: string | null | undefined): string;
//# sourceMappingURL=style-sanitizer.d.ts.map