@blokkli/editor 2.0.0-alpha.13 → 2.0.0-alpha.15
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.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +4873 -1167
- package/dist/modules/drupal/graphql/base/fragment.ParagraphsBlokkliConfigInput.graphql +31 -0
- package/dist/modules/drupal/graphql/base/fragment.blokkliProps.graphql +1 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +5 -0
- package/dist/modules/drupal/graphql/base/query.pbEntityConfig.graphql +5 -0
- package/dist/modules/drupal/graphql/features/publishNew.graphql +1 -4
- package/dist/modules/drupal/graphql/features/scheduler.graphql +31 -0
- package/dist/modules/drupal/graphql/features/transform.graphql +9 -1
- package/dist/modules/drupal/graphql/features/transform_host.graphql +38 -0
- package/dist/modules/drupal/graphql/mutations/update_host_options.graphql +15 -0
- package/dist/modules/drupal/index.d.mts +1 -1
- package/dist/modules/drupal/index.mjs +37 -7
- package/dist/modules/drupal/runtime/adapter/index.js +140 -5
- package/dist/runtime/adapter/index.d.ts +90 -1
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +27 -3
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue +65 -0
- package/dist/runtime/blokkliPlugins/BlockIndicator/index.vue.d.ts +26 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +3 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +3 -2
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +3 -3
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +49 -11
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +29 -15
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +2 -2
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +6 -7
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +2 -9
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +1 -1
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +6 -3
- package/dist/runtime/blokkliPlugins/index.d.ts +8 -7
- package/dist/runtime/blokkliPlugins/index.js +15 -13
- package/dist/runtime/components/Blocks/Fragment/icon.svg +1 -1
- package/dist/runtime/components/BlokkliProvider.vue +1 -0
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +1 -0
- package/dist/runtime/components/Edit/Actions/index.vue +39 -67
- package/dist/runtime/components/Edit/AddListItem/index.vue +2 -5
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue +19 -0
- package/dist/runtime/components/Edit/AddListItemIcon/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +5 -5
- package/dist/runtime/components/Edit/Dialog/index.vue +5 -1
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +1 -1
- package/dist/runtime/components/Edit/DiffViewer/State.vue +276 -0
- package/dist/runtime/components/Edit/DiffViewer/State.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +35 -6
- package/dist/runtime/components/Edit/EditProvider.vue +46 -35
- package/dist/runtime/components/Edit/Features/AddList/index.vue +15 -25
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/fragment.glsl +58 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue +168 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Analyze/Overlay/vertex.glsl +72 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue +159 -0
- package/dist/runtime/components/Edit/Features/Analyze/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue +100 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Results.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue +56 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItem.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue +87 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodes.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue +101 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/ResultsItemNodesTarget.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue +18 -0
- package/dist/runtime/components/Edit/Features/Analyze/Results/Status.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue +92 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/Chart.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue +77 -0
- package/dist/runtime/components/Edit/Features/Analyze/Summary/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/axe.js +75 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.d.ts +4 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/defineAnalyzer.js +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.d.ts +32 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/Context.js +45 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/collectTextElements.js +95 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/helpers/normalizeArray.js +13 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/index.js +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/readability.js +165 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.d.ts +44 -0
- package/dist/runtime/components/Edit/Features/Analyze/analyzers/types.js +0 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Analyze/helper.js +28 -0
- package/dist/runtime/components/Edit/Features/Analyze/index.vue +44 -0
- package/dist/runtime/components/Edit/Features/Anchors/Renderer.vue +136 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue +32 -0
- package/dist/runtime/components/Edit/Features/Anchors/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +25 -13
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue +296 -0
- package/dist/runtime/components/Edit/Features/Artboard/Renderer.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +10 -245
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +161 -28
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +16 -4
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +4 -53
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +12 -14
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +14 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +27 -24
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +13 -190
- package/dist/runtime/components/Edit/Features/Diff/index.vue +2 -2
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +4 -4
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +35 -71
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +62 -48
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +3 -20
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +33 -1
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/History/index.vue +35 -12
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +6 -2
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Library/index.vue +11 -9
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +5 -8
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +9 -4
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +8 -14
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +9 -3
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +0 -1
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +37 -19
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +8 -2
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +81 -37
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +5 -5
- package/dist/runtime/components/Edit/Features/Options/index.vue +30 -6
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +41 -14
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue +47 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/PublishOption.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue +183 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/ScheduleDate.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue +83 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Summary.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +381 -128
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +3 -14
- package/dist/runtime/components/Edit/Features/Publish/index.vue +37 -22
- package/dist/runtime/components/Edit/Features/Revert/index.vue +3 -3
- package/dist/runtime/components/Edit/Features/Search/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue +54 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/AddButtonsField.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue +120 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue +459 -0
- package/dist/runtime/components/Edit/Features/Selection/AddButtons/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/fragment.glsl +14 -9
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +32 -11
- package/dist/runtime/components/Edit/Features/Selection/Overlay/vertex.glsl +1 -1
- package/dist/runtime/components/Edit/Features/Selection/index.vue +76 -7
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +12 -17
- package/dist/runtime/components/Edit/Features/Settings/index.vue +11 -25
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +5 -1
- package/dist/runtime/components/Edit/Features/Theme/index.vue +2 -1
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +3 -2
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue +198 -0
- package/dist/runtime/components/Edit/Features/Transform/Dialog/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +155 -44
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue +198 -0
- package/dist/runtime/components/Edit/Form/Datepicker/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Form/Radio/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Radio/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue +37 -0
- package/dist/runtime/components/Edit/Form/RadioTabs/index.vue.d.ts +22 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue +29 -0
- package/dist/runtime/components/Edit/Form/Select/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue +33 -0
- package/dist/runtime/components/Edit/Form/Text/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +13 -6
- package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +4 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +1 -1
- package/dist/runtime/components/Edit/Indicators/index.vue +123 -0
- package/dist/runtime/components/Edit/Indicators/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +2 -1
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue +66 -0
- package/dist/runtime/components/Edit/Konami/Game/PixelGrid.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Konami/Game/blokkli.png +0 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.d.ts +2 -0
- package/dist/runtime/components/Edit/Konami/Game/charmap.js +168 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue +752 -0
- package/dist/runtime/components/Edit/Konami/Game/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.d.ts +8 -0
- package/dist/runtime/components/Edit/Konami/Game/textRendering.js +138 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.d.ts +9 -0
- package/dist/runtime/components/Edit/Konami/Game/useIconRendering.js +130 -0
- package/dist/runtime/components/Edit/Konami/index.vue +44 -0
- package/dist/runtime/components/Edit/Konami/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Loading/index.vue +6 -2
- package/dist/runtime/components/Edit/Loading/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Messages/index.vue +8 -3
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue +17 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Checkbox/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue +37 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Options/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue +43 -0
- package/dist/runtime/components/Edit/PluginConfigForm/Text/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue +57 -0
- package/dist/runtime/components/Edit/PluginConfigForm/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +3 -4
- package/dist/runtime/components/Edit/RelativeTime/index.vue +3 -2
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +8 -3
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +3 -3
- package/dist/runtime/components/Edit/Toolbar/index.vue +3 -2
- package/dist/runtime/components/Edit/Transition/index.vue +41 -0
- package/dist/runtime/components/Edit/Transition/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/index.d.ts +24 -15
- package/dist/runtime/components/Edit/index.js +46 -28
- package/dist/runtime/composables/defineBlokkli.js +7 -3
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +4 -7
- package/dist/runtime/composables/defineBlokkliProvider.d.ts +11 -0
- package/dist/runtime/composables/defineBlokkliProvider.js +46 -0
- package/dist/runtime/composables/useBlokkliHelper.js +1 -1
- package/dist/runtime/constants/index.d.ts +3 -0
- package/dist/runtime/constants/index.js +3 -0
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/addElementClasses.d.ts +2 -0
- package/dist/runtime/helpers/addElementClasses.js +24 -0
- package/dist/runtime/helpers/animationProvider.d.ts +4 -2
- package/dist/runtime/helpers/animationProvider.js +7 -2
- package/dist/runtime/helpers/bundles/index.d.ts +1 -0
- package/dist/runtime/helpers/bundles/index.js +4 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.d.ts +20 -0
- package/dist/runtime/helpers/composables/useStickyToolbar.js +215 -0
- package/dist/runtime/helpers/definitionProvider.d.ts +2 -1
- package/dist/runtime/helpers/definitionProvider.js +17 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -1
- package/dist/runtime/helpers/domProvider.js +89 -43
- package/dist/runtime/helpers/dropTargets/index.d.ts +6 -0
- package/dist/runtime/helpers/dropTargets/index.js +49 -0
- package/dist/runtime/helpers/eventBus.d.ts +1 -1
- package/dist/runtime/helpers/eventBus.js +2 -2
- package/dist/runtime/helpers/index.d.ts +10 -1
- package/dist/runtime/helpers/index.js +57 -0
- package/dist/runtime/helpers/indicatorsProvider.d.ts +10 -0
- package/dist/runtime/helpers/indicatorsProvider.js +23 -0
- package/dist/runtime/helpers/keyboardProvider.d.ts +2 -0
- package/dist/runtime/helpers/keyboardProvider.js +17 -1
- package/dist/runtime/helpers/pluginProvider.d.ts +10 -0
- package/dist/runtime/helpers/pluginProvider.js +33 -0
- package/dist/runtime/helpers/renderCycle.d.ts +1 -0
- package/dist/runtime/helpers/renderCycle.js +10 -0
- package/dist/runtime/helpers/runtimeHelpers/index.js +14 -11
- package/dist/runtime/helpers/selectionProvider.d.ts +16 -0
- package/dist/runtime/helpers/selectionProvider.js +47 -35
- package/dist/runtime/helpers/stateProvider.d.ts +7 -2
- package/dist/runtime/helpers/stateProvider.js +89 -14
- package/dist/runtime/helpers/storageProvider.d.ts +4 -3
- package/dist/runtime/helpers/storageProvider.js +56 -3
- package/dist/runtime/helpers/symbols.d.ts +1 -0
- package/dist/runtime/helpers/symbols.js +1 -0
- package/dist/runtime/helpers/textProvider.js +6 -0
- package/dist/runtime/helpers/themeProvider.d.ts +2 -0
- package/dist/runtime/helpers/themeProvider.js +4 -1
- package/dist/runtime/helpers/transform.js +1 -3
- package/dist/runtime/helpers/uiProvider.d.ts +9 -2
- package/dist/runtime/helpers/uiProvider.js +72 -47
- package/dist/runtime/helpers/useTransitionedValue.d.ts +18 -0
- package/dist/runtime/helpers/useTransitionedValue.js +57 -0
- package/dist/runtime/icons/anchor.svg +1 -0
- package/dist/runtime/icons/arrow-left.svg +1 -1
- package/dist/runtime/icons/arrow-right.svg +1 -1
- package/dist/runtime/icons/arrow-top-right.svg +1 -0
- package/dist/runtime/icons/calendar-clock.svg +1 -0
- package/dist/runtime/icons/chart.svg +1 -0
- package/dist/runtime/icons/copy.svg +1 -0
- package/dist/runtime/icons/cursor-move.svg +1 -1
- package/dist/runtime/icons/diff.svg +1 -1
- package/dist/runtime/icons/eye-off.svg +1 -0
- package/dist/runtime/icons/eye.svg +1 -1
- package/dist/runtime/icons/info.svg +1 -1
- package/dist/runtime/icons/link.svg +1 -0
- package/dist/runtime/icons/speedometer.svg +1 -0
- package/dist/runtime/types/blokkOptions.d.ts +8 -0
- package/dist/runtime/types/index.d.ts +172 -6
- package/dist/runtime/types/theme.d.ts +2 -1
- package/dist/shared/{editor.gz_ac6uT.d.mts → editor.CKsrTpc1.d.mts} +1 -1
- package/package.json +20 -5
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +0 -22
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +0 -41
- /package/dist/runtime/components/Edit/Features/{FieldAreas/Overlay → Analyze}/index.vue.d.ts +0 -0
- /package/dist/runtime/components/Edit/Features/{FieldAreas/index.vue.d.ts → Anchors/Renderer.vue.d.ts} +0 -0
|
@@ -1,72 +1,16 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
:
|
|
5
|
-
:
|
|
6
|
-
:
|
|
7
|
-
|
|
8
|
-
'artboardToolbarButtonTourText',
|
|
9
|
-
'Shows the current zoom factor. Click on it to reset the zoom back to 100%.'
|
|
10
|
-
)
|
|
11
|
-
"
|
|
12
|
-
icon="magnifier"
|
|
13
|
-
meta
|
|
14
|
-
key-code="0"
|
|
15
|
-
region="view-options"
|
|
16
|
-
weight="100"
|
|
17
|
-
@click="resetZoom"
|
|
18
|
-
>
|
|
19
|
-
<div class="bk-feature-canvas-button">
|
|
20
|
-
<span>{{ zoomLevel }}</span>
|
|
21
|
-
</div>
|
|
22
|
-
</PluginToolbarButton>
|
|
23
|
-
|
|
24
|
-
<PluginViewOption
|
|
25
|
-
id="artboardOverview"
|
|
26
|
-
v-slot="{ isActive }"
|
|
27
|
-
:label="$t('artboardOverviewToggle', 'Toggle overview')"
|
|
28
|
-
:title-on="$t('artboardOverviewShow', 'Show overview')"
|
|
29
|
-
:title-off="$t('artboardOverviewHide', 'Hide overview')"
|
|
30
|
-
:tour-text="
|
|
31
|
-
$t(
|
|
32
|
-
'artboardOverviewTourText',
|
|
33
|
-
`Displays a top level overview of your content.`
|
|
34
|
-
)
|
|
35
|
-
"
|
|
36
|
-
icon="eye"
|
|
37
|
-
key-code="O"
|
|
38
|
-
weight="90"
|
|
39
|
-
>
|
|
40
|
-
<Teleport v-if="isActive" to="body">
|
|
41
|
-
<Overview :artboard="artboard" />
|
|
42
|
-
</Teleport>
|
|
43
|
-
</PluginViewOption>
|
|
44
|
-
|
|
45
|
-
<Scrollbar :artboard="artboard" orientation="y" />
|
|
2
|
+
<Renderer
|
|
3
|
+
v-if="renderArtboard"
|
|
4
|
+
:persist="settings.persist"
|
|
5
|
+
:momentum="settings.momentum"
|
|
6
|
+
:scroll-speed="settings.scrollSpeed"
|
|
7
|
+
/>
|
|
46
8
|
</template>
|
|
47
9
|
|
|
48
10
|
<script setup>
|
|
49
|
-
import {
|
|
50
|
-
watch,
|
|
51
|
-
computed,
|
|
52
|
-
useBlokkli,
|
|
53
|
-
onMounted,
|
|
54
|
-
onBeforeUnmount,
|
|
55
|
-
defineBlokkliFeature
|
|
56
|
-
} from "#imports";
|
|
57
|
-
import { PluginToolbarButton, PluginViewOption } from "#blokkli/plugins";
|
|
58
|
-
import { asValidNumber } from "#blokkli/helpers";
|
|
59
|
-
import Overview from "./Overview/index.vue";
|
|
60
|
-
import Scrollbar from "./Scrollbar/index.vue";
|
|
61
|
-
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
11
|
+
import { computed, useBlokkli, defineBlokkliFeature } from "#imports";
|
|
62
12
|
import defineShortcut from "#blokkli/helpers/composables/defineShortcut";
|
|
63
|
-
import
|
|
64
|
-
createArtboard,
|
|
65
|
-
touch,
|
|
66
|
-
wheel,
|
|
67
|
-
mouse,
|
|
68
|
-
dom as domPlugin
|
|
69
|
-
} from "artboard-deluxe";
|
|
13
|
+
import Renderer from "./Renderer.vue";
|
|
70
14
|
const { settings } = defineBlokkliFeature({
|
|
71
15
|
id: "artboard",
|
|
72
16
|
label: "Artboard",
|
|
@@ -102,173 +46,8 @@ const { settings } = defineBlokkliFeature({
|
|
|
102
46
|
},
|
|
103
47
|
screenshot: "feature-artboard.jpg"
|
|
104
48
|
});
|
|
105
|
-
const {
|
|
106
|
-
const
|
|
107
|
-
const PADDING = 50;
|
|
108
|
-
const options = computed(() => {
|
|
109
|
-
return {
|
|
110
|
-
maxScale: ui.isMobile.value ? 1 : 3,
|
|
111
|
-
direction: ui.isMobile.value ? "vertical" : "both",
|
|
112
|
-
minScale: 0.1,
|
|
113
|
-
overscrollBounds: {
|
|
114
|
-
top: ui.visibleViewport.value.y + PADDING,
|
|
115
|
-
left: ui.visibleViewport.value.x + PADDING,
|
|
116
|
-
right: ui.viewport.value.width - ui.visibleViewport.value.width - ui.visibleViewport.value.x + PADDING,
|
|
117
|
-
bottom: PADDING
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
});
|
|
121
|
-
watch(options, function(newOptions) {
|
|
122
|
-
artboard.setOptions(newOptions);
|
|
123
|
-
});
|
|
124
|
-
const storageKey = computed(() => "artboard:" + context.value.entityUuid);
|
|
125
|
-
const savedState = storage.use(storageKey, null);
|
|
126
|
-
const saveState = () => {
|
|
127
|
-
if (!settings.value.persist) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
savedState.value = {
|
|
131
|
-
offset: artboard.getOffset(),
|
|
132
|
-
scale: artboard.getScale()
|
|
133
|
-
};
|
|
134
|
-
};
|
|
135
|
-
let pluginWheel = null;
|
|
136
|
-
const wheelOptions = computed(() => {
|
|
137
|
-
return {
|
|
138
|
-
useMomentumZoom: settings.value.momentum,
|
|
139
|
-
useMomentumScroll: settings.value.momentum,
|
|
140
|
-
interceptWheel: true,
|
|
141
|
-
scrollSpeed: settings.value.scrollSpeed,
|
|
142
|
-
wheelZoomFactor: settings.value.scrollSpeed
|
|
143
|
-
};
|
|
144
|
-
});
|
|
145
|
-
watch(wheelOptions, function(newOptions) {
|
|
146
|
-
if (pluginWheel) {
|
|
147
|
-
pluginWheel.options.setAll(newOptions);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
watch(selection.uuids, function() {
|
|
151
|
-
if (artboard.getMomentum()) {
|
|
152
|
-
artboard.cancelAnimation();
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
function getArtboard() {
|
|
156
|
-
pluginWheel = wheel(wheelOptions.value);
|
|
157
|
-
return createArtboard(
|
|
158
|
-
ui.rootElement(),
|
|
159
|
-
[
|
|
160
|
-
mouse(),
|
|
161
|
-
touch(),
|
|
162
|
-
pluginWheel,
|
|
163
|
-
domPlugin({
|
|
164
|
-
element: ui.artboardElement(),
|
|
165
|
-
precision: 1,
|
|
166
|
-
restoreStyles: true
|
|
167
|
-
})
|
|
168
|
-
],
|
|
169
|
-
{
|
|
170
|
-
initTransform: savedState.value && settings.value.persist ? {
|
|
171
|
-
x: asValidNumber(savedState.value.offset.x, 0),
|
|
172
|
-
y: asValidNumber(savedState.value.offset.y, 0),
|
|
173
|
-
scale: asValidNumber(savedState.value?.scale, 1)
|
|
174
|
-
} : void 0,
|
|
175
|
-
...options.value
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
const artboard = getArtboard();
|
|
180
|
-
watch(options, function(newOptions) {
|
|
181
|
-
artboard.setOptions(newOptions);
|
|
182
|
-
});
|
|
183
|
-
const AUTOSCROLL_EDGE_ZONE = 130;
|
|
184
|
-
const AUTOSCROLL_SPEED = 12;
|
|
185
|
-
let autoScrollSpeed = 1;
|
|
186
|
-
function edgeStep(distance) {
|
|
187
|
-
const ratio = distance / AUTOSCROLL_EDGE_ZONE;
|
|
188
|
-
return Math.pow(ratio, 3) * AUTOSCROLL_SPEED;
|
|
189
|
-
}
|
|
190
|
-
onBlokkliEvent("animationFrame:before", ({ time, mouseY }) => {
|
|
191
|
-
if (selection.isDragging.value) {
|
|
192
|
-
const viewportHeight = ui.viewport.value.height;
|
|
193
|
-
const currentOffset = artboard.getOffset();
|
|
194
|
-
const y = Math.min(Math.max(mouseY, 0), viewportHeight);
|
|
195
|
-
let dy = 0;
|
|
196
|
-
if (y < AUTOSCROLL_EDGE_ZONE) {
|
|
197
|
-
const dist = AUTOSCROLL_EDGE_ZONE - y;
|
|
198
|
-
dy = edgeStep(dist);
|
|
199
|
-
} else if (y > viewportHeight - AUTOSCROLL_EDGE_ZONE) {
|
|
200
|
-
const dist = y - (viewportHeight - AUTOSCROLL_EDGE_ZONE);
|
|
201
|
-
dy = -edgeStep(dist);
|
|
202
|
-
} else {
|
|
203
|
-
autoScrollSpeed = 1;
|
|
204
|
-
}
|
|
205
|
-
if (dy !== 0) {
|
|
206
|
-
artboard.setOffset(null, currentOffset.y + dy * autoScrollSpeed);
|
|
207
|
-
autoScrollSpeed = Math.min(autoScrollSpeed * 1.01, 2.25);
|
|
208
|
-
}
|
|
209
|
-
} else {
|
|
210
|
-
autoScrollSpeed = 1;
|
|
211
|
-
}
|
|
212
|
-
artboard.loop(time);
|
|
213
|
-
const artboardSize = artboard.getArtboardSize();
|
|
214
|
-
if (artboardSize) {
|
|
215
|
-
ui.artboardSize.value.height = artboardSize.height;
|
|
216
|
-
ui.artboardSize.value.width = artboardSize.width;
|
|
217
|
-
}
|
|
218
|
-
const offset = artboard.getOffset();
|
|
219
|
-
ui.artboardOffset.value.x = asValidNumber(Math.ceil(offset.x), 0);
|
|
220
|
-
ui.artboardOffset.value.y = asValidNumber(Math.ceil(offset.y), 0);
|
|
221
|
-
ui.artboardScale.value = asValidNumber(artboard.getScale(), 1);
|
|
222
|
-
animation.requestDraw();
|
|
223
|
-
});
|
|
224
|
-
onMounted(() => {
|
|
225
|
-
window.addEventListener("beforeunload", saveState);
|
|
226
|
-
});
|
|
227
|
-
onBeforeUnmount(() => {
|
|
228
|
-
saveState();
|
|
229
|
-
artboard.destroy();
|
|
230
|
-
window.removeEventListener("beforeunload", saveState);
|
|
231
|
-
});
|
|
232
|
-
const resetZoom = () => {
|
|
233
|
-
artboard.resetZoom({
|
|
234
|
-
duration: 500
|
|
235
|
-
});
|
|
236
|
-
animation.requestDraw();
|
|
237
|
-
};
|
|
238
|
-
onBlokkliEvent("keyPressed", (e) => {
|
|
239
|
-
if (e.code === "Home") {
|
|
240
|
-
e.originalEvent.preventDefault();
|
|
241
|
-
artboard.scrollToTop();
|
|
242
|
-
animation.requestDraw();
|
|
243
|
-
} else if (e.code === "End") {
|
|
244
|
-
e.originalEvent.preventDefault();
|
|
245
|
-
artboard.scrollToEnd();
|
|
246
|
-
animation.requestDraw();
|
|
247
|
-
} else if (e.code === "PageUp") {
|
|
248
|
-
e.originalEvent.preventDefault();
|
|
249
|
-
artboard.scrollPageUp();
|
|
250
|
-
animation.requestDraw();
|
|
251
|
-
} else if (e.code === "PageDown") {
|
|
252
|
-
e.originalEvent.preventDefault();
|
|
253
|
-
artboard.scrollPageDown();
|
|
254
|
-
animation.requestDraw();
|
|
255
|
-
} else if (e.code === "ArrowUp") {
|
|
256
|
-
e.originalEvent.preventDefault();
|
|
257
|
-
artboard.scrollUp();
|
|
258
|
-
animation.requestDraw();
|
|
259
|
-
} else if (e.code === "ArrowDown") {
|
|
260
|
-
e.originalEvent.preventDefault();
|
|
261
|
-
artboard.scrollDown();
|
|
262
|
-
animation.requestDraw();
|
|
263
|
-
} else if (e.code === "0" && e.meta) {
|
|
264
|
-
e.originalEvent.preventDefault();
|
|
265
|
-
resetZoom();
|
|
266
|
-
} else if (e.code === "1" && e.meta) {
|
|
267
|
-
e.originalEvent.preventDefault();
|
|
268
|
-
artboard.scaleToFit();
|
|
269
|
-
animation.requestDraw();
|
|
270
|
-
}
|
|
271
|
-
});
|
|
49
|
+
const { ui, $t } = useBlokkli();
|
|
50
|
+
const renderArtboard = computed(() => !ui.isAnalyzing.value);
|
|
272
51
|
defineShortcut(
|
|
273
52
|
[
|
|
274
53
|
{
|
|
@@ -304,20 +83,6 @@ defineShortcut(
|
|
|
304
83
|
return { ...v, group: $t("artboard", "Artboard") };
|
|
305
84
|
})
|
|
306
85
|
);
|
|
307
|
-
onBlokkliEvent("scrollIntoView", (e) => {
|
|
308
|
-
const rect = dom.getBlockRect(e.uuid);
|
|
309
|
-
if (!rect) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
if (dom.isBlockVisible(e.uuid)) {
|
|
313
|
-
return;
|
|
314
|
-
}
|
|
315
|
-
artboard.scrollIntoView(rect, {
|
|
316
|
-
scale: "none",
|
|
317
|
-
axis: "y",
|
|
318
|
-
behavior: e.immediate ? "instant" : "auto"
|
|
319
|
-
});
|
|
320
|
-
});
|
|
321
86
|
</script>
|
|
322
87
|
|
|
323
88
|
<script>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Teleport to="body">
|
|
3
|
-
<
|
|
3
|
+
<BlokkliTransition name="slide-in">
|
|
4
4
|
<Overlay v-if="placedAction" @close="onClose" @submit="onSubmit" />
|
|
5
|
-
</
|
|
5
|
+
</BlokkliTransition>
|
|
6
6
|
</Teleport>
|
|
7
7
|
|
|
8
8
|
<PluginAddAction
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
<script setup>
|
|
21
21
|
import { useBlokkli, defineBlokkliFeature, ref } from "#imports";
|
|
22
22
|
import { PluginAddAction } from "#blokkli/plugins";
|
|
23
|
+
import { BlokkliTransition } from "#blokkli/components";
|
|
23
24
|
import Overlay from "./Overlay/index.vue";
|
|
24
25
|
const { adapter } = defineBlokkliFeature({
|
|
25
26
|
id: "assistant",
|
|
@@ -60,6 +60,7 @@ import {
|
|
|
60
60
|
import { AddListItem } from "#blokkli/components";
|
|
61
61
|
import defineCommands from "#blokkli/helpers/composables/defineCommands";
|
|
62
62
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
63
|
+
import { isInternalBundle } from "#blokkli/helpers/bundles";
|
|
63
64
|
import { PluginTourItem } from "#blokkli/plugins";
|
|
64
65
|
import { getFieldKey, onlyUnique } from "#blokkli/helpers";
|
|
65
66
|
const { settings } = defineBlokkliFeature({
|
|
@@ -79,7 +80,6 @@ const { settings } = defineBlokkliFeature({
|
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
82
|
});
|
|
82
|
-
const reservedBundles = ["from_library", "blokkli_fragment"];
|
|
83
83
|
const {
|
|
84
84
|
selection,
|
|
85
85
|
storage,
|
|
@@ -174,7 +174,7 @@ function determineVisibility(bundle, label) {
|
|
|
174
174
|
return true;
|
|
175
175
|
}
|
|
176
176
|
const sortedList = computed(() => {
|
|
177
|
-
return [...generallyAvailableBundles.value].filter((v) => !
|
|
177
|
+
return [...generallyAvailableBundles.value].filter((v) => !isInternalBundle(v.id)).map((v) => {
|
|
178
178
|
const isVisible = determineVisibility(v.id, v.label);
|
|
179
179
|
const isDisabled = !v.id || !selectableBundles.value.includes(v.id);
|
|
180
180
|
return {
|
|
@@ -208,7 +208,7 @@ const getBundlesForAppendCommands = () => {
|
|
|
208
208
|
return [];
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
return field.allowedBundles.filter((v) => !
|
|
211
|
+
return field.allowedBundles.filter((v) => !isInternalBundle(v));
|
|
212
212
|
}
|
|
213
213
|
return [];
|
|
214
214
|
};
|
|
@@ -227,7 +227,7 @@ const getAppendEndCommands = () => {
|
|
|
227
227
|
return [];
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
-
return field.allowedBundles.filter((v) => !
|
|
230
|
+
return field.allowedBundles.filter((v) => !isInternalBundle(v)).map((bundle) => {
|
|
231
231
|
const definition = types.getBlockBundleDefinition(bundle);
|
|
232
232
|
return {
|
|
233
233
|
id: "block_add_list:append_end:" + bundle + field.name,
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
icon="clipboard"
|
|
15
15
|
weight="-30"
|
|
16
16
|
>
|
|
17
|
-
<div class="bk-clipboard bk-control">
|
|
17
|
+
<div class="bk bk-clipboard bk-control">
|
|
18
18
|
<div
|
|
19
19
|
v-if="!pastedItems.length"
|
|
20
|
-
class="bk
|
|
20
|
+
class="bk-clipboard-info bk-sidebar-padding"
|
|
21
21
|
>
|
|
22
22
|
<h4>{{ $t("clipboardEmpty", "No items in the clipboard") }}</h4>
|
|
23
23
|
<div
|
|
@@ -63,6 +63,16 @@
|
|
|
63
63
|
</div>
|
|
64
64
|
</div>
|
|
65
65
|
</PluginSidebar>
|
|
66
|
+
<PluginItemDropdown
|
|
67
|
+
id="clipboard"
|
|
68
|
+
:title="$t('clipboard', 'Clipboard')"
|
|
69
|
+
:enabled="
|
|
70
|
+
!!selection.blocks.value.length && state.editMode.value === 'editing'
|
|
71
|
+
"
|
|
72
|
+
:items="itemDropdownItems"
|
|
73
|
+
icon="clipboard"
|
|
74
|
+
@select="onSelectDropdownItem"
|
|
75
|
+
/>
|
|
66
76
|
</template>
|
|
67
77
|
|
|
68
78
|
<script setup>
|
|
@@ -71,15 +81,17 @@ import {
|
|
|
71
81
|
ref,
|
|
72
82
|
useBlokkli,
|
|
73
83
|
onMounted,
|
|
74
|
-
onUnmounted
|
|
84
|
+
onUnmounted,
|
|
85
|
+
computed
|
|
75
86
|
} from "#imports";
|
|
76
|
-
import { PluginSidebar } from "#blokkli/plugins";
|
|
87
|
+
import { PluginSidebar, PluginItemDropdown } from "#blokkli/plugins";
|
|
77
88
|
import ClipboardList from "./List/index.vue";
|
|
78
|
-
import {
|
|
89
|
+
import { generateUUID, getFieldKey } from "#blokkli/helpers";
|
|
79
90
|
import { Icon } from "#blokkli/components";
|
|
80
91
|
import onBlokkliEvent from "#blokkli/helpers/composables/onBlokkliEvent";
|
|
81
92
|
import defineShortcut from "#blokkli/helpers/composables/defineShortcut";
|
|
82
93
|
import getVideoId from "get-video-id";
|
|
94
|
+
import { emitMessage } from "#blokkli/helpers/eventBus";
|
|
83
95
|
const { settings, logger } = defineBlokkliFeature({
|
|
84
96
|
id: "clipboard",
|
|
85
97
|
label: "Clipboard",
|
|
@@ -96,8 +108,36 @@ const { settings, logger } = defineBlokkliFeature({
|
|
|
96
108
|
},
|
|
97
109
|
screenshot: "feature-clipboard.jpg"
|
|
98
110
|
});
|
|
99
|
-
const { selection, $t, adapter, dom, state, ui, types } = useBlokkli();
|
|
111
|
+
const { selection, $t, adapter, dom, state, ui, types, keyboard } = useBlokkli();
|
|
100
112
|
const plugin = ref(null);
|
|
113
|
+
const selectionClipboard = ref([]);
|
|
114
|
+
const itemDropdownItems = computed(() => {
|
|
115
|
+
return [
|
|
116
|
+
{
|
|
117
|
+
id: "copy",
|
|
118
|
+
label: $t("copy", "Copy"),
|
|
119
|
+
icon: "copy",
|
|
120
|
+
description: $t("clipboardCopyShortcutHelp", "Copy selected blocks")
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
id: "paste",
|
|
124
|
+
label: $t("paste", "Paste"),
|
|
125
|
+
enabled: !!selectionClipboard.value.length,
|
|
126
|
+
icon: "clipboard",
|
|
127
|
+
description: $t(
|
|
128
|
+
"clipboardPasteDescription",
|
|
129
|
+
"Paste blocks from clipboard"
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
];
|
|
133
|
+
});
|
|
134
|
+
function onSelectDropdownItem(item) {
|
|
135
|
+
if (item.id === "copy") {
|
|
136
|
+
copyCurrentSelectionToClipboard();
|
|
137
|
+
} else if (item.id === "paste" && selectionClipboard.value.length) {
|
|
138
|
+
handleSelectionPaste(selectionClipboard.value);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
101
141
|
const ALLOWED_HTML_ATTRIBUTES = ["href"];
|
|
102
142
|
const _MOCK = [
|
|
103
143
|
{
|
|
@@ -230,11 +270,21 @@ const showClipboardSidebar = () => {
|
|
|
230
270
|
plugin?.value?.showSidebar();
|
|
231
271
|
}
|
|
232
272
|
};
|
|
273
|
+
function emitPasteError(message) {
|
|
274
|
+
const prefix = $t("clipboardPasteError", "Failed to paste:");
|
|
275
|
+
emitMessage(`${prefix} ${message}`, "error");
|
|
276
|
+
}
|
|
233
277
|
const handleSelectionPaste = (pastedUuids) => {
|
|
234
278
|
if (!adapter.pasteExistingBlocks) {
|
|
235
279
|
return;
|
|
236
280
|
}
|
|
237
281
|
if (selection.uuids.value.length !== 1) {
|
|
282
|
+
emitPasteError(
|
|
283
|
+
$t(
|
|
284
|
+
"clipboardPasteErrorOneField",
|
|
285
|
+
"Pasting is only possible into one field at a time."
|
|
286
|
+
)
|
|
287
|
+
);
|
|
238
288
|
return;
|
|
239
289
|
}
|
|
240
290
|
if (!pastedUuids.length) {
|
|
@@ -244,36 +294,114 @@ const handleSelectionPaste = (pastedUuids) => {
|
|
|
244
294
|
if (!block) {
|
|
245
295
|
return;
|
|
246
296
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
297
|
+
let targetField = null;
|
|
298
|
+
let targetFieldConfig = null;
|
|
299
|
+
let targetFieldKey = null;
|
|
300
|
+
let preceedingUuid = void 0;
|
|
301
|
+
if (!keyboard.isPressingShift.value) {
|
|
302
|
+
const pastedBundles = pastedUuids.map((uuid) => dom.findBlock(uuid)?.itemBundle).filter((bundle) => !!bundle);
|
|
303
|
+
if (pastedBundles.length) {
|
|
304
|
+
const nestedFields = types.fieldConfig.forEntityTypeAndBundle(
|
|
305
|
+
block.entityType,
|
|
306
|
+
block.itemBundle
|
|
307
|
+
);
|
|
308
|
+
for (const fieldConfig of nestedFields) {
|
|
309
|
+
const allowedPastedBundles = pastedBundles.filter(
|
|
310
|
+
(bundle) => fieldConfig.allowedBundles.includes(bundle)
|
|
311
|
+
);
|
|
312
|
+
if (allowedPastedBundles.length > 0) {
|
|
313
|
+
const nestedFieldKey = getFieldKey(block.uuid, fieldConfig.name);
|
|
314
|
+
const currentCount = state.getFieldBlockCount(nestedFieldKey);
|
|
315
|
+
if (fieldConfig.cardinality === -1 || currentCount + allowedPastedBundles.length <= fieldConfig.cardinality) {
|
|
316
|
+
targetField = {
|
|
317
|
+
entityType: block.entityType,
|
|
318
|
+
entityUuid: block.uuid,
|
|
319
|
+
name: fieldConfig.name
|
|
320
|
+
};
|
|
321
|
+
targetFieldConfig = fieldConfig;
|
|
322
|
+
targetFieldKey = nestedFieldKey;
|
|
323
|
+
preceedingUuid = void 0;
|
|
324
|
+
break;
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
250
329
|
}
|
|
251
|
-
|
|
252
|
-
field.
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
330
|
+
if (!targetField || !targetFieldConfig || !targetFieldKey) {
|
|
331
|
+
const field = state.getMutatedField(block.hostUuid, block.hostFieldName);
|
|
332
|
+
if (!field) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
const fieldConfig = types.getFieldConfig(
|
|
336
|
+
field.entityType,
|
|
337
|
+
block.hostBundle,
|
|
338
|
+
field.name
|
|
339
|
+
);
|
|
340
|
+
if (!fieldConfig) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
targetField = {
|
|
344
|
+
entityType: field.entityType,
|
|
345
|
+
entityUuid: field.entityUuid,
|
|
346
|
+
name: field.name
|
|
347
|
+
};
|
|
348
|
+
targetFieldConfig = fieldConfig;
|
|
349
|
+
targetFieldKey = getFieldKey(field.entityUuid, field.name);
|
|
350
|
+
preceedingUuid = selection.uuids.value[0];
|
|
351
|
+
}
|
|
352
|
+
const pastedBlocks = [];
|
|
353
|
+
const notAllowedBundles = [];
|
|
354
|
+
for (let i = 0; i < pastedUuids.length; i++) {
|
|
355
|
+
const uuid = pastedUuids[i];
|
|
356
|
+
if (!uuid) {
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const block2 = dom.findBlock(uuid);
|
|
360
|
+
if (!block2) {
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
const isAllowed = targetFieldConfig.allowedBundles.includes(
|
|
364
|
+
block2.itemBundle
|
|
365
|
+
);
|
|
366
|
+
if (!isAllowed) {
|
|
367
|
+
notAllowedBundles.push(block2.itemBundle);
|
|
368
|
+
continue;
|
|
369
|
+
}
|
|
370
|
+
pastedBlocks.push(block2);
|
|
258
371
|
}
|
|
259
|
-
const fieldKey = getFieldKey(field.entityUuid, field.name);
|
|
260
|
-
const pastedBlocks = pastedUuids.map((uuid) => dom.findBlock(uuid)).filter(falsy).filter((block2) => fieldConfig.allowedBundles.includes(block2.itemBundle));
|
|
261
372
|
if (!pastedBlocks.length) {
|
|
373
|
+
const blockTypes = notAllowedBundles.map((bundle) => {
|
|
374
|
+
return types.getBlockBundleDefinition(bundle)?.label ?? bundle;
|
|
375
|
+
});
|
|
376
|
+
const message = blockTypes.length === 1 ? $t(
|
|
377
|
+
"clipboardPasteErrorAllowedBundlesSingle",
|
|
378
|
+
'Block type "@types" is not allowed here.'
|
|
379
|
+
) : $t(
|
|
380
|
+
"clipboardPasteErrorAllowedBundlesMultiple",
|
|
381
|
+
"Block types (@types) are not allowed here."
|
|
382
|
+
);
|
|
383
|
+
emitPasteError(message.replace("@types", blockTypes.join(", ")));
|
|
262
384
|
return;
|
|
263
385
|
}
|
|
264
|
-
const count = state.getFieldBlockCount(
|
|
265
|
-
if (
|
|
386
|
+
const count = state.getFieldBlockCount(targetFieldKey);
|
|
387
|
+
if (targetFieldConfig.cardinality !== -1 && count + pastedBlocks.length > targetFieldConfig.cardinality) {
|
|
388
|
+
emitPasteError(
|
|
389
|
+
$t(
|
|
390
|
+
"clipboardPasteErrorCardinality",
|
|
391
|
+
"This field only allows up to @count blocks."
|
|
392
|
+
).replace("@count", targetFieldConfig.cardinality.toString())
|
|
393
|
+
);
|
|
266
394
|
return;
|
|
267
395
|
}
|
|
268
396
|
state.mutateWithLoadingState(
|
|
269
397
|
() => adapter.pasteExistingBlocks({
|
|
270
398
|
uuids: pastedBlocks.map((v) => v.uuid),
|
|
271
399
|
host: {
|
|
272
|
-
type:
|
|
273
|
-
uuid:
|
|
274
|
-
fieldName:
|
|
400
|
+
type: targetField.entityType,
|
|
401
|
+
uuid: targetField.entityUuid,
|
|
402
|
+
fieldName: targetField.name
|
|
275
403
|
},
|
|
276
|
-
preceedingUuid
|
|
404
|
+
preceedingUuid
|
|
277
405
|
})
|
|
278
406
|
);
|
|
279
407
|
};
|
|
@@ -371,16 +499,21 @@ function setClipboard(text) {
|
|
|
371
499
|
} catch (_e) {
|
|
372
500
|
}
|
|
373
501
|
}
|
|
374
|
-
|
|
502
|
+
function copyCurrentSelectionToClipboard() {
|
|
375
503
|
if (!selection.blocks.value.length) {
|
|
376
|
-
|
|
377
|
-
}
|
|
378
|
-
if (e.code !== "c" || !e.meta) {
|
|
504
|
+
selectionClipboard.value = [];
|
|
379
505
|
return;
|
|
380
506
|
}
|
|
381
507
|
setClipboard(
|
|
382
508
|
JSON.stringify({ type: "selection", uuids: selection.uuids.value })
|
|
383
509
|
);
|
|
510
|
+
selectionClipboard.value = selection.uuids.value;
|
|
511
|
+
}
|
|
512
|
+
onBlokkliEvent("keyPressed", (e) => {
|
|
513
|
+
if (e.code !== "c" || !e.meta) {
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
copyCurrentSelectionToClipboard();
|
|
384
517
|
});
|
|
385
518
|
defineShortcut([
|
|
386
519
|
{
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div v-if="shouldRender" class="bk-command-palette-results-
|
|
3
|
-
<h2>{{ label }}</h2>
|
|
2
|
+
<div v-if="shouldRender" class="bk-command-palette-results-list">
|
|
4
3
|
<div>
|
|
5
4
|
<button
|
|
6
5
|
v-for="item in mapped"
|
|
@@ -18,21 +17,22 @@
|
|
|
18
17
|
<ItemIcon v-else :bundle="item.bundle" />
|
|
19
18
|
</div>
|
|
20
19
|
<Highlight :text="item.label" tag="span" :positions="item.positions" />
|
|
20
|
+
<div class="bk-command-group">{{ getGroupLabel(item.group) }}</div>
|
|
21
21
|
</button>
|
|
22
22
|
</div>
|
|
23
23
|
</div>
|
|
24
24
|
</template>
|
|
25
25
|
|
|
26
26
|
<script setup>
|
|
27
|
-
import { computed } from "#imports";
|
|
27
|
+
import { computed, useBlokkli } from "#imports";
|
|
28
28
|
import { Icon, ItemIcon, Highlight } from "#blokkli/components";
|
|
29
29
|
const props = defineProps({
|
|
30
|
-
label: { type: String, required: true },
|
|
31
30
|
commands: { type: Array, required: true },
|
|
32
31
|
visibleIds: { type: null, required: true },
|
|
33
32
|
focusedId: { type: String, required: true }
|
|
34
33
|
});
|
|
35
34
|
defineEmits(["close", "focus", "select"]);
|
|
35
|
+
const { $t } = useBlokkli();
|
|
36
36
|
const mapped = computed(() => {
|
|
37
37
|
return props.commands.map((v) => {
|
|
38
38
|
const found = props.visibleIds?.find((w) => w.id === v._id);
|
|
@@ -47,5 +47,17 @@ const mapped = computed(() => {
|
|
|
47
47
|
return indexA - indexB;
|
|
48
48
|
});
|
|
49
49
|
});
|
|
50
|
+
const getGroupLabel = (id) => {
|
|
51
|
+
if (id === "ui") {
|
|
52
|
+
return $t("commandGroup.ui", "Interface");
|
|
53
|
+
} else if (id === "add") {
|
|
54
|
+
return $t("commandGroup.add", "Add new");
|
|
55
|
+
} else if (id === "action") {
|
|
56
|
+
return $t("commandGroup.action", "Actions");
|
|
57
|
+
} else if (id === "selection") {
|
|
58
|
+
return $t("commandGroup.selection", "Selection");
|
|
59
|
+
}
|
|
60
|
+
return $t("commandGroup.misc", "Miscellaneous");
|
|
61
|
+
};
|
|
50
62
|
const shouldRender = computed(() => mapped.value.some((v) => v.visible));
|
|
51
63
|
</script>
|