Repository navigation
Subscribe to file path if the editor is gone - #375
Conversation
Even if the editor that the preview tab was tracking has been destroyed, we can still display the rendered markdown by checking its file contents. Do that instead of instantly destroying the pane. Closes atom/atom#86582
subscribeToFilePath is a bit misleading here...it doesn't actually subscribe to the file path changing in any way. Now we subscribe to the rename event and fire did-change-title so that the Markdown Preview titles get updated properly.
|
This is ready for review. |
| renderMarkdown: -> | ||
| @showLoading() unless @loaded | ||
| @getMarkdownSource().then (source) => @renderMarkdownText(source) if source? | ||
| .catch (reason) => |
There was a problem hiding this comment.
Without this catch the preview pane would endlessly display as loading despite the promise already having been rejected (eg when the file has been deleted).
|
The |
file.writeSync doesn't appear to trigger file.onDidChange (atom/node-pathwatcher#110)
|
Ok, specs are finally passing. |
|
Sorry for missing this @50Wliu. I didn't comb over every square inch but the tests look thorough and everything seems reasonable. I trust you to be around to address any issues that might arise. 🚢 |
Even if the editor that the preview tab was tracking has been destroyed, we can still display the rendered markdown by checking its file contents. Do that instead of instantly destroying the newly-created pane when attempting to split an orphaned preview pane.
While this PR substantially increases the capabilities of Markdown Preview when previewing a file no longer open in Atom, it does not do the following:
editorIdif the original file is re-opened in AtomCloses atom/atom#8652