@blokkli/editor 2.0.0-alpha.17 → 2.0.0-alpha.19
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 +380 -59
- package/dist/modules/drupal/graphql/base/fragment.paragraphsFieldItem.graphql +3 -1
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +1 -10
- package/dist/modules/drupal/graphql/mutations/set_paragraph_schedule.graphql +15 -0
- package/dist/modules/drupal/index.mjs +33 -0
- package/dist/modules/drupal/runtime/adapter/index.js +10 -2
- package/dist/runtime/adapter/index.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +23 -13
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/BlokkliEditable.vue +13 -13
- package/dist/runtime/components/BlokkliField.vue.d.ts +3 -3
- package/dist/runtime/components/BlokkliItem.vue +1 -1
- package/dist/runtime/components/BlokkliItem.vue.d.ts +4 -2
- package/dist/runtime/components/BlokkliProvider.vue +12 -8
- package/dist/runtime/components/Edit/Actions/index.vue +27 -16
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +26 -10
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +3 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +6 -4
- package/dist/runtime/components/Edit/DraggableList.vue +15 -7
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/EditProvider.vue +29 -16
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +9 -6
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +1 -1
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +15 -11
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +19 -102
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +3 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +28 -52
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue +154 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/ScheduleSection.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue +222 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/Dialog/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -0
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +15 -16
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Item/index.vue +51 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts +9 -13
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +46 -66
- package/dist/runtime/components/Edit/Features/Comments/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Debug/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +13 -5
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +14 -11
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +30 -18
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +6 -8
- package/dist/runtime/components/Edit/Features/Edit/index.vue +15 -21
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +8 -3
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +29 -12
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +40 -42
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +16 -25
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/Library/index.vue +27 -23
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +6 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +15 -12
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +68 -15
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +15 -15
- package/dist/runtime/components/Edit/Features/Search/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +34 -11
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +21 -20
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +3 -3
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +61 -27
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +13 -6
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +2 -27
- package/dist/runtime/components/Edit/Features/Translations/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +5 -5
- package/dist/runtime/components/Edit/Features/index.vue +17 -7
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +4 -3
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue +6 -2
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +12 -2
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue.d.ts → ScheduleDate/index.vue.d.ts} +11 -1
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +3 -0
- package/dist/runtime/components/Edit/Transition/Height.vue +95 -0
- package/dist/runtime/components/Edit/Transition/Height.vue.d.ts +36 -0
- package/dist/runtime/components/Edit/index.d.ts +3 -1
- package/dist/runtime/components/Edit/index.js +5 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +2 -1
- package/dist/runtime/helpers/animationProvider.js +6 -2
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -1
- package/dist/runtime/helpers/domProvider.d.ts +10 -16
- package/dist/runtime/helpers/domProvider.js +80 -135
- package/dist/runtime/helpers/index.d.ts +1 -8
- package/dist/runtime/helpers/index.js +1 -84
- package/dist/runtime/helpers/providers/blocks.d.ts +10 -0
- package/dist/runtime/helpers/providers/blocks.js +91 -0
- package/dist/runtime/helpers/providers/directive.d.ts +24 -0
- package/dist/runtime/helpers/{editableProvider.js → providers/directive.js} +90 -29
- package/dist/runtime/helpers/providers/element.d.ts +6 -0
- package/dist/runtime/helpers/providers/element.js +35 -0
- package/dist/runtime/helpers/providers/fields.d.ts +8 -0
- package/dist/runtime/helpers/providers/fields.js +47 -0
- package/dist/runtime/helpers/selectionProvider.d.ts +11 -11
- package/dist/runtime/helpers/selectionProvider.js +38 -45
- package/dist/runtime/helpers/stateProvider.d.ts +1 -0
- package/dist/runtime/helpers/stateProvider.js +21 -15
- package/dist/runtime/helpers/themeProvider.d.ts +2 -1
- package/dist/runtime/helpers/themeProvider.js +24 -14
- package/dist/runtime/helpers/typesProvider.js +10 -26
- package/dist/runtime/helpers/uiProvider.d.ts +3 -2
- package/dist/runtime/helpers/uiProvider.js +11 -15
- package/dist/runtime/icons/calendar.svg +1 -0
- package/dist/runtime/icons/clock.svg +1 -0
- package/dist/runtime/icons/comment_add.svg +1 -5
- package/dist/runtime/icons/delete.svg +1 -8
- package/dist/runtime/icons/duplicate.svg +1 -12
- package/dist/runtime/icons/edit.svg +1 -8
- package/dist/runtime/icons/reusable.svg +1 -5
- package/dist/runtime/plugins/{blokkliEditable.js → blokkliDirectives.js} +14 -20
- package/dist/runtime/types/index.d.ts +55 -36
- package/package.json +1 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/helpers/editableProvider.d.ts +0 -14
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -7,7 +7,7 @@ query pbConfig($entityType: String!, $entityBundle: String!) {
|
|
|
7
7
|
}
|
|
8
8
|
allTypes: entityQuery(entityType: PARAGRAPHS_TYPE, limit: 999) {
|
|
9
9
|
items {
|
|
10
|
-
...
|
|
10
|
+
...blokkliParagraphsType
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -85,12 +85,3 @@ fragment paragraphsBlokkliSupportedClipboard on ParagraphsBlokkliSupportedClipbo
|
|
|
85
85
|
videoProviders
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
fragment paragraphsType on ParagraphsType {
|
|
90
|
-
id
|
|
91
|
-
label
|
|
92
|
-
icon: iconDefault
|
|
93
|
-
description
|
|
94
|
-
allowReusable
|
|
95
|
-
isTranslatable
|
|
96
|
-
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
mutation pbSetParagraphSchedule(
|
|
2
|
+
$entityType: EntityType!
|
|
3
|
+
$entityUuid: String!
|
|
4
|
+
$langcode: String
|
|
5
|
+
$items: [ParagraphsBlokkliSetParagraphScheduleInput]!
|
|
6
|
+
) {
|
|
7
|
+
state: paragraphsEditMutationState(
|
|
8
|
+
entityType: $entityType
|
|
9
|
+
entityUuid: $entityUuid
|
|
10
|
+
) {
|
|
11
|
+
action: set_paragraph_schedule(items: $items) {
|
|
12
|
+
...paragraphsBlokkliMutationResult
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -201,6 +201,39 @@ fragment paragraphsBlokkliPublishOptions on ParagraphsBlokkliPublishOptions {
|
|
|
201
201
|
} else {
|
|
202
202
|
addGraphqlDocument("features/publish.graphql");
|
|
203
203
|
}
|
|
204
|
+
const paragraphsBlokkliEditContextFields = [
|
|
205
|
+
...getTypeFields("ParagraphsBlokkliParagraphEditContext").keys()
|
|
206
|
+
];
|
|
207
|
+
graphql.addDocument(
|
|
208
|
+
"blokkli:paragraphsBlokkliParagraphEditContext",
|
|
209
|
+
`
|
|
210
|
+
fragment paragraphsBlokkliParagraphEditContext on ParagraphsBlokkliParagraphEditContext {
|
|
211
|
+
${paragraphsBlokkliEditContextFields.join("\n ")}
|
|
212
|
+
}
|
|
213
|
+
`
|
|
214
|
+
);
|
|
215
|
+
addMutation("set_paragraph_schedule", "block-scheduler");
|
|
216
|
+
const paragraphsTypeFields = [
|
|
217
|
+
...getTypeFields("ParagraphsType").keys()
|
|
218
|
+
].filter((field) => {
|
|
219
|
+
return [
|
|
220
|
+
"id",
|
|
221
|
+
"label",
|
|
222
|
+
"description",
|
|
223
|
+
"allowReusable",
|
|
224
|
+
"isTranslatable",
|
|
225
|
+
"hasPublishOn",
|
|
226
|
+
"hasUnpublishOn"
|
|
227
|
+
].includes(field);
|
|
228
|
+
});
|
|
229
|
+
graphql.addDocument(
|
|
230
|
+
"blokkli:paragraphsType",
|
|
231
|
+
`
|
|
232
|
+
fragment blokkliParagraphsType on ParagraphsType {
|
|
233
|
+
${paragraphsTypeFields.join("\n ")}
|
|
234
|
+
}
|
|
235
|
+
`
|
|
236
|
+
);
|
|
204
237
|
}
|
|
205
238
|
});
|
|
206
239
|
|
|
@@ -100,7 +100,7 @@ export default defineBlokkliEditAdapter(
|
|
|
100
100
|
clipboard: v.data.clipboards || [],
|
|
101
101
|
availableFeatures: v.data.features,
|
|
102
102
|
allTypes: (v.data.allTypes.items || []).filter(
|
|
103
|
-
(v2) => v2 && "
|
|
103
|
+
(v2) => v2 && "id" in v2
|
|
104
104
|
),
|
|
105
105
|
fieldConfig: v.data.fieldConfig || [],
|
|
106
106
|
editableFieldConfig: v.data.editableFieldConfig || [],
|
|
@@ -206,7 +206,7 @@ export default defineBlokkliEditAdapter(
|
|
|
206
206
|
}).then(mapMutation);
|
|
207
207
|
const moveBlock = (e) => useGraphqlMutation("pbMoveParagraph", {
|
|
208
208
|
...ctx.value,
|
|
209
|
-
uuid: e.item.uuid,
|
|
209
|
+
uuid: e.item.block.uuid,
|
|
210
210
|
hostType: e.host.type,
|
|
211
211
|
hostUuid: e.host.uuid,
|
|
212
212
|
hostFieldName: e.host.fieldName,
|
|
@@ -895,6 +895,14 @@ export default defineBlokkliEditAdapter(
|
|
|
895
895
|
revisionLogMessage: options.revisionLogMessage
|
|
896
896
|
}).then(mapMutation);
|
|
897
897
|
}
|
|
898
|
+
if (hasMutation("pbSetParagraphSchedule")) {
|
|
899
|
+
adapter.setBlockScheduleDate = (blocks) => useGraphqlMutation("pbSetParagraphSchedule", {
|
|
900
|
+
entityType: ctx.value.entityType,
|
|
901
|
+
entityUuid: ctx.value.entityUuid,
|
|
902
|
+
langcode: ctx.value.langcode,
|
|
903
|
+
items: blocks
|
|
904
|
+
}).then(mapMutation);
|
|
905
|
+
}
|
|
898
906
|
return adapter;
|
|
899
907
|
}
|
|
900
908
|
);
|
|
@@ -179,6 +179,23 @@ export type BlokkliAdapterScheduleOptions = {
|
|
|
179
179
|
*/
|
|
180
180
|
date: string;
|
|
181
181
|
};
|
|
182
|
+
export type BlokkliAdapterSetBlockScheduleOptions = {
|
|
183
|
+
/**
|
|
184
|
+
* The UUID of the block.
|
|
185
|
+
*/
|
|
186
|
+
uuid: string;
|
|
187
|
+
/**
|
|
188
|
+
* The schedule type.
|
|
189
|
+
*/
|
|
190
|
+
type: 'publish' | 'unpublish';
|
|
191
|
+
/**
|
|
192
|
+
* The date. If empty, remove the schedule date.
|
|
193
|
+
*/
|
|
194
|
+
date?: string;
|
|
195
|
+
};
|
|
196
|
+
export type BlokkliAdapterUnscheduleBlockOptions = {
|
|
197
|
+
uuid: string;
|
|
198
|
+
};
|
|
182
199
|
export type BlokkliAdapterUnscheduleOptions = {
|
|
183
200
|
/**
|
|
184
201
|
* The host entity type.
|
|
@@ -344,6 +361,10 @@ export interface BlokkliAdapter<T> {
|
|
|
344
361
|
* Unschedule an already scheduled edit state.
|
|
345
362
|
*/
|
|
346
363
|
unscheduleEditState?: (options: BlokkliAdapterUnscheduleOptions) => Promise<MutationResponseLike<T | undefined | null>>;
|
|
364
|
+
/**
|
|
365
|
+
* Schedule a block.
|
|
366
|
+
*/
|
|
367
|
+
setBlockScheduleDate?: (blocks: BlokkliAdapterSetBlockScheduleOptions[]) => Promise<MutationResponseLike<T | undefined | null>>;
|
|
347
368
|
/**
|
|
348
369
|
* Set a specific history index.
|
|
349
370
|
*/
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="#bk-blokkli-item-actions">
|
|
3
3
|
<button
|
|
4
|
+
v-if="shouldRender"
|
|
4
5
|
ref="el"
|
|
5
6
|
:disabled="isDisabled"
|
|
6
|
-
|
|
7
|
+
class="bk-item-action"
|
|
8
|
+
:class="[
|
|
9
|
+
{ 'bk-is-active': active, 'bk-is-last': weight === 'last' },
|
|
10
|
+
$attrs.class
|
|
11
|
+
]"
|
|
7
12
|
:style="weight !== 'last' ? { order: weight || 0 } : void 0"
|
|
8
13
|
@click.prevent.stop="onClick"
|
|
9
14
|
>
|
|
10
15
|
<slot name="icon">
|
|
11
|
-
<Icon v-if="icon" :name="icon" />
|
|
16
|
+
<Icon v-if="icon" :name="icon" class="bk-item-action-icon" />
|
|
12
17
|
</slot>
|
|
13
18
|
<div class="bk-tooltip">
|
|
14
19
|
<span>{{ title }}</span>
|
|
@@ -23,7 +28,7 @@
|
|
|
23
28
|
</div>
|
|
24
29
|
</button>
|
|
25
30
|
</Teleport>
|
|
26
|
-
<slot :items="selection.
|
|
31
|
+
<slot :items="selection.items.value" :uuids="uuids" />
|
|
27
32
|
</template>
|
|
28
33
|
|
|
29
34
|
<script setup>
|
|
@@ -31,7 +36,7 @@ import { computed, ref, useBlokkli } from "#imports";
|
|
|
31
36
|
import { Icon, ShortcutIndicator } from "#blokkli/components";
|
|
32
37
|
import defineCommands from "#blokkli/helpers/composables/defineCommands";
|
|
33
38
|
import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
|
|
34
|
-
const { selection } = useBlokkli();
|
|
39
|
+
const { selection, state } = useBlokkli();
|
|
35
40
|
const el = ref(null);
|
|
36
41
|
const uuids = computed(() => selection.uuids.value);
|
|
37
42
|
const props = defineProps({
|
|
@@ -42,26 +47,33 @@ const props = defineProps({
|
|
|
42
47
|
keyCode: { type: String, required: false },
|
|
43
48
|
meta: { type: Boolean, required: false },
|
|
44
49
|
multiple: { type: Boolean, required: false },
|
|
50
|
+
editOnly: { type: Boolean, required: false },
|
|
45
51
|
weight: { type: [Number, String], required: false },
|
|
46
52
|
icon: { type: null, required: false },
|
|
47
53
|
tourText: { type: String, required: false }
|
|
48
54
|
});
|
|
49
55
|
const isDisabled = computed(
|
|
50
|
-
() => props.disabled || !props.multiple && selection.
|
|
56
|
+
() => props.disabled || !props.multiple && selection.items.value.length > 1
|
|
51
57
|
);
|
|
58
|
+
const shouldRender = computed(() => {
|
|
59
|
+
if (props.editOnly) {
|
|
60
|
+
return state.editMode.value === "editing";
|
|
61
|
+
}
|
|
62
|
+
return true;
|
|
63
|
+
});
|
|
52
64
|
const emit = defineEmits(["click"]);
|
|
53
65
|
const onClick = () => {
|
|
54
66
|
if (isDisabled.value || !uuids.value.length) {
|
|
55
67
|
return;
|
|
56
68
|
}
|
|
57
|
-
emit("click", selection.
|
|
69
|
+
emit("click", selection.items.value);
|
|
58
70
|
};
|
|
59
71
|
defineCommands(() => ({
|
|
60
72
|
id: "plugin:item_action:" + props.id,
|
|
61
73
|
group: "selection",
|
|
62
74
|
label: props.title,
|
|
63
75
|
icon: props.icon,
|
|
64
|
-
disabled: props.disabled || !selection.
|
|
76
|
+
disabled: props.disabled || !selection.items.value.length,
|
|
65
77
|
callback: onClick
|
|
66
78
|
}));
|
|
67
79
|
defineTourItem(() => {
|
|
@@ -75,10 +87,8 @@ defineTourItem(() => {
|
|
|
75
87
|
element: () => el.value
|
|
76
88
|
};
|
|
77
89
|
});
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
name: "PluginItemAction"
|
|
83
|
-
};
|
|
90
|
+
defineOptions({
|
|
91
|
+
name: "PluginItemAction",
|
|
92
|
+
inheritAttrs: false
|
|
93
|
+
});
|
|
84
94
|
</script>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlokkliIcon } from '#blokkli-build/icons';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { RenderedFieldListItem } from '#blokkli/types';
|
|
3
|
+
type __VLS_Props = {
|
|
4
4
|
id: string;
|
|
5
5
|
/**
|
|
6
6
|
* The title of the action.
|
|
@@ -27,55 +27,31 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
27
27
|
*/
|
|
28
28
|
multiple?: boolean;
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
weight?: number | string | "last";
|
|
33
|
-
icon?: BlokkliIcon;
|
|
34
|
-
tourText?: string;
|
|
35
|
-
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
36
|
-
click: (items: DraggableExistingBlock[]) => any;
|
|
37
|
-
}, string, import("vue").PublicProps, Readonly<{
|
|
38
|
-
id: string;
|
|
39
|
-
/**
|
|
40
|
-
* The title of the action.
|
|
41
|
-
*/
|
|
42
|
-
title: string;
|
|
43
|
-
/**
|
|
44
|
-
* Whether the action is disabled.
|
|
45
|
-
*/
|
|
46
|
-
disabled?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* Whether the button should be displayed in an active state (e.g. when it's a dropdown).
|
|
30
|
+
* Whether the action is only available in edit mode.
|
|
49
31
|
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* The key code to use for the shortcut.
|
|
53
|
-
*/
|
|
54
|
-
keyCode?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Wheter the shortcut needs the meta modifier key.
|
|
57
|
-
*/
|
|
58
|
-
meta?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Whether the action supports multiple items.
|
|
61
|
-
*/
|
|
62
|
-
multiple?: boolean;
|
|
32
|
+
editOnly?: boolean;
|
|
63
33
|
/**
|
|
64
34
|
* The weight, used for positioning the button.
|
|
65
35
|
*/
|
|
66
|
-
weight?: number | string |
|
|
36
|
+
weight?: number | string | 'last';
|
|
67
37
|
icon?: BlokkliIcon;
|
|
68
38
|
tourText?: string;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
39
|
+
};
|
|
40
|
+
declare var __VLS_5: {}, __VLS_19: {
|
|
41
|
+
items: RenderedFieldListItem[];
|
|
42
|
+
uuids: string[];
|
|
43
|
+
};
|
|
44
|
+
type __VLS_Slots = {} & {
|
|
45
|
+
icon?: (props: typeof __VLS_5) => any;
|
|
73
46
|
} & {
|
|
74
|
-
default?: (props:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
47
|
+
default?: (props: typeof __VLS_19) => any;
|
|
48
|
+
};
|
|
49
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
50
|
+
click: (items: RenderedFieldListItem[]) => any;
|
|
51
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
52
|
+
onClick?: ((items: RenderedFieldListItem[]) => any) | undefined;
|
|
53
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
|
+
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
79
55
|
export default _default;
|
|
80
56
|
type __VLS_WithSlots<T, S> = T & {
|
|
81
57
|
new (): {
|
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import defineTourItem from "#blokkli/helpers/composables/defineTourItem";
|
|
7
|
-
import { getCurrentInstance } from "#imports";
|
|
7
|
+
import { getCurrentInstance, useBlokkli } from "#imports";
|
|
8
8
|
const props = defineProps({
|
|
9
9
|
id: { type: String, required: true },
|
|
10
10
|
title: { type: String, required: true },
|
|
11
11
|
text: { type: String, required: true },
|
|
12
12
|
selector: { type: String, required: false }
|
|
13
13
|
});
|
|
14
|
+
const { element } = useBlokkli();
|
|
14
15
|
const findElement = (el) => {
|
|
15
16
|
if (el instanceof Text) {
|
|
16
17
|
return findElement(el.nextElementSibling);
|
|
@@ -25,10 +26,14 @@ defineTourItem(() => {
|
|
|
25
26
|
title: props.title,
|
|
26
27
|
text: props.text,
|
|
27
28
|
element: () => {
|
|
28
|
-
const provided = props.selector ?
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const provided = props.selector ? element.query(
|
|
30
|
+
document.documentElement,
|
|
31
|
+
props.selector,
|
|
32
|
+
`TourItem Plugin: ${props.id}`
|
|
33
|
+
) : void 0;
|
|
34
|
+
const el = provided || findElement(instance?.vnode.el);
|
|
35
|
+
if (el instanceof HTMLElement) {
|
|
36
|
+
return el;
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<component :is="tag"
|
|
2
|
+
<component :is="tag" ref="root">
|
|
3
3
|
<slot :value="renderedValue" />
|
|
4
4
|
</component>
|
|
5
5
|
</template>
|
|
@@ -37,16 +37,6 @@ if (!entity) {
|
|
|
37
37
|
throw new Error("Missing entity context.");
|
|
38
38
|
}
|
|
39
39
|
const renderedValue = computed(() => valueOverride.value || props.value);
|
|
40
|
-
const attrs = computed(() => {
|
|
41
|
-
if (isEditing && props.name) {
|
|
42
|
-
return {
|
|
43
|
-
"data-blokkli-editable-field": props.name,
|
|
44
|
-
"data-blokkli-editable-component": "true",
|
|
45
|
-
"data-blokkli-editable-value": props.value
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
return void 0;
|
|
49
|
-
});
|
|
50
40
|
const onEditableUpdateValue = (e) => {
|
|
51
41
|
if (e.name === props.name && e.entityUuid === entity.uuid) {
|
|
52
42
|
valueOverride.value = e.value;
|
|
@@ -58,7 +48,12 @@ onMounted(() => {
|
|
|
58
48
|
}
|
|
59
49
|
editContext.eventBus.on("editable:update", onEditableUpdateValue);
|
|
60
50
|
if (root.value instanceof HTMLElement && entity) {
|
|
61
|
-
app.
|
|
51
|
+
app.directive.registerDirectiveElement(
|
|
52
|
+
root.value,
|
|
53
|
+
props.name,
|
|
54
|
+
entity,
|
|
55
|
+
"editable"
|
|
56
|
+
);
|
|
62
57
|
}
|
|
63
58
|
});
|
|
64
59
|
onBeforeUnmount(() => {
|
|
@@ -66,7 +61,12 @@ onBeforeUnmount(() => {
|
|
|
66
61
|
editContext.eventBus.off("editable:update", onEditableUpdateValue);
|
|
67
62
|
}
|
|
68
63
|
if (app && root.value instanceof HTMLElement && entity) {
|
|
69
|
-
app.
|
|
64
|
+
app.directive.unregisterDirectiveElement(
|
|
65
|
+
root.value,
|
|
66
|
+
props.name,
|
|
67
|
+
entity,
|
|
68
|
+
"editable"
|
|
69
|
+
);
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BlokkliFragmentName } from '#blokkli-build/definitions';
|
|
2
|
-
import type { FieldListItem } from '#blokkli/types';
|
|
2
|
+
import type { FieldListItem, FieldDropAlignment } from '#blokkli/types';
|
|
3
3
|
import type { ValidFieldListTypes, FieldListItemTyped } from '#blokkli-build/generated-types';
|
|
4
4
|
type __VLS_Slots = {
|
|
5
5
|
default(props: {
|
|
@@ -19,7 +19,7 @@ type __VLS_Props = {
|
|
|
19
19
|
editClass?: string;
|
|
20
20
|
nonEmptyClass?: string;
|
|
21
21
|
allowedFragments?: BlokkliFragmentName[];
|
|
22
|
-
dropAlignment?:
|
|
22
|
+
dropAlignment?: FieldDropAlignment;
|
|
23
23
|
/**
|
|
24
24
|
* Renders proxy blocks during editing.
|
|
25
25
|
*/
|
|
@@ -33,8 +33,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}
|
|
|
33
33
|
list: Array<FieldListItem | null | undefined> | FieldListItem | null;
|
|
34
34
|
fieldListType: ValidFieldListTypes;
|
|
35
35
|
allowedFragments: BlokkliFragmentName[];
|
|
36
|
+
dropAlignment: FieldDropAlignment;
|
|
36
37
|
tag: string;
|
|
37
|
-
dropAlignment: "vertical" | "horizontal";
|
|
38
38
|
shouldRenderItem: (item: FieldListItem | FieldListItemTyped) => boolean;
|
|
39
39
|
listClass: string;
|
|
40
40
|
editClass: string;
|
|
@@ -38,10 +38,10 @@ const itemEntityType = useRuntimeConfig().public.blokkli.itemEntityType;
|
|
|
38
38
|
const componentProps = defineProps({
|
|
39
39
|
uuid: { type: String, required: true },
|
|
40
40
|
bundle: { type: String, required: true },
|
|
41
|
-
isNew: { type: Boolean, required: false },
|
|
42
41
|
options: { type: null, required: false, default: () => ({}) },
|
|
43
42
|
props: { type: null, required: false, default: () => ({}) },
|
|
44
43
|
index: { type: Number, required: false, default: 0 },
|
|
44
|
+
editContext: { type: Object, required: false, default: void 0 },
|
|
45
45
|
parentType: { type: String, required: false, default: "" },
|
|
46
46
|
isEditing: { type: Boolean, required: false, default: false }
|
|
47
47
|
});
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
+
import type { BlockEditContext } from '#blokkli/types';
|
|
1
2
|
declare const _default: import("vue").DefineComponent<{
|
|
2
3
|
uuid: string;
|
|
3
4
|
bundle: string;
|
|
4
|
-
isNew?: boolean;
|
|
5
5
|
options?: any;
|
|
6
6
|
props?: any;
|
|
7
7
|
index?: number;
|
|
8
|
+
editContext?: BlockEditContext;
|
|
8
9
|
parentType?: string;
|
|
9
10
|
isEditing?: boolean;
|
|
10
11
|
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
11
12
|
uuid: string;
|
|
12
13
|
bundle: string;
|
|
13
|
-
isNew?: boolean;
|
|
14
14
|
options?: any;
|
|
15
15
|
props?: any;
|
|
16
16
|
index?: number;
|
|
17
|
+
editContext?: BlockEditContext;
|
|
17
18
|
parentType?: string;
|
|
18
19
|
isEditing?: boolean;
|
|
19
20
|
}> & Readonly<{}>, {
|
|
@@ -21,6 +22,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
21
22
|
options: any;
|
|
22
23
|
parentType: string;
|
|
23
24
|
isEditing: boolean;
|
|
25
|
+
editContext: BlockEditContext;
|
|
24
26
|
props: any;
|
|
25
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
26
28
|
export default _default;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div
|
|
3
|
+
ref="providerEl"
|
|
3
4
|
:data-provider-uuid="entityUuid"
|
|
4
5
|
:data-provider-entity-type="entityType"
|
|
5
6
|
:data-provider-entity-bundle="entityBundle"
|
|
@@ -23,14 +24,15 @@
|
|
|
23
24
|
/>
|
|
24
25
|
</PreviewProvider>
|
|
25
26
|
<EditProvider
|
|
26
|
-
v-else-if="isEditing && shouldRender"
|
|
27
|
+
v-else-if="isEditing && shouldRender && providerEl"
|
|
27
28
|
v-slot="{ mutatedEntity }"
|
|
28
|
-
:
|
|
29
|
-
:entity
|
|
30
|
-
:entity-
|
|
31
|
-
:entity-
|
|
32
|
-
:
|
|
33
|
-
:
|
|
29
|
+
:provider-el
|
|
30
|
+
:entity
|
|
31
|
+
:entity-type
|
|
32
|
+
:entity-uuid
|
|
33
|
+
:entity-bundle
|
|
34
|
+
:language
|
|
35
|
+
:isolate
|
|
34
36
|
:permissions
|
|
35
37
|
>
|
|
36
38
|
<slot
|
|
@@ -71,13 +73,15 @@ import {
|
|
|
71
73
|
useRouter,
|
|
72
74
|
provide,
|
|
73
75
|
ref,
|
|
74
|
-
onMounted
|
|
76
|
+
onMounted,
|
|
77
|
+
useTemplateRef
|
|
75
78
|
} from "#imports";
|
|
76
79
|
import {
|
|
77
80
|
INJECT_ENTITY_CONTEXT,
|
|
78
81
|
INJECT_PROVIDER_CONTEXT
|
|
79
82
|
} from "../helpers/symbols";
|
|
80
83
|
defineSlots();
|
|
84
|
+
const providerEl = useTemplateRef("providerEl");
|
|
81
85
|
const PreviewProvider = defineAsyncComponent(
|
|
82
86
|
() => import("./Edit/PreviewProvider.vue")
|
|
83
87
|
);
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
<button
|
|
21
21
|
class="bk-blokkli-item-actions-type-button"
|
|
22
22
|
:disabled="!shouldRenderButton"
|
|
23
|
-
:title="title"
|
|
24
23
|
:class="{
|
|
25
24
|
'is-open': showDropdown,
|
|
26
25
|
'is-interactive': shouldRenderButton,
|
|
@@ -50,9 +49,14 @@
|
|
|
50
49
|
title
|
|
51
50
|
}}</span>
|
|
52
51
|
<span
|
|
53
|
-
v-if="selection.
|
|
52
|
+
v-if="selection.items.value.length > 1"
|
|
54
53
|
class="bk-blokkli-item-actions-title-count"
|
|
55
|
-
>{{ selection.
|
|
54
|
+
>{{ selection.items.value.length }}</span
|
|
55
|
+
>
|
|
56
|
+
<span
|
|
57
|
+
v-show="selectedIsNew"
|
|
58
|
+
class="bk-blokkli-item-actions-title-pill"
|
|
59
|
+
>{{ $t("selectedIsNew", "New") }}</span
|
|
56
60
|
>
|
|
57
61
|
<Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
|
|
58
62
|
</button>
|
|
@@ -64,7 +68,7 @@
|
|
|
64
68
|
</div>
|
|
65
69
|
|
|
66
70
|
<div
|
|
67
|
-
v-show="selection.
|
|
71
|
+
v-show="!selection.hasHostSelected.value"
|
|
68
72
|
id="bk-blokkli-item-actions"
|
|
69
73
|
class="bk-blokkli-item-actions-buttons"
|
|
70
74
|
/>
|
|
@@ -84,7 +88,7 @@ import {
|
|
|
84
88
|
onBeforeUnmount,
|
|
85
89
|
useTemplateRef
|
|
86
90
|
} from "#imports";
|
|
87
|
-
import {
|
|
91
|
+
import { falsy } from "#blokkli/helpers";
|
|
88
92
|
import { ItemIcon, Icon } from "#blokkli/components";
|
|
89
93
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
90
94
|
import useStickyToolbar from "#blokkli/helpers/composables/useStickyToolbar";
|
|
@@ -107,9 +111,9 @@ const controlsEl = ref(null);
|
|
|
107
111
|
const mountedPlugins = ref([]);
|
|
108
112
|
const showDropdown = ref(false);
|
|
109
113
|
const hasAnythingSelected = computed(
|
|
110
|
-
() => selection.hasHostSelected.value || !!selection.
|
|
114
|
+
() => selection.hasHostSelected.value || !!selection.items.value.length
|
|
111
115
|
);
|
|
112
|
-
watch(selection.
|
|
116
|
+
watch(selection.items, () => {
|
|
113
117
|
showDropdown.value = false;
|
|
114
118
|
});
|
|
115
119
|
watch(selection.hasHostSelected, () => {
|
|
@@ -117,7 +121,7 @@ watch(selection.hasHostSelected, () => {
|
|
|
117
121
|
});
|
|
118
122
|
const bundleIcon = computed(() => {
|
|
119
123
|
if (itemBundle.value?.id === "from_library") {
|
|
120
|
-
const reusableBundle = selection.
|
|
124
|
+
const reusableBundle = selection.items.value[0]?.library?.reusableBundle;
|
|
121
125
|
if (reusableBundle) {
|
|
122
126
|
return reusableBundle;
|
|
123
127
|
}
|
|
@@ -125,7 +129,7 @@ const bundleIcon = computed(() => {
|
|
|
125
129
|
return itemBundle.value?.id;
|
|
126
130
|
});
|
|
127
131
|
const hasSelectedHost = computed(() => {
|
|
128
|
-
return selection.
|
|
132
|
+
return selection.items.value.length === 0;
|
|
129
133
|
});
|
|
130
134
|
const title = computed(() => {
|
|
131
135
|
if (ui.transformLabel.value) {
|
|
@@ -150,25 +154,32 @@ const title = computed(() => {
|
|
|
150
154
|
return fragments.join(", ");
|
|
151
155
|
}
|
|
152
156
|
} else if (itemBundle.value.id === "from_library") {
|
|
153
|
-
const title2 = selection.
|
|
157
|
+
const title2 = selection.items.value[0]?.library?.label;
|
|
154
158
|
if (title2) {
|
|
155
159
|
return title2;
|
|
156
160
|
}
|
|
157
161
|
}
|
|
158
162
|
return itemBundle.value.label;
|
|
159
|
-
} else if (!selection.
|
|
163
|
+
} else if (!selection.items.value.length) {
|
|
160
164
|
return state.entity.value.label;
|
|
161
165
|
}
|
|
162
166
|
return $t("multipleItemsLabel", "Items");
|
|
163
167
|
});
|
|
164
|
-
const
|
|
165
|
-
(
|
|
166
|
-
|
|
168
|
+
const selectedIsNew = computed(() => {
|
|
169
|
+
if (selection.uuids.value.length !== 1) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
const uuid = selection.uuids.value[0];
|
|
173
|
+
if (!uuid) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
return !!state.getFieldListItem(uuid)?.editContext?.isNew;
|
|
177
|
+
});
|
|
167
178
|
const itemBundle = computed(() => {
|
|
168
|
-
if (
|
|
179
|
+
if (selection.bundles.value.length !== 1) {
|
|
169
180
|
return;
|
|
170
181
|
}
|
|
171
|
-
const bundle =
|
|
182
|
+
const bundle = selection.bundles.value[0];
|
|
172
183
|
return types.getBlockBundleDefinition(bundle);
|
|
173
184
|
});
|
|
174
185
|
const observer = new ResizeObserver((entries) => {
|