@blokkli/editor 2.0.0-alpha.53 → 2.0.0-alpha.55
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/global/constants/index.d.ts +1 -1
- package/dist/global/constants/index.js +1 -1
- package/dist/global/types/features.d.ts +5 -9
- package/dist/module.json +1 -1
- package/dist/module.mjs +28 -35
- package/dist/modules/agent/index.mjs +46 -29
- package/dist/modules/agent/runtime/app/composables/agentProvider.js +2 -1
- package/dist/modules/agent/runtime/app/features/agent/Container.d.vue.ts +19 -0
- package/dist/modules/agent/runtime/app/features/agent/Container.vue +195 -0
- package/dist/modules/agent/runtime/app/features/agent/Container.vue.d.ts +19 -0
- package/dist/modules/agent/runtime/app/features/agent/index.vue +18 -164
- package/dist/modules/agent/runtime/app/features/agent/types.d.ts +9 -0
- package/dist/modules/agent/runtime/app/helpers/index.d.ts +7 -3
- package/dist/modules/agent/runtime/app/helpers/index.js +9 -3
- package/dist/modules/agent/runtime/app/prompts/fixReadability.js +51 -44
- package/dist/modules/agent/runtime/app/tools/add_media_paragraph/index.js +2 -1
- package/dist/modules/agent/runtime/app/tools/check_readability/index.js +1 -0
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/Component.vue +1 -1
- package/dist/modules/agent/runtime/app/tools/delegate_text_rewrite/index.js +6 -1
- package/dist/modules/agent/runtime/app/tools/get_readability_issues/index.js +1 -0
- package/dist/modules/agent/runtime/app/types/index.d.ts +12 -0
- package/dist/modules/charts/runtime/components/ChartRenderer/index.vue +34 -18
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +7 -0
- package/dist/modules/drupal/graphql/features/droppable-field-items.graphql +22 -0
- package/dist/modules/drupal/graphql/features/import-existing.graphql +0 -25
- package/dist/modules/drupal/graphql/features/workspace.graphql +9 -2
- package/dist/modules/drupal/graphql/mutations/update_droppable_field.graphql +21 -0
- package/dist/modules/drupal/index.mjs +6 -2
- package/dist/modules/drupal/runtime/adapter/index.js +75 -39
- package/dist/modules/readability/index.d.mts +11 -0
- package/dist/modules/readability/index.mjs +17 -0
- package/dist/modules/readability/runtime/adapter-extension.d.ts +2 -0
- package/dist/modules/readability/runtime/adapter-extension.js +5 -0
- package/dist/modules/readability/runtime/analyzers/builtin.d.ts +10 -0
- package/dist/modules/readability/runtime/analyzers/builtin.js +340 -0
- package/dist/runtime/components/BlokkliEditable.vue +10 -90
- package/dist/runtime/components/BlokkliItem.vue +2 -2
- package/dist/runtime/components/BlokkliProvider.vue +11 -5
- package/dist/runtime/composables/defineBlokkli.js +3 -1
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +2 -3
- package/dist/runtime/editor/components/Actions/index.vue +1 -1
- package/dist/runtime/editor/components/AnimationCanvas/index.vue +41 -6
- package/dist/runtime/editor/components/AppMenu/Inner.d.vue.ts +7 -0
- package/dist/runtime/editor/components/AppMenu/Inner.vue +83 -0
- package/dist/runtime/editor/components/AppMenu/Inner.vue.d.ts +7 -0
- package/dist/runtime/editor/components/AppMenu/index.vue +5 -79
- package/dist/runtime/editor/components/ArtboardTooltip/index.d.vue.ts +1 -0
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue +9 -1
- package/dist/runtime/editor/components/ArtboardTooltip/index.vue.d.ts +1 -0
- package/dist/runtime/editor/components/BlockPreviewItem/index.vue +12 -6
- package/dist/runtime/editor/components/BlokkliEditableEdit.d.vue.ts +23 -0
- package/dist/runtime/editor/components/BlokkliEditableEdit.vue +95 -0
- package/dist/runtime/editor/components/BlokkliEditableEdit.vue.d.ts +23 -0
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.d.vue.ts +4 -1
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue +4 -1
- package/dist/runtime/editor/components/BlokkliRootErrorBoundary.vue.d.ts +4 -1
- package/dist/runtime/editor/components/BundleSelector/index.vue +10 -5
- package/dist/runtime/editor/components/Dialog/index.vue +0 -77
- package/dist/runtime/editor/components/EditIndicator.d.vue.ts +1 -0
- package/dist/runtime/editor/components/EditIndicator.vue +3 -2
- package/dist/runtime/editor/components/EditIndicator.vue.d.ts +1 -0
- package/dist/runtime/editor/components/EditProvider.d.vue.ts +3 -1
- package/dist/runtime/editor/components/EditProvider.vue +13 -4
- package/dist/runtime/editor/components/EditProvider.vue.d.ts +3 -1
- package/dist/runtime/editor/components/FeaturesRenderer/index.vue +1 -4
- package/dist/runtime/editor/components/Form/Text/index.d.vue.ts +5 -0
- package/dist/runtime/editor/components/Form/Text/index.vue +10 -4
- package/dist/runtime/editor/components/Form/Text/index.vue.d.ts +5 -0
- package/dist/runtime/editor/components/FormOverlay/index.vue +0 -24
- package/dist/runtime/editor/components/GrowOnly/index.d.vue.ts +10 -0
- package/dist/runtime/editor/components/GrowOnly/index.vue +34 -0
- package/dist/runtime/editor/components/GrowOnly/index.vue.d.ts +10 -0
- package/dist/runtime/editor/components/Konami/Game/index.vue +120 -0
- package/dist/runtime/editor/components/Konami/index.vue +7 -124
- package/dist/runtime/editor/components/Loading/index.vue +1 -1
- package/dist/runtime/editor/components/PluginConfigForm/Text/index.vue +1 -0
- package/dist/runtime/editor/components/PluginConfigForm/index.vue +1 -0
- package/dist/runtime/editor/components/PreviewProvider.d.vue.ts +3 -1
- package/dist/runtime/editor/components/PreviewProvider.vue +6 -1
- package/dist/runtime/editor/components/PreviewProvider.vue.d.ts +3 -1
- package/dist/runtime/editor/components/Toolbar/index.vue +1 -1
- package/dist/runtime/editor/components/index.d.ts +11 -10
- package/dist/runtime/editor/components/index.js +32 -10
- package/dist/runtime/editor/composables/defineRenderer.d.ts +2 -2
- package/dist/runtime/editor/composables/defineRenderer.js +8 -3
- package/dist/runtime/editor/css/output.css +1 -1
- package/dist/runtime/editor/events/index.d.ts +6 -0
- package/dist/runtime/editor/features/analyze/Main.d.vue.ts +1 -0
- package/dist/runtime/editor/features/analyze/Main.vue +9 -8
- package/dist/runtime/editor/features/analyze/Main.vue.d.ts +1 -0
- package/dist/runtime/editor/features/analyze/Results/ResultsItem.vue +7 -15
- package/dist/runtime/editor/features/analyze/Results/ResultsItemNodesTarget.vue +4 -2
- package/dist/runtime/editor/features/analyze/analyzers/axe.js +9 -9
- package/dist/runtime/editor/features/analyze/analyzers/readability.js +7 -7
- package/dist/runtime/editor/features/analyze/index.vue +26 -26
- package/dist/runtime/editor/features/analyze/readability/types.d.ts +18 -14
- package/dist/runtime/editor/features/anchors/index.vue +6 -2
- package/dist/runtime/editor/features/artboard/Renderer.vue +3 -2
- package/dist/runtime/editor/features/block-scheduler/Dialog/index.vue +78 -0
- package/dist/runtime/editor/features/block-scheduler/index.vue +34 -89
- package/dist/runtime/editor/features/breadcrumbs/index.vue +2 -2
- package/dist/runtime/editor/features/changelog/changelog.json +8 -0
- package/dist/runtime/editor/features/changelog/index.vue +10 -8
- package/dist/runtime/editor/features/clipboard/DropElement/index.vue +152 -0
- package/dist/runtime/editor/features/clipboard/index.vue +13 -159
- package/dist/runtime/editor/features/command-palette/Palette/Item/index.vue +0 -28
- package/dist/runtime/editor/features/command-palette/Palette/index.vue +17 -6
- package/dist/runtime/editor/features/command-palette/index.vue +7 -2
- package/dist/runtime/editor/features/comments/index.vue +6 -3
- package/dist/runtime/editor/features/debug/Main.vue +168 -0
- package/dist/runtime/editor/features/debug/Section/Features.vue +1 -2
- package/dist/runtime/editor/features/debug/index.vue +6 -170
- package/dist/runtime/editor/features/dev-mode/index.vue +2 -1
- package/dist/runtime/editor/features/diff/index.vue +6 -2
- package/dist/runtime/editor/features/dragging-overlay/Renderer/index.vue +15 -16
- package/dist/runtime/editor/features/dragging-overlay/index.vue +4 -3
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.d.vue.ts +15 -0
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue +547 -0
- package/dist/runtime/editor/features/droppable-field-edit/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.d.vue.ts +3 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.vue +231 -0
- package/dist/runtime/editor/features/droppable-field-edit/index.vue.d.ts +3 -0
- package/dist/runtime/editor/features/droppable-field-edit/types.d.ts +70 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.d.vue.ts +1 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue +34 -21
- package/dist/runtime/editor/features/editable-field/Overlay/Frame/index.vue.d.ts +1 -0
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.d.vue.ts +2 -2
- package/dist/runtime/editor/features/editable-field/Overlay/Plaintext/index.vue.d.ts +2 -2
- package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/ChunkOverlay.vue +1 -1
- package/dist/runtime/editor/features/editable-field/Overlay/ReadabilityIndicator/index.vue +6 -13
- package/dist/runtime/editor/features/editable-field/Overlay/index.vue +4 -4
- package/dist/runtime/editor/features/fragments/index.vue +9 -4
- package/dist/runtime/editor/features/help/index.vue +7 -2
- package/dist/runtime/editor/features/highlights/Renderer/index.vue +11 -17
- package/dist/runtime/editor/features/history/index.vue +3 -2
- package/dist/runtime/editor/features/hover/Renderer/index.vue +87 -36
- package/dist/runtime/editor/features/hover/Renderer/vertex.glsl +5 -5
- package/dist/runtime/editor/features/hover/index.vue +1 -1
- package/dist/runtime/editor/features/import-existing/Dialog/Item.d.vue.ts +5 -0
- package/dist/runtime/editor/features/import-existing/Dialog/Item.vue +55 -0
- package/dist/runtime/editor/features/import-existing/Dialog/Item.vue.d.ts +5 -0
- package/dist/runtime/editor/features/import-existing/Dialog/index.d.vue.ts +7 -3
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue +107 -65
- package/dist/runtime/editor/features/import-existing/Dialog/index.vue.d.ts +7 -3
- package/dist/runtime/editor/features/import-existing/index.vue +19 -6
- package/dist/runtime/editor/features/import-existing/types.d.ts +0 -11
- package/dist/runtime/editor/features/library/ReusableDialog/index.vue +7 -33
- package/dist/runtime/editor/features/library/index.vue +14 -5
- package/dist/runtime/editor/features/media-library/Library/index.vue +3 -1
- package/dist/runtime/editor/features/media-library/index.vue +9 -2
- package/dist/runtime/editor/features/media-library/types.d.ts +2 -0
- package/dist/runtime/editor/features/multi-select/Renderer/index.vue +16 -15
- package/dist/runtime/editor/features/multi-select/index.vue +9 -3
- package/dist/runtime/editor/features/options/Form/Radios/index.vue +4 -8
- package/dist/runtime/editor/features/options/index.vue +7 -2
- package/dist/runtime/editor/features/preview-grant/index.vue +8 -2
- package/dist/runtime/editor/features/publish/index.vue +3 -2
- package/dist/runtime/editor/features/referenced-entities/index.vue +7 -2
- package/dist/runtime/editor/features/responsive-preview/index.vue +13 -11
- package/dist/runtime/editor/features/search/index.vue +6 -2
- package/dist/runtime/editor/features/selection/AddButtons/Renderer/index.vue +6 -11
- package/dist/runtime/editor/features/selection/Renderer/index.vue +9 -14
- package/dist/runtime/editor/features/selection/index.vue +7 -4
- package/dist/runtime/editor/features/settings/index.vue +8 -3
- package/dist/runtime/editor/features/structure/index.vue +3 -2
- package/dist/runtime/editor/features/templates/CreateDialog/index.vue +1 -0
- package/dist/runtime/editor/features/templates/index.vue +14 -6
- package/dist/runtime/editor/features/theme/index.vue +2 -1
- package/dist/runtime/editor/features/tour/index.vue +6 -2
- package/dist/runtime/editor/features/translations/index.vue +7 -4
- package/dist/runtime/editor/features/workspace/Overlay/Item.d.vue.ts +3 -0
- package/dist/runtime/editor/features/workspace/Overlay/Item.vue +49 -0
- package/dist/runtime/editor/features/workspace/Overlay/Item.vue.d.ts +3 -0
- package/dist/runtime/editor/features/workspace/Overlay/index.vue +16 -104
- package/dist/runtime/editor/features/workspace/index.vue +6 -2
- package/dist/runtime/editor/helpers/webgl/index.d.ts +3 -2
- package/dist/runtime/editor/helpers/webgl/index.js +2 -3
- package/dist/runtime/editor/libraries/fzf.d.ts +3 -0
- package/dist/runtime/editor/libraries/fzf.js +7 -0
- package/dist/runtime/editor/libraries/twgl.d.ts +10 -0
- package/dist/runtime/editor/libraries/twgl.js +14 -0
- package/dist/runtime/editor/plugins/DebugOverlay/index.vue +3 -1
- package/dist/runtime/editor/plugins/Sidebar/Detached/index.vue +39 -18
- package/dist/runtime/editor/plugins/Sidebar/index.d.vue.ts +2 -0
- package/dist/runtime/editor/plugins/Sidebar/index.vue +12 -4
- package/dist/runtime/editor/plugins/Sidebar/index.vue.d.ts +2 -0
- package/dist/runtime/editor/providers/animation.d.ts +5 -10
- package/dist/runtime/editor/providers/animation.js +10 -8
- package/dist/runtime/editor/providers/directive.d.ts +11 -0
- package/dist/runtime/editor/providers/directive.js +16 -0
- package/dist/runtime/editor/providers/features.d.ts +3 -3
- package/dist/runtime/editor/providers/features.js +1 -1
- package/dist/runtime/editor/providers/fieldValue.d.ts +27 -0
- package/dist/runtime/editor/providers/fieldValue.js +21 -1
- package/dist/runtime/editor/providers/keyboard.js +6 -3
- package/dist/runtime/editor/providers/readability.d.ts +28 -4
- package/dist/runtime/editor/providers/readability.js +30 -46
- package/dist/runtime/editor/providers/selection.d.ts +8 -0
- package/dist/runtime/editor/providers/selection.js +6 -0
- package/dist/runtime/editor/providers/texts.d.ts +1 -3
- package/dist/runtime/editor/providers/texts.js +34 -37
- package/dist/runtime/editor/providers/workspaces.d.ts +93 -0
- package/dist/runtime/editor/providers/workspaces.js +76 -0
- package/dist/runtime/editor/translations/de.json +918 -3616
- package/dist/runtime/editor/translations/fr.json +250 -3616
- package/dist/runtime/editor/translations/gsw_CH.json +918 -3616
- package/dist/runtime/editor/translations/it.json +250 -3616
- package/dist/runtime/editor/types/app.d.ts +2 -0
- package/dist/runtime/editor/types/features.d.ts +1 -1
- package/dist/runtime/editor/types/state.d.ts +7 -0
- package/dist/runtime/helpers/injections.d.ts +6 -0
- package/dist/runtime/helpers/injections.js +3 -0
- package/dist/runtime/types/definitions.d.ts +4 -0
- package/package.json +14 -4
- package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.d.ts +0 -6
- package/dist/runtime/editor/features/analyze/readability/builtinAnalyzer.js +0 -216
- package/dist/runtime/editor/features/workspace/types.d.ts +0 -59
- /package/dist/runtime/editor/features/{workspace → droppable-field-edit}/types.js +0 -0
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
<script setup>
|
|
6
6
|
import { useBlokkli, computed, ref, watch } from "#imports";
|
|
7
|
-
import {
|
|
8
|
-
setBuffersAndAttributes,
|
|
9
|
-
drawBufferInfo,
|
|
10
|
-
setUniforms
|
|
11
|
-
} from "twgl.js";
|
|
12
7
|
import vs from "./vertex.glsl?raw";
|
|
13
8
|
import fs from "./fragment.glsl?raw";
|
|
14
9
|
import { RectangleBufferCollector } from "#blokkli/editor/helpers/webgl";
|
|
@@ -25,9 +20,11 @@ const {
|
|
|
25
20
|
directive,
|
|
26
21
|
blocks,
|
|
27
22
|
fields,
|
|
28
|
-
permissions
|
|
23
|
+
permissions,
|
|
24
|
+
types,
|
|
25
|
+
keyboard
|
|
29
26
|
} = useBlokkli();
|
|
30
|
-
const MAX_RECTS =
|
|
27
|
+
const MAX_RECTS = 12;
|
|
31
28
|
function getDeepestUuid(uuids) {
|
|
32
29
|
if (uuids.length === 0) {
|
|
33
30
|
return null;
|
|
@@ -60,12 +57,14 @@ const hoverState = createHoverState();
|
|
|
60
57
|
let previousHoveredUuids = [];
|
|
61
58
|
let previousDeepestUuid = null;
|
|
62
59
|
let previousEditableFieldRect = null;
|
|
60
|
+
let previousDroppableFieldRect = null;
|
|
63
61
|
const isHoveringEditableField = ref(false);
|
|
62
|
+
const isHoveringDroppableField = ref(false);
|
|
64
63
|
const isHoveringSelectedBlock = ref(false);
|
|
65
64
|
class HoverRectangleBufferCollector extends RectangleBufferCollector {
|
|
66
|
-
getBufferInfo(gl) {
|
|
65
|
+
getBufferInfo(gl, twgl) {
|
|
67
66
|
if (!this.bufferInfo) {
|
|
68
|
-
this.bufferInfo = this.createBufferInfo(gl);
|
|
67
|
+
this.bufferInfo = this.createBufferInfo(gl, twgl);
|
|
69
68
|
}
|
|
70
69
|
return this.bufferInfo;
|
|
71
70
|
}
|
|
@@ -74,8 +73,10 @@ function resetHoverState() {
|
|
|
74
73
|
previousHoveredUuids = [];
|
|
75
74
|
previousDeepestUuid = null;
|
|
76
75
|
previousEditableFieldRect = null;
|
|
76
|
+
previousDroppableFieldRect = null;
|
|
77
77
|
hoverState.visible.fill(0);
|
|
78
78
|
isHoveringEditableField.value = false;
|
|
79
|
+
isHoveringDroppableField.value = false;
|
|
79
80
|
isHoveringSelectedBlock.value = false;
|
|
80
81
|
}
|
|
81
82
|
watch(ui.isChangingOptions, (isChanging) => {
|
|
@@ -95,13 +96,15 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
|
|
|
95
96
|
};
|
|
96
97
|
const isOutsideArtboard = mouseX < artboardRect.x || mouseX > artboardRect.x + artboardRect.width || mouseY < artboardRect.y || mouseY > artboardRect.y + artboardRect.height;
|
|
97
98
|
if (isOutsideArtboard) {
|
|
98
|
-
const needsUpdate = previousHoveredUuids.length > 0 || previousEditableFieldRect !== null || isHoveringEditableField.value || isHoveringSelectedBlock.value;
|
|
99
|
+
const needsUpdate = previousHoveredUuids.length > 0 || previousEditableFieldRect !== null || previousDroppableFieldRect !== null || isHoveringEditableField.value || isHoveringDroppableField.value || isHoveringSelectedBlock.value;
|
|
99
100
|
hoverState.visible.fill(0);
|
|
100
101
|
isHoveringEditableField.value = false;
|
|
102
|
+
isHoveringDroppableField.value = false;
|
|
101
103
|
isHoveringSelectedBlock.value = false;
|
|
102
104
|
previousHoveredUuids = [];
|
|
103
105
|
previousDeepestUuid = null;
|
|
104
106
|
previousEditableFieldRect = null;
|
|
107
|
+
previousDroppableFieldRect = null;
|
|
105
108
|
return needsUpdate;
|
|
106
109
|
}
|
|
107
110
|
const artboardMouseX = mouseX / scale - offset.x / scale;
|
|
@@ -134,32 +137,65 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
|
|
|
134
137
|
const hoveredChanged = unselectedHoveredUuids.length !== previousHoveredUuids.length || unselectedHoveredUuids.some(
|
|
135
138
|
(uuid, i) => uuid !== previousHoveredUuids[i]
|
|
136
139
|
) || deepestUuid !== previousDeepestUuid;
|
|
140
|
+
const suppressFieldHover = keyboard.isPressingControl.value;
|
|
137
141
|
let hoveredEditableFieldRect = null;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
142
|
+
if (!suppressFieldHover) {
|
|
143
|
+
const editableRects = directive.getVisible("editable");
|
|
144
|
+
let fallbackEditableRect = null;
|
|
145
|
+
for (let i = 0; i < editableRects.length; i++) {
|
|
146
|
+
const editableRect = editableRects[i];
|
|
147
|
+
if (!isInsideRect(artboardMouseX, artboardMouseY, editableRect)) continue;
|
|
148
|
+
const key = editableRect.key;
|
|
149
|
+
const entityUuid = key.split(":")[2];
|
|
150
|
+
const block = blocks.getBlock(entityUuid);
|
|
151
|
+
if (block && (!permissions.checkBlockBundlePermission(block.bundle, "edit") || permissions.blockHasRestrictedAncestor(entityUuid))) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
if (deepestUuid && entityUuid === deepestUuid) {
|
|
155
|
+
hoveredEditableFieldRect = editableRect;
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
if (!fallbackEditableRect && !hoveredUuids.includes(entityUuid)) {
|
|
159
|
+
fallbackEditableRect = editableRect;
|
|
160
|
+
}
|
|
152
161
|
}
|
|
153
|
-
if (!
|
|
154
|
-
|
|
162
|
+
if (!hoveredEditableFieldRect) {
|
|
163
|
+
hoveredEditableFieldRect = fallbackEditableRect;
|
|
155
164
|
}
|
|
156
165
|
}
|
|
157
|
-
|
|
158
|
-
|
|
166
|
+
let hoveredDroppableFieldRect = null;
|
|
167
|
+
if (!suppressFieldHover && !hoveredEditableFieldRect) {
|
|
168
|
+
const droppableRects = directive.getVisible("droppable");
|
|
169
|
+
const excludedKeys = /* @__PURE__ */ new Set();
|
|
170
|
+
for (const el of directive.getDroppableElements()) {
|
|
171
|
+
const config = types.getDroppableFieldConfig(el.fieldName, el);
|
|
172
|
+
if (config.type !== "reference") {
|
|
173
|
+
excludedKeys.add(el.key);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
let fallbackDroppableRect = null;
|
|
177
|
+
for (let i = 0; i < droppableRects.length; i++) {
|
|
178
|
+
const droppableRect = droppableRects[i];
|
|
179
|
+
if (!isInsideRect(artboardMouseX, artboardMouseY, droppableRect)) continue;
|
|
180
|
+
const key = droppableRect.key;
|
|
181
|
+
if (excludedKeys.has(key)) continue;
|
|
182
|
+
const entityUuid = key.split(":")[2];
|
|
183
|
+
if (deepestUuid && entityUuid === deepestUuid) {
|
|
184
|
+
hoveredDroppableFieldRect = droppableRect;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
if (!fallbackDroppableRect && !hoveredUuids.includes(entityUuid)) {
|
|
188
|
+
fallbackDroppableRect = droppableRect;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (!hoveredDroppableFieldRect) {
|
|
192
|
+
hoveredDroppableFieldRect = fallbackDroppableRect;
|
|
193
|
+
}
|
|
159
194
|
}
|
|
160
195
|
if (!hoveredChanged) {
|
|
161
196
|
const editableFieldChanged = hoveredEditableFieldRect === null !== (previousEditableFieldRect === null) || hoveredEditableFieldRect && previousEditableFieldRect && (hoveredEditableFieldRect.x !== previousEditableFieldRect.x || hoveredEditableFieldRect.y !== previousEditableFieldRect.y || hoveredEditableFieldRect.width !== previousEditableFieldRect.width || hoveredEditableFieldRect.height !== previousEditableFieldRect.height);
|
|
162
|
-
|
|
197
|
+
const droppableFieldChanged = hoveredDroppableFieldRect === null !== (previousDroppableFieldRect === null) || hoveredDroppableFieldRect && previousDroppableFieldRect && (hoveredDroppableFieldRect.x !== previousDroppableFieldRect.x || hoveredDroppableFieldRect.y !== previousDroppableFieldRect.y || hoveredDroppableFieldRect.width !== previousDroppableFieldRect.width || hoveredDroppableFieldRect.height !== previousDroppableFieldRect.height);
|
|
198
|
+
if (!editableFieldChanged && !droppableFieldChanged) {
|
|
163
199
|
return false;
|
|
164
200
|
}
|
|
165
201
|
}
|
|
@@ -219,10 +255,25 @@ function updateHoverState(mouseX, mouseY, offset, scale, artboardSize) {
|
|
|
219
255
|
hoverState.types[10] = 2;
|
|
220
256
|
hoverState.visible[10] = 1;
|
|
221
257
|
}
|
|
258
|
+
if (hoveredDroppableFieldRect) {
|
|
259
|
+
const inset = 2;
|
|
260
|
+
hoverState.positions[11 * 4 + 0] = hoveredDroppableFieldRect.x + inset;
|
|
261
|
+
hoverState.positions[11 * 4 + 1] = hoveredDroppableFieldRect.y + inset;
|
|
262
|
+
hoverState.positions[11 * 4 + 2] = hoveredDroppableFieldRect.width - inset * 2;
|
|
263
|
+
hoverState.positions[11 * 4 + 3] = hoveredDroppableFieldRect.height - inset * 2;
|
|
264
|
+
hoverState.radii[11 * 4 + 0] = 0;
|
|
265
|
+
hoverState.radii[11 * 4 + 1] = 0;
|
|
266
|
+
hoverState.radii[11 * 4 + 2] = 0;
|
|
267
|
+
hoverState.radii[11 * 4 + 3] = 0;
|
|
268
|
+
hoverState.types[11] = 2;
|
|
269
|
+
hoverState.visible[11] = 1;
|
|
270
|
+
}
|
|
222
271
|
previousHoveredUuids = unselectedHoveredUuids;
|
|
223
272
|
previousDeepestUuid = deepestUuid;
|
|
224
273
|
previousEditableFieldRect = hoveredEditableFieldRect;
|
|
274
|
+
previousDroppableFieldRect = hoveredDroppableFieldRect;
|
|
225
275
|
isHoveringEditableField.value = hoveredEditableFieldRect !== null;
|
|
276
|
+
isHoveringDroppableField.value = hoveredDroppableFieldRect !== null;
|
|
226
277
|
isHoveringSelectedBlock.value = deepestUuid !== null && selectedUuids.includes(deepestUuid);
|
|
227
278
|
return true;
|
|
228
279
|
}
|
|
@@ -242,7 +293,7 @@ onBlokkliEvent("state:reloaded", () => {
|
|
|
242
293
|
onBlokkliEvent("ui:resized", () => {
|
|
243
294
|
resetHoverState();
|
|
244
295
|
});
|
|
245
|
-
const { collector } = defineRenderer("hover-overlay", {
|
|
296
|
+
const { collector } = await defineRenderer("hover-overlay", {
|
|
246
297
|
zIndex: 200,
|
|
247
298
|
collector: () => {
|
|
248
299
|
const c = new HoverRectangleBufferCollector();
|
|
@@ -263,7 +314,7 @@ const { collector } = defineRenderer("hover-overlay", {
|
|
|
263
314
|
},
|
|
264
315
|
program: () => ({ shaders: [vs, fs] }),
|
|
265
316
|
cursor: () => {
|
|
266
|
-
if (isHoveringEditableField.value && state.editMode.value !== "readonly") {
|
|
317
|
+
if ((isHoveringEditableField.value || isHoveringDroppableField.value) && state.editMode.value !== "readonly") {
|
|
267
318
|
return "text";
|
|
268
319
|
}
|
|
269
320
|
if (isHoveringSelectedBlock.value && state.editMode.value === "editing") {
|
|
@@ -271,8 +322,8 @@ const { collector } = defineRenderer("hover-overlay", {
|
|
|
271
322
|
}
|
|
272
323
|
return null;
|
|
273
324
|
},
|
|
274
|
-
render: (ctx, gl, program) => {
|
|
275
|
-
const bufferInfo = collector.getBufferInfo(gl);
|
|
325
|
+
render: (ctx, gl, program, twgl) => {
|
|
326
|
+
const bufferInfo = collector.getBufferInfo(gl, twgl);
|
|
276
327
|
if (!ui.openTooltip.value) {
|
|
277
328
|
updateHoverState(
|
|
278
329
|
ctx.mouseX,
|
|
@@ -283,7 +334,7 @@ const { collector } = defineRenderer("hover-overlay", {
|
|
|
283
334
|
);
|
|
284
335
|
}
|
|
285
336
|
gl.useProgram(program.program);
|
|
286
|
-
setUniforms(program, {
|
|
337
|
+
twgl.setUniforms(program, {
|
|
287
338
|
u_color_mono: toShaderColor(uniforms.value.u_color_mono),
|
|
288
339
|
u_color_accent: toShaderColor(uniforms.value.u_color_accent),
|
|
289
340
|
u_color_teal: toShaderColor(uniforms.value.u_color_teal),
|
|
@@ -297,8 +348,8 @@ const { collector } = defineRenderer("hover-overlay", {
|
|
|
297
348
|
u_opacity: ctx.changeOptionsTransition
|
|
298
349
|
});
|
|
299
350
|
animation.setSharedUniforms(gl, program);
|
|
300
|
-
setBuffersAndAttributes(gl, program, bufferInfo);
|
|
301
|
-
drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
|
|
351
|
+
twgl.setBuffersAndAttributes(gl, program, bufferInfo);
|
|
352
|
+
twgl.drawBufferInfo(gl, bufferInfo, gl.TRIANGLES);
|
|
302
353
|
},
|
|
303
354
|
renderFallback: (ctx, ctx2d) => {
|
|
304
355
|
if (!ui.openTooltip.value) {
|
|
@@ -19,11 +19,11 @@ uniform float u_offset_x;
|
|
|
19
19
|
uniform float u_offset_y;
|
|
20
20
|
uniform vec2 u_resolution;
|
|
21
21
|
|
|
22
|
-
// Hover state uniforms (
|
|
23
|
-
uniform vec4 u_hover_positions[
|
|
24
|
-
uniform vec4 u_hover_radii[
|
|
25
|
-
uniform float u_hover_types[
|
|
26
|
-
uniform float u_hover_visible[
|
|
22
|
+
// Hover state uniforms (12 rectangles)
|
|
23
|
+
uniform vec4 u_hover_positions[12]; // x, y, width, height
|
|
24
|
+
uniform vec4 u_hover_radii[12]; // topLeft, topRight, bottomRight, bottomLeft
|
|
25
|
+
uniform float u_hover_types[12]; // 0=mono, 1=accent, 2=teal fill
|
|
26
|
+
uniform float u_hover_visible[12]; // 0=hidden, 1=visible
|
|
27
27
|
|
|
28
28
|
// Color uniforms
|
|
29
29
|
uniform vec3 u_color_mono;
|
|
@@ -17,7 +17,7 @@ defineBlokkliFeature({
|
|
|
17
17
|
const { selection, ui, dom, animation, $t } = useBlokkli();
|
|
18
18
|
const isLocked = ref(false);
|
|
19
19
|
const isVisible = computed(
|
|
20
|
-
() => !isLocked.value && dom.isReady.value && !selection.isMultiSelecting.value && !selection.
|
|
20
|
+
() => !isLocked.value && dom.isReady.value && !selection.isMultiSelecting.value && !selection.activeFieldLabel.value && !selection.isDragging.value && !ui.hasTransformOverlayOpen.value && !ui.hasDialogOpen.value && !ui.hasNestedEditorOpen.value && !ui.isAnimating.value && !ui.isApproving.value
|
|
21
21
|
);
|
|
22
22
|
</script>
|
|
23
23
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<any, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
+
"update:selectedUuid": (value: string) => any;
|
|
3
|
+
}, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, any, {}, any>;
|
|
4
|
+
declare const _default: typeof __VLS_export;
|
|
5
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
class="_bk_flex _bk_items-start _bk_gap-5 _bk_cursor-pointer _bk_hover:bg-mono-50 _bk_p-10 _bk_border _bk_border-mono-200 _bk_rounded-md _bk_hover:border-mono-400 _bk_min-w-0"
|
|
4
|
+
:class="{
|
|
5
|
+
'_bk_!border-accent-600 _bk_outline _bk_outline-4 _bk_outline-accent-200 _bk_!bg-accent-50': isSelected
|
|
6
|
+
}"
|
|
7
|
+
>
|
|
8
|
+
<span class="bk-radio">
|
|
9
|
+
<input v-model="selectedUuid" type="radio" :value="uuid" name="entity" />
|
|
10
|
+
<span />
|
|
11
|
+
</span>
|
|
12
|
+
<div class="_bk_flex-1 _bk_min-w-0">
|
|
13
|
+
<div class="_bk_truncate _bk_font-semibold _bk_text-base">
|
|
14
|
+
{{ label }}
|
|
15
|
+
<span class="_bk_font-normal _bk_text-mono-500">{{ id }}</span>
|
|
16
|
+
</div>
|
|
17
|
+
<ul class="bk-pill-list _bk_mt-3">
|
|
18
|
+
<li>
|
|
19
|
+
<span class="bk-pill bk-is-mono">{{ bundleLabel }}</span>
|
|
20
|
+
</li>
|
|
21
|
+
<li v-if="lastChanged">
|
|
22
|
+
<span class="bk-pill bk-is-yellow-light">
|
|
23
|
+
<RelativeTime :timestamp="lastChanged" />
|
|
24
|
+
</span>
|
|
25
|
+
</li>
|
|
26
|
+
<li v-if="isOwner">
|
|
27
|
+
<span class="bk-pill">{{ $t("owner", "Owner") }}</span>
|
|
28
|
+
</li>
|
|
29
|
+
</ul>
|
|
30
|
+
</div>
|
|
31
|
+
</label>
|
|
32
|
+
</template>
|
|
33
|
+
|
|
34
|
+
<script setup>
|
|
35
|
+
import { computed, useBlokkli } from "#imports";
|
|
36
|
+
import { RelativeTime } from "#blokkli/editor/components";
|
|
37
|
+
const props = defineProps({
|
|
38
|
+
id: { type: String, required: true },
|
|
39
|
+
uuid: { type: String, required: true },
|
|
40
|
+
entityType: { type: String, required: true },
|
|
41
|
+
bundle: { type: String, required: true },
|
|
42
|
+
label: { type: String, required: true },
|
|
43
|
+
url: { type: String, required: true },
|
|
44
|
+
lastChanged: { type: [String, null], required: true },
|
|
45
|
+
uid: { type: [String, null], required: true },
|
|
46
|
+
context: { type: String, required: false },
|
|
47
|
+
bundleLabel: { type: String, required: true },
|
|
48
|
+
isOwner: { type: Boolean, required: true }
|
|
49
|
+
});
|
|
50
|
+
const selectedUuid = defineModel("selectedUuid", { type: String, ...{ required: true } });
|
|
51
|
+
const isSelected = computed(() => {
|
|
52
|
+
return selectedUuid.value === props.uuid;
|
|
53
|
+
});
|
|
54
|
+
const { $t } = useBlokkli();
|
|
55
|
+
</script>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<any, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
2
|
+
"update:selectedUuid": (value: string) => any;
|
|
3
|
+
}, string, import("vue").PublicProps, any, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, any, {}, any>;
|
|
4
|
+
declare const _default: typeof __VLS_export;
|
|
5
|
+
export default _default;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FieldConfig } from '#blokkli/editor/types/definitions';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fields: FieldConfig[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
2
6
|
cancel: () => any;
|
|
3
7
|
confirm: (data: {
|
|
4
8
|
sourceUuid: string;
|
|
5
9
|
fields: string[];
|
|
6
10
|
}) => any;
|
|
7
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
12
|
onCancel?: (() => any) | undefined;
|
|
9
13
|
onConfirm?: ((data: {
|
|
10
14
|
sourceUuid: string;
|
|
11
15
|
fields: string[];
|
|
12
16
|
}) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
18
|
declare const _default: typeof __VLS_export;
|
|
15
19
|
export default _default;
|
|
@@ -12,12 +12,13 @@
|
|
|
12
12
|
:width="800"
|
|
13
13
|
:submit-label="$t('importExistingDialogSubmit', 'Import content')"
|
|
14
14
|
:can-submit="!!(sourceEntityUuid && selectedFields.length)"
|
|
15
|
-
:is-loading="isLoading"
|
|
15
|
+
:is-loading="isLoading || workspaces.isLoading.value || isSearching"
|
|
16
16
|
@submit="onSubmit"
|
|
17
17
|
@cancel="$emit('cancel')"
|
|
18
18
|
>
|
|
19
19
|
<div class="bk">
|
|
20
20
|
<FormCheckboxes
|
|
21
|
+
v-if="fieldOptions.length > 1"
|
|
21
22
|
id="import-existing-fields"
|
|
22
23
|
v-model="selectedFields"
|
|
23
24
|
:label="
|
|
@@ -29,72 +30,125 @@
|
|
|
29
30
|
:options="fieldOptions"
|
|
30
31
|
inline
|
|
31
32
|
/>
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
{{
|
|
33
|
+
<div class="_bk_mt-15 _bk_pt-15 _bk_border-t _bk_border-t-mono-300">
|
|
34
|
+
<FormText
|
|
35
|
+
id="import-existing-search"
|
|
36
|
+
v-model="searchText"
|
|
37
|
+
:label="$t('importExistingPagesTitle', 'Select page')"
|
|
38
|
+
:placeholder="
|
|
39
|
+
$t('importExistingSearchPlaceholder', 'Search pages...')
|
|
40
|
+
"
|
|
41
|
+
/>
|
|
42
|
+
<GrowOnly class="_bk_mt-20 _bk_min-w-0">
|
|
43
|
+
<div
|
|
44
|
+
v-if="!pagedItems.length && !workspaces.isLoading.value"
|
|
45
|
+
class="_bk_py-20 _bk_text-center _bk_text-mono-500 _bk_text-sm"
|
|
46
|
+
>
|
|
47
|
+
{{ $t("importExistingNoResults", "No pages found.") }}
|
|
48
|
+
</div>
|
|
49
|
+
<div class="_bk_grid _bk_gap-10">
|
|
50
|
+
<Item
|
|
51
|
+
v-for="item in pagedItems"
|
|
52
|
+
:key="item.uuid"
|
|
53
|
+
v-model:selected-uuid="sourceEntityUuid"
|
|
54
|
+
v-bind="item"
|
|
55
|
+
:bundle-label="workspaces.getBundleLabel(item.bundle)"
|
|
56
|
+
:is-owner="!!(item.uid && item.uid === ownerId)"
|
|
57
|
+
/>
|
|
47
58
|
</div>
|
|
48
|
-
</
|
|
59
|
+
</GrowOnly>
|
|
49
60
|
</div>
|
|
50
61
|
</div>
|
|
51
|
-
<template #pre-footer>
|
|
62
|
+
<template v-if="totalPages > 1" #pre-footer>
|
|
52
63
|
<Pagination v-model="page" :total-pages />
|
|
53
64
|
</template>
|
|
54
65
|
</DialogModal>
|
|
55
66
|
</template>
|
|
56
67
|
|
|
57
68
|
<script setup>
|
|
58
|
-
import {
|
|
69
|
+
import {
|
|
70
|
+
computed,
|
|
71
|
+
ref,
|
|
72
|
+
useBlokkli,
|
|
73
|
+
watch,
|
|
74
|
+
onMounted,
|
|
75
|
+
onBeforeUnmount
|
|
76
|
+
} from "#imports";
|
|
59
77
|
import {
|
|
60
78
|
DialogModal,
|
|
61
|
-
ConfigForm,
|
|
62
79
|
Pagination,
|
|
63
|
-
FormCheckboxes
|
|
80
|
+
FormCheckboxes,
|
|
81
|
+
FormText,
|
|
82
|
+
GrowOnly
|
|
64
83
|
} from "#blokkli/editor/components";
|
|
65
|
-
|
|
84
|
+
import Item from "./Item.vue";
|
|
85
|
+
const { $t, context, state, workspaces } = useBlokkli();
|
|
86
|
+
const props = defineProps({
|
|
87
|
+
fields: { type: Array, required: true }
|
|
88
|
+
});
|
|
66
89
|
const emit = defineEmits(["confirm", "cancel"]);
|
|
90
|
+
const fieldOptions = computed(
|
|
91
|
+
() => props.fields.map((field) => {
|
|
92
|
+
return {
|
|
93
|
+
value: field.name,
|
|
94
|
+
label: field.label
|
|
95
|
+
};
|
|
96
|
+
})
|
|
97
|
+
);
|
|
67
98
|
const sourceEntityUuid = ref("");
|
|
68
|
-
const selectedFields = ref(
|
|
99
|
+
const selectedFields = ref(fieldOptions.value.map((v) => v.value));
|
|
69
100
|
const isLoading = ref(false);
|
|
70
101
|
const page = ref(0);
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
102
|
+
const searchText = ref("");
|
|
103
|
+
const fzfResults = ref([]);
|
|
104
|
+
const isSearching = ref(false);
|
|
105
|
+
const ownerId = computed(() => state.owner.value?.id);
|
|
106
|
+
const currentBundle = computed(() => context.value.entityBundle);
|
|
107
|
+
const sortedItems = computed(
|
|
108
|
+
() => searchText.value.trim() ? fzfResults.value : workspaces.defaultSorted.value
|
|
109
|
+
);
|
|
110
|
+
const filteredItems = computed(
|
|
111
|
+
() => sortedItems.value.filter((item) => item.bundle === currentBundle.value)
|
|
112
|
+
);
|
|
113
|
+
const perPage = 16;
|
|
114
|
+
const totalPages = computed(
|
|
115
|
+
() => Math.max(1, Math.ceil(filteredItems.value.length / perPage))
|
|
77
116
|
);
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
117
|
+
const pagedItems = computed(
|
|
118
|
+
() => filteredItems.value.slice(page.value * perPage, (page.value + 1) * perPage)
|
|
119
|
+
);
|
|
120
|
+
watch(searchText, () => {
|
|
121
|
+
page.value = 0;
|
|
83
122
|
});
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
watch: [args]
|
|
123
|
+
let searchTimeout = null;
|
|
124
|
+
watch(searchText, (newValue) => {
|
|
125
|
+
if (searchTimeout) {
|
|
126
|
+
clearTimeout(searchTimeout);
|
|
127
|
+
searchTimeout = null;
|
|
90
128
|
}
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
129
|
+
if (!newValue.trim()) {
|
|
130
|
+
fzfResults.value = [];
|
|
131
|
+
isSearching.value = false;
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
isSearching.value = true;
|
|
135
|
+
const query = newValue.trim();
|
|
136
|
+
searchTimeout = setTimeout(async () => {
|
|
137
|
+
if (searchText.value.trim() !== query) {
|
|
138
|
+
isSearching.value = false;
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
const results = await workspaces.search(query);
|
|
143
|
+
if (searchText.value.trim() === query) {
|
|
144
|
+
fzfResults.value = results;
|
|
145
|
+
}
|
|
146
|
+
} finally {
|
|
147
|
+
if (searchText.value.trim() === query) {
|
|
148
|
+
isSearching.value = false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, 150);
|
|
98
152
|
});
|
|
99
153
|
function onSubmit() {
|
|
100
154
|
emit("confirm", {
|
|
@@ -103,17 +157,12 @@ function onSubmit() {
|
|
|
103
157
|
});
|
|
104
158
|
isLoading.value = true;
|
|
105
159
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
value: field.name,
|
|
113
|
-
label: field.label
|
|
114
|
-
};
|
|
115
|
-
})
|
|
116
|
-
);
|
|
160
|
+
onMounted(() => workspaces.ensureLoaded());
|
|
161
|
+
onBeforeUnmount(() => {
|
|
162
|
+
if (searchTimeout) {
|
|
163
|
+
clearTimeout(searchTimeout);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
117
166
|
</script>
|
|
118
167
|
|
|
119
168
|
<style>
|
|
@@ -124,12 +173,5 @@ const fieldOptions = computed(
|
|
|
124
173
|
--bk-tw-bg-opacity: 1;
|
|
125
174
|
background-color: rgb(255 255 255 / var(--bk-tw-bg-opacity, 1));
|
|
126
175
|
padding: 0px
|
|
127
|
-
}
|
|
128
|
-
.bk.bk-import-existing-dialog .bk-import-existing-dialog-results {
|
|
129
|
-
margin-top: 15px;
|
|
130
|
-
border-top-width: 1px;
|
|
131
|
-
--bk-tw-border-opacity: 1;
|
|
132
|
-
border-top-color: rgb(var(--bk-theme-mono-300) / var(--bk-tw-border-opacity, 1));
|
|
133
|
-
padding-top: 15px
|
|
134
176
|
}
|
|
135
177
|
</style>
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
import type { FieldConfig } from '#blokkli/editor/types/definitions';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
fields: FieldConfig[];
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
2
6
|
cancel: () => any;
|
|
3
7
|
confirm: (data: {
|
|
4
8
|
sourceUuid: string;
|
|
5
9
|
fields: string[];
|
|
6
10
|
}) => any;
|
|
7
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
11
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
8
12
|
onCancel?: (() => any) | undefined;
|
|
9
13
|
onConfirm?: ((data: {
|
|
10
14
|
sourceUuid: string;
|
|
11
15
|
fields: string[];
|
|
12
16
|
}) => any) | undefined;
|
|
13
|
-
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions,
|
|
17
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
18
|
declare const _default: typeof __VLS_export;
|
|
15
19
|
export default _default;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<BlokkliTransition name="slide-up">
|
|
4
4
|
<ExistingDialog
|
|
5
5
|
v-if="showModal"
|
|
6
|
+
:fields
|
|
6
7
|
@confirm="onSubmit($event.sourceUuid, $event.fields)"
|
|
7
8
|
@cancel="showModal = false"
|
|
8
9
|
/>
|
|
@@ -11,31 +12,43 @@
|
|
|
11
12
|
</template>
|
|
12
13
|
|
|
13
14
|
<script setup>
|
|
14
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
computed,
|
|
17
|
+
useBlokkli,
|
|
18
|
+
onMounted,
|
|
19
|
+
defineBlokkliFeature,
|
|
20
|
+
defineAsyncComponent
|
|
21
|
+
} from "#imports";
|
|
15
22
|
import { BlokkliTransition } from "#blokkli/editor/components";
|
|
16
|
-
import ExistingDialog from "./Dialog/index.vue";
|
|
17
23
|
import { defineMenuButton, useDialog } from "#blokkli/editor/composables";
|
|
24
|
+
const ExistingDialog = defineAsyncComponent(() => import("./Dialog/index.vue"));
|
|
18
25
|
const { adapter, settings } = defineBlokkliFeature({
|
|
19
26
|
id: "import-existing",
|
|
20
27
|
label: "Import existing content",
|
|
21
28
|
icon: "bk_mdi_arrow_downward",
|
|
22
|
-
requiredAdapterMethods: ["
|
|
29
|
+
requiredAdapterMethods: ["getHostEntities", "importFromExisting"],
|
|
23
30
|
description: "Implements a menu action that renders a dialog to import blocks from another entity.",
|
|
24
31
|
settings: {
|
|
25
32
|
showDialogWhenEmpty: {
|
|
26
33
|
type: "checkbox",
|
|
27
|
-
default:
|
|
34
|
+
default: false,
|
|
28
35
|
label: "Show import dialog at start",
|
|
29
36
|
description: "Displays the import dialog when starting bl\xF6kkli if the page is empty.",
|
|
30
37
|
group: "behavior"
|
|
31
38
|
}
|
|
32
39
|
}
|
|
33
40
|
});
|
|
34
|
-
const { ui, state, $t } = useBlokkli();
|
|
41
|
+
const { ui, state, $t, types, context } = useBlokkli();
|
|
35
42
|
const isEmpty = computed(
|
|
36
43
|
() => !state.mutatedFields.value.find((v) => v.list?.length)
|
|
37
44
|
);
|
|
38
45
|
const showModal = useDialog("import-existing", "center");
|
|
46
|
+
const fields = computed(
|
|
47
|
+
() => types.fieldConfig.forEntityTypeAndBundle(
|
|
48
|
+
context.value.entityType,
|
|
49
|
+
context.value.entityBundle
|
|
50
|
+
)
|
|
51
|
+
);
|
|
39
52
|
function onSubmit(sourceUuid, sourceFields) {
|
|
40
53
|
showModal.value = false;
|
|
41
54
|
state.mutateWithLoadingState(
|
|
@@ -53,7 +66,7 @@ onMounted(() => {
|
|
|
53
66
|
}
|
|
54
67
|
});
|
|
55
68
|
defineMenuButton(() => {
|
|
56
|
-
if (!
|
|
69
|
+
if (!fields.value.length) {
|
|
57
70
|
return void 0;
|
|
58
71
|
}
|
|
59
72
|
return {
|