@blokkli/editor 1.0.1 → 1.0.3
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 +31 -1
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +9 -1
- package/dist/runtime/adapter/index.d.ts +4 -0
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +2 -3
- package/dist/runtime/components/Edit/Dialog/index.vue +14 -1
- package/dist/runtime/components/Edit/DragInteractions/index.vue +6 -7
- package/dist/runtime/components/Edit/EditProvider.vue +1 -0
- package/dist/runtime/components/Edit/Features/Edit/index.vue +63 -14
- package/dist/runtime/components/Edit/Features/Exit/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +206 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +25 -2
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +1 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +2 -4
- package/dist/runtime/components/Edit/Features/Publish/index.vue +4 -1
- package/dist/runtime/components/Edit/Features/Translations/index.vue +43 -1
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/broadcastProvider.d.ts +10 -2
- package/dist/runtime/helpers/composables/onBroadcastEvent.d.ts +2 -0
- package/dist/runtime/helpers/composables/onBroadcastEvent.js +10 -0
- package/dist/runtime/helpers/index.js +2 -2
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +5 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +4 -6
- package/dist/runtime/types/index.d.ts +12 -2
- package/package.json +1 -1
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { type Emitter } from 'mitt';
|
|
2
|
-
type BroadcastEvents = {
|
|
2
|
+
export type BroadcastEvents = {
|
|
3
3
|
previewFocused: undefined;
|
|
4
|
+
published: {
|
|
5
|
+
uuid: string;
|
|
6
|
+
};
|
|
7
|
+
closeEditor: {
|
|
8
|
+
uuid: string;
|
|
9
|
+
};
|
|
10
|
+
editorLoaded: {
|
|
11
|
+
uuid: string;
|
|
12
|
+
};
|
|
4
13
|
};
|
|
5
14
|
export type BroadcastProvider = Emitter<BroadcastEvents>;
|
|
6
15
|
export default function (): BroadcastProvider;
|
|
7
|
-
export {};
|
|
@@ -20,7 +20,7 @@ export function buildDraggableItem(element) {
|
|
|
20
20
|
const hostFieldName = dataset.hostFieldName;
|
|
21
21
|
const reusableBundle = dataset.reusableBundle;
|
|
22
22
|
const hostFieldListType = dataset.hostFieldListType;
|
|
23
|
-
const
|
|
23
|
+
const libraryItemUuid = dataset.bkLibraryItemUuid;
|
|
24
24
|
const isNew = dataset.isNew === "true";
|
|
25
25
|
const parentBlockBundle = hostType === itemEntityType ? hostBundle : void 0;
|
|
26
26
|
if (uuid && hostType && hostUuid && hostFieldName && itemBundle && hostBundle && entityType && hostFieldListType) {
|
|
@@ -44,7 +44,7 @@ export function buildDraggableItem(element) {
|
|
|
44
44
|
hostFieldName,
|
|
45
45
|
hostFieldListType,
|
|
46
46
|
reusableBundle,
|
|
47
|
-
|
|
47
|
+
libraryItemUuid,
|
|
48
48
|
editTitle: editTitle || void 0,
|
|
49
49
|
isNew,
|
|
50
50
|
parentBlockBundle
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
* This file should contain all helpers that are meant for runtime functionality, such as defineBlokkli composable or <BlokkliProvider>.
|
|
3
3
|
*/
|
|
4
4
|
import type { BlockOptionDefinition } from '#blokkli/types/blokkOptions';
|
|
5
|
+
/**
|
|
6
|
+
* Map all kinds of truthy values for a checkbox.
|
|
7
|
+
* Returns our "internal" value of a checkbox state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function mapCheckboxTrue(v?: unknown): '1' | '0';
|
|
5
10
|
/**
|
|
6
11
|
* Get the runtime value for an option.
|
|
7
12
|
*
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
+
export function mapCheckboxTrue(v) {
|
|
2
|
+
return v === true || v === "1" || v === 1 || v === "true" ? "1" : "0";
|
|
3
|
+
}
|
|
1
4
|
export function getRuntimeOptionValue(definition, value) {
|
|
2
5
|
if (definition.type === "checkbox") {
|
|
3
|
-
|
|
4
|
-
return value === "1" || value === "true";
|
|
5
|
-
} else if (typeof value === "boolean") {
|
|
6
|
-
return value;
|
|
7
|
-
}
|
|
8
|
-
return false;
|
|
6
|
+
return mapCheckboxTrue(value) === "1";
|
|
9
7
|
} else if (definition.type === "radios") {
|
|
10
8
|
if (typeof value === "string") {
|
|
11
9
|
return value;
|
|
@@ -526,9 +526,9 @@ export interface DraggableExistingBlock {
|
|
|
526
526
|
*/
|
|
527
527
|
reusableBundle?: string;
|
|
528
528
|
/**
|
|
529
|
-
* The
|
|
529
|
+
* The UUID of the library item this block belongs to.
|
|
530
530
|
*/
|
|
531
|
-
|
|
531
|
+
libraryItemUuid?: string;
|
|
532
532
|
/**
|
|
533
533
|
* The title to use when displaying the block in lists during editing.
|
|
534
534
|
*/
|
|
@@ -802,6 +802,11 @@ export type DropClipboardItemEvent = {
|
|
|
802
802
|
host: DraggableHostData;
|
|
803
803
|
afterUuid?: string;
|
|
804
804
|
};
|
|
805
|
+
export type LibraryEditItemEvent = {
|
|
806
|
+
url: string;
|
|
807
|
+
uuid: string;
|
|
808
|
+
label?: string;
|
|
809
|
+
};
|
|
805
810
|
export type EventbusEvents = {
|
|
806
811
|
select: string | string[];
|
|
807
812
|
'item:edit': EditBlockEvent;
|
|
@@ -827,6 +832,7 @@ export type EventbusEvents = {
|
|
|
827
832
|
'select:next': undefined;
|
|
828
833
|
'item:dropped': undefined;
|
|
829
834
|
'block:append': BlockAppendEvent;
|
|
835
|
+
'item:doubleClick': DraggableExistingBlock;
|
|
830
836
|
scrollIntoView: ScrollIntoViewEvent;
|
|
831
837
|
'animationFrame:before': undefined;
|
|
832
838
|
'canvas:draw': CanvasDrawEvent;
|
|
@@ -853,6 +859,10 @@ export type EventbusEvents = {
|
|
|
853
859
|
* Emitted when publishing failed.
|
|
854
860
|
*/
|
|
855
861
|
'publish:failed': undefined;
|
|
862
|
+
/**
|
|
863
|
+
* Edit a library item.
|
|
864
|
+
*/
|
|
865
|
+
'library:edit-item': LibraryEditItemEvent;
|
|
856
866
|
};
|
|
857
867
|
export type Eventbus = Emitter<EventbusEvents>;
|
|
858
868
|
export type ItemEditContext = {
|