Skip to content

Commit 5e062d6

Browse files
authored
fix(useStudio): ignore non-markdown files on file-selected event (#171)
1 parent e5a103d commit 5e062d6

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/runtime/composables/useStudio.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,12 +295,11 @@ export const useStudio = () => {
295295
case 'nuxt-studio:editor:file-selected': {
296296
const content = await findContentWithId(payload.path)
297297
if (!content) {
298-
// DO not navigate to another page if content is not found
299-
// This makes sure that user stays on the same page when navigation through directories in the editor
300-
}
301-
else if (content._partial) {
302-
// Partials should use as helpers for other content files, like `_dir.yml`
303-
// We should not navigate if content is a partial
298+
// Do not navigate to another page if content is not found
299+
// This makes sure that user stays on the same page when navigation through directories in the editor
300+
} else if (content._partial || !String(payload.path).endsWith('.md')) {
301+
// Partials and non-markdown files should use as helpers for other content files, like `_dir.yml`
302+
// We should not navigate if content is a partial or non-markdown file
304303
}
305304
else if (content._path !== useRoute().path) {
306305
editorSelectedPath.value = content._path!

0 commit comments

Comments
 (0)