mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
fix: use active Excalidraw component when editing text (#3478)
* fix: use active excalidraw component when editing text * changelog * tweak
This commit is contained in:
parent
354976e08e
commit
891ac82447
3 changed files with 7 additions and 3 deletions
|
@ -43,6 +43,7 @@ export const textWysiwyg = ({
|
|||
getViewportCoords,
|
||||
element,
|
||||
canvas,
|
||||
excalidrawContainer,
|
||||
}: {
|
||||
id: ExcalidrawElement["id"];
|
||||
appState: AppState;
|
||||
|
@ -51,6 +52,7 @@ export const textWysiwyg = ({
|
|||
getViewportCoords: (x: number, y: number) => [number, number];
|
||||
element: ExcalidrawElement;
|
||||
canvas: HTMLCanvasElement | null;
|
||||
excalidrawContainer: HTMLDivElement | null;
|
||||
}) => {
|
||||
const updateWysiwygStyle = () => {
|
||||
const updatedElement = Scene.getScene(element)?.getElement(id);
|
||||
|
@ -71,7 +73,7 @@ export const textWysiwyg = ({
|
|||
// margin-right of parent if any
|
||||
Number(
|
||||
getComputedStyle(
|
||||
document.querySelector(".excalidraw")!.parentNode as Element,
|
||||
excalidrawContainer?.parentNode as Element,
|
||||
).marginRight.slice(0, -2),
|
||||
);
|
||||
|
||||
|
@ -363,7 +365,7 @@ export const textWysiwyg = ({
|
|||
passive: false,
|
||||
capture: true,
|
||||
});
|
||||
document
|
||||
.querySelector(".excalidraw-textEditorContainer")!
|
||||
excalidrawContainer
|
||||
?.querySelector(".excalidraw-textEditorContainer")!
|
||||
.appendChild(editable);
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue