@ditojs/admin 2.34.4 → 2.35.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/dist/dito-admin.es.js +1012 -967
- package/dist/dito-admin.umd.js +5 -5
- package/dist/style.css +1 -1
- package/package.json +32 -35
- package/src/DitoContext.js +8 -1
- package/src/mixins/OptionsMixin.js +4 -9
- package/src/types/DitoTypeCode.vue +82 -25
- package/src/types/DitoTypeMarkup.vue +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/admin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.35.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,33 +39,34 @@
|
|
|
39
39
|
"not ie_mob > 0"
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@ditojs/ui": "^2.
|
|
43
|
-
"@ditojs/utils": "^2.
|
|
44
|
-
"@kyvg/vue3-notification": "^3.
|
|
42
|
+
"@ditojs/ui": "^2.35.0",
|
|
43
|
+
"@ditojs/utils": "^2.35.0",
|
|
44
|
+
"@kyvg/vue3-notification": "^3.4.0",
|
|
45
45
|
"@lk77/vue3-color": "^3.0.6",
|
|
46
|
-
"@tiptap/core": "^2.
|
|
47
|
-
"@tiptap/extension-blockquote": "^2.
|
|
48
|
-
"@tiptap/extension-bold": "^2.
|
|
49
|
-
"@tiptap/extension-bullet-list": "^2.
|
|
50
|
-
"@tiptap/extension-code": "^2.
|
|
51
|
-
"@tiptap/extension-code-block": "^2.
|
|
52
|
-
"@tiptap/extension-document": "^2.
|
|
53
|
-
"@tiptap/extension-hard-break": "^2.
|
|
54
|
-
"@tiptap/extension-heading": "^2.
|
|
55
|
-
"@tiptap/extension-history": "^2.
|
|
56
|
-
"@tiptap/extension-horizontal-rule": "^2.
|
|
57
|
-
"@tiptap/extension-italic": "^2.
|
|
58
|
-
"@tiptap/extension-link": "^2.
|
|
59
|
-
"@tiptap/extension-list-item": "^2.
|
|
60
|
-
"@tiptap/extension-ordered-list": "^2.
|
|
61
|
-
"@tiptap/extension-paragraph": "^2.
|
|
62
|
-
"@tiptap/extension-strike": "^2.
|
|
63
|
-
"@tiptap/extension-subscript": "^2.
|
|
64
|
-
"@tiptap/extension-superscript": "^2.
|
|
65
|
-
"@tiptap/extension-text": "^2.
|
|
66
|
-
"@tiptap/extension-
|
|
67
|
-
"@tiptap/
|
|
68
|
-
"@tiptap/
|
|
46
|
+
"@tiptap/core": "^2.8.0",
|
|
47
|
+
"@tiptap/extension-blockquote": "^2.8.0",
|
|
48
|
+
"@tiptap/extension-bold": "^2.8.0",
|
|
49
|
+
"@tiptap/extension-bullet-list": "^2.8.0",
|
|
50
|
+
"@tiptap/extension-code": "^2.8.0",
|
|
51
|
+
"@tiptap/extension-code-block": "^2.8.0",
|
|
52
|
+
"@tiptap/extension-document": "^2.8.0",
|
|
53
|
+
"@tiptap/extension-hard-break": "^2.8.0",
|
|
54
|
+
"@tiptap/extension-heading": "^2.8.0",
|
|
55
|
+
"@tiptap/extension-history": "^2.8.0",
|
|
56
|
+
"@tiptap/extension-horizontal-rule": "^2.8.0",
|
|
57
|
+
"@tiptap/extension-italic": "^2.8.0",
|
|
58
|
+
"@tiptap/extension-link": "^2.8.0",
|
|
59
|
+
"@tiptap/extension-list-item": "^2.8.0",
|
|
60
|
+
"@tiptap/extension-ordered-list": "^2.8.0",
|
|
61
|
+
"@tiptap/extension-paragraph": "^2.8.0",
|
|
62
|
+
"@tiptap/extension-strike": "^2.8.0",
|
|
63
|
+
"@tiptap/extension-subscript": "^2.8.0",
|
|
64
|
+
"@tiptap/extension-superscript": "^2.8.0",
|
|
65
|
+
"@tiptap/extension-text": "^2.8.0",
|
|
66
|
+
"@tiptap/extension-text-style": "^2.8.0",
|
|
67
|
+
"@tiptap/extension-underline": "^2.8.0",
|
|
68
|
+
"@tiptap/pm": "^2.8.0",
|
|
69
|
+
"@tiptap/vue-3": "^2.8.0",
|
|
69
70
|
"@vueuse/integrations": "^11.1.0",
|
|
70
71
|
"codeflask": "^1.4.1",
|
|
71
72
|
"filesize": "^10.1.6",
|
|
@@ -76,20 +77,16 @@
|
|
|
76
77
|
"tinycolor2": "^1.6.0",
|
|
77
78
|
"tippy.js": "^6.3.7",
|
|
78
79
|
"type-fest": "^4.26.1",
|
|
79
|
-
"vue": "^3.5.
|
|
80
|
+
"vue": "^3.5.11",
|
|
80
81
|
"vue-multiselect": "^3.1.0",
|
|
81
82
|
"vue-router": "^4.4.5",
|
|
82
83
|
"vue-upload-component": "^3.1.17"
|
|
83
84
|
},
|
|
84
85
|
"devDependencies": {
|
|
85
|
-
"@ditojs/build": "^2.
|
|
86
|
-
"
|
|
87
|
-
"@vue/compiler-sfc": "^3.5.8",
|
|
88
|
-
"pug": "^3.0.3",
|
|
89
|
-
"sass": "^1.79.3",
|
|
90
|
-
"typescript": "^5.6.2",
|
|
86
|
+
"@ditojs/build": "^2.35.0",
|
|
87
|
+
"typescript": "^5.6.3",
|
|
91
88
|
"vite": "^5.4.8"
|
|
92
89
|
},
|
|
93
90
|
"types": "types",
|
|
94
|
-
"gitHead": "
|
|
91
|
+
"gitHead": "53671911f207390474d992e72a9671fb93f2b78c"
|
|
95
92
|
}
|
package/src/DitoContext.js
CHANGED
|
@@ -21,7 +21,14 @@ const { hasOwnProperty } = Object.prototype
|
|
|
21
21
|
const contexts = new WeakMap()
|
|
22
22
|
|
|
23
23
|
function get(context, key, defaultValue) {
|
|
24
|
-
|
|
24
|
+
let raw = toRaw(context)
|
|
25
|
+
let object = null
|
|
26
|
+
// In case `DitoContext.extend()` was used, we need to find the actual context
|
|
27
|
+
// object from the object's the inheritance chain:
|
|
28
|
+
while (raw && !object) {
|
|
29
|
+
object = contexts.get(raw)
|
|
30
|
+
raw = Object.getPrototypeOf(raw)
|
|
31
|
+
}
|
|
25
32
|
const value = key in object ? object[key] : undefined
|
|
26
33
|
// If `object` explicitly sets the key to `undefined`, return it.
|
|
27
34
|
return value !== undefined || hasOwnProperty.call(object, key)
|
|
@@ -17,12 +17,6 @@ import {
|
|
|
17
17
|
export default {
|
|
18
18
|
mixins: [DataMixin],
|
|
19
19
|
|
|
20
|
-
data() {
|
|
21
|
-
return {
|
|
22
|
-
hasOptions: false
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
|
|
26
20
|
computed: {
|
|
27
21
|
selectedValue: {
|
|
28
22
|
get() {
|
|
@@ -80,9 +74,6 @@ export default {
|
|
|
80
74
|
if (!isArray(data)) {
|
|
81
75
|
throw new Error(`Invalid options data, should be array: ${data}`)
|
|
82
76
|
}
|
|
83
|
-
// TODO: Fix side-effects
|
|
84
|
-
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
|
85
|
-
this.hasOptions = data.length > 0
|
|
86
77
|
return this.processOptions(data)
|
|
87
78
|
},
|
|
88
79
|
|
|
@@ -92,6 +83,10 @@ export default {
|
|
|
92
83
|
return this.options
|
|
93
84
|
},
|
|
94
85
|
|
|
86
|
+
hasOptions() {
|
|
87
|
+
return this.activeOptions.length > 0
|
|
88
|
+
},
|
|
89
|
+
|
|
95
90
|
relate: getSchemaAccessor('relate', {
|
|
96
91
|
// TODO: Convert to `relateBy: 'id'`
|
|
97
92
|
type: Boolean,
|
|
@@ -1,34 +1,63 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
2
|
.dito-code(
|
|
3
3
|
:id="dataPath"
|
|
4
|
-
ref="code"
|
|
5
4
|
:style="style"
|
|
6
5
|
)
|
|
6
|
+
.dito-code__editor(ref="editor")
|
|
7
|
+
.dito-resize(
|
|
8
|
+
v-if="resizable"
|
|
9
|
+
@mousedown.stop.prevent="onDragResize"
|
|
10
|
+
)
|
|
7
11
|
</template>
|
|
8
12
|
|
|
9
13
|
<script>
|
|
10
14
|
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
11
15
|
import DomMixin from '../mixins/DomMixin.js'
|
|
16
|
+
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
12
17
|
import CodeFlask from 'codeflask'
|
|
13
18
|
|
|
14
19
|
// @vue/component
|
|
15
20
|
export default DitoTypeComponent.register('code', {
|
|
16
21
|
mixins: [DomMixin],
|
|
17
22
|
|
|
23
|
+
data() {
|
|
24
|
+
return {
|
|
25
|
+
height: null
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
|
|
18
29
|
computed: {
|
|
19
|
-
lines(
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
lines: getSchemaAccessor('lines', {
|
|
31
|
+
type: Number,
|
|
32
|
+
default: 3
|
|
33
|
+
}),
|
|
34
|
+
|
|
35
|
+
language: getSchemaAccessor('language', {
|
|
36
|
+
type: String,
|
|
37
|
+
default: 'javascript'
|
|
38
|
+
}),
|
|
39
|
+
|
|
40
|
+
indentSize: getSchemaAccessor('indentSize', {
|
|
41
|
+
type: Number,
|
|
42
|
+
default: 2
|
|
43
|
+
}),
|
|
44
|
+
|
|
45
|
+
resizable: getSchemaAccessor('resizable', {
|
|
46
|
+
type: Boolean,
|
|
47
|
+
default: false
|
|
48
|
+
}),
|
|
22
49
|
|
|
23
50
|
style() {
|
|
24
|
-
return
|
|
51
|
+
return {
|
|
52
|
+
height: this.height || `calc(${this.lines}em * var(--line-height))`
|
|
53
|
+
}
|
|
25
54
|
}
|
|
26
55
|
},
|
|
27
56
|
|
|
28
57
|
mounted() {
|
|
29
|
-
const flask = new CodeFlask(this.$refs.
|
|
30
|
-
language: this.
|
|
31
|
-
|
|
58
|
+
const flask = new CodeFlask(this.$refs.editor, {
|
|
59
|
+
language: this.language,
|
|
60
|
+
indentSize: this.indentSize,
|
|
32
61
|
lineNumbers: false
|
|
33
62
|
})
|
|
34
63
|
|
|
@@ -50,7 +79,7 @@ export default DitoTypeComponent.register('code', {
|
|
|
50
79
|
onChange()
|
|
51
80
|
}
|
|
52
81
|
|
|
53
|
-
this.domOn(this.$refs.
|
|
82
|
+
this.domOn(this.$refs.editor.querySelector('textarea'), {
|
|
54
83
|
focus: onFocus,
|
|
55
84
|
blur: onBlur
|
|
56
85
|
})
|
|
@@ -87,6 +116,10 @@ export default DitoTypeComponent.register('code', {
|
|
|
87
116
|
}
|
|
88
117
|
})
|
|
89
118
|
|
|
119
|
+
this.$watch('language', language => {
|
|
120
|
+
flask.updateLanguage(language)
|
|
121
|
+
})
|
|
122
|
+
|
|
90
123
|
setCode(this.value || '')
|
|
91
124
|
},
|
|
92
125
|
|
|
@@ -96,7 +129,30 @@ export default DitoTypeComponent.register('code', {
|
|
|
96
129
|
},
|
|
97
130
|
|
|
98
131
|
blurElement() {
|
|
99
|
-
this.$el.querySelector('textarea')?.
|
|
132
|
+
this.$el.querySelector('textarea')?.blur()
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
onDragResize(event) {
|
|
136
|
+
const getPoint = ({ clientX: x, clientY: y }) => ({ x, y })
|
|
137
|
+
|
|
138
|
+
let prevY = getPoint(event).y
|
|
139
|
+
let height = parseFloat(getComputedStyle(this.$el).height)
|
|
140
|
+
|
|
141
|
+
const mousemove = event => {
|
|
142
|
+
const { y } = getPoint(event)
|
|
143
|
+
height += y - prevY
|
|
144
|
+
prevY = y
|
|
145
|
+
this.height = `${Math.max(height, 0)}px`
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const handlers = this.domOn(document, {
|
|
149
|
+
mousemove,
|
|
150
|
+
|
|
151
|
+
mouseup(event) {
|
|
152
|
+
mousemove(event)
|
|
153
|
+
handlers.remove()
|
|
154
|
+
}
|
|
155
|
+
})
|
|
100
156
|
}
|
|
101
157
|
}
|
|
102
158
|
})
|
|
@@ -112,6 +168,7 @@ export default DitoTypeComponent.register('code', {
|
|
|
112
168
|
// For proper sizing of content along with :style="style" setting above,
|
|
113
169
|
// for proper line-height calculation.
|
|
114
170
|
padding: $input-padding;
|
|
171
|
+
min-height: calc(1em * var(--line-height) + 2 * $input-padding-ver);
|
|
115
172
|
|
|
116
173
|
.codeflask {
|
|
117
174
|
background: none;
|
|
@@ -119,24 +176,24 @@ export default DitoTypeComponent.register('code', {
|
|
|
119
176
|
// the desired height with :style="style".
|
|
120
177
|
top: 0;
|
|
121
178
|
left: 0;
|
|
122
|
-
}
|
|
123
179
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
180
|
+
&__textarea,
|
|
181
|
+
&__pre {
|
|
182
|
+
// Use same padding as .dito-code
|
|
183
|
+
padding: $input-padding;
|
|
184
|
+
}
|
|
129
185
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
186
|
+
&__textarea,
|
|
187
|
+
&__code,
|
|
188
|
+
&__lines {
|
|
189
|
+
font-family: $font-family-mono;
|
|
190
|
+
font-size: var(--font-size);
|
|
191
|
+
line-height: var(--line-height);
|
|
192
|
+
}
|
|
137
193
|
|
|
138
|
-
|
|
139
|
-
|
|
194
|
+
&__lines {
|
|
195
|
+
padding: $input-padding;
|
|
196
|
+
}
|
|
140
197
|
}
|
|
141
198
|
}
|
|
142
199
|
</style>
|
|
@@ -526,18 +526,6 @@ const LinkWithTitle = Link.extend({
|
|
|
526
526
|
|
|
527
527
|
position: relative;
|
|
528
528
|
|
|
529
|
-
.dito-resize {
|
|
530
|
-
@extend %icon-resize;
|
|
531
|
-
|
|
532
|
-
position: absolute;
|
|
533
|
-
top: unset;
|
|
534
|
-
left: unset;
|
|
535
|
-
right: 0;
|
|
536
|
-
bottom: 0;
|
|
537
|
-
width: 1em;
|
|
538
|
-
height: 1em;
|
|
539
|
-
}
|
|
540
|
-
|
|
541
529
|
.ProseMirror {
|
|
542
530
|
height: 100%;
|
|
543
531
|
outline: none;
|