-
@@ -108,11 +107,12 @@ export default {
},
},
mounted() {
- if (this.enabled) {
+ if (this.enabled && this.hasRichWorkspace) {
this.getFileInfo()
}
subscribe('Text::showRichWorkspace', this.showRichWorkspace)
subscribe('Text::hideRichWorkspace', this.hideRichWorkspace)
+ subscribe('files:node:created', this.onFileCreated)
subscribe('files:node:deleted', this.onFileDeleted)
subscribe('files:node:renamed', this.onFileRenamed)
@@ -122,6 +122,7 @@ export default {
beforeDestroy() {
unsubscribe('Text::showRichWorkspace', this.showRichWorkspace)
unsubscribe('Text::hideRichWorkspace', this.hideRichWorkspace)
+ unsubscribe('files:node:created', this.onFileCreated)
unsubscribe('files:node:deleted', this.onFileDeleted)
unsubscribe('files:node:renamed', this.onFileRenamed)
@@ -144,9 +145,10 @@ export default {
})
},
getFileInfo(autofocus) {
- if (!this.hasRichWorkspace) {
+ if (!this.enabled) {
return
}
+ this.file = null
this.ready = false
this.loaded = true
this.autofocus = false
@@ -208,6 +210,11 @@ export default {
// schedule to normal behaviour
this.$_timeoutAutohide = setTimeout(this.onTimeoutAutohide, 7000) // 7s
},
+ onFileCreated(node) {
+ if (SUPPORTED_STATIC_FILENAMES.includes(node.basename)) {
+ this.showRichWorkspace()
+ }
+ },
onFileDeleted(node) {
if (node.path === this.file.path) {
this.hideRichWorkspace()