@blokkli/editor 1.1.3 → 1.3.0
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 +1693 -41
- package/dist/runtime/adapter/drupal/graphql/base.graphql +40 -3
- package/dist/runtime/adapter/drupal/graphql/comments.graphql +6 -1
- package/dist/runtime/adapter/drupal/graphql/transform.graphql +10 -2
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +44 -18
- package/dist/runtime/adapter/index.d.ts +15 -2
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +4 -1
- package/dist/runtime/components/BlokkliField.vue +8 -2
- package/dist/runtime/components/Edit/Actions/index.vue +27 -6
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +1 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +7 -0
- package/dist/runtime/components/Edit/EditProvider.vue +23 -5
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +4 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +3 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +14 -2
- package/dist/runtime/components/Edit/Features/Debug/index.vue +26 -4
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +236 -0
- package/dist/runtime/components/Edit/Features/Diff/index.vue +37 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +14 -4
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +3 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +20 -6
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +8 -1
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +11 -5
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +1 -0
- package/dist/runtime/components/Edit/Features/History/index.vue +3 -1
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +5 -2
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +10 -3
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +46 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +66 -34
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +14 -1
- package/dist/runtime/components/Edit/Features/Preview/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Publish/index.vue +2 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +78 -44
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +8 -8
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +6 -1
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +23 -2
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +71 -38
- package/dist/runtime/components/Edit/Features/Settings/index.vue +4 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +5 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +24 -2
- package/dist/runtime/components/Edit/Features/index.vue +4 -0
- package/dist/runtime/components/Edit/InfoBox/index.vue +14 -0
- package/dist/runtime/components/Edit/Messages/index.vue +10 -12
- package/dist/runtime/components/Edit/PreviewProvider.vue +9 -2
- package/dist/runtime/components/Edit/Sortli/index.vue +6 -1
- package/dist/runtime/components/Edit/index.d.ts +2 -1
- package/dist/runtime/components/Edit/index.js +3 -1
- package/dist/runtime/constants/index.d.ts +1 -1
- package/dist/runtime/constants/index.js +1 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/animationProvider.js +2 -1
- package/dist/runtime/helpers/featuresProvider.d.ts +7 -14
- package/dist/runtime/helpers/featuresProvider.js +29 -1
- package/dist/runtime/helpers/stateProvider.d.ts +1 -0
- package/dist/runtime/helpers/stateProvider.js +23 -4
- package/dist/runtime/helpers/uiProvider.d.ts +5 -1
- package/dist/runtime/helpers/uiProvider.js +10 -2
- package/dist/runtime/icons/diff.svg +1 -0
- package/dist/runtime/icons/info.svg +1 -0
- package/dist/runtime/types/generatedModuleTypes.d.ts +4 -4
- package/dist/runtime/types/index.d.ts +59 -1
- package/package.json +2 -1
|
@@ -43,12 +43,16 @@ const { settings } = defineBlokkliFeature({
|
|
|
43
43
|
type: 'checkbox',
|
|
44
44
|
default: true,
|
|
45
45
|
label: 'Use animations',
|
|
46
|
+
description:
|
|
47
|
+
'Animates UI elements like dialogs or drawers or interactions like drag and drop or scroll changes.',
|
|
46
48
|
group: 'advanced',
|
|
47
49
|
},
|
|
48
50
|
lowPerformanceMode: {
|
|
49
51
|
type: 'checkbox',
|
|
50
52
|
default: false,
|
|
51
53
|
label: 'Enable low performance mode',
|
|
54
|
+
description:
|
|
55
|
+
'Reduces the animations and interactivity to a minimum for devices with low performance.',
|
|
52
56
|
group: 'advanced',
|
|
53
57
|
},
|
|
54
58
|
resetAllSettings: {
|
|
@@ -44,7 +44,7 @@ const { adapter } = defineBlokkliFeature({
|
|
|
44
44
|
screenshot: 'feature-transform.jpg',
|
|
45
45
|
})
|
|
46
46
|
|
|
47
|
-
const { types, selection, state, $t, dom } = useBlokkli()
|
|
47
|
+
const { types, selection, state, $t, dom, ui } = useBlokkli()
|
|
48
48
|
|
|
49
49
|
const {
|
|
50
50
|
data: plugins,
|
|
@@ -64,6 +64,8 @@ watch(selection.uuids, async () => {
|
|
|
64
64
|
})
|
|
65
65
|
|
|
66
66
|
async function onTransform(plugin: TransformPlugin, uuids: string[]) {
|
|
67
|
+
ui.setTransform(plugin.label)
|
|
68
|
+
|
|
67
69
|
await state.mutateWithLoadingState(
|
|
68
70
|
() =>
|
|
69
71
|
adapter.applyTransformPlugin({
|
|
@@ -75,6 +77,8 @@ async function onTransform(plugin: TransformPlugin, uuids: string[]) {
|
|
|
75
77
|
'The action "@name" could not be executed.',
|
|
76
78
|
).replace('@name', plugin.label),
|
|
77
79
|
)
|
|
80
|
+
|
|
81
|
+
ui.setTransform()
|
|
78
82
|
}
|
|
79
83
|
|
|
80
84
|
const itemBundleIds = computed(() =>
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
</PluginTourItem>
|
|
51
51
|
</Teleport>
|
|
52
52
|
|
|
53
|
-
<Teleport to="
|
|
53
|
+
<Teleport to="#bk-banner-container">
|
|
54
54
|
<Banner
|
|
55
55
|
v-if="state.editMode.value === 'translating'"
|
|
56
56
|
:active-language="activeLanguage"
|
|
@@ -116,7 +116,20 @@ const { translation, editMode } = state
|
|
|
116
116
|
|
|
117
117
|
const isOpen = ref(false)
|
|
118
118
|
|
|
119
|
-
const isDropdown = computed(() =>
|
|
119
|
+
const isDropdown = computed(() => {
|
|
120
|
+
// Always a dropdown on mobile.
|
|
121
|
+
if (ui.isMobile.value) {
|
|
122
|
+
return true
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// It is a dropdown if all langcodes combined is greater than 15.
|
|
126
|
+
// That way up to 7 languages with 2-char langcodes are displayed as radio buttons.
|
|
127
|
+
// This handles cases where langcodes are e.g. 'en-US', 'en-GB', 'de-CH', etc.
|
|
128
|
+
// In this case it switches to a dropdown. This is better than relying on the number
|
|
129
|
+
// languages.
|
|
130
|
+
const allCodes = items.value.map((v) => v.code).join('')
|
|
131
|
+
return allCodes.length > 15
|
|
132
|
+
})
|
|
120
133
|
const activeLangcode = computed(() => context.value.language)
|
|
121
134
|
const activeLanguage = computed<Language>(() => {
|
|
122
135
|
return (
|
|
@@ -212,6 +225,15 @@ onBlokkliEvent('item:doubleClick', function (block) {
|
|
|
212
225
|
}
|
|
213
226
|
})
|
|
214
227
|
|
|
228
|
+
onBlokkliEvent('entity:translated', (langcode) => {
|
|
229
|
+
const targetTranslation = translation.value.translations?.find(
|
|
230
|
+
(v) => v.id === langcode,
|
|
231
|
+
)
|
|
232
|
+
if (targetTranslation) {
|
|
233
|
+
adapter.changeLanguage(targetTranslation)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
|
|
215
237
|
onMounted(() => {
|
|
216
238
|
// Make sure the user is not trying to edit a translation that does not exist.
|
|
217
239
|
const translationExists = !!translation.value.translations?.find(
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
</div>
|
|
13
|
-
</Teleport>
|
|
2
|
+
<div class="bk bk-messages">
|
|
3
|
+
<TransitionGroup name="bk-message">
|
|
4
|
+
<Item
|
|
5
|
+
v-for="(message, index) in messages"
|
|
6
|
+
v-bind="message"
|
|
7
|
+
:key="index"
|
|
8
|
+
@close="removeMessage(index)"
|
|
9
|
+
/>
|
|
10
|
+
</TransitionGroup>
|
|
11
|
+
</div>
|
|
14
12
|
</template>
|
|
15
13
|
|
|
16
14
|
<script lang="ts" setup>
|
|
@@ -62,7 +62,7 @@ const mutatedEntity = computed(
|
|
|
62
62
|
() => mutatedEntityFromState.value || props.entity,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
const { data, refresh } = await useAsyncData(() =>
|
|
65
|
+
const { data, refresh, error } = await useAsyncData(() =>
|
|
66
66
|
adapter.loadState().then((v) => adapter.mapState(v)),
|
|
67
67
|
)
|
|
68
68
|
|
|
@@ -94,8 +94,10 @@ const updateState = () => {
|
|
|
94
94
|
|
|
95
95
|
updateState()
|
|
96
96
|
|
|
97
|
+
const isPreview = computed(() => !error.value)
|
|
98
|
+
|
|
97
99
|
provide(INJECT_MUTATED_FIELDS_MAP, mutatedFieldsMap)
|
|
98
|
-
provide(INJECT_IS_PREVIEW,
|
|
100
|
+
provide(INJECT_IS_PREVIEW, isPreview)
|
|
99
101
|
provide<ItemEditContext>(INJECT_EDIT_CONTEXT, {
|
|
100
102
|
mutatedOptions,
|
|
101
103
|
eventBus,
|
|
@@ -127,6 +129,11 @@ const onMouseDown = () => {
|
|
|
127
129
|
* update.
|
|
128
130
|
*/
|
|
129
131
|
function checkChangedDate() {
|
|
132
|
+
// State loading has failed, so we can return here; no need to poll.
|
|
133
|
+
if (!isPreview.value) {
|
|
134
|
+
return
|
|
135
|
+
}
|
|
136
|
+
|
|
130
137
|
clearTimeout(timeout)
|
|
131
138
|
|
|
132
139
|
const delay = adapter.getLastChanged ? 1000 : 5000
|
|
@@ -19,6 +19,10 @@ import {
|
|
|
19
19
|
|
|
20
20
|
const { eventBus } = useBlokkli()
|
|
21
21
|
|
|
22
|
+
const props = defineProps<{
|
|
23
|
+
getDragItems?: (activeItem?: DraggableItem) => DraggableItem[] | null
|
|
24
|
+
}>()
|
|
25
|
+
|
|
22
26
|
let pointerStartCoords: Coord | null = null
|
|
23
27
|
let activeItem: DraggableItem | null = null
|
|
24
28
|
|
|
@@ -55,8 +59,9 @@ function onPointerMove(e: PointerEvent) {
|
|
|
55
59
|
const distance = getDistance(coords, pointerStartCoords)
|
|
56
60
|
|
|
57
61
|
if (distance > 7) {
|
|
62
|
+
const dragItems = props.getDragItems ? props.getDragItems(activeItem) : null
|
|
58
63
|
eventBus.emit('dragging:start', {
|
|
59
|
-
items: [activeItem],
|
|
64
|
+
items: dragItems && dragItems.length ? dragItems : [activeItem],
|
|
60
65
|
coords,
|
|
61
66
|
mode: 'mouse',
|
|
62
67
|
})
|
|
@@ -12,4 +12,5 @@ import Loading from './Loading/index.vue.js';
|
|
|
12
12
|
import Highlight from './Highlight/index.vue.js';
|
|
13
13
|
import ViewportBlockingRect from './ViewportBlockingRect/index.vue.js';
|
|
14
14
|
import ScrollBoundary from './ScrollBoundary/index.vue.js';
|
|
15
|
-
|
|
15
|
+
import InfoBox from './InfoBox/index.vue.js';
|
|
16
|
+
export { ItemIcon, ShortcutIndicator, RelativeTime, Icon, Resizable, DialogModal, ScaleToFit, Sortli, FormOverlay, AddListItem, Loading, Highlight, ViewportBlockingRect, ScrollBoundary, InfoBox, };
|
|
@@ -12,6 +12,7 @@ import Loading from "./Loading/index.vue";
|
|
|
12
12
|
import Highlight from "./Highlight/index.vue";
|
|
13
13
|
import ViewportBlockingRect from "./ViewportBlockingRect/index.vue";
|
|
14
14
|
import ScrollBoundary from "./ScrollBoundary/index.vue";
|
|
15
|
+
import InfoBox from "./InfoBox/index.vue";
|
|
15
16
|
export {
|
|
16
17
|
ItemIcon,
|
|
17
18
|
ShortcutIndicator,
|
|
@@ -26,5 +27,6 @@ export {
|
|
|
26
27
|
Loading,
|
|
27
28
|
Highlight,
|
|
28
29
|
ViewportBlockingRect,
|
|
29
|
-
ScrollBoundary
|
|
30
|
+
ScrollBoundary,
|
|
31
|
+
InfoBox
|
|
30
32
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const SETTINGS_GROUP: readonly ["appearance", "artboard", "behavior", "advanced"];
|
|
1
|
+
export declare const SETTINGS_GROUP: readonly ["appearance", "artboard", "behavior", "beta", "advanced"];
|
|
2
2
|
export declare const VIEWPORT: readonly ["mobile", "desktop"];
|
|
3
3
|
export type SettingsGroup = (typeof SETTINGS_GROUP)[number];
|
|
4
4
|
export type Viewport = (typeof VIEWPORT)[number];
|