@xleddyl/nuxt-cms 0.1.50 → 0.1.52

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/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@xleddyl/nuxt-cms",
3
3
  "configKey": "cms",
4
- "version": "0.1.50",
4
+ "version": "0.1.52",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -904,7 +904,7 @@ async function loadCmsConfig(nuxt, resolver, configPathOption, i18n, logger) {
904
904
  `const pageRoutes = ${JSON.stringify(routesByEntry, null, 3)}`,
905
905
  ``,
906
906
  `for (const [name, routes] of Object.entries(pageRoutes)) {`,
907
- ` const entry = (config as Record<string, { pages?: unknown }>)[name]`,
907
+ ` const entry = Object(config)[name]`,
908
908
  ` if (entry) entry.pages = routes`,
909
909
  `}`,
910
910
  ``,
@@ -54,7 +54,7 @@
54
54
  >
55
55
  <CmsIcon name="bars-2" class="size-4" />
56
56
  </button>
57
- <span class="cms-block-bar-name" :title="labelOf(item)">{{ labelOf(item) }}</span>
57
+ <span class="cms-block-bar-name" :title="barTitle(item)">{{ barLabel(item) }}</span>
58
58
  <div class="cms-block-bar-actions">
59
59
  <CmsButton
60
60
  icon="trash"
@@ -143,6 +143,7 @@
143
143
  <script setup>
144
144
  import {
145
145
  isTranslatableMediaField,
146
+ mediaFilename,
146
147
  mediaIconFor,
147
148
  mediaPublicUrl,
148
149
  mediaTypeForKey,
@@ -174,6 +175,13 @@ function blockOf(item) {
174
175
  function labelOf(item) {
175
176
  return blockOf(item)?.label ?? String(item.type);
176
177
  }
178
+ function barLabel(item) {
179
+ const key = mediaKeyOf(item);
180
+ return key ? mediaFilename(key) : labelOf(item);
181
+ }
182
+ function barTitle(item) {
183
+ return mediaKeyOf(item) ?? labelOf(item);
184
+ }
177
185
  function mediaKeyOf(item) {
178
186
  const locale = props.locale ?? i18n.defaultLocale;
179
187
  for (const [key, field] of Object.entries(blockOf(item)?.fields ?? {})) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xleddyl/nuxt-cms",
3
- "version": "0.1.50",
3
+ "version": "0.1.52",
4
4
  "description": "Lightweight CMS that ships with your Nuxt app: runs on the Nitro server, content types defined in code, /cms admin panel, GraphQL API, SQLite or Postgres. No external CMS needed!",
5
5
  "license": "MIT",
6
6
  "author": "Edoardo Alberti (https://github.com/xleddyl)",