@blokkli/editor 1.0.2 → 1.0.4
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/README.md +0 -6
- package/dist/module.json +1 -1
- package/dist/module.mjs +11 -3
- package/dist/runtime/components/BlokkliField.vue +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +5 -3
- package/dist/runtime/components/Edit/DraggableList.vue +1 -1
- package/dist/runtime/components/Edit/Features/Edit/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +2 -4
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Translations/index.vue +18 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +5 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +4 -6
- package/dist/runtime/types/index.d.ts +9 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,12 +51,6 @@ implements all features available in the editor. It provides a new edit state
|
|
|
51
51
|
entity that stores the applied mutations and implements a GraphQL schema
|
|
52
52
|
extension to integrate the adapter.
|
|
53
53
|
|
|
54
|
-
## Roadmap
|
|
55
|
-
|
|
56
|
-
blökkli is currently still in beta and therefore subject to change. If you're
|
|
57
|
-
considering integrating it in production sites you should probably wait until
|
|
58
|
-
the first stable release.
|
|
59
|
-
|
|
60
54
|
## Acknowledgments
|
|
61
55
|
|
|
62
56
|
blökkli was developed by [dulnan](https://github.com/dulnan) at
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { createUnplugin } from 'unplugin';
|
|
|
6
6
|
import MagicString from 'magic-string';
|
|
7
7
|
import { walk } from 'estree-walker-ts';
|
|
8
8
|
|
|
9
|
-
const version = "1.0.
|
|
9
|
+
const version = "1.0.4";
|
|
10
10
|
|
|
11
11
|
function sortObjectKeys(obj) {
|
|
12
12
|
const sortedKeys = Object.keys(obj).sort();
|
|
@@ -237,10 +237,14 @@ class BlockExtractor {
|
|
|
237
237
|
acc.push(
|
|
238
238
|
`${bundle}__parent_block_${entry.parentBundle}: ${v.componentName}`
|
|
239
239
|
);
|
|
240
|
-
} else {
|
|
240
|
+
} else if ("fieldList" in entry) {
|
|
241
241
|
acc.push(
|
|
242
242
|
`${bundle}__field_list_type_${entry.fieldList}: ${v.componentName}`
|
|
243
243
|
);
|
|
244
|
+
} else if ("fieldListType" in entry) {
|
|
245
|
+
acc.push(
|
|
246
|
+
`${bundle}__field_list_type_${entry.fieldListType}: ${v.componentName}`
|
|
247
|
+
);
|
|
244
248
|
}
|
|
245
249
|
});
|
|
246
250
|
} else {
|
|
@@ -551,10 +555,14 @@ export function getBlokkliFragmentComponent(name: string): any {
|
|
|
551
555
|
acc.push(
|
|
552
556
|
`block_${bundle}__parent_block_${entry.parentBundle}: ${v.componentName}`
|
|
553
557
|
);
|
|
554
|
-
} else {
|
|
558
|
+
} else if ("fieldList" in entry) {
|
|
555
559
|
acc.push(
|
|
556
560
|
`block_${bundle}__field_list_type_${entry.fieldList}: ${v.componentName}`
|
|
557
561
|
);
|
|
562
|
+
} else if ("fieldListType" in entry) {
|
|
563
|
+
acc.push(
|
|
564
|
+
`block_${bundle}__field_list_type_${entry.fieldListType}: ${v.componentName}`
|
|
565
|
+
);
|
|
558
566
|
}
|
|
559
567
|
});
|
|
560
568
|
}
|
|
@@ -158,15 +158,17 @@ function onPointerDown(e: PointerEvent) {
|
|
|
158
158
|
e.stopImmediatePropagation()
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
if (e.pointerType === 'touch') {
|
|
162
|
+
return onTouchStart(e)
|
|
163
|
+
}
|
|
164
|
+
|
|
161
165
|
// If we are already dragging, return.
|
|
162
166
|
// This might be the case if a dragging:start event was manually triggered,
|
|
163
167
|
// e.g. when selecting a draggable item using the keyboard.
|
|
164
168
|
if (selection.isDragging.value) {
|
|
165
169
|
return
|
|
166
170
|
}
|
|
167
|
-
|
|
168
|
-
return onTouchStart(e)
|
|
169
|
-
}
|
|
171
|
+
|
|
170
172
|
pointerDownTimestamp = Date.now()
|
|
171
173
|
const coords = { x: e.clientX, y: e.clientY }
|
|
172
174
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<PluginItemAction
|
|
3
|
+
v-if="isEditing"
|
|
3
4
|
id="edit"
|
|
4
5
|
:title="$t('edit', 'Edit')"
|
|
5
6
|
:disabled="!canEdit"
|
|
@@ -36,6 +37,8 @@ const block = computed(() => {
|
|
|
36
37
|
return selection.blocks.value[0]
|
|
37
38
|
})
|
|
38
39
|
|
|
40
|
+
const isEditing = computed(() => state.editMode.value === 'editing')
|
|
41
|
+
|
|
39
42
|
const canEdit = computed(() => {
|
|
40
43
|
// Editing is only possible when a single block is selected.
|
|
41
44
|
if (!block.value) {
|
|
@@ -44,7 +44,7 @@ const onSelect = (uuids: string[]) => {
|
|
|
44
44
|
let startTimeout: any = null
|
|
45
45
|
|
|
46
46
|
onBlokkliEvent('mouse:down', (e) => {
|
|
47
|
-
if (!enabled.value || e.type !== 'mouse') {
|
|
47
|
+
if (!enabled.value || e.type !== 'mouse' || selection.isDragging.value) {
|
|
48
48
|
return
|
|
49
49
|
}
|
|
50
50
|
if (keyboard.isPressingSpace.value || keyboard.isPressingControl.value) {
|
|
@@ -69,6 +69,7 @@ import OptionColor from './Color/index.vue'
|
|
|
69
69
|
import OptionRange from './Range/index.vue'
|
|
70
70
|
import OptionNumber from './Number/index.vue'
|
|
71
71
|
import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions'
|
|
72
|
+
import { mapCheckboxTrue } from '#blokkli/helpers/runtimeHelpers'
|
|
72
73
|
|
|
73
74
|
const { state } = useBlokkli()
|
|
74
75
|
|
|
@@ -99,10 +100,7 @@ const validateValue = (
|
|
|
99
100
|
return v
|
|
100
101
|
}
|
|
101
102
|
} else if (props.option.type === 'checkbox') {
|
|
102
|
-
|
|
103
|
-
return v ? '1' : '0'
|
|
104
|
-
}
|
|
105
|
-
return v === '1' ? '1' : '0'
|
|
103
|
+
return mapCheckboxTrue(v)
|
|
106
104
|
} else if (props.option.type === 'checkboxes') {
|
|
107
105
|
const options = Object.keys(props.option.options || {})
|
|
108
106
|
const items = Array.isArray(v)
|
|
@@ -258,6 +258,7 @@ const visibleOptions = computed<OptionItem[]>(() => {
|
|
|
258
258
|
parentType: parentType as any,
|
|
259
259
|
props: ctxProps as any,
|
|
260
260
|
entity: context.value,
|
|
261
|
+
fieldListType: block?.hostFieldListType || 'default',
|
|
261
262
|
})
|
|
262
263
|
|
|
263
264
|
return availableOptions.value.filter((v) => visibleKeys.includes(v.property))
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
:disabled="!canTranslateBlock"
|
|
76
76
|
:title="$t('translationsItemAction', 'Translate')"
|
|
77
77
|
icon="translate"
|
|
78
|
+
:weight="-100"
|
|
78
79
|
@click="onTranslate"
|
|
79
80
|
/>
|
|
80
81
|
</template>
|
|
@@ -100,6 +101,7 @@ import type {
|
|
|
100
101
|
} from '#blokkli/types'
|
|
101
102
|
import Banner from './Banner/index.vue'
|
|
102
103
|
import { getDefinition } from '#blokkli/definitions'
|
|
104
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
103
105
|
|
|
104
106
|
const { adapter } = defineBlokkliFeature({
|
|
105
107
|
id: 'translations',
|
|
@@ -109,7 +111,7 @@ const { adapter } = defineBlokkliFeature({
|
|
|
109
111
|
description: 'Adds support for block translations.',
|
|
110
112
|
})
|
|
111
113
|
|
|
112
|
-
const { eventBus, state, context, $t, ui, selection } = useBlokkli()
|
|
114
|
+
const { eventBus, state, context, $t, ui, selection, types } = useBlokkli()
|
|
113
115
|
const { translation, editMode } = state
|
|
114
116
|
|
|
115
117
|
const isOpen = ref(false)
|
|
@@ -173,6 +175,15 @@ const canTranslateBlock = computed(() => {
|
|
|
173
175
|
if (definition?.editor?.disableEdit) {
|
|
174
176
|
return false
|
|
175
177
|
}
|
|
178
|
+
const type = types.getBlockBundleDefinition(block.itemBundle)
|
|
179
|
+
|
|
180
|
+
if (!type) {
|
|
181
|
+
return false
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (!type.isTranslatable) {
|
|
185
|
+
return false
|
|
186
|
+
}
|
|
176
187
|
|
|
177
188
|
return true
|
|
178
189
|
})
|
|
@@ -195,6 +206,12 @@ function onTranslate(items: DraggableExistingBlock[]) {
|
|
|
195
206
|
})
|
|
196
207
|
}
|
|
197
208
|
|
|
209
|
+
onBlokkliEvent('item:doubleClick', function (block) {
|
|
210
|
+
if (editMode.value === 'translating' && canTranslateBlock.value) {
|
|
211
|
+
onTranslate([block])
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
|
|
198
215
|
onMounted(() => {
|
|
199
216
|
// Make sure the user is not trying to edit a translation that does not exist.
|
|
200
217
|
const translationExists = !!translation.value.translations?.find(
|