The JavaScript variable wgRevisionId is 0 when editing with the wikitext editor.
It seems that logically, it should be the revision used as the basis of the edit (the latest, or an oldid if that was used in the URL).
wgCurRevisionId (which is always the latest) is set.
See Also:
T53594: Add wgRevisionId for revision of displayed page or diff