[Feat] Improve warning for unsaved changes

Description

Identified in this comment:

it looks to be a race condition potentially. I can easily reproduce by quickly editing then closing, before the blue dot on Source Control shows up. I'll send you a video.

I'm running Chrome: ...

Implementation plan

Let's consider decoupling the "preventUnload" event from Source Control, and just checking if the user has made any changes, considering the entire editor state "dirty". Only after a commit, we'll want to remove the "preventUnload" handling.

/cc @ericschurter