fix: Paste clipboard contents into unbound text elements (#5849)

* Fix #5848.

* Add test.

* some tweaks

Co-authored-by: Aakansha Doshi <aakansha1216@gmail.com>
This commit is contained in:
DanielJGeiger 2022-11-09 00:00:22 -06:00 committed by GitHub
parent e201e79cd0
commit a0ecfed4cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 8 deletions

View file

@ -290,17 +290,14 @@ export const textWysiwyg = ({
fontSize: app.state.currentItemFontSize,
fontFamily: app.state.currentItemFontFamily,
});
const wrappedText = container
? wrapText(data, font, getMaxContainerWidth(container))
: data;
const wrappedText = wrapText(
data,
font,
getMaxContainerWidth(container!),
);
const dimensions = measureText(wrappedText, font);
editable.style.height = `${dimensions.height}px`;
if (data) {
onChange(wrappedText);
}
onChange(wrappedText);
};
editable.oninput = () => {
const updatedTextElement = Scene.getScene(element)?.getElement(