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
@ -1803,6 +1803,7 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
this.focusContainer();
|
this.focusContainer();
|
||||||
}),
|
}),
|
||||||
element,
|
element,
|
||||||
|
excalidrawContainer: this.excalidrawContainerRef.current,
|
||||||
});
|
});
|
||||||
// deselect all other elements when inserting text
|
// deselect all other elements when inserting text
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -43,6 +43,7 @@ export const textWysiwyg = ({
|
|||||||
getViewportCoords,
|
getViewportCoords,
|
||||||
element,
|
element,
|
||||||
canvas,
|
canvas,
|
||||||
|
excalidrawContainer,
|
||||||
}: {
|
}: {
|
||||||
id: ExcalidrawElement["id"];
|
id: ExcalidrawElement["id"];
|
||||||
appState: AppState;
|
appState: AppState;
|
||||||
@ -51,6 +52,7 @@ export const textWysiwyg = ({
|
|||||||
getViewportCoords: (x: number, y: number) => [number, number];
|
getViewportCoords: (x: number, y: number) => [number, number];
|
||||||
element: ExcalidrawElement;
|
element: ExcalidrawElement;
|
||||||
canvas: HTMLCanvasElement | null;
|
canvas: HTMLCanvasElement | null;
|
||||||
|
excalidrawContainer: HTMLDivElement | null;
|
||||||
}) => {
|
}) => {
|
||||||
const updateWysiwygStyle = () => {
|
const updateWysiwygStyle = () => {
|
||||||
const updatedElement = Scene.getScene(element)?.getElement(id);
|
const updatedElement = Scene.getScene(element)?.getElement(id);
|
||||||
@ -71,7 +73,7 @@ export const textWysiwyg = ({
|
|||||||
// margin-right of parent if any
|
// margin-right of parent if any
|
||||||
Number(
|
Number(
|
||||||
getComputedStyle(
|
getComputedStyle(
|
||||||
document.querySelector(".excalidraw")!.parentNode as Element,
|
excalidrawContainer?.parentNode as Element,
|
||||||
).marginRight.slice(0, -2),
|
).marginRight.slice(0, -2),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -363,7 +365,7 @@ export const textWysiwyg = ({
|
|||||||
passive: false,
|
passive: false,
|
||||||
capture: true,
|
capture: true,
|
||||||
});
|
});
|
||||||
document
|
excalidrawContainer
|
||||||
.querySelector(".excalidraw-textEditorContainer")!
|
?.querySelector(".excalidraw-textEditorContainer")!
|
||||||
.appendChild(editable);
|
.appendChild(editable);
|
||||||
};
|
};
|
||||||
|
@ -38,6 +38,7 @@ Please add the latest change on the top under the correct section.
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
|
- Use active Excalidraw component when editing text. This fixes a case where text editing was not working when you have multiple Excalidraw components on the same page [#3478](https://github.com/excalidraw/excalidraw/pull/3478).
|
||||||
- When switching theme, apply it only to the active Excalidraw component. This fixes a case where the theme was getting applied to the first Excalidraw component if you had multiple Excalidraw components on the same page [#3446](https://github.com/excalidraw/excalidraw/pull/3446)
|
- When switching theme, apply it only to the active Excalidraw component. This fixes a case where the theme was getting applied to the first Excalidraw component if you had multiple Excalidraw components on the same page [#3446](https://github.com/excalidraw/excalidraw/pull/3446)
|
||||||
|
|
||||||
### Refactor
|
### Refactor
|
||||||
|
Loading…
x
Reference in New Issue
Block a user