@blokkli/editor 2.0.0-alpha.16 → 2.0.0-alpha.18
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 +640 -137
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -1
- 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/features/comments.graphql +11 -8
- 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 +12 -4
- 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 -15
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +20 -44
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +10 -5
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +4 -2
- package/dist/runtime/components/BlokkliEditable.vue +32 -14
- package/dist/runtime/components/BlokkliField.vue +3 -0
- 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 +41 -28
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +2 -1
- package/dist/runtime/components/Edit/Actions/index.vue +36 -20
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +436 -25
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue +83 -0
- package/dist/runtime/components/Edit/ArtboardTooltip/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Banner/index.vue +51 -0
- package/dist/runtime/components/Edit/Banner/index.vue.d.ts +18 -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/EditIndicator.vue +118 -44
- package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/EditProvider.vue +101 -31
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +9 -11
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +28 -26
- 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 +29 -53
- 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/{Selection/AddButtons/AddButtonsField.vue.d.ts → BlockScheduler/Dialog/index.vue.d.ts} +6 -9
- package/dist/runtime/components/Edit/Features/BlockScheduler/index.vue +96 -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/CommandPalette/index.vue +2 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +35 -20
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Comments/CommentInput/index.vue +29 -0
- package/dist/runtime/components/Edit/Features/{Publish/Dialog/ScheduleDate.vue.d.ts → Comments/CommentInput/index.vue.d.ts} +2 -2
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +22 -16
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +15 -6
- package/dist/runtime/components/Edit/Features/Comments/index.vue +21 -9
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +4 -7
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +26 -35
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue +240 -0
- package/dist/runtime/components/Edit/Features/Debug/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +7 -165
- package/dist/runtime/components/Edit/Features/Delete/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -6
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +55 -48
- 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 +16 -22
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +7 -6
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +69 -4
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +13 -9
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +45 -87
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +41 -43
- 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/History/index.vue +5 -2
- package/dist/runtime/components/Edit/Features/Hover/Overlay/fragment.glsl +139 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue +261 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Hover/Overlay/vertex.glsl +117 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue +25 -0
- package/dist/runtime/components/Edit/Features/Hover/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +5 -7
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +19 -27
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +32 -28
- package/dist/runtime/components/Edit/Features/Library/index.vue +28 -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 +36 -29
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +2 -4
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +6 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +8 -6
- package/dist/runtime/components/Edit/Features/Options/index.vue +6 -6
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue +35 -0
- package/dist/runtime/components/Edit/Features/Ownership/Renderer.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +7 -25
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue +5 -1
- 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 +39 -74
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +7 -5
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/fragment.glsl +106 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue +440 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/index.vue.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Renderer/vertex.glsl +102 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +53 -125
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +2 -2
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +88 -29
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +5 -3
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +11 -2
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/Selection/index.vue +66 -39
- 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/Banner/index.vue +17 -11
- package/dist/runtime/components/Edit/Features/Translations/index.vue +20 -23
- 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/Text/index.vue +2 -1
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +1 -0
- 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/Indicators/index.vue +1 -1
- 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/Konami/Game/index.vue +5 -5
- package/dist/runtime/components/Edit/{Features/Publish/Dialog/ScheduleDate.vue → ScheduleDate/index.vue} +6 -58
- package/dist/runtime/components/Edit/ScheduleDate/index.vue.d.ts +23 -0
- 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 +7 -3
- package/dist/runtime/components/Edit/index.js +12 -4
- package/dist/runtime/composables/defineBlokkli.js +4 -2
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.d.ts +35 -1
- package/dist/runtime/helpers/animationProvider.js +179 -48
- package/dist/runtime/helpers/composables/defineRenderer.d.ts +8 -0
- package/dist/runtime/helpers/composables/defineRenderer.js +8 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.d.ts +4 -0
- package/dist/runtime/helpers/composables/useStateBasedCache.js +13 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +4 -1
- package/dist/runtime/helpers/composables/useStickyToolbar.js +53 -35
- package/dist/runtime/helpers/definitionProvider.d.ts +1 -1
- package/dist/runtime/helpers/dom/index.d.ts +1 -0
- package/dist/runtime/helpers/domProvider.d.ts +54 -14
- package/dist/runtime/helpers/domProvider.js +168 -134
- 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/providers/directive.js +205 -0
- 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 +7 -2
- package/dist/runtime/helpers/stateProvider.js +83 -14
- package/dist/runtime/helpers/storageProvider.d.ts +3 -2
- package/dist/runtime/helpers/storageProvider.js +6 -2
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- 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 +11 -3
- package/dist/runtime/helpers/uiProvider.js +45 -17
- 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/blokkliDirectives.js +96 -0
- package/dist/runtime/types/index.d.ts +66 -35
- package/package.json +1 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +0 -401
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +0 -63
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +0 -54
- package/dist/runtime/plugins/blokkliEditable.js +0 -31
- /package/dist/runtime/components/Edit/{DragInteractions → Features/BlockScheduler}/index.vue.d.ts +0 -0
- /package/dist/runtime/plugins/{blokkliEditable.d.ts → blokkliDirectives.d.ts} +0 -0
|
@@ -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"
|
|
@@ -9,32 +10,34 @@
|
|
|
9
10
|
<PreviewProvider
|
|
10
11
|
v-if="isPreviewing"
|
|
11
12
|
v-slot="{ mutatedEntity }"
|
|
12
|
-
:entity
|
|
13
|
-
:entity-type
|
|
14
|
-
:entity-uuid
|
|
15
|
-
:entity-bundle
|
|
16
|
-
:language
|
|
13
|
+
:entity
|
|
14
|
+
:entity-type
|
|
15
|
+
:entity-uuid
|
|
16
|
+
:entity-bundle
|
|
17
|
+
:language
|
|
17
18
|
>
|
|
18
19
|
<slot
|
|
19
20
|
:entity="mutatedEntity"
|
|
20
|
-
:is-editing
|
|
21
|
-
:can-edit
|
|
21
|
+
:is-editing
|
|
22
|
+
:can-edit
|
|
22
23
|
:is-preview="isPreviewing"
|
|
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
|
|
36
|
+
:permissions
|
|
34
37
|
>
|
|
35
38
|
<slot
|
|
36
|
-
:is-editing
|
|
37
|
-
:can-edit
|
|
39
|
+
:is-editing
|
|
40
|
+
:can-edit
|
|
38
41
|
:is-preview="isPreviewing"
|
|
39
42
|
:entity="mutatedEntity"
|
|
40
43
|
/>
|
|
@@ -43,18 +46,22 @@
|
|
|
43
46
|
|
|
44
47
|
<slot
|
|
45
48
|
v-else
|
|
46
|
-
:is-editing
|
|
47
|
-
:can-edit
|
|
49
|
+
:is-editing
|
|
50
|
+
:can-edit
|
|
48
51
|
:is-preview="isPreviewing"
|
|
49
52
|
:entity="entity"
|
|
50
53
|
/>
|
|
51
54
|
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
<ClientOnly>
|
|
56
|
+
<EditIndicator
|
|
57
|
+
v-if="showIndicator"
|
|
58
|
+
:uuid="entityUuid"
|
|
59
|
+
:entity-type
|
|
60
|
+
:edit-label
|
|
61
|
+
:permissions
|
|
62
|
+
@edit="edit"
|
|
63
|
+
/>
|
|
64
|
+
</ClientOnly>
|
|
58
65
|
</div>
|
|
59
66
|
</template>
|
|
60
67
|
|
|
@@ -66,13 +73,15 @@ import {
|
|
|
66
73
|
useRouter,
|
|
67
74
|
provide,
|
|
68
75
|
ref,
|
|
69
|
-
onMounted
|
|
76
|
+
onMounted,
|
|
77
|
+
useTemplateRef
|
|
70
78
|
} from "#imports";
|
|
71
79
|
import {
|
|
72
80
|
INJECT_ENTITY_CONTEXT,
|
|
73
81
|
INJECT_PROVIDER_CONTEXT
|
|
74
82
|
} from "../helpers/symbols";
|
|
75
83
|
defineSlots();
|
|
84
|
+
const providerEl = useTemplateRef("providerEl");
|
|
76
85
|
const PreviewProvider = defineAsyncComponent(
|
|
77
86
|
() => import("./Edit/PreviewProvider.vue")
|
|
78
87
|
);
|
|
@@ -92,26 +101,30 @@ const props = defineProps({
|
|
|
92
101
|
entityType: { type: String, required: true },
|
|
93
102
|
entityBundle: { type: String, required: true },
|
|
94
103
|
entityUuid: { type: String, required: true },
|
|
95
|
-
canEdit: { type: Boolean, required: true },
|
|
96
104
|
tag: { type: String, required: false, default: "div" },
|
|
97
105
|
language: { type: String, required: false, default: "" },
|
|
98
106
|
editLabel: { type: String, required: false, default: "" },
|
|
99
107
|
editPath: { type: String, required: false, default: void 0 },
|
|
100
108
|
hostOptions: { type: null, required: false, default: void 0 },
|
|
109
|
+
permissions: { type: Array, required: false, default: () => {
|
|
110
|
+
return [];
|
|
111
|
+
} },
|
|
101
112
|
isolate: { type: Boolean, required: false }
|
|
102
113
|
});
|
|
103
114
|
const shouldRender = ref(false);
|
|
104
115
|
const isInEditor = computed(
|
|
105
116
|
() => props.entityUuid && props.entityType && props.entityBundle && (isPreviewing.value || isEditing.value)
|
|
106
117
|
);
|
|
118
|
+
const canEdit = computed(() => props.permissions.includes("edit"));
|
|
119
|
+
const canUseBlokkli = computed(() => !!props.permissions.length);
|
|
107
120
|
const isEditing = computed(
|
|
108
|
-
() =>
|
|
121
|
+
() => canUseBlokkli.value && !!props.entityUuid && route.query.blokkliEditing === props.entityUuid
|
|
109
122
|
);
|
|
110
123
|
const isPreviewing = computed(
|
|
111
124
|
() => !!props.entityUuid && route.query.blokkliPreview === props.entityUuid
|
|
112
125
|
);
|
|
113
126
|
const showIndicator = computed(
|
|
114
|
-
() => props.
|
|
127
|
+
() => !!props.permissions.length && !route.query.blokkliEditing && !route.query.blokkliPreview
|
|
115
128
|
);
|
|
116
129
|
function edit() {
|
|
117
130
|
router.push({
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import type { EditPermission } from '#blokkli/types';
|
|
1
2
|
declare const _default: <T extends object>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
2
3
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, never> & {
|
|
3
4
|
entity?: T;
|
|
4
5
|
entityType: string;
|
|
5
6
|
entityBundle: string;
|
|
6
7
|
entityUuid: string;
|
|
7
|
-
canEdit: boolean;
|
|
8
8
|
tag?: string;
|
|
9
9
|
language?: string;
|
|
10
10
|
editLabel?: string;
|
|
11
11
|
editPath?: string;
|
|
12
12
|
hostOptions?: any;
|
|
13
|
+
permissions?: EditPermission[];
|
|
13
14
|
/**
|
|
14
15
|
* When set to true, during editing, everything except the provider element will be hidden.
|
|
15
16
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="bk bk-blokkli-item-actions bk-control" @click.stop>
|
|
4
4
|
<div
|
|
5
5
|
v-show="
|
|
6
|
-
!selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected && shouldRender && !ui.
|
|
6
|
+
!selection.isDragging.value && !selection.editableActive.value && !ui.isAnimating.value && !ui.hasTransformOverlayOpen.value && hasAnythingSelected && shouldRender && !ui.hasTooltipOpen.value
|
|
7
7
|
"
|
|
8
8
|
ref="el"
|
|
9
9
|
class="bk-blokkli-item-actions-inner"
|
|
@@ -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,
|
|
@@ -39,14 +38,25 @@
|
|
|
39
38
|
<Icon v-if="ui.isTransforming.value" name="loader" />
|
|
40
39
|
<ItemIcon v-else-if="bundleIcon" :bundle="bundleIcon" />
|
|
41
40
|
<Icon v-else name="selection" />
|
|
41
|
+
<div
|
|
42
|
+
v-if="itemBundle?.id === 'from_library'"
|
|
43
|
+
class="bk-blokkli-item-actions-title-icon-reusable"
|
|
44
|
+
>
|
|
45
|
+
<Icon name="reusable" />
|
|
46
|
+
</div>
|
|
42
47
|
</div>
|
|
43
48
|
<span class="bk-blokkli-item-actions-title-label">{{
|
|
44
49
|
title
|
|
45
50
|
}}</span>
|
|
46
51
|
<span
|
|
47
|
-
v-if="selection.
|
|
52
|
+
v-if="selection.items.value.length > 1"
|
|
48
53
|
class="bk-blokkli-item-actions-title-count"
|
|
49
|
-
>{{ 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
|
|
50
60
|
>
|
|
51
61
|
<Icon v-if="shouldRenderButton" name="caret" class="bk-caret" />
|
|
52
62
|
</button>
|
|
@@ -57,10 +67,8 @@
|
|
|
57
67
|
/>
|
|
58
68
|
</div>
|
|
59
69
|
|
|
60
|
-
<div id="bk-blokkli-item-actions-after" />
|
|
61
|
-
|
|
62
70
|
<div
|
|
63
|
-
v-show="selection.
|
|
71
|
+
v-show="!selection.hasHostSelected.value"
|
|
64
72
|
id="bk-blokkli-item-actions"
|
|
65
73
|
class="bk-blokkli-item-actions-buttons"
|
|
66
74
|
/>
|
|
@@ -80,7 +88,7 @@ import {
|
|
|
80
88
|
onBeforeUnmount,
|
|
81
89
|
useTemplateRef
|
|
82
90
|
} from "#imports";
|
|
83
|
-
import {
|
|
91
|
+
import { falsy } from "#blokkli/helpers";
|
|
84
92
|
import { ItemIcon, Icon } from "#blokkli/components";
|
|
85
93
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
86
94
|
import useStickyToolbar from "#blokkli/helpers/composables/useStickyToolbar";
|
|
@@ -96,15 +104,16 @@ const { shouldRender } = useStickyToolbar(el, {
|
|
|
96
104
|
shouldUpdate: () => !selection.isChangingOptions.value,
|
|
97
105
|
getHeight: () => ACTIONS_HEIGHT,
|
|
98
106
|
getWidth: () => scrollWidth,
|
|
99
|
-
getMargin: () => 20
|
|
107
|
+
getMargin: () => 20,
|
|
108
|
+
allowHorizontalOverflow: true
|
|
100
109
|
});
|
|
101
110
|
const controlsEl = ref(null);
|
|
102
111
|
const mountedPlugins = ref([]);
|
|
103
112
|
const showDropdown = ref(false);
|
|
104
113
|
const hasAnythingSelected = computed(
|
|
105
|
-
() => selection.hasHostSelected.value || !!selection.
|
|
114
|
+
() => selection.hasHostSelected.value || !!selection.items.value.length
|
|
106
115
|
);
|
|
107
|
-
watch(selection.
|
|
116
|
+
watch(selection.items, () => {
|
|
108
117
|
showDropdown.value = false;
|
|
109
118
|
});
|
|
110
119
|
watch(selection.hasHostSelected, () => {
|
|
@@ -112,7 +121,7 @@ watch(selection.hasHostSelected, () => {
|
|
|
112
121
|
});
|
|
113
122
|
const bundleIcon = computed(() => {
|
|
114
123
|
if (itemBundle.value?.id === "from_library") {
|
|
115
|
-
const reusableBundle = selection.
|
|
124
|
+
const reusableBundle = selection.items.value[0]?.library?.reusableBundle;
|
|
116
125
|
if (reusableBundle) {
|
|
117
126
|
return reusableBundle;
|
|
118
127
|
}
|
|
@@ -120,7 +129,7 @@ const bundleIcon = computed(() => {
|
|
|
120
129
|
return itemBundle.value?.id;
|
|
121
130
|
});
|
|
122
131
|
const hasSelectedHost = computed(() => {
|
|
123
|
-
return selection.
|
|
132
|
+
return selection.items.value.length === 0;
|
|
124
133
|
});
|
|
125
134
|
const title = computed(() => {
|
|
126
135
|
if (ui.transformLabel.value) {
|
|
@@ -145,25 +154,32 @@ const title = computed(() => {
|
|
|
145
154
|
return fragments.join(", ");
|
|
146
155
|
}
|
|
147
156
|
} else if (itemBundle.value.id === "from_library") {
|
|
148
|
-
const title2 = selection.
|
|
157
|
+
const title2 = selection.items.value[0]?.library?.label;
|
|
149
158
|
if (title2) {
|
|
150
159
|
return title2;
|
|
151
160
|
}
|
|
152
161
|
}
|
|
153
162
|
return itemBundle.value.label;
|
|
154
|
-
} else if (!selection.
|
|
163
|
+
} else if (!selection.items.value.length) {
|
|
155
164
|
return state.entity.value.label;
|
|
156
165
|
}
|
|
157
166
|
return $t("multipleItemsLabel", "Items");
|
|
158
167
|
});
|
|
159
|
-
const
|
|
160
|
-
(
|
|
161
|
-
|
|
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
|
+
});
|
|
162
178
|
const itemBundle = computed(() => {
|
|
163
|
-
if (
|
|
179
|
+
if (selection.bundles.value.length !== 1) {
|
|
164
180
|
return;
|
|
165
181
|
}
|
|
166
|
-
const bundle =
|
|
182
|
+
const bundle = selection.bundles.value[0];
|
|
167
183
|
return types.getBlockBundleDefinition(bundle);
|
|
168
184
|
});
|
|
169
185
|
const observer = new ResizeObserver((entries) => {
|