2121 -->
2222
2323<template >
24- <div v-if =" enabled && file !== null "
24+ <div v-if =" enabled && localHasRichWorkspace "
2525 id =" rich-workspace"
2626 :class =" {'focus': focus, 'dark': darkTheme }" >
2727 <RichTextReader v-if =" !loaded || !ready" :content =" content" class =" rich-workspace--preview" />
@@ -80,6 +80,8 @@ export default {
8080 },
8181 data () {
8282 return {
83+ // Keep track of a local copy of the hasRichWorkspace state as it might change after intitial rendering (e.g. when adding/removing the readme)
84+ localHasRichWorkspace: false ,
8385 focus: false ,
8486 folder: null ,
8587 file: null ,
@@ -105,8 +107,12 @@ export default {
105107 document .querySelector (' #rich-workspace .text-editor__main' ).scrollTo (0 , 0 )
106108 }
107109 },
110+ hasRichWorkspace (value ) {
111+ this .localHasRichWorkspace = value
112+ },
108113 },
109114 mounted () {
115+ this .localHasRichWorkspace = this .hasRichWorkspace
110116 if (this .enabled && this .hasRichWorkspace ) {
111117 this .getFileInfo ()
112118 }
@@ -137,6 +143,7 @@ export default {
137143 this .unlistenKeydownEvents ()
138144 },
139145 reset () {
146+ this .localHasRichWorkspace = false
140147 this .file = null
141148 this .focus = false
142149 this .$nextTick (() => {
@@ -164,6 +171,7 @@ export default {
164171 this .editing = true
165172 this .loaded = true
166173 this .autofocus = autofocus || false
174+ this .localHasRichWorkspace = true
167175 return true
168176 })
169177 .catch ((error ) => {
@@ -212,19 +220,20 @@ export default {
212220 },
213221 onFileCreated (node ) {
214222 if (SUPPORTED_STATIC_FILENAMES .includes (node .basename )) {
215- this .showRichWorkspace ()
223+ this .localHasRichWorkspace = true
224+ this .getFileInfo (true )
216225 }
217226 },
218227 onFileDeleted (node ) {
219228 if (node .path === this .file .path ) {
220- this .hideRichWorkspace ()
229+ this .localHasRichWorkspace = false
221230 }
222231 },
223232 onFileRenamed (node ) {
224233 if (SUPPORTED_STATIC_FILENAMES .includes (node .basename )) {
225- this .showRichWorkspace ()
234+ this .localHasRichWorkspace = true
226235 } else if (node .fileid === this .file ? .id && node .path !== this .file ? .path ) {
227- this .hideRichWorkspace ()
236+ this .localHasRichWorkspace = false
228237 }
229238 },
230239 },
@@ -241,11 +250,14 @@ export default {
241250 transition: max- height 0 .5s cubic- bezier (0 , 1 , 0 , 1 );
242251 z- index: 61 ;
243252 position: relative;
244- min- height: 30vh ;
245253 }
246254
247255 .rich - workspace-- preview {
248256 margin- top: 44px ;
257+
258+ & : deep (div [contenteditable = ' false' ]) {
259+ margin: 0 ;
260+ }
249261 }
250262
251263 /* For subfolders, where there are no Recommendations */
0 commit comments