Skip to content

Commit

Permalink
fix(useStudio): ignore non-markdown files on file-selected event (#171
Browse files Browse the repository at this point in the history
)
  • Loading branch information
farnabaz committed May 13, 2024
1 parent e5a103d commit 5e062d6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/runtime/composables/useStudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,12 +295,11 @@ export const useStudio = () => {
case 'nuxt-studio:editor:file-selected': {
const content = await findContentWithId(payload.path)
if (!content) {
// DO not navigate to another page if content is not found
// This makes sure that user stays on the same page when navigation through directories in the editor
}
else if (content._partial) {
// Partials should use as helpers for other content files, like `_dir.yml`
// We should not navigate if content is a partial
// Do not navigate to another page if content is not found
// This makes sure that user stays on the same page when navigation through directories in the editor
} else if (content._partial || !String(payload.path).endsWith('.md')) {

Check failure on line 300 in src/runtime/composables/useStudio.ts

View workflow job for this annotation

GitHub Actions / nightly (ubuntu-latest, 20)

Closing curly brace appears on the same line as the subsequent block
// Partials and non-markdown files should use as helpers for other content files, like `_dir.yml`
// We should not navigate if content is a partial or non-markdown file
}
else if (content._path !== useRoute().path) {
editorSelectedPath.value = content._path!
Expand Down

0 comments on commit 5e062d6

Please sign in to comment.