obsidian-drag-and-drop-blocks
obsidian-drag-and-drop-blocks copied to clipboard
request view update after drop to excalidraw view
Because you only add the block reference to the source line once the drop event is confirmed, the block reference does not resolve to the source text correctly in excalidraw.
Demo
Note that I have Excalidraw switched to preview mode.

- The first drop is displayed as a block reference because at the time of drop, the source reference does not exist and Excalidraw is unable to parse it to resolve the block contents.
- The second drop is displayed correctly as the source text because by that time the block reference exists.
- By switching back to raw mode and to preview mode again, the first reference is also resolved correctly.
Suggested solution
Note that you will need Excalidraw 1.3.6 (not yet released - but should be by the time you look at this) to accept text drops.
I think the following lines should resolve this issue if you add them here.
https://github.com/GitMurf/obsidian-drag-and-drop-blocks/blob/2caec7be6011db3fadd368aef39a99891b7add87/main.ts#L857
} else {
mdEditor.replaceSelection(selectedText);
//@ts-ignore
if (thisApp.workspace.activeLeaf.view.getViewType() === "excalidraw") {
//@ts-ignore
thisApp.workspace.activeLeaf.view.plugin.triggerEmbedUpdates();
}
}
Cool! I will add, thanks!
I was thinking about this... an alternative would be, that you add the block reference to the line the moment the drag action starts. The reason for dragging is to drop the block reference to another document - why wait until the drop happens. This would solve the update issue, because by the time you are ready to drop, the block reference is already there in the file.
I’ve gone back and forth on this. The reason I did it this way is in case the user decides to cancel the drop. They would then need to go back and undo the creation of the block reference. Although I guess I could check on cancel and then go back and remove the block ref if cancelled. Let me think about this.