@blokkli/editor 1.0.0 → 1.0.2
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/module.json +1 -1
- package/dist/module.mjs +35 -3
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +9 -1
- package/dist/runtime/adapter/index.d.ts +4 -0
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +2 -3
- package/dist/runtime/components/Edit/Dialog/index.vue +14 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +1 -4
- package/dist/runtime/components/Edit/EditProvider.vue +1 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +33 -27
- package/dist/runtime/components/Edit/Features/Edit/index.vue +60 -14
- package/dist/runtime/components/Edit/Features/Exit/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +206 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +7 -8
- package/dist/runtime/components/Edit/Features/Library/index.vue +25 -2
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +11 -10
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +26 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/broadcastProvider.d.ts +10 -2
- package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +2 -0
- package/dist/runtime/helpers/composables/onBroadcastEvent.js +10 -0
- package/dist/runtime/helpers/featuresProvider.d.ts +2 -2
- package/dist/runtime/helpers/index.js +2 -2
- package/dist/runtime/types/index.d.ts +12 -2
- package/package.json +1 -1
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</Teleport>
|
|
51
51
|
|
|
52
52
|
<Teleport to="body">
|
|
53
|
-
<transition name="bk-slide-
|
|
53
|
+
<transition name="bk-slide-up" :duration="200">
|
|
54
54
|
<LibraryDialog
|
|
55
55
|
v-if="placedAction && adapter.getLibraryItems"
|
|
56
56
|
:field="placedAction.field"
|
|
@@ -59,6 +59,12 @@
|
|
|
59
59
|
/>
|
|
60
60
|
</transition>
|
|
61
61
|
</Teleport>
|
|
62
|
+
<EditReusable
|
|
63
|
+
v-if="editingLibraryItem"
|
|
64
|
+
v-bind="editingLibraryItem"
|
|
65
|
+
@submit="onSubmitLibraryItem"
|
|
66
|
+
@close="cancelLibraryItemEdit"
|
|
67
|
+
/>
|
|
62
68
|
</template>
|
|
63
69
|
|
|
64
70
|
<script lang="ts" setup>
|
|
@@ -66,8 +72,10 @@ import { ref, computed, useBlokkli, defineBlokkliFeature } from '#imports'
|
|
|
66
72
|
import { PluginItemAction, PluginAddAction } from '#blokkli/plugins'
|
|
67
73
|
import ReusableDialog from './ReusableDialog/index.vue'
|
|
68
74
|
import LibraryDialog from './LibraryDialog/index.vue'
|
|
75
|
+
import EditReusable from './EditReusable/index.vue'
|
|
69
76
|
import { getDefinition } from '#blokkli/definitions'
|
|
70
|
-
import type { ActionPlacedEvent } from '#blokkli/types'
|
|
77
|
+
import type { ActionPlacedEvent, LibraryEditItemEvent } from '#blokkli/types'
|
|
78
|
+
import onBlokkliEvent from '#blokkli/helpers/composables/onBlokkliEvent'
|
|
71
79
|
|
|
72
80
|
const { adapter } = defineBlokkliFeature({
|
|
73
81
|
id: 'library',
|
|
@@ -175,6 +183,21 @@ const canMakeReusable = computed(
|
|
|
175
183
|
itemBundle?.value?.allowReusable &&
|
|
176
184
|
fromLibraryAllowedInList.value,
|
|
177
185
|
)
|
|
186
|
+
|
|
187
|
+
const editingLibraryItem = ref<LibraryEditItemEvent | null>(null)
|
|
188
|
+
|
|
189
|
+
onBlokkliEvent('library:edit-item', function (e) {
|
|
190
|
+
editingLibraryItem.value = e
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
function cancelLibraryItemEdit() {
|
|
194
|
+
editingLibraryItem.value = null
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function onSubmitLibraryItem() {
|
|
198
|
+
eventBus.emit('reloadState')
|
|
199
|
+
cancelLibraryItemEdit()
|
|
200
|
+
}
|
|
178
201
|
</script>
|
|
179
202
|
|
|
180
203
|
<script lang="ts">
|
|
@@ -98,7 +98,7 @@ import {
|
|
|
98
98
|
nextTick,
|
|
99
99
|
} from '#imports'
|
|
100
100
|
import { Sortli, Icon } from '#blokkli/components'
|
|
101
|
-
import type { MediaLibraryFilter } from './../types'
|
|
101
|
+
import type { MediaLibraryFilter, MediaLibraryGetResults } from './../types'
|
|
102
102
|
import type { BlokkliIcon } from '#blokkli/icons'
|
|
103
103
|
|
|
104
104
|
const props = defineProps<{
|
|
@@ -150,15 +150,16 @@ watch(key, () => {
|
|
|
150
150
|
page.value = 0
|
|
151
151
|
})
|
|
152
152
|
|
|
153
|
-
const { data, status } =
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
153
|
+
const { data, status } =
|
|
154
|
+
await useLazyAsyncData<MediaLibraryGetResults<any> | null>(
|
|
155
|
+
() => {
|
|
156
|
+
return adapter.mediaLibraryGetResults!({
|
|
157
|
+
filters: filterValues.value,
|
|
158
|
+
page: page.value,
|
|
159
|
+
})
|
|
160
|
+
},
|
|
161
|
+
{ watch: [key, page] },
|
|
162
|
+
)
|
|
162
163
|
|
|
163
164
|
watch(data, () => {
|
|
164
165
|
nextTick(() => {
|
|
@@ -111,7 +111,7 @@ defineDropAreas((dragItems) => {
|
|
|
111
111
|
// Generate a drop area for every matching droppable field.
|
|
112
112
|
return dom
|
|
113
113
|
.getAllDroppableFields()
|
|
114
|
-
.map<DropArea | undefined>((field) => {
|
|
114
|
+
.map<DropArea | undefined>((field: DroppableEntityField) => {
|
|
115
115
|
const config = types.getDroppableFieldConfig(field.fieldName, field.host)
|
|
116
116
|
// @TODO: This should be provided by the adapter on the item.
|
|
117
117
|
if (config.allowedEntityType !== 'media') {
|
|
@@ -24,7 +24,7 @@ const { adapter } = defineBlokkliFeature({
|
|
|
24
24
|
'Provides a menu button to publish the changes of the current entity.',
|
|
25
25
|
})
|
|
26
26
|
|
|
27
|
-
const { state, $t, eventBus } = useBlokkli()
|
|
27
|
+
const { state, $t, eventBus, broadcast, context } = useBlokkli()
|
|
28
28
|
const { mutations, canEdit, mutateWithLoadingState } = state
|
|
29
29
|
|
|
30
30
|
const onClick = async () => {
|
|
@@ -39,7 +39,10 @@ const onClick = async () => {
|
|
|
39
39
|
if (validations.length) {
|
|
40
40
|
eventBus.emit('publish:failed')
|
|
41
41
|
}
|
|
42
|
+
return
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
broadcast.emit('published', { uuid: context.value.entityUuid })
|
|
43
46
|
}
|
|
44
47
|
</script>
|
|
45
48
|
|
|
@@ -96,7 +96,7 @@ const doSearch = () => {
|
|
|
96
96
|
// This component can only ever be rendered if this adapter method exists,
|
|
97
97
|
// so we can safely assume it's there.
|
|
98
98
|
adapter.getContentSearchResults!(props.tab, props.search).then(
|
|
99
|
-
(newItems) => {
|
|
99
|
+
(newItems: SearchContentItem[]) => {
|
|
100
100
|
items.value = newItems
|
|
101
101
|
itemsSearchTerm.value = searchTerm
|
|
102
102
|
isLoading.value = false
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
<PluginItemAction
|
|
73
73
|
v-if="editMode === 'translating'"
|
|
74
74
|
id="translate"
|
|
75
|
+
:disabled="!canTranslateBlock"
|
|
75
76
|
:title="$t('translationsItemAction', 'Translate')"
|
|
76
77
|
icon="translate"
|
|
77
78
|
@click="onTranslate"
|
|
@@ -98,6 +99,7 @@ import type {
|
|
|
98
99
|
Language,
|
|
99
100
|
} from '#blokkli/types'
|
|
100
101
|
import Banner from './Banner/index.vue'
|
|
102
|
+
import { getDefinition } from '#blokkli/definitions'
|
|
101
103
|
|
|
102
104
|
const { adapter } = defineBlokkliFeature({
|
|
103
105
|
id: 'translations',
|
|
@@ -107,7 +109,7 @@ const { adapter } = defineBlokkliFeature({
|
|
|
107
109
|
description: 'Adds support for block translations.',
|
|
108
110
|
})
|
|
109
111
|
|
|
110
|
-
const { eventBus, state, context, $t, ui } = useBlokkli()
|
|
112
|
+
const { eventBus, state, context, $t, ui, selection } = useBlokkli()
|
|
111
113
|
const { translation, editMode } = state
|
|
112
114
|
|
|
113
115
|
const isOpen = ref(false)
|
|
@@ -152,6 +154,29 @@ const items = computed<TranslationStateItem[]>(() => {
|
|
|
152
154
|
.filter(falsy)
|
|
153
155
|
})
|
|
154
156
|
|
|
157
|
+
const canTranslateBlock = computed(() => {
|
|
158
|
+
if (selection.blocks.value.length !== 1) {
|
|
159
|
+
return false
|
|
160
|
+
}
|
|
161
|
+
const block = selection.blocks.value[0]
|
|
162
|
+
|
|
163
|
+
if (block.libraryItemUuid) {
|
|
164
|
+
return false
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
const definition = getDefinition(
|
|
168
|
+
block.itemBundle,
|
|
169
|
+
block.hostFieldListType,
|
|
170
|
+
block.parentBlockBundle,
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
if (definition?.editor?.disableEdit) {
|
|
174
|
+
return false
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return true
|
|
178
|
+
})
|
|
179
|
+
|
|
155
180
|
function onClick(item: TranslationStateItem, event: Event) {
|
|
156
181
|
if (item.translation?.exists) {
|
|
157
182
|
return adapter.changeLanguage(item.translation)
|