mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-06-05 09:34:37 +08:00
Lexical: Added media resize support via drag handles
This commit is contained in:
@ -31,6 +31,22 @@ export function formatSizeValue(size: number | string, defaultSuffix: string = '
|
||||
return size;
|
||||
}
|
||||
|
||||
export function sizeToPixels(size: string): number {
|
||||
if (/^-?\d+$/.test(size)) {
|
||||
return Number(size);
|
||||
}
|
||||
|
||||
if (/^-?\d+\.\d+$/.test(size)) {
|
||||
return Math.round(Number(size));
|
||||
}
|
||||
|
||||
if (/^-?\d+px\s*$/.test(size)) {
|
||||
return Number(size.trim().replace('px', ''));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
export type StyleMap = Map<string, string>;
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user