@ditojs/admin 2.0.5 → 2.1.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 +1511 -1435
- package/dist/dito-admin.umd.js +4 -4
- package/dist/style.css +1 -1
- package/package.json +31 -31
- package/src/DitoAdmin.js +66 -31
- package/src/DitoComponent.js +4 -1
- package/src/DitoContext.js +13 -5
- package/src/{TypeComponent.js → DitoTypeComponent.js} +8 -5
- package/src/components/DitoAccount.vue +20 -19
- package/src/components/DitoButtons.vue +14 -12
- package/src/components/DitoClipboard.vue +16 -8
- package/src/components/DitoContainer.vue +56 -43
- package/src/components/DitoCreateButton.vue +20 -15
- package/src/components/DitoDialog.vue +69 -48
- package/src/components/DitoEditButtons.vue +16 -14
- package/src/components/DitoElement.vue +2 -3
- package/src/components/DitoErrors.vue +18 -13
- package/src/components/DitoForm.vue +41 -24
- package/src/components/DitoFormNested.vue +12 -10
- package/src/components/DitoHeader.vue +103 -69
- package/src/components/DitoLabel.vue +108 -81
- package/src/components/DitoMenu.vue +52 -36
- package/src/components/DitoPagination.vue +9 -7
- package/src/components/DitoPane.vue +53 -45
- package/src/components/DitoPanel.vue +62 -42
- package/src/components/DitoPanels.vue +11 -10
- package/src/components/DitoRoot.vue +57 -46
- package/src/components/DitoSchema.vue +179 -131
- package/src/components/DitoSchemaInlined.vue +39 -28
- package/src/components/DitoScopes.vue +41 -31
- package/src/components/DitoSpinner.vue +31 -40
- package/src/components/DitoTableCell.vue +9 -9
- package/src/components/DitoTableHead.vue +52 -37
- package/src/components/DitoTabs.vue +39 -29
- package/src/components/DitoTreeItem.vue +140 -86
- package/src/components/DitoVNode.vue +1 -1
- package/src/components/DitoView.vue +13 -11
- package/src/mixins/DataMixin.js +11 -9
- package/src/mixins/DitoMixin.js +47 -25
- package/src/mixins/EmitterMixin.js +2 -1
- package/src/mixins/ItemMixin.js +15 -10
- package/src/mixins/LoadingMixin.js +2 -1
- package/src/mixins/NumberMixin.js +15 -10
- package/src/mixins/OptionsMixin.js +24 -12
- package/src/mixins/ResourceMixin.js +42 -34
- package/src/mixins/RouteMixin.js +8 -8
- package/src/mixins/SortableMixin.js +1 -1
- package/src/mixins/SourceMixin.js +68 -34
- package/src/mixins/TypeMixin.js +5 -4
- package/src/mixins/ValidationMixin.js +3 -0
- package/src/styles/_base.scss +17 -0
- package/src/styles/_button.scss +212 -0
- package/src/styles/_imports.scss +2 -0
- package/src/styles/_layout.scss +22 -0
- package/src/styles/_notifications.scss +54 -0
- package/src/styles/_pulldown.scss +39 -0
- package/src/styles/_scroll.scss +15 -0
- package/src/styles/_settings.scss +68 -0
- package/src/styles/_sortable.scss +13 -0
- package/src/styles/_table.scss +224 -0
- package/src/styles/style.scss +9 -0
- package/src/types/DitoTypeButton.vue +72 -0
- package/src/types/{TypeCheckbox.vue → DitoTypeCheckbox.vue} +12 -11
- package/src/types/{TypeCheckboxes.vue → DitoTypeCheckboxes.vue} +21 -15
- package/src/types/{TypeCode.vue → DitoTypeCode.vue} +46 -34
- package/src/types/{TypeColor.vue → DitoTypeColor.vue} +71 -52
- package/src/types/{TypeComponent.vue → DitoTypeComponent.vue} +2 -2
- package/src/types/DitoTypeComputed.vue +54 -0
- package/src/types/DitoTypeDate.vue +64 -0
- package/src/types/DitoTypeLabel.vue +23 -0
- package/src/types/{TypeList.vue → DitoTypeList.vue} +83 -61
- package/src/types/{TypeMarkup.vue → DitoTypeMarkup.vue} +172 -122
- package/src/types/DitoTypeMultiselect.vue +434 -0
- package/src/types/DitoTypeNumber.vue +46 -0
- package/src/types/{TypeObject.vue → DitoTypeObject.vue} +41 -26
- package/src/types/{TypePanel.vue → DitoTypePanel.vue} +2 -2
- package/src/types/{TypeProgress.vue → DitoTypeProgress.vue} +4 -6
- package/src/types/{TypeRadio.vue → DitoTypeRadio.vue} +17 -13
- package/src/types/{TypeSection.vue → DitoTypeSection.vue} +17 -17
- package/src/types/{TypeSelect.vue → DitoTypeSelect.vue} +39 -35
- package/src/types/{TypeSlider.vue → DitoTypeSlider.vue} +29 -23
- package/src/types/{TypeSwitch.vue → DitoTypeSwitch.vue} +15 -13
- package/src/types/DitoTypeText.vue +77 -0
- package/src/types/{TypeTextarea.vue → DitoTypeTextarea.vue} +17 -14
- package/src/types/DitoTypeTreeList.vue +191 -0
- package/src/types/{TypeUpload.vue → DitoTypeUpload.vue} +92 -65
- package/src/types/index.js +26 -26
- package/src/utils/SchemaGraph.js +21 -13
- package/src/utils/accessor.js +17 -9
- package/src/utils/data.js +4 -1
- package/src/utils/filter.js +8 -10
- package/src/utils/options.js +3 -3
- package/src/utils/resource.js +12 -10
- package/src/utils/schema.js +190 -125
- package/src/utils/type.js +31 -20
- package/src/validations/_decimals.js +1 -2
- package/types/index.d.ts +27 -23
- package/src/styles/_base.sass +0 -15
- package/src/styles/_button.sass +0 -127
- package/src/styles/_imports.sass +0 -2
- package/src/styles/_layout.sass +0 -13
- package/src/styles/_notifications.sass +0 -33
- package/src/styles/_pulldown.sass +0 -26
- package/src/styles/_scroll.sass +0 -13
- package/src/styles/_settings.sass +0 -55
- package/src/styles/_sortable.sass +0 -9
- package/src/styles/_table.sass +0 -153
- package/src/styles/style.sass +0 -10
- package/src/types/TypeButton.vue +0 -73
- package/src/types/TypeComputed.vue +0 -53
- package/src/types/TypeDate.vue +0 -64
- package/src/types/TypeLabel.vue +0 -19
- package/src/types/TypeMultiselect.vue +0 -376
- package/src/types/TypeNumber.vue +0 -44
- package/src/types/TypeText.vue +0 -67
- package/src/types/TypeTreeList.vue +0 -164
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
.dito-navigation(
|
|
9
9
|
v-if="scopes || hasPagination"
|
|
10
10
|
)
|
|
11
|
-
|
|
11
|
+
DitoScopes(
|
|
12
12
|
v-if="scopes"
|
|
13
13
|
:query="query"
|
|
14
14
|
:scopes="scopes"
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
.dito-spacer(
|
|
19
19
|
v-else-if="hasPagination"
|
|
20
20
|
)
|
|
21
|
-
|
|
21
|
+
DitoPagination(
|
|
22
22
|
v-if="hasPagination"
|
|
23
23
|
:query="query"
|
|
24
24
|
:limit="paginate"
|
|
@@ -32,28 +32,30 @@
|
|
|
32
32
|
'dito-table-even-count': hasEvenCount
|
|
33
33
|
}`
|
|
34
34
|
)
|
|
35
|
-
|
|
35
|
+
DitoTableHead(
|
|
36
36
|
v-if="columns"
|
|
37
37
|
:query="query"
|
|
38
38
|
:columns="columns"
|
|
39
39
|
:hasEditButtons="hasEditButtons"
|
|
40
40
|
)
|
|
41
|
-
|
|
41
|
+
UseSortable(
|
|
42
42
|
tag="tbody"
|
|
43
43
|
:modelValue="updateOrder(sourceSchema, listData, paginationRange)"
|
|
44
|
-
@update:modelValue="value => listData = value"
|
|
45
44
|
:options="getSortableOptions(draggable)"
|
|
45
|
+
@update:modelValue="value => (listData = value)"
|
|
46
46
|
)
|
|
47
47
|
tr(
|
|
48
|
-
v-for="item, index in listData"
|
|
49
|
-
:key="getItemUid(schema, item)"
|
|
48
|
+
v-for="(item, index) in listData"
|
|
50
49
|
:id="getDataPath(index)"
|
|
50
|
+
:key="getItemUid(schema, item)"
|
|
51
51
|
)
|
|
52
|
-
template(
|
|
52
|
+
template(
|
|
53
|
+
v-if="columns"
|
|
54
|
+
)
|
|
53
55
|
template(
|
|
54
56
|
v-for="column in columns"
|
|
55
57
|
)
|
|
56
|
-
|
|
58
|
+
DitoTableCell(
|
|
57
59
|
v-if="shouldRender(column)"
|
|
58
60
|
:key="column.name"
|
|
59
61
|
:class="getCellClass(column)"
|
|
@@ -70,7 +72,7 @@
|
|
|
70
72
|
v-else
|
|
71
73
|
)
|
|
72
74
|
td
|
|
73
|
-
|
|
75
|
+
DitoSchemaInlined(
|
|
74
76
|
v-if="isInlined"
|
|
75
77
|
:label="getItemLabel(schema, item, { index, asObject: true })"
|
|
76
78
|
:schema="getItemFormSchema(schema, item, context)"
|
|
@@ -105,7 +107,7 @@
|
|
|
105
107
|
td.dito-cell-edit-buttons(
|
|
106
108
|
v-if="hasCellEditButtons"
|
|
107
109
|
)
|
|
108
|
-
|
|
110
|
+
DitoEditButtons(
|
|
109
111
|
:deletable="deletable"
|
|
110
112
|
:draggable="draggable"
|
|
111
113
|
:editable="editable"
|
|
@@ -122,10 +124,8 @@
|
|
|
122
124
|
v-if="hasListButtons && !single"
|
|
123
125
|
)
|
|
124
126
|
tr
|
|
125
|
-
td.dito-cell-edit-buttons(
|
|
126
|
-
|
|
127
|
-
)
|
|
128
|
-
dito-edit-buttons(
|
|
127
|
+
td.dito-cell-edit-buttons(:colspan="numColumns")
|
|
128
|
+
DitoEditButtons(
|
|
129
129
|
:creatable="creatable"
|
|
130
130
|
:createPath="path"
|
|
131
131
|
:buttons="buttonSchemas"
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
:store="store"
|
|
137
137
|
)
|
|
138
138
|
//- Render create buttons outside table when in a single component view:
|
|
139
|
-
|
|
139
|
+
DitoEditButtons.dito-buttons-main.dito-buttons-large(
|
|
140
140
|
v-if="hasListButtons && single"
|
|
141
141
|
:creatable="creatable"
|
|
142
142
|
:createPath="path"
|
|
@@ -149,45 +149,23 @@
|
|
|
149
149
|
)
|
|
150
150
|
</template>
|
|
151
151
|
|
|
152
|
-
<style lang="sass">
|
|
153
|
-
@import '../styles/_imports'
|
|
154
|
-
|
|
155
|
-
.dito-list
|
|
156
|
-
position: relative
|
|
157
|
-
.dito-navigation
|
|
158
|
-
display: flex
|
|
159
|
-
justify-content: space-between
|
|
160
|
-
padding-bottom: $content-padding-half
|
|
161
|
-
+user-select(none)
|
|
162
|
-
&:empty
|
|
163
|
-
display: none
|
|
164
|
-
.dito-scopes,
|
|
165
|
-
.dito-pagination
|
|
166
|
-
display: flex
|
|
167
|
-
flex: 0 1 auto
|
|
168
|
-
min-width: 0
|
|
169
|
-
&.dito-single
|
|
170
|
-
// So that list buttons can be sticky to the bottom:
|
|
171
|
-
display: grid
|
|
172
|
-
grid-template-rows: min-content
|
|
173
|
-
height: 100%
|
|
174
|
-
</style>
|
|
175
|
-
|
|
176
152
|
<script>
|
|
177
|
-
import
|
|
153
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
178
154
|
import DitoContext from '../DitoContext.js'
|
|
179
155
|
import SourceMixin from '../mixins/SourceMixin.js'
|
|
180
156
|
import SortableMixin from '../mixins/SortableMixin.js'
|
|
181
157
|
import {
|
|
182
|
-
getNamedSchemas,
|
|
183
|
-
|
|
158
|
+
getNamedSchemas,
|
|
159
|
+
getViewEditPath,
|
|
160
|
+
resolveSchemaComponent,
|
|
161
|
+
resolveSchemaComponents
|
|
184
162
|
} from '../utils/schema.js'
|
|
185
163
|
import { getFiltersPanel } from '../utils/filter.js'
|
|
186
164
|
import { appendDataPath } from '../utils/data.js'
|
|
187
165
|
import { pickBy, equals, hyphenate } from '@ditojs/utils'
|
|
188
166
|
|
|
189
167
|
// @vue/component
|
|
190
|
-
export default
|
|
168
|
+
export default DitoTypeComponent.register('list', {
|
|
191
169
|
mixins: [SourceMixin, SortableMixin],
|
|
192
170
|
|
|
193
171
|
getSourceType(type) {
|
|
@@ -203,15 +181,17 @@ export default TypeComponent.register('list', {
|
|
|
203
181
|
// At the time of the creation of the panel schema, the schemaComponent is
|
|
204
182
|
// not filled yet, so we can't get the target component (dataPath) right
|
|
205
183
|
// away. Use a proxy and a getter instead, to get around this:
|
|
206
|
-
const getListComponent = () =>
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
184
|
+
const getListComponent = () =>
|
|
185
|
+
schemaComponent.getComponentByDataPath(
|
|
186
|
+
dataPath,
|
|
187
|
+
component => component.type === 'list'
|
|
188
|
+
)
|
|
210
189
|
|
|
211
190
|
return getFiltersPanel(
|
|
212
191
|
getNamedSchemas(filters),
|
|
213
192
|
dataPath,
|
|
214
|
-
{
|
|
193
|
+
{
|
|
194
|
+
// Create a simple proxy to get / set the query, see getFiltersPanel()
|
|
215
195
|
get query() {
|
|
216
196
|
return getListComponent()?.query
|
|
217
197
|
},
|
|
@@ -237,18 +217,17 @@ export default TypeComponent.register('list', {
|
|
|
237
217
|
},
|
|
238
218
|
|
|
239
219
|
hasListButtons() {
|
|
240
|
-
return !!(
|
|
241
|
-
this.buttonSchemas ||
|
|
242
|
-
this.creatable
|
|
243
|
-
)
|
|
220
|
+
return !!(this.buttonSchemas || this.creatable)
|
|
244
221
|
},
|
|
245
222
|
|
|
246
223
|
hasEditButtons() {
|
|
247
224
|
const { listData } = this
|
|
248
|
-
return
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
225
|
+
return (
|
|
226
|
+
listData.length > 0 && (
|
|
227
|
+
this.editable ||
|
|
228
|
+
this.deletable ||
|
|
229
|
+
this.draggable
|
|
230
|
+
)
|
|
252
231
|
)
|
|
253
232
|
},
|
|
254
233
|
|
|
@@ -306,19 +285,62 @@ export default TypeComponent.register('list', {
|
|
|
306
285
|
},
|
|
307
286
|
|
|
308
287
|
async processSchema(
|
|
309
|
-
api,
|
|
310
|
-
|
|
288
|
+
api,
|
|
289
|
+
schema,
|
|
290
|
+
name,
|
|
291
|
+
routes,
|
|
292
|
+
level,
|
|
293
|
+
nested = false,
|
|
294
|
+
flatten = false,
|
|
311
295
|
process = null
|
|
312
296
|
) {
|
|
313
297
|
await Promise.all([
|
|
314
298
|
resolveSchemaComponent(schema),
|
|
315
299
|
resolveSchemaComponents(schema.columns),
|
|
316
300
|
SourceMixin.processSchema(
|
|
317
|
-
api,
|
|
318
|
-
|
|
301
|
+
api,
|
|
302
|
+
schema,
|
|
303
|
+
name,
|
|
304
|
+
routes,
|
|
305
|
+
level,
|
|
306
|
+
nested,
|
|
307
|
+
flatten,
|
|
319
308
|
process
|
|
320
309
|
)
|
|
321
310
|
])
|
|
322
311
|
}
|
|
323
312
|
})
|
|
324
313
|
</script>
|
|
314
|
+
|
|
315
|
+
<style lang="scss">
|
|
316
|
+
@import '../styles/_imports';
|
|
317
|
+
|
|
318
|
+
.dito-list {
|
|
319
|
+
position: relative;
|
|
320
|
+
|
|
321
|
+
.dito-navigation {
|
|
322
|
+
display: flex;
|
|
323
|
+
justify-content: space-between;
|
|
324
|
+
padding-bottom: $content-padding-half;
|
|
325
|
+
@include user-select(none);
|
|
326
|
+
|
|
327
|
+
&:empty {
|
|
328
|
+
display: none;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.dito-scopes,
|
|
332
|
+
.dito-pagination {
|
|
333
|
+
display: flex;
|
|
334
|
+
flex: 0 1 auto;
|
|
335
|
+
min-width: 0;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
&.dito-single {
|
|
340
|
+
// So that list buttons can be sticky to the bottom:
|
|
341
|
+
display: grid;
|
|
342
|
+
grid-template-rows: min-content;
|
|
343
|
+
height: 100%;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
</style>
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
<template lang="pug">
|
|
2
|
-
.dito-markup(
|
|
3
|
-
:id="dataPath"
|
|
4
|
-
)
|
|
2
|
+
.dito-markup(:id="dataPath")
|
|
5
3
|
.dito-markup-toolbar(:editor="editor")
|
|
6
4
|
.dito-buttons.dito-buttons-toolbar(
|
|
7
5
|
v-if="groupedButtons.length > 0"
|
|
@@ -11,11 +9,12 @@
|
|
|
11
9
|
)
|
|
12
10
|
button.dito-button(
|
|
13
11
|
v-for="{ name, icon, isActive, onClick } in buttons"
|
|
14
|
-
:
|
|
12
|
+
:key="name"
|
|
13
|
+
:class="{ 'dito-active': isActive }"
|
|
15
14
|
@click="onClick"
|
|
16
15
|
)
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
Icon(:name="icon")
|
|
17
|
+
EditorContent.dito-markup-editor(
|
|
19
18
|
ref="editor"
|
|
20
19
|
:editor="editor"
|
|
21
20
|
:style="styles"
|
|
@@ -26,98 +25,8 @@
|
|
|
26
25
|
)
|
|
27
26
|
</template>
|
|
28
27
|
|
|
29
|
-
<style lang="sass">
|
|
30
|
-
@import '../styles/_imports'
|
|
31
|
-
|
|
32
|
-
.dito-markup
|
|
33
|
-
@extend %input
|
|
34
|
-
position: relative
|
|
35
|
-
|
|
36
|
-
.dito-resize
|
|
37
|
-
@extend %icon-resize
|
|
38
|
-
position: absolute
|
|
39
|
-
top: unset
|
|
40
|
-
left: unset
|
|
41
|
-
right: 0
|
|
42
|
-
bottom: 0
|
|
43
|
-
width: 1em
|
|
44
|
-
height: 1em
|
|
45
|
-
|
|
46
|
-
.ProseMirror
|
|
47
|
-
height: 100%
|
|
48
|
-
outline: none
|
|
49
|
-
|
|
50
|
-
.dito-markup-editor
|
|
51
|
-
overflow-y: scroll
|
|
52
|
-
// Move padding "inside" editor to correctly position scrollbar
|
|
53
|
-
margin-right: -$input-padding-hor
|
|
54
|
-
padding-right: $input-padding-hor
|
|
55
|
-
|
|
56
|
-
.dito-buttons-toolbar
|
|
57
|
-
margin: $input-padding-ver 0
|
|
58
|
-
|
|
59
|
-
h1,
|
|
60
|
-
h2,
|
|
61
|
-
h3,
|
|
62
|
-
p,
|
|
63
|
-
ul,
|
|
64
|
-
ol,
|
|
65
|
-
pre,
|
|
66
|
-
blockquote
|
|
67
|
-
margin: 1rem 0
|
|
68
|
-
&:first-child
|
|
69
|
-
margin-top: 0
|
|
70
|
-
&:last-child
|
|
71
|
-
margin-bottom: 0
|
|
72
|
-
h1,
|
|
73
|
-
h2,
|
|
74
|
-
h3
|
|
75
|
-
font-weight: bold
|
|
76
|
-
h1
|
|
77
|
-
font-size: 1.4rem
|
|
78
|
-
h2
|
|
79
|
-
font-size: 1.2rem
|
|
80
|
-
ul
|
|
81
|
-
list-style: disc
|
|
82
|
-
code
|
|
83
|
-
font-family: $font-family-mono
|
|
84
|
-
pre
|
|
85
|
-
padding: 0.7rem 1rem
|
|
86
|
-
border-radius: $border-radius
|
|
87
|
-
background: $color-darker
|
|
88
|
-
color: $color-white
|
|
89
|
-
overflow-x: auto
|
|
90
|
-
code
|
|
91
|
-
display: block
|
|
92
|
-
p code
|
|
93
|
-
display: inline-block
|
|
94
|
-
padding: 0 0.3rem
|
|
95
|
-
border-radius: $border-radius
|
|
96
|
-
background: $color-lighter
|
|
97
|
-
a
|
|
98
|
-
pointer-events: none
|
|
99
|
-
cursor: default
|
|
100
|
-
color: blue
|
|
101
|
-
text-decoration: underline
|
|
102
|
-
ul,
|
|
103
|
-
ol
|
|
104
|
-
padding-left: 2rem
|
|
105
|
-
li
|
|
106
|
-
& > p,
|
|
107
|
-
& > ol,
|
|
108
|
-
& > ul
|
|
109
|
-
margin: 0
|
|
110
|
-
blockquote
|
|
111
|
-
border-left: 3px solid $color-lighter
|
|
112
|
-
padding-left: 1rem
|
|
113
|
-
font-style: italic
|
|
114
|
-
p
|
|
115
|
-
margin: 0
|
|
116
|
-
|
|
117
|
-
</style>
|
|
118
|
-
|
|
119
28
|
<script>
|
|
120
|
-
import
|
|
29
|
+
import DitoTypeComponent from '../DitoTypeComponent.js'
|
|
121
30
|
import DomMixin from '../mixins/DomMixin.js'
|
|
122
31
|
import { getSchemaAccessor } from '../utils/accessor.js'
|
|
123
32
|
import { Editor, EditorContent, Mark, getMarkAttributes } from '@tiptap/vue-3'
|
|
@@ -158,18 +67,22 @@ import { History } from '@tiptap/extension-history'
|
|
|
158
67
|
|
|
159
68
|
import { Icon } from '@ditojs/ui/src'
|
|
160
69
|
import {
|
|
161
|
-
isArray,
|
|
70
|
+
isArray,
|
|
71
|
+
isObject,
|
|
72
|
+
underscore,
|
|
73
|
+
hyphenate,
|
|
74
|
+
debounce,
|
|
75
|
+
camelize
|
|
162
76
|
} from '@ditojs/utils'
|
|
163
77
|
|
|
164
78
|
// @vue/component
|
|
165
|
-
export default
|
|
79
|
+
export default DitoTypeComponent.register('markup', {
|
|
80
|
+
mixins: [DomMixin],
|
|
166
81
|
components: {
|
|
167
82
|
EditorContent,
|
|
168
83
|
Icon
|
|
169
84
|
},
|
|
170
85
|
|
|
171
|
-
mixins: [DomMixin],
|
|
172
|
-
|
|
173
86
|
data() {
|
|
174
87
|
return {
|
|
175
88
|
editor: null,
|
|
@@ -205,8 +118,8 @@ export default TypeComponent.register('markup', {
|
|
|
205
118
|
basicNodeButtons() {
|
|
206
119
|
return this.getButtons('nodes', {
|
|
207
120
|
paragraph: {
|
|
208
|
-
|
|
209
|
-
|
|
121
|
+
// Do not show the paragraph command as active if any of the block
|
|
122
|
+
// commands are also active:
|
|
210
123
|
ignoreActive: () =>
|
|
211
124
|
this.otherNodeButtons.some(button => button.isActive)
|
|
212
125
|
},
|
|
@@ -286,9 +199,9 @@ export default TypeComponent.register('markup', {
|
|
|
286
199
|
return isObject(enableRules)
|
|
287
200
|
? enableRules
|
|
288
201
|
: {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
202
|
+
input: !!enableRules,
|
|
203
|
+
paste: !!enableRules
|
|
204
|
+
}
|
|
292
205
|
}
|
|
293
206
|
})
|
|
294
207
|
},
|
|
@@ -411,6 +324,7 @@ export default TypeComponent.register('markup', {
|
|
|
411
324
|
// See if `href` can be parsed as a URL, and if not,
|
|
412
325
|
// prefix it with a default protocol.
|
|
413
326
|
try {
|
|
327
|
+
// eslint-disable-next-line no-new
|
|
414
328
|
new URL(href)
|
|
415
329
|
} catch {
|
|
416
330
|
href = `https://${href}`
|
|
@@ -542,15 +456,21 @@ const Small = Mark.create({
|
|
|
542
456
|
|
|
543
457
|
addCommands() {
|
|
544
458
|
return {
|
|
545
|
-
setSmall:
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
459
|
+
setSmall:
|
|
460
|
+
attributes =>
|
|
461
|
+
({ commands }) => {
|
|
462
|
+
return commands.setMark(this.name, attributes)
|
|
463
|
+
},
|
|
464
|
+
toggleSmall:
|
|
465
|
+
attributes =>
|
|
466
|
+
({ commands }) => {
|
|
467
|
+
return commands.toggleMark(this.name, attributes)
|
|
468
|
+
},
|
|
469
|
+
unsetSmall:
|
|
470
|
+
() =>
|
|
471
|
+
({ commands }) => {
|
|
472
|
+
return commands.unsetMark(this.name)
|
|
473
|
+
}
|
|
554
474
|
}
|
|
555
475
|
}
|
|
556
476
|
})
|
|
@@ -568,13 +488,15 @@ const LinkWithTitle = Link.extend({
|
|
|
568
488
|
},
|
|
569
489
|
|
|
570
490
|
parseHTML() {
|
|
571
|
-
return [
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
491
|
+
return [
|
|
492
|
+
{
|
|
493
|
+
tag: 'a',
|
|
494
|
+
getAttrs: element => ({
|
|
495
|
+
href: element.getAttribute('href'),
|
|
496
|
+
title: element.getAttribute('title')
|
|
497
|
+
})
|
|
498
|
+
}
|
|
499
|
+
]
|
|
578
500
|
},
|
|
579
501
|
|
|
580
502
|
renderHTML(node) {
|
|
@@ -583,3 +505,131 @@ const LinkWithTitle = Link.extend({
|
|
|
583
505
|
}
|
|
584
506
|
})
|
|
585
507
|
</script>
|
|
508
|
+
|
|
509
|
+
<style lang="scss">
|
|
510
|
+
@import '../styles/_imports';
|
|
511
|
+
|
|
512
|
+
.dito-markup {
|
|
513
|
+
@extend %input;
|
|
514
|
+
|
|
515
|
+
position: relative;
|
|
516
|
+
|
|
517
|
+
.dito-resize {
|
|
518
|
+
@extend %icon-resize;
|
|
519
|
+
|
|
520
|
+
position: absolute;
|
|
521
|
+
top: unset;
|
|
522
|
+
left: unset;
|
|
523
|
+
right: 0;
|
|
524
|
+
bottom: 0;
|
|
525
|
+
width: 1em;
|
|
526
|
+
height: 1em;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
.ProseMirror {
|
|
530
|
+
height: 100%;
|
|
531
|
+
outline: none;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.dito-markup-editor {
|
|
535
|
+
overflow-y: scroll;
|
|
536
|
+
// Move padding "inside" editor to correctly position scrollbar
|
|
537
|
+
margin-right: -$input-padding-hor;
|
|
538
|
+
padding-right: $input-padding-hor;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.dito-buttons-toolbar {
|
|
542
|
+
margin: $input-padding-ver 0;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
h1,
|
|
546
|
+
h2,
|
|
547
|
+
h3,
|
|
548
|
+
p,
|
|
549
|
+
ul,
|
|
550
|
+
ol,
|
|
551
|
+
pre,
|
|
552
|
+
blockquote {
|
|
553
|
+
margin: 1rem 0;
|
|
554
|
+
|
|
555
|
+
&:first-child {
|
|
556
|
+
margin-top: 0;
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
&:last-child {
|
|
560
|
+
margin-bottom: 0;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
h1,
|
|
565
|
+
h2,
|
|
566
|
+
h3 {
|
|
567
|
+
font-weight: bold;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
h1 {
|
|
571
|
+
font-size: 1.4rem;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
h2 {
|
|
575
|
+
font-size: 1.2rem;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
ul {
|
|
579
|
+
list-style: disc;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
code {
|
|
583
|
+
font-family: $font-family-mono;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
pre {
|
|
587
|
+
padding: 0.7rem 1rem;
|
|
588
|
+
border-radius: $border-radius;
|
|
589
|
+
background: $color-darker;
|
|
590
|
+
color: $color-white;
|
|
591
|
+
overflow-x: auto;
|
|
592
|
+
|
|
593
|
+
code {
|
|
594
|
+
display: block;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
p code {
|
|
599
|
+
display: inline-block;
|
|
600
|
+
padding: 0 0.3rem;
|
|
601
|
+
border-radius: $border-radius;
|
|
602
|
+
background: $color-lighter;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
a {
|
|
606
|
+
pointer-events: none;
|
|
607
|
+
cursor: default;
|
|
608
|
+
color: blue;
|
|
609
|
+
text-decoration: underline;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
ul,
|
|
613
|
+
ol {
|
|
614
|
+
padding-left: 2rem;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
li {
|
|
618
|
+
& > p,
|
|
619
|
+
& > ol,
|
|
620
|
+
& > ul {
|
|
621
|
+
margin: 0;
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
blockquote {
|
|
626
|
+
border-left: 3px solid $color-lighter;
|
|
627
|
+
padding-left: 1rem;
|
|
628
|
+
font-style: italic;
|
|
629
|
+
|
|
630
|
+
p {
|
|
631
|
+
margin: 0;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
</style>
|