fix: center align text when bind to container via context menu (#6451)

This commit is contained in:
Bear 2023-04-14 21:22:39 +08:00 committed by GitHub
parent ca3be2c678
commit 6164b5273c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View file

@ -1,4 +1,9 @@
import { BOUND_TEXT_PADDING, ROUNDNESS, VERTICAL_ALIGN } from "../constants";
import {
BOUND_TEXT_PADDING,
ROUNDNESS,
VERTICAL_ALIGN,
TEXT_ALIGN,
} from "../constants";
import { getNonDeletedElements, isTextElement, newElement } from "../element";
import { mutateElement } from "../element/mutateElement";
import {
@ -132,6 +137,7 @@ export const actionBindText = register({
mutateElement(textElement, {
containerId: container.id,
verticalAlign: VERTICAL_ALIGN.MIDDLE,
textAlign: TEXT_ALIGN.CENTER,
});
mutateElement(container, {
boundElements: (container.boundElements || []).concat({