mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: support collaboration in bound text (#4573)
* fix: support collaboration in bounded text * align implementation irrespective of collab/submit * don't wrap when submitted * fix * tests: exit editor via ESCAPE instead to remove async hacks * simplify and remove dead comment * remove mutating coords in submit since its taken care in updateWysiwygStyle Co-authored-by: dwelle <luzar.david@gmail.com>
This commit is contained in:
parent
0850ab0dd0
commit
24bf4cb5fb
6 changed files with 56 additions and 82 deletions
|
@ -21,7 +21,7 @@ import { AppState } from "../types";
|
|||
import { getElementAbsoluteCoords } from ".";
|
||||
import { adjustXYWithRotation } from "../math";
|
||||
import { getResizedElementAbsoluteCoords } from "./bounds";
|
||||
import { getContainerElement, measureText } from "./textElement";
|
||||
import { getContainerElement, measureText, wrapText } from "./textElement";
|
||||
import { isBoundToContainer } from "./typeChecks";
|
||||
import { BOUND_TEXT_PADDING } from "../constants";
|
||||
|
||||
|
@ -247,17 +247,17 @@ export const updateTextElement = (
|
|||
text,
|
||||
isDeleted,
|
||||
originalText,
|
||||
}: { text: string; isDeleted?: boolean; originalText: string },
|
||||
|
||||
isSubmit: boolean,
|
||||
}: {
|
||||
text: string;
|
||||
isDeleted?: boolean;
|
||||
originalText: string;
|
||||
},
|
||||
): ExcalidrawTextElement => {
|
||||
const boundToContainer = isBoundToContainer(element);
|
||||
|
||||
// Don't update dimensions and text value for bounded text unless submitted
|
||||
const dimensions =
|
||||
boundToContainer && !isSubmit
|
||||
? undefined
|
||||
: getAdjustedDimensions(element, text);
|
||||
const container = getContainerElement(element);
|
||||
if (container) {
|
||||
text = wrapText(text, getFontString(element), container.width);
|
||||
}
|
||||
const dimensions = getAdjustedDimensions(element, text);
|
||||
return newElementWith(element, {
|
||||
text,
|
||||
originalText,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue