Update ExcalidrawView.ts

This commit is contained in:
zsviczian
2021-12-03 12:51:15 +01:00
committed by GitHub
parent 1a2e7ac23f
commit ac260925dd

View File

@@ -861,7 +861,8 @@ export default class ExcalidrawView extends TextFileView {
}
};
const el: ExcalidrawElement[] = this.excalidrawAPI.getSceneElements();
const newIds = newElements.map((e)=>e.id);
const el: ExcalidrawElement[] = this.excalidrawAPI.getSceneElements().filter((e)=>!newIds.includes(e.id));
let st: AppState = this.excalidrawAPI.getAppState();
if(repositionToCursor) newElements = repositionElementsToCursor(newElements,currentPosition,true);
@@ -1398,4 +1399,4 @@ export default class ExcalidrawView extends TextFileView {
export function getTextMode(data:string):TextMode {
const parsed = data.search("excalidraw-plugin: parsed\n")>-1 || data.search("excalidraw-plugin: locked\n")>-1; //locked for backward compatibility
return parsed ? TextMode.parsed : TextMode.raw;
}
}