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

aakansha/mermaid-dupl
zsviczian 1 year ago committed by GitHub
parent 482178b7b6
commit b8ae1d2486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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 {

Loading…
Cancel
Save