1
0
mirror of https://github.com/excalidraw/excalidraw.git synced 2024-11-02 03:25:53 +01:00

setActiveTool - do not clear selectedElementIds so customData of image can be used & do not render when deferredText is empty

This commit is contained in:
zsviczian 2023-09-26 21:37:13 +02:00 committed by GitHub
parent 482178b7b6
commit b8ae1d2486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

@ -3116,7 +3116,8 @@ class App extends React.Component<AppProps, AppState> {
| "eraser"
| "hand"
| "frame"
| "embeddable";
| "embeddable"
| "mermaid";
}
| { type: "custom"; customType: string },
) => {
@ -3138,7 +3139,12 @@ class App extends React.Component<AppProps, AppState> {
if (nextActiveTool.type !== "selection") {
this.setState({
activeTool: nextActiveTool,
selectedElementIds: makeNextSelectedElementIds({}, this.state),
selectedElementIds: makeNextSelectedElementIds(
nextActiveTool.type === "mermaid"
? this.state.selectedElementIds
: {},
this.state,
),
selectedGroupIds: {},
editingGroupId: null,
activeEmbeddable: null,

@ -129,7 +129,11 @@ const MermaidToExcalidraw = ({
useEffect(() => {
const renderExcalidrawPreview = async () => {
const canvasNode = canvasRef.current;
if (!canvasNode || !mermaidToExcalidrawLib.current) {
if (
!canvasNode ||
!mermaidToExcalidrawLib.current ||
deferredText === ""
) {
return;
}
try {