@ditojs/admin 2.36.1 → 2.37.0

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.36.1",
3
+ "version": "2.37.0",
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",
@@ -39,9 +39,9 @@
39
39
  "not ie_mob > 0"
40
40
  ],
41
41
  "dependencies": {
42
- "@ditojs/ui": "^2.36.1",
43
- "@ditojs/utils": "^2.36.0",
44
- "@kyvg/vue3-notification": "^3.4.0",
42
+ "@ditojs/ui": "^2.37.0",
43
+ "@ditojs/utils": "^2.37.0",
44
+ "@kyvg/vue3-notification": "^3.4.1",
45
45
  "@lk77/vue3-color": "^3.0.6",
46
46
  "@tiptap/core": "^2.9.1",
47
47
  "@tiptap/extension-blockquote": "^2.9.1",
@@ -67,26 +67,27 @@
67
67
  "@tiptap/extension-underline": "^2.9.1",
68
68
  "@tiptap/pm": "^2.9.1",
69
69
  "@tiptap/vue-3": "^2.9.1",
70
- "@vueuse/integrations": "^11.1.0",
70
+ "@vueuse/integrations": "^11.2.0",
71
71
  "codeflask": "^1.4.1",
72
72
  "filesize": "^10.1.6",
73
73
  "filesize-parser": "^1.5.1",
74
- "focus-trap": "^7.6.0",
75
- "nanoid": "^5.0.7",
74
+ "focus-trap": "^7.6.2",
75
+ "nanoid": "^5.0.8",
76
76
  "sortablejs": "^1.15.3",
77
77
  "tinycolor2": "^1.6.0",
78
78
  "tippy.js": "^6.3.7",
79
- "type-fest": "^4.26.1",
80
- "vue": "^3.5.12",
79
+ "tiptap-footnotes": "^2.0.1",
80
+ "type-fest": "^4.27.0",
81
+ "vue": "^3.5.13",
81
82
  "vue-multiselect": "^3.1.0",
82
83
  "vue-router": "^4.4.5",
83
84
  "vue-upload-component": "^3.1.17"
84
85
  },
85
86
  "devDependencies": {
86
- "@ditojs/build": "^2.36.1",
87
+ "@ditojs/build": "^2.37.0",
87
88
  "typescript": "^5.6.3",
88
- "vite": "^5.4.10"
89
+ "vite": "^5.4.11"
89
90
  },
90
91
  "types": "types",
91
- "gitHead": "70fd2abe897c2a4fd5d51cdaa06493c059f05d46"
92
+ "gitHead": "22955cc5d9a91f267dc22934d2fcc6824b8a42a8"
92
93
  }
