mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: Support updating text properties by clicking on container (#4499)
This commit is contained in:
parent
11396a21de
commit
dd8e465304
5 changed files with 99 additions and 55 deletions
|
@ -102,7 +102,7 @@ export const textWysiwyg = ({
|
|||
if (updatedElement && isTextElement(updatedElement)) {
|
||||
let coordX = updatedElement.x;
|
||||
let coordY = updatedElement.y;
|
||||
let container = updatedElement?.containerId
|
||||
const container = updatedElement?.containerId
|
||||
? Scene.getScene(updatedElement)!.getElement(updatedElement.containerId)
|
||||
: null;
|
||||
let maxWidth = updatedElement.width;
|
||||
|
@ -123,21 +123,12 @@ export const textWysiwyg = ({
|
|||
height = editorHeight;
|
||||
}
|
||||
if (propertiesUpdated) {
|
||||
const currentContainer = Scene.getScene(updatedElement)?.getElement(
|
||||
updatedElement.containerId,
|
||||
) as ExcalidrawBindableElement;
|
||||
approxLineHeight = isTextElement(updatedElement)
|
||||
? getApproxLineHeight(getFontString(updatedElement))
|
||||
: 0;
|
||||
if (
|
||||
updatedElement.height >
|
||||
currentContainer.height - BOUND_TEXT_PADDING * 2
|
||||
) {
|
||||
const nextHeight = updatedElement.height + BOUND_TEXT_PADDING * 2;
|
||||
originalContainerHeight = nextHeight;
|
||||
mutateElement(container, { height: nextHeight });
|
||||
container = { ...container, height: nextHeight };
|
||||
}
|
||||
|
||||
originalContainerHeight = container.height;
|
||||
|
||||
// update height of the editor after properties updated
|
||||
height = updatedElement.height;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue