Both the Makecode Editor and Python Editor can be used when your computer is offline. This article details the various configurations.
Makecode Editor
The editor at makecode.microbit.org can work offline, providing it has been fully loaded whilst online beforehand. This is because the editor is cached in the browser. Providing you don't clear your browser cache when you close the browser, you will be able to return to the previous state of the editor.
MakeCode Offline
There is also a standalone Offline app for MakeCode that you may wish to use in situations where you have limited or no internet connectivity.
Python Editor
The editor at python.microbit.org can work offline, providing it has been fully loaded whilst online beforehand. The Python Editor will reset itself when reloaded and you will also not be able to browse help when working offline.