@ditojs/admin 2.34.2 → 2.34.3

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": "@ditojs/admin",
3
- "version": "2.34.2",
3
+ "version": "2.34.3",
4
4
  "type": "module",
5
5
  "description": "Dito.js Admin is a schema based admin interface for Dito.js Server, featuring auto-generated views and forms and built with Vue.js",
6
6
  "repository": "https://github.com/ditojs/dito/tree/master/packages/admin",
@@ -91,5 +91,5 @@
91
91
  "vite": "^5.4.8"
92
92
  },
93
93
  "types": "types",
94
- "gitHead": "305801f364bf3d0b663eb0aa4bcd5ef31d88beac"
94
+ "gitHead": "5a5381114ae8012a9111015e2279fbc9e322c73a"
95
95
  }
@@ -6,6 +6,7 @@
6
6
  'dito-active': active
7
7
  }`
8
8
  :style="level > 0 && { '--level': level }"
9
+ :data-path="path"
9
10
  )
10
11
  .dito-tree-header(
11
12
  v-if="label"
@@ -271,22 +272,38 @@ export default DitoComponent.component('DitoTreeItem', {
271
272
  return appendDataPath(this.dataPath, property.name)
272
273
  },
273
274
 
274
- onEdit() {
275
+ editPath(path) {
275
276
  // All we got to do is push the right edit path to the router, the rest
276
277
  // is handled by our routes, allowing reloads as well.
277
278
  this.$router.push({
278
- path: `${this.container.path}${this.path}`,
279
+ path: `${this.container.path}${path}`,
279
280
  // Preserve current query
280
281
  query: this.$route.query
281
282
  })
282
283
  },
283
284
 
285
+ onEdit() {
286
+ this.editPath(this.path)
287
+ },
288
+
284
289
  onDelete() {
285
290
  // TODO: Implement!
286
291
  },
287
292
 
288
293
  onChange() {
289
294
  this.container.onChange()
295
+ },
296
+
297
+ // @override
298
+ onEndDrag(event) {
299
+ SortableMixin.methods.onEndDrag.call(this, event)
300
+ const { item } = event
301
+ // Preserve active state of edited sub-items, by editing their new path.
302
+ if (item.classList.contains('dito-active')) {
303
+ this.$nextTick(() => {
304
+ this.editPath(event.item.dataset.path)
305
+ })
306
+ }
290
307
  }
291
308
  }
292
309
  })
@@ -234,9 +234,9 @@ export default {
234
234
  }
235
235
  if (!store) {
236
236
  store = this.setStore(key, reactive({}))
237
- if (index != null) {
238
- this.setStoreKeyByIndex(index, key)
239
- }
237
+ }
238
+ if (index != null) {
239
+ this.setStoreKeyByIndex(index, key)
240
240
  }
241
241
  return store
242
242
  },
@@ -373,11 +373,11 @@ export default DitoTypeComponent.register('markup', {
373
373
 
374
374
  HardBreak.extend({
375
375
  addKeyboardShortcuts: () => {
376
- const callback = () => this.editor.commands.setHardBreak()
376
+ const setHardBreak = () => this.editor.commands.setHardBreak()
377
377
  return {
378
- 'Mod-Enter': callback,
379
- 'Shift-Enter': callback,
380
- ...(this.hardBreak ? { Enter: callback } : null)
378
+ 'Mod-Enter': setHardBreak,
379
+ 'Shift-Enter': setHardBreak,
380
+ ...(this.hardBreak ? { Enter: setHardBreak } : null)
381
381
  }
382
382
  }
383
383
  })