@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
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<DialogModal
|
|
3
|
+
:title="$t('blockSchedulerDialogTitle', 'Manage scheduling')"
|
|
4
|
+
:submit-label="$t('blockSchedulerDialogSubmit', 'Save schedule')"
|
|
5
|
+
:width="900"
|
|
6
|
+
:lead="
|
|
7
|
+
$t(
|
|
8
|
+
'blockSchedulerDialogLead',
|
|
9
|
+
'Schedule automatic publishing and unpublishing dates for the selected blocks.'
|
|
10
|
+
)
|
|
11
|
+
"
|
|
12
|
+
:is-loading
|
|
13
|
+
:can-submit
|
|
14
|
+
@cancel="$emit('close')"
|
|
15
|
+
@submit="onSubmit"
|
|
16
|
+
>
|
|
17
|
+
<div class="bk-block-scheduler-dialog">
|
|
18
|
+
<ScheduleSection
|
|
19
|
+
v-model="publishOn"
|
|
20
|
+
icon="eye"
|
|
21
|
+
:label="$t('blockSchedulerDialogPublishOn', 'Publish on')"
|
|
22
|
+
:items="publishOnItems"
|
|
23
|
+
:supported-bundles="bundlesWithPublish"
|
|
24
|
+
:disabled="publishDisabled"
|
|
25
|
+
/>
|
|
26
|
+
|
|
27
|
+
<ScheduleSection
|
|
28
|
+
v-model="unpublishOn"
|
|
29
|
+
icon="eye-off"
|
|
30
|
+
:label="$t('blockSchedulerDialogUnpublishOn', 'Unpublish on')"
|
|
31
|
+
:items="unpublishOnItems"
|
|
32
|
+
:supported-bundles="bundlesWithUnpublish"
|
|
33
|
+
:disabled="unpublishDisabled"
|
|
34
|
+
/>
|
|
35
|
+
|
|
36
|
+
<div class="bk-block-scheduler-table">
|
|
37
|
+
<h3 class="bk-block-scheduler-table-title">
|
|
38
|
+
<span v-if="canSubmit">{{
|
|
39
|
+
$t("blockSchedulerChangesPreview", "Changes to be applied")
|
|
40
|
+
}}</span>
|
|
41
|
+
<span v-else>
|
|
42
|
+
{{ $t("blockSchedulerNoChanges", "No changes to be applied.") }}
|
|
43
|
+
</span>
|
|
44
|
+
</h3>
|
|
45
|
+
<table v-if="canSubmit" class="bk-table">
|
|
46
|
+
<thead>
|
|
47
|
+
<tr>
|
|
48
|
+
<th>{{ $t("bundle", "Bundle") }}</th>
|
|
49
|
+
<th>{{ $t("blockSchedulerDialogPublishOn", "Publish on") }}</th>
|
|
50
|
+
<th>
|
|
51
|
+
{{ $t("blockSchedulerDialogUnpublishOn", "Unpublish on") }}
|
|
52
|
+
</th>
|
|
53
|
+
</tr>
|
|
54
|
+
</thead>
|
|
55
|
+
<tbody>
|
|
56
|
+
<tr v-for="(row, index) in tableRows" :key="index">
|
|
57
|
+
<td>{{ row.bundle }}</td>
|
|
58
|
+
<td>{{ row.publishOn }}</td>
|
|
59
|
+
<td>{{ row.unpublishOn }}</td>
|
|
60
|
+
</tr>
|
|
61
|
+
</tbody>
|
|
62
|
+
</table>
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</DialogModal>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<script setup>
|
|
69
|
+
import { falsy } from "#blokkli/helpers";
|
|
70
|
+
import { computed, useBlokkli, ref } from "#imports";
|
|
71
|
+
import ScheduleSection from "./ScheduleSection.vue";
|
|
72
|
+
import { DialogModal } from "#blokkli/components";
|
|
73
|
+
const props = defineProps({
|
|
74
|
+
uuids: { type: Array, required: true },
|
|
75
|
+
bundlesWithPublish: { type: Array, required: true },
|
|
76
|
+
bundlesWithUnpublish: { type: Array, required: true }
|
|
77
|
+
});
|
|
78
|
+
const emit = defineEmits(["close"]);
|
|
79
|
+
const { state, $t, adapter, ui, types } = useBlokkli();
|
|
80
|
+
const isLoading = ref(false);
|
|
81
|
+
const error = ref("");
|
|
82
|
+
const items = computed(() => {
|
|
83
|
+
return props.uuids.map((uuid) => {
|
|
84
|
+
return state.getFieldListItem(uuid);
|
|
85
|
+
}).filter(falsy).map((item) => {
|
|
86
|
+
return {
|
|
87
|
+
uuid: item.uuid,
|
|
88
|
+
bundle: item.bundle,
|
|
89
|
+
isPublished: !!item.editContext?.isPublished,
|
|
90
|
+
publishOn: item.editContext?.publishOn,
|
|
91
|
+
unpublishOn: item.editContext?.unpublishOn
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
const selectedBundles = computed(() => {
|
|
96
|
+
const bundles = items.value.map((item) => item.bundle);
|
|
97
|
+
return [...new Set(bundles)];
|
|
98
|
+
});
|
|
99
|
+
const publishDisabled = computed(() => {
|
|
100
|
+
return !selectedBundles.value.some(
|
|
101
|
+
(bundle) => props.bundlesWithPublish.includes(bundle)
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
const unpublishDisabled = computed(() => {
|
|
105
|
+
return !selectedBundles.value.some(
|
|
106
|
+
(bundle) => props.bundlesWithUnpublish.includes(bundle)
|
|
107
|
+
);
|
|
108
|
+
});
|
|
109
|
+
const publishOnItems = computed(() => {
|
|
110
|
+
return items.value.map((item) => ({
|
|
111
|
+
uuid: item.uuid,
|
|
112
|
+
bundle: item.bundle,
|
|
113
|
+
date: item.publishOn
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
116
|
+
const unpublishOnItems = computed(() => {
|
|
117
|
+
return items.value.map((item) => ({
|
|
118
|
+
uuid: item.uuid,
|
|
119
|
+
bundle: item.bundle,
|
|
120
|
+
date: item.unpublishOn
|
|
121
|
+
}));
|
|
122
|
+
});
|
|
123
|
+
function getCommonDate(items2, supportedBundles) {
|
|
124
|
+
const supportedItems = items2.filter(
|
|
125
|
+
(item) => supportedBundles.includes(item.bundle)
|
|
126
|
+
);
|
|
127
|
+
if (supportedItems.length === 0) {
|
|
128
|
+
return void 0;
|
|
129
|
+
}
|
|
130
|
+
const dates = supportedItems.map((item) => item.date);
|
|
131
|
+
if (dates.every((date) => date == null)) {
|
|
132
|
+
return null;
|
|
133
|
+
}
|
|
134
|
+
const firstDate = dates[0];
|
|
135
|
+
const allSame = dates.every((date) => date === firstDate);
|
|
136
|
+
return allSame ? firstDate ?? null : void 0;
|
|
137
|
+
}
|
|
138
|
+
const publishOn = ref(
|
|
139
|
+
getCommonDate(publishOnItems.value, props.bundlesWithPublish)
|
|
140
|
+
);
|
|
141
|
+
const unpublishOn = ref(
|
|
142
|
+
getCommonDate(unpublishOnItems.value, props.bundlesWithUnpublish)
|
|
143
|
+
);
|
|
144
|
+
const tableRows = computed(() => {
|
|
145
|
+
return items.value.map((item) => {
|
|
146
|
+
const bundleDef = types.getBlockBundleDefinition(item.bundle);
|
|
147
|
+
const supportsPublish = props.bundlesWithPublish.includes(item.bundle);
|
|
148
|
+
const supportsUnpublish = props.bundlesWithUnpublish.includes(item.bundle);
|
|
149
|
+
let publishOnDisplay;
|
|
150
|
+
if (!supportsPublish) {
|
|
151
|
+
publishOnDisplay = $t("notSupported", "Not supported");
|
|
152
|
+
} else if (publishOn.value === void 0) {
|
|
153
|
+
publishOnDisplay = item.publishOn ? ui.formatDate(item.publishOn) : $t("notSet", "Not set");
|
|
154
|
+
} else if (publishOn.value) {
|
|
155
|
+
publishOnDisplay = ui.formatDate(publishOn.value);
|
|
156
|
+
} else {
|
|
157
|
+
publishOnDisplay = $t("notSet", "Not set");
|
|
158
|
+
}
|
|
159
|
+
let unpublishOnDisplay;
|
|
160
|
+
if (!supportsUnpublish) {
|
|
161
|
+
unpublishOnDisplay = $t("notSupported", "Not supported");
|
|
162
|
+
} else if (unpublishOn.value === void 0) {
|
|
163
|
+
unpublishOnDisplay = item.unpublishOn ? ui.formatDate(item.unpublishOn) : $t("notSet", "Not set");
|
|
164
|
+
} else if (unpublishOn.value) {
|
|
165
|
+
unpublishOnDisplay = ui.formatDate(unpublishOn.value);
|
|
166
|
+
} else {
|
|
167
|
+
unpublishOnDisplay = $t("notSet", "Not set");
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
bundle: bundleDef?.label || item.bundle,
|
|
171
|
+
publishOn: publishOnDisplay,
|
|
172
|
+
unpublishOn: unpublishOnDisplay
|
|
173
|
+
};
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
const canSubmit = computed(() => {
|
|
177
|
+
return items.value.some((item) => {
|
|
178
|
+
const supportsPublish = props.bundlesWithPublish.includes(item.bundle);
|
|
179
|
+
const supportsUnpublish = props.bundlesWithUnpublish.includes(item.bundle);
|
|
180
|
+
if (supportsPublish && publishOn.value !== void 0 && item.publishOn !== publishOn.value) {
|
|
181
|
+
return true;
|
|
182
|
+
}
|
|
183
|
+
if (supportsUnpublish && unpublishOn.value !== void 0 && item.unpublishOn !== unpublishOn.value) {
|
|
184
|
+
return true;
|
|
185
|
+
}
|
|
186
|
+
return false;
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
async function onSubmit() {
|
|
190
|
+
isLoading.value = true;
|
|
191
|
+
const blocks = [];
|
|
192
|
+
items.value.forEach((item) => {
|
|
193
|
+
const supportsPublish = props.bundlesWithPublish.includes(item.bundle);
|
|
194
|
+
const supportsUnpublish = props.bundlesWithUnpublish.includes(item.bundle);
|
|
195
|
+
if (supportsPublish && publishOn.value !== void 0 && item.publishOn !== publishOn.value) {
|
|
196
|
+
blocks.push({
|
|
197
|
+
uuid: item.uuid,
|
|
198
|
+
type: "publish",
|
|
199
|
+
date: publishOn.value || void 0
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
if (supportsUnpublish && unpublishOn.value !== void 0 && item.unpublishOn !== unpublishOn.value) {
|
|
203
|
+
blocks.push({
|
|
204
|
+
uuid: item.uuid,
|
|
205
|
+
type: "unpublish",
|
|
206
|
+
date: unpublishOn.value || void 0
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
isLoading.value = true;
|
|
211
|
+
const isSuccess = await state.mutateWithLoadingState(
|
|
212
|
+
() => adapter.setBlockScheduleDate(blocks),
|
|
213
|
+
false,
|
|
214
|
+
$t("blockSchedulerSuccessMessage", "Successfully updated schedule dates.")
|
|
215
|
+
);
|
|
216
|
+
if (!isSuccess) {
|
|
217
|
+
error.value = "An unexpected error happened.";
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
emit("close");
|
|
221
|
+
}
|
|
222
|
+
</script>
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
type __VLS_Props = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
y: number;
|
|
6
|
-
} | null;
|
|
7
|
-
title: string;
|
|
2
|
+
uuids: string[];
|
|
3
|
+
bundlesWithPublish: string[];
|
|
4
|
+
bundlesWithUnpublish: string[];
|
|
8
5
|
};
|
|
9
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
10
|
-
|
|
6
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
+
close: () => any;
|
|
11
8
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
12
|
-
|
|
9
|
+
onClose?: (() => any) | undefined;
|
|
13
10
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
11
|
export default _default;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<PluginItemAction
|
|
3
|
+
id="block-scheduler"
|
|
4
|
+
:title="$t('manageSchedule', 'Manage schedule...')"
|
|
5
|
+
:disabled
|
|
6
|
+
multiple
|
|
7
|
+
edit-only
|
|
8
|
+
meta
|
|
9
|
+
:weight="1e3"
|
|
10
|
+
:class="{
|
|
11
|
+
'bk-has-schedule': selectionHasDates
|
|
12
|
+
}"
|
|
13
|
+
@click="onClick"
|
|
14
|
+
>
|
|
15
|
+
<template #icon>
|
|
16
|
+
<div class="bk-schedule-action-icon">
|
|
17
|
+
<Icon name="calendar" class="bk-item-action-icon" />
|
|
18
|
+
<Icon
|
|
19
|
+
v-if="selectionHasDates"
|
|
20
|
+
name="check"
|
|
21
|
+
class="bk-schedule-action-icon-check"
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
</PluginItemAction>
|
|
26
|
+
<Teleport to="body">
|
|
27
|
+
<BlokkliTransition name="slide-up">
|
|
28
|
+
<SchedulerDialog
|
|
29
|
+
v-if="isVisible"
|
|
30
|
+
:uuids="selectedUuids"
|
|
31
|
+
:bundles-with-publish="bundlesWithPublish"
|
|
32
|
+
:bundles-with-unpublish="bundlesWithUnpublish"
|
|
33
|
+
@close="onClose"
|
|
34
|
+
/>
|
|
35
|
+
</BlokkliTransition>
|
|
36
|
+
</Teleport>
|
|
37
|
+
</template>
|
|
38
|
+
|
|
39
|
+
<script setup>
|
|
40
|
+
import { useBlokkli, defineBlokkliFeature, computed, ref } from "#imports";
|
|
41
|
+
import { PluginItemAction } from "#blokkli/plugins";
|
|
42
|
+
import { BlokkliTransition, Icon } from "#blokkli/components";
|
|
43
|
+
import SchedulerDialog from "./Dialog/index.vue";
|
|
44
|
+
defineBlokkliFeature({
|
|
45
|
+
id: "block-scheduler",
|
|
46
|
+
icon: "calendar",
|
|
47
|
+
label: "Block Scheduler",
|
|
48
|
+
description: "Adds support for scheduling blocks.",
|
|
49
|
+
requiredAdapterMethods: ["setBlockScheduleDate"]
|
|
50
|
+
});
|
|
51
|
+
const { $t, state, selection, types } = useBlokkli();
|
|
52
|
+
const bundlesWithPublish = computed(
|
|
53
|
+
() => types.generallyAvailableBundles.filter((v) => v.hasPublishOn).map((v) => v.id)
|
|
54
|
+
);
|
|
55
|
+
const bundlesWithUnpublish = computed(
|
|
56
|
+
() => types.generallyAvailableBundles.filter((v) => v.hasUnpublishOn).map((v) => v.id)
|
|
57
|
+
);
|
|
58
|
+
const selectedUuids = ref([]);
|
|
59
|
+
const isVisible = computed(() => {
|
|
60
|
+
return !!selectedUuids.value.length;
|
|
61
|
+
});
|
|
62
|
+
const selectionHasDates = computed(() => {
|
|
63
|
+
for (let i = 0; i < selection.uuids.value.length; i++) {
|
|
64
|
+
const uuid = selection.uuids.value[i];
|
|
65
|
+
if (!uuid) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const block = state.getFieldListItem(uuid);
|
|
69
|
+
if (!block) {
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (block.editContext?.publishOn || block.editContext?.unpublishOn) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
});
|
|
78
|
+
const disabled = computed(() => {
|
|
79
|
+
const hasSupport = selection.bundles.value.some(
|
|
80
|
+
(bundle) => bundlesWithPublish.value.includes(bundle) || bundlesWithUnpublish.value.includes(bundle)
|
|
81
|
+
);
|
|
82
|
+
return !hasSupport;
|
|
83
|
+
});
|
|
84
|
+
function onClick() {
|
|
85
|
+
selectedUuids.value = [...selection.uuids.value];
|
|
86
|
+
}
|
|
87
|
+
function onClose() {
|
|
88
|
+
selectedUuids.value = [];
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
|
|
92
|
+
<script>
|
|
93
|
+
export default {
|
|
94
|
+
name: "BlockScheduler"
|
|
95
|
+
};
|
|
96
|
+
</script>
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
id="clipboard"
|
|
68
68
|
:title="$t('clipboard', 'Clipboard')"
|
|
69
69
|
:enabled="
|
|
70
|
-
!!selection.
|
|
70
|
+
!!selection.items.value.length && state.editMode.value === 'editing'
|
|
71
71
|
"
|
|
72
72
|
:items="itemDropdownItems"
|
|
73
73
|
icon="clipboard"
|
|
@@ -92,6 +92,7 @@ import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
|
92
92
|
import defineShortcut from "#blokkli/helpers/composables/defineShortcut";
|
|
93
93
|
import getVideoId from "get-video-id";
|
|
94
94
|
import { emitMessage } from "#blokkli/helpers/eventBus";
|
|
95
|
+
import { itemEntityType } from "#blokkli-build/config";
|
|
95
96
|
const { settings, logger } = defineBlokkliFeature({
|
|
96
97
|
id: "clipboard",
|
|
97
98
|
label: "Clipboard",
|
|
@@ -108,7 +109,7 @@ const { settings, logger } = defineBlokkliFeature({
|
|
|
108
109
|
},
|
|
109
110
|
screenshot: "feature-clipboard.jpg"
|
|
110
111
|
});
|
|
111
|
-
const { selection, $t, adapter,
|
|
112
|
+
const { selection, $t, adapter, state, ui, types, keyboard, blocks } = useBlokkli();
|
|
112
113
|
const plugin = ref(null);
|
|
113
114
|
const selectionClipboard = ref([]);
|
|
114
115
|
const itemDropdownItems = computed(() => {
|
|
@@ -290,7 +291,7 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
290
291
|
if (!pastedUuids.length) {
|
|
291
292
|
return;
|
|
292
293
|
}
|
|
293
|
-
const block = selection.
|
|
294
|
+
const block = selection.items.value[0];
|
|
294
295
|
if (!block) {
|
|
295
296
|
return;
|
|
296
297
|
}
|
|
@@ -299,11 +300,11 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
299
300
|
let targetFieldKey = null;
|
|
300
301
|
let preceedingUuid = void 0;
|
|
301
302
|
if (!keyboard.isPressingShift.value) {
|
|
302
|
-
const pastedBundles = pastedUuids.map((uuid) =>
|
|
303
|
+
const pastedBundles = pastedUuids.map((uuid) => blocks.getBlock(uuid)?.bundle).filter((bundle) => !!bundle);
|
|
303
304
|
if (pastedBundles.length) {
|
|
304
305
|
const nestedFields = types.fieldConfig.forEntityTypeAndBundle(
|
|
305
|
-
|
|
306
|
-
block.
|
|
306
|
+
itemEntityType,
|
|
307
|
+
block.bundle
|
|
307
308
|
);
|
|
308
309
|
for (const fieldConfig of nestedFields) {
|
|
309
310
|
const allowedPastedBundles = pastedBundles.filter(
|
|
@@ -314,7 +315,7 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
314
315
|
const currentCount = state.getFieldBlockCount(nestedFieldKey);
|
|
315
316
|
if (fieldConfig.cardinality === -1 || currentCount + allowedPastedBundles.length <= fieldConfig.cardinality) {
|
|
316
317
|
targetField = {
|
|
317
|
-
entityType:
|
|
318
|
+
entityType: itemEntityType,
|
|
318
319
|
entityUuid: block.uuid,
|
|
319
320
|
name: fieldConfig.name
|
|
320
321
|
};
|
|
@@ -328,13 +329,13 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
328
329
|
}
|
|
329
330
|
}
|
|
330
331
|
if (!targetField || !targetFieldConfig || !targetFieldKey) {
|
|
331
|
-
const field = state.getMutatedField(block.
|
|
332
|
+
const field = state.getMutatedField(block.host.uuid, block.host.fieldName);
|
|
332
333
|
if (!field) {
|
|
333
334
|
return;
|
|
334
335
|
}
|
|
335
336
|
const fieldConfig = types.getFieldConfig(
|
|
336
337
|
field.entityType,
|
|
337
|
-
block.
|
|
338
|
+
block.host.bundle,
|
|
338
339
|
field.name
|
|
339
340
|
);
|
|
340
341
|
if (!fieldConfig) {
|
|
@@ -356,15 +357,13 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
356
357
|
if (!uuid) {
|
|
357
358
|
continue;
|
|
358
359
|
}
|
|
359
|
-
const block2 =
|
|
360
|
+
const block2 = blocks.getBlock(uuid);
|
|
360
361
|
if (!block2) {
|
|
361
362
|
continue;
|
|
362
363
|
}
|
|
363
|
-
const isAllowed = targetFieldConfig.allowedBundles.includes(
|
|
364
|
-
block2.itemBundle
|
|
365
|
-
);
|
|
364
|
+
const isAllowed = targetFieldConfig.allowedBundles.includes(block2.bundle);
|
|
366
365
|
if (!isAllowed) {
|
|
367
|
-
notAllowedBundles.push(block2.
|
|
366
|
+
notAllowedBundles.push(block2.bundle);
|
|
368
367
|
continue;
|
|
369
368
|
}
|
|
370
369
|
pastedBlocks.push(block2);
|
|
@@ -500,7 +499,7 @@ function setClipboard(text) {
|
|
|
500
499
|
}
|
|
501
500
|
}
|
|
502
501
|
function copyCurrentSelectionToClipboard() {
|
|
503
|
-
if (!selection.
|
|
502
|
+
if (!selection.items.value.length) {
|
|
504
503
|
selectionClipboard.value = [];
|
|
505
504
|
return;
|
|
506
505
|
}
|
|
@@ -510,7 +509,7 @@ function copyCurrentSelectionToClipboard() {
|
|
|
510
509
|
selectionClipboard.value = selection.uuids.value;
|
|
511
510
|
}
|
|
512
511
|
onBlokkliEvent("keyPressed", (e) => {
|
|
513
|
-
if (e.code !== "c" || !e.meta) {
|
|
512
|
+
if (e.code !== "c" || !e.meta || ui.hasDialogOpen.value) {
|
|
514
513
|
return;
|
|
515
514
|
}
|
|
516
515
|
copyCurrentSelectionToClipboard();
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
ref="buttonEl"
|
|
4
|
+
:data-command-id="item.id"
|
|
5
|
+
:data-command-visible="true"
|
|
6
|
+
class="bk-command"
|
|
7
|
+
:class="{ 'bk-is-focused': isFocused }"
|
|
8
|
+
@mouseenter="$emit('focus', index)"
|
|
9
|
+
@click.prevent="$emit('select', item.id)"
|
|
10
|
+
>
|
|
11
|
+
<div class="bk-command-icon">
|
|
12
|
+
<Icon v-if="item.icon" :name="item.icon" />
|
|
13
|
+
<ItemIcon v-else :bundle="item.bundle" />
|
|
14
|
+
</div>
|
|
15
|
+
<Highlight :text="item.label" tag="span" :positions="item.positions" />
|
|
16
|
+
<div class="bk-command-group">{{ getGroupLabel(item.group) }}</div>
|
|
17
|
+
</button>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script setup>
|
|
21
|
+
import { watch, useBlokkli, useTemplateRef } from "#imports";
|
|
22
|
+
import { Icon, ItemIcon, Highlight } from "#blokkli/components";
|
|
23
|
+
const props = defineProps({
|
|
24
|
+
item: { type: Object, required: true },
|
|
25
|
+
index: { type: Number, required: true },
|
|
26
|
+
isFocused: { type: Boolean, required: true }
|
|
27
|
+
});
|
|
28
|
+
defineEmits(["focus", "select"]);
|
|
29
|
+
const { $t } = useBlokkli();
|
|
30
|
+
const buttonEl = useTemplateRef("buttonEl");
|
|
31
|
+
watch(
|
|
32
|
+
() => props.isFocused,
|
|
33
|
+
(focused) => {
|
|
34
|
+
if (focused && buttonEl.value) {
|
|
35
|
+
buttonEl.value.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
const getGroupLabel = (id) => {
|
|
40
|
+
if (id === "ui") {
|
|
41
|
+
return $t("commandGroup.ui", "Interface");
|
|
42
|
+
} else if (id === "add") {
|
|
43
|
+
return $t("commandGroup.add", "Add new");
|
|
44
|
+
} else if (id === "action") {
|
|
45
|
+
return $t("commandGroup.action", "Actions");
|
|
46
|
+
} else if (id === "selection") {
|
|
47
|
+
return $t("commandGroup.selection", "Selection");
|
|
48
|
+
}
|
|
49
|
+
return $t("commandGroup.misc", "Miscellaneous");
|
|
50
|
+
};
|
|
51
|
+
</script>
|
package/dist/runtime/components/Edit/Features/CommandPalette/Palette/{Group → Item}/index.vue.d.ts
RENAMED
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import type { Command } from '#blokkli/types';
|
|
2
2
|
type __VLS_Props = {
|
|
3
|
-
|
|
3
|
+
item: Command & {
|
|
4
4
|
_id: number;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}[] | undefined;
|
|
10
|
-
focusedId: string;
|
|
5
|
+
positions?: number[];
|
|
6
|
+
};
|
|
7
|
+
index: number;
|
|
8
|
+
isFocused: boolean;
|
|
11
9
|
};
|
|
12
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
-
|
|
14
|
-
focus: (
|
|
15
|
-
select: (id: string) => void;
|
|
10
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
11
|
+
select: (id: string) => any;
|
|
12
|
+
focus: (index: number) => any;
|
|
16
13
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
17
|
-
onClose?: (() => any) | undefined;
|
|
18
|
-
onFocus?: ((id: string) => any) | undefined;
|
|
19
14
|
onSelect?: ((id: string) => any) | undefined;
|
|
15
|
+
onFocus?: ((index: number) => any) | undefined;
|
|
20
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
21
17
|
export default _default;
|