@docsector/docsector-reader 0.5.6 → 0.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docsector/docsector-reader",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "A documentation rendering engine built with Vue 3, Quasar v2 and Vite. Transform Markdown into beautiful, navigable documentation sites.",
5
5
  "productName": "Docsector Reader",
6
6
  "author": "Rodrigo de Araujo Vieira",
@@ -78,6 +78,19 @@ const getPageStatusTooltip = (status) => {
78
78
  return t('menu.status.empty.tooltip')
79
79
  }
80
80
  }
81
+
82
+ const normalizePath = (path) => {
83
+ if (!path) {
84
+ return '/'
85
+ }
86
+
87
+ const normalized = String(path).replace(/\/+$/, '')
88
+ return normalized === '' ? '/' : normalized
89
+ }
90
+
91
+ const isMenuItemActive = (path) => {
92
+ return normalizePath(path) === normalizePath($route.path)
93
+ }
81
94
  </script>
82
95
 
83
96
  <template>
@@ -90,7 +103,7 @@ const getPageStatusTooltip = (status) => {
90
103
 
91
104
  <q-item
92
105
  :to="subitem.path + '/overview'"
93
- :active="subitem.path + subpage === $route.path"
106
+ :active="isMenuItemActive(subitem.path + subpage)"
94
107
  v-show="founds[subitem.path] || !founds"
95
108
  >
96
109
  <q-item-section side>
package/src/store/App.js CHANGED
@@ -18,14 +18,18 @@ export default {
18
18
  const base = firstRoutePath.substr(1)
19
19
  let relative = secondRoutePath.substr(firstRoutePath.length)
20
20
 
21
- commit('page/setBase', base, { root: true })
22
- commit('page/setRelative', relative, { root: true })
23
- commit('page/setAbsolute', base + relative, { root: true })
21
+ if (relative !== '/') {
22
+ relative = relative.replace(/\/+$/, '')
23
+ }
24
24
 
25
25
  if (relative === '/' || relative === '') {
26
26
  relative = '/overview'
27
27
  }
28
28
 
29
+ commit('page/setBase', base, { root: true })
30
+ commit('page/setRelative', relative, { root: true })
31
+ commit('page/setAbsolute', base + relative, { root: true })
32
+
29
33
  if (firstRoutePath) {
30
34
  const i18nBase = base.replace(/_$/, '').replace(/\//g, '.')
31
35
  const i18nRelative = relative.replace(/_$/, '').replace(/\//g, '.')