1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-23 23:02:08 +03:00

Lexical: Finished off core cell properties functionality

This commit is contained in:
Dan Brown
2024-08-05 18:49:17 +01:00
parent 8939f310db
commit b3d3b14f79
6 changed files with 160 additions and 100 deletions

View File

@@ -21,4 +21,12 @@ export function el(tag: string, attrs: Record<string, string | null> = {}, child
export function htmlToDom(html: string): Document {
const parser = new DOMParser();
return parser.parseFromString(html, 'text/html');
}
export function formatSizeValue(size: number | string, defaultSuffix: string = 'px'): string {
if (typeof size === 'number' || /^-?\d+$/.test(size)) {
return `${size}${defaultSuffix}`;
}
return size;
}