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.
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.
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.