@@ -119,14 +119,12 @@ export default DitoComponent.component('DitoRoot', {
119
119
  tippyDelegate(this.$el, {
120
120
  target: '.dito-info',
121
121
  theme: 'info',
122
- appendTo: node => node.closest('.dito-pane'),
123
122
  animation: 'shift-away-subtle',
124
123
  interactive: true,
125
124
  delay: 250,
126
125
  zIndex: 1,
127
- onShow(instance) {
128
- instance.setContent(instance.reference.dataset.info)
129
- }
126
+ appendTo: node => node.closest('.dito-pane'),
127
+ onShow: instance => instance.setContent(instance.reference.dataset.info)
130
128
  })
131
129
 
132
130
  // Clear the label marked as active on all mouse and keyboard events, except
@@ -598,26 +598,32 @@ export default DitoComponent.component('DitoSchema', {
598
598
  while (dataPathParts.length > 0) {
599
599
  const components = this.getComponentsByDataPath(dataPathParts)
600
600
  for (const component of components) {
601
- if (
602
- await component.navigateToComponent?.(
603
- fullDataPath,
604
- subComponents => {
605
- let found = false
606
- for (const component of subComponents) {
607
- const errs = errors[component.dataPath]
608
- if (
609
- errs &&
610
- component.showValidationErrors(errs, first && focus)
611
- ) {
612
- found = true
613
- first = false
614
- break
615
- }
601
+ const navigated = await component.navigateToComponent?.(
602
+ fullDataPath,
603
+ subComponents => {
604
+ let found = false
605
+ for (const component of subComponents) {
606
+ const matched = Object.fromEntries(
607
+ Object.entries(errors).filter(
608
+ ([dataPath]) =>
609
+ normalizeDataPath(dataPath).startsWith(
610
+ component.dataPath
611
+ )
612
+ )
613
+ )
614
+ if (
615
+ Object.keys(matched).length > 0 &&
616
+ component.showValidationErrors(matched, first && focus)
617
+ ) {
618
+ found = true
619
+ first = false
620
+ break
616
621
  }
617
- return found
618
622
  }
619
- )
620
- ) {
623
+ return found
624
+ }
625
+ )
626
+ if (navigated) {
621
627
  // Found a nested form to display at least parts fo the errors.
622
628
  // We can't show all errors at once, so we're done. Don't call
623
629
  // `notifyErrors()` yet, as we can only display it once
@@ -587,6 +587,7 @@ export default {
587
587
  this.$nextTick(callOnComplete)
588
588
  })
589
589
  }
590
+ return
590
591
  }
591
592
  // Keep removing the last part until we find a match.
592
593
  dataPathParts.pop()
@@ -95,6 +95,9 @@ export default {
95
95
  showValidationErrors(errors, focus) {
96
96
  // Convert from AJV errors objects to an array of error messages
97
97
  this.errors = []
98
+ if (errors.length === 0) {
99
+ return false
100
+ }
98
101
  for (const { message } of errors) {
99
102
  this.addError(message, true)
100
103
  }
@@ -31,7 +31,7 @@ export default DitoTypeComponent.register(
31
31
  get() {
32
32
  const { schema } = this
33
33
  if (schema.data || schema.dataPath) {
34
- const value = this.handleDataSchema(schema, 'schema')
34
+ const value = this.handleDataSchema(schema, 'value')
35
35
  // TODO: Fix side-effects
36
36
  // eslint-disable-next-line max-len
37
37
  // eslint-disable-next-line vue/no-side-effects-in-computed-properties
@@ -52,6 +52,8 @@ import { HorizontalRule } from '@tiptap/extension-horizontal-rule'
52
52
  import { OrderedList } from '@tiptap/extension-ordered-list'
53
53
  import { BulletList } from '@tiptap/extension-bullet-list'
54
54
  import { ListItem } from '@tiptap/extension-list-item'
55
+ // Footnotes:
56
+ import { Footnotes, FootnoteReference, Footnote } from 'tiptap-footnotes'
55
57
  // TODO:
56
58
  // import { Image } from '@tiptap/extension-image'
57
59
  // import { Mention } from '@tiptap/extension-mention'
@@ -139,7 +141,10 @@ export default DitoTypeComponent.register('markup', {
139
141
  toolButtons() {
140
142
  return this.getButtons('tools', {
141
143
  undo: true,
142
- redo: true
144
+ redo: true,
145
+ footnotes: {
146
+ command: 'addFootnote'
147
+ }
143
148
  })
144
149
  },
145
150
 
@@ -341,7 +346,10 @@ export default DitoTypeComponent.register('markup', {
341
346
  } = this.schema
342
347
  return [
343
348
  // Essentials:
344
- Document,
349
+ tools.footnotes
350
+ ? Document.extend({ content: 'block+ footnotes?' })
351
+ : Document,
352
+
345
353
  Text,
346
354
  Paragraph, // button can be controlled, but node needs to be on.
347
355
 
@@ -364,6 +372,10 @@ export default DitoTypeComponent.register('markup', {
364
372
  (nodes.orderedList || nodes.bulletList) && ListItem,
365
373
  nodes.bulletList && BulletList,
366
374
  nodes.orderedList && OrderedList,
375
+
376
+ // Footnotes:
377
+ ...(tools.footnotes ? [Footnotes, Footnote, FootnoteReference] : []),
378
+
367
379
  // TODO:
368
380
  // nodes.todoList && TodoItem,
369
381
  // nodes.todoList && TodoList,
@@ -625,12 +637,23 @@ const LinkWithTitle = Link.extend({
625
637
 
626
638
  blockquote {
627
639
  border-left: 3px solid $color-lighter;
628
- padding-left: 1rem;
640
+ padding-left: 1em;
629
641
  font-style: italic;
630
642
 
631
643
  p {
632
644
  margin: 0;
633
645
  }
634
646
  }
647
+
648
+ ol.footnotes {
649
+ margin-top: 1em;
650
+ padding: 1em 0;
651
+ list-style-type: decimal;
652
+ padding-left: 2em;
653
+
654
+ &:has(li) {
655
+ border-top: 1px solid $color-light;
656
+ }
657
+ }
635
658
  }
636
659
  </style>