mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Trim wysiwyg text to avoid misalignment on Firefox (#454)
This commit is contained in:
parent
bbabf33d78
commit
86cb228df4
1 changed files with 7 additions and 1 deletions
|
@ -10,6 +10,12 @@ type TextWysiwygParams = {
|
||||||
onSubmit: (text: string) => void;
|
onSubmit: (text: string) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// When WYSIWYG text ends with white spaces, the text gets vertically misaligned
|
||||||
|
// in order to fix this issue, we remove those white spaces
|
||||||
|
function trimText(text: string) {
|
||||||
|
return text.trim();
|
||||||
|
}
|
||||||
|
|
||||||
export function textWysiwyg({
|
export function textWysiwyg({
|
||||||
initText,
|
initText,
|
||||||
x,
|
x,
|
||||||
|
@ -77,7 +83,7 @@ export function textWysiwyg({
|
||||||
|
|
||||||
function handleSubmit() {
|
function handleSubmit() {
|
||||||
if (editable.innerText) {
|
if (editable.innerText) {
|
||||||
onSubmit(editable.innerText);
|
onSubmit(trimText(editable.innerText));
|
||||||
}
|
}
|
||||||
cleanup();
|
cleanup();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue