@blokkli/editor 1.4.0-alpha.0 → 2.0.0-alpha.1
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 +12 -125
- package/dist/module.json +4 -4
- package/dist/module.mjs +1853 -1135
- package/dist/modules/drupal/adapter/index.d.mts +6 -0
- package/dist/modules/drupal/adapter/index.mjs +762 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliEditState.graphql +44 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutatedField.graphql +11 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationItem.graphql +9 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliMutationResult.graphql +7 -0
- package/dist/modules/drupal/graphql/base/fragment.paragraphsBlokkliViolation.graphql +7 -0
- package/dist/modules/drupal/graphql/base/query.pbConfig.graphql +96 -0
- package/dist/modules/drupal/graphql/base/query.pbEditState.graphql +15 -0
- package/dist/modules/drupal/graphql/features/conversions.graphql +44 -0
- package/dist/modules/drupal/graphql/features/import-existing.graphql +34 -0
- package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/library.graphql +17 -0
- package/dist/modules/drupal/graphql/features/media-library.graphql +28 -0
- package/dist/modules/drupal/graphql/features/preview-grant.graphql +13 -0
- package/dist/modules/drupal/graphql/features/publish.graphql +15 -0
- package/dist/modules/drupal/graphql/features/publishNew.graphql +59 -0
- package/dist/modules/drupal/graphql/mutations/add.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_clipboard_text.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_entity_reference.graphql +31 -0
- package/dist/modules/drupal/graphql/mutations/add_entity_reference_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/add_file.graphql +27 -0
- package/dist/modules/drupal/graphql/mutations/add_image.graphql +27 -0
- package/dist/modules/drupal/graphql/mutations/add_video_remote.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/bulk_update_behavior_settings.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/duplicate.graphql +33 -0
- package/dist/modules/drupal/graphql/mutations/move.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/move_multiple.graphql +25 -0
- package/dist/modules/drupal/graphql/mutations/redo.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/remove.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/remove_multiple.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/replace_host_entity_media.graphql +20 -0
- package/dist/modules/drupal/graphql/mutations/replace_media.graphql +22 -0
- package/dist/modules/drupal/graphql/mutations/revertAllChanges.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/setHistoryIndex.graphql +15 -0
- package/dist/modules/drupal/graphql/mutations/setMutationStatus.graphql +16 -0
- package/dist/modules/drupal/graphql/mutations/takeOwnership.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/undo.graphql +14 -0
- package/dist/modules/drupal/graphql/mutations/update_behavior_setting.graphql +23 -0
- package/dist/modules/drupal/graphql/mutations/update_field_value.graphql +22 -0
- package/dist/modules/drupal/graphql/mutations/update_host_entity_field_value.graphql +20 -0
- package/dist/modules/drupal/index.d.mts +10 -0
- package/dist/modules/drupal/index.mjs +151 -0
- package/dist/runtime/adapter/index.d.ts +30 -4
- package/dist/runtime/blokkliPlugins/AddAction/index.vue +39 -54
- package/dist/runtime/blokkliPlugins/AddAction/index.vue.d.ts +26 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue +38 -64
- package/dist/runtime/blokkliPlugins/ContextMenu/Menu/index.vue.d.ts +12 -0
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue +19 -30
- package/dist/runtime/blokkliPlugins/ContextMenu/index.vue.d.ts +37 -0
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue +15 -23
- package/dist/runtime/blokkliPlugins/DebugOverlay/index.vue.d.ts +21 -0
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue +27 -44
- package/dist/runtime/blokkliPlugins/DroppableEdit/index.vue.d.ts +41 -0
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue +39 -85
- package/dist/runtime/blokkliPlugins/ItemAction/index.vue.d.ts +83 -0
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue +22 -26
- package/dist/runtime/blokkliPlugins/ItemDropdown/index.vue.d.ts +17 -0
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue +30 -38
- package/dist/runtime/blokkliPlugins/MenuButton/index.vue.d.ts +32 -0
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue +146 -211
- package/dist/runtime/blokkliPlugins/Sidebar/Detached/index.vue.d.ts +91 -0
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue +95 -139
- package/dist/runtime/blokkliPlugins/Sidebar/index.vue.d.ts +85 -0
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue +38 -57
- package/dist/runtime/blokkliPlugins/ToolbarButton/index.vue.d.ts +48 -0
- package/dist/runtime/blokkliPlugins/TourItem/index.vue +20 -29
- package/dist/runtime/blokkliPlugins/TourItem/index.vue.d.ts +20 -0
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue +45 -59
- package/dist/runtime/blokkliPlugins/ViewOption/index.vue.d.ts +39 -0
- package/dist/runtime/components/Blocks/Fragment/index.vue +13 -17
- package/dist/runtime/components/Blocks/Fragment/index.vue.d.ts +6 -0
- package/dist/runtime/components/Blocks/FromLibrary/index.vue +23 -30
- package/dist/runtime/components/Blocks/FromLibrary/index.vue.d.ts +6 -0
- package/dist/runtime/components/BlokkliEditable.vue +29 -49
- package/dist/runtime/components/BlokkliEditable.vue.d.ts +34 -0
- package/dist/runtime/components/BlokkliField.vue +100 -159
- package/dist/runtime/components/BlokkliField.vue.d.ts +133 -0
- package/dist/runtime/components/BlokkliItem.vue +43 -66
- package/dist/runtime/components/BlokkliItem.vue.d.ts +26 -0
- package/dist/runtime/components/BlokkliProvider.vue +50 -87
- package/dist/runtime/components/BlokkliProvider.vue.d.ts +51 -0
- package/dist/runtime/components/Edit/Actions/index.vue +116 -164
- package/dist/runtime/components/Edit/Actions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/AddListItem/index.vue +45 -66
- package/dist/runtime/components/Edit/AddListItem/index.vue.d.ts +28 -0
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue +52 -88
- package/dist/runtime/components/Edit/AnimationCanvas/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/AppMenu/index.vue +12 -15
- package/dist/runtime/components/Edit/AppMenu/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/BlockProxy/index.vue +48 -84
- package/dist/runtime/components/Edit/BlockProxy/index.vue.d.ts +10 -0
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue +16 -20
- package/dist/runtime/components/Edit/BlokkliErrorBoundary.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/Dialog/index.vue +67 -103
- package/dist/runtime/components/Edit/Dialog/index.vue.d.ts +44 -0
- package/dist/runtime/components/Edit/DragInteractions/index.vue +219 -333
- package/dist/runtime/components/Edit/DragInteractions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/DraggableList.vue +82 -125
- package/dist/runtime/components/Edit/DraggableList.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/EditIndicator.vue +34 -46
- package/dist/runtime/components/Edit/EditIndicator.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/EditProvider.vue +144 -142
- package/dist/runtime/components/Edit/EditProvider.vue.d.ts +26 -0
- package/dist/runtime/components/Edit/Features/AddList/index.vue +90 -117
- package/dist/runtime/components/Edit/Features/AddList/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue +43 -63
- package/dist/runtime/components/Edit/Features/Artboard/Overview/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue +18 -23
- package/dist/runtime/components/Edit/Features/Artboard/Scrollbar/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Artboard/index.vue +175 -223
- package/dist/runtime/components/Edit/Features/Artboard/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue +7 -7
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/ResultMarkup/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue +39 -52
- package/dist/runtime/components/Edit/Features/Assistant/Overlay/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Assistant/index.vue +31 -40
- package/dist/runtime/components/Edit/Features/Assistant/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue +225 -326
- package/dist/runtime/components/Edit/Features/BlockAddList/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue +36 -44
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/File.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue +33 -35
- package/dist/runtime/components/Edit/Features/Clipboard/List/Item/Video.vue.d.ts +3 -0
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue +13 -21
- package/dist/runtime/components/Edit/Features/Clipboard/List/index.vue.d.ts +10 -0
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue +226 -297
- package/dist/runtime/components/Edit/Features/Clipboard/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue +24 -34
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/Group/index.vue.d.ts +22 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue +146 -195
- package/dist/runtime/components/Edit/Features/CommandPalette/Palette/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue +21 -26
- package/dist/runtime/components/Edit/Features/CommandPalette/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue +9 -12
- package/dist/runtime/components/Edit/Features/Comments/AddForm/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue +20 -28
- package/dist/runtime/components/Edit/Features/Comments/Comment/index.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue +30 -42
- package/dist/runtime/components/Edit/Features/Comments/Overlay/Item/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue +70 -100
- package/dist/runtime/components/Edit/Features/Comments/Overlay/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Comments/index.vue +37 -48
- package/dist/runtime/components/Edit/Features/Comments/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Conversions/index.vue +40 -56
- package/dist/runtime/components/Edit/Features/Conversions/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue +37 -50
- package/dist/runtime/components/Edit/Features/Debug/Rects/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue +35 -44
- package/dist/runtime/components/Edit/Features/Debug/Viewport/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Debug/index.vue +43 -57
- package/dist/runtime/components/Edit/Features/Debug/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Delete/index.vue +31 -52
- package/dist/runtime/components/Edit/Features/Delete/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue +68 -107
- package/dist/runtime/components/Edit/Features/Diff/DiffView/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Diff/index.vue +17 -19
- package/dist/runtime/components/Edit/Features/Diff/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue +193 -337
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DragItems/index.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/fragment.glsl +1 -1
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue +391 -644
- package/dist/runtime/components/Edit/Features/DraggingOverlay/DropTargets/index.vue.d.ts +156 -0
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue +197 -323
- package/dist/runtime/components/Edit/Features/DraggingOverlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue +49 -71
- package/dist/runtime/components/Edit/Features/Duplicate/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Edit/index.vue +41 -71
- package/dist/runtime/components/Edit/Features/Edit/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue +35 -51
- package/dist/runtime/components/Edit/Features/EditForm/Frame/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Features/EditForm/index.vue +104 -140
- package/dist/runtime/components/Edit/Features/EditForm/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue +18 -25
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Contenteditable/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue +34 -50
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Frame/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue +40 -51
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/Plaintext/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue +145 -207
- package/dist/runtime/components/Edit/Features/EditableField/Overlay/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/EditableField/index.vue +90 -143
- package/dist/runtime/components/Edit/Features/EditableField/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue +28 -36
- package/dist/runtime/components/Edit/Features/EditableMask/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue +49 -58
- package/dist/runtime/components/Edit/Features/EntityTitle/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Exit/index.vue +16 -20
- package/dist/runtime/components/Edit/Features/Exit/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue +4 -15
- package/dist/runtime/components/Edit/Features/FieldAreas/Overlay/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue +19 -21
- package/dist/runtime/components/Edit/Features/FieldAreas/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue +29 -36
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/Item/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue +82 -99
- package/dist/runtime/components/Edit/Features/Fragments/Dialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Fragments/index.vue +41 -51
- package/dist/runtime/components/Edit/Features/Fragments/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Grid/index.vue +17 -20
- package/dist/runtime/components/Edit/Features/Grid/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue +24 -35
- package/dist/runtime/components/Edit/Features/Help/Shortcuts/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Help/index.vue +17 -21
- package/dist/runtime/components/Edit/Features/Help/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/History/List/index.vue +46 -67
- package/dist/runtime/components/Edit/Features/History/List/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/History/index.vue +54 -69
- package/dist/runtime/components/Edit/Features/History/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue +48 -66
- package/dist/runtime/components/Edit/Features/ImportExisting/Dialog/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue +38 -54
- package/dist/runtime/components/Edit/Features/ImportExisting/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue +88 -126
- package/dist/runtime/components/Edit/Features/Library/EditReusable/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue +33 -35
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/Item/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue +119 -146
- package/dist/runtime/components/Edit/Features/Library/LibraryDialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue +37 -47
- package/dist/runtime/components/Edit/Features/Library/ReusableDialog/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Library/index.vue +85 -117
- package/dist/runtime/components/Edit/Features/Library/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue +13 -19
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/Item.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue +76 -120
- package/dist/runtime/components/Edit/Features/MediaLibrary/Library/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue +107 -140
- package/dist/runtime/components/Edit/Features/MediaLibrary/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/MediaLibrary/types.d.ts +1 -1
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue +128 -188
- package/dist/runtime/components/Edit/Features/MultiSelect/Overlay/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue +42 -57
- package/dist/runtime/components/Edit/Features/MultiSelect/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue +27 -34
- package/dist/runtime/components/Edit/Features/Options/Form/Checkbox/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue +55 -75
- package/dist/runtime/components/Edit/Features/Options/Form/Checkboxes/index.vue.d.ts +24 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue +18 -21
- package/dist/runtime/components/Edit/Features/Options/Form/Color/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Options/Form/DateTimeLocal/index.vue +36 -0
- package/dist/runtime/components/Edit/Features/Options/Form/DateTimeLocal/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue +7 -9
- package/dist/runtime/components/Edit/Features/Options/Form/Group.vue.d.ts +29 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue +87 -93
- package/dist/runtime/components/Edit/Features/Options/Form/Item.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue +31 -45
- package/dist/runtime/components/Edit/Features/Options/Form/Number/index.vue.d.ts +21 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue +54 -78
- package/dist/runtime/components/Edit/Features/Options/Form/Radios/index.vue.d.ts +30 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue +23 -33
- package/dist/runtime/components/Edit/Features/Options/Form/Range/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue +17 -26
- package/dist/runtime/components/Edit/Features/Options/Form/Text/index.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue +183 -252
- package/dist/runtime/components/Edit/Features/Options/Form/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Options/index.vue +38 -66
- package/dist/runtime/components/Edit/Features/Options/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Ownership/index.vue +26 -33
- package/dist/runtime/components/Edit/Features/Ownership/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Preview/index.vue +22 -27
- package/dist/runtime/components/Edit/Features/Preview/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue +11 -15
- package/dist/runtime/components/Edit/Features/PreviewGrant/QrCode/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue +31 -36
- package/dist/runtime/components/Edit/Features/PreviewGrant/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue +18 -20
- package/dist/runtime/components/Edit/Features/ProxyView/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue +118 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/Item.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue +251 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/index.vue.d.ts +19 -0
- package/dist/runtime/components/Edit/Features/Publish/Dialog/types.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Publish/index.vue +70 -74
- package/dist/runtime/components/Edit/Features/Publish/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue +48 -54
- package/dist/runtime/components/Edit/Features/ResponsivePreview/Frame/index.vue.d.ts +27 -0
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue +77 -103
- package/dist/runtime/components/Edit/Features/ResponsivePreview/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Revert/index.vue +27 -32
- package/dist/runtime/components/Edit/Features/Revert/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue +66 -87
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Content/index.vue.d.ts +17 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue +89 -139
- package/dist/runtime/components/Edit/Features/Search/Overlay/Results/Page/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue +79 -108
- package/dist/runtime/components/Edit/Features/Search/Overlay/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Search/index.vue +30 -37
- package/dist/runtime/components/Edit/Features/Search/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue +67 -103
- package/dist/runtime/components/Edit/Features/Selection/Overlay/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue +28 -36
- package/dist/runtime/components/Edit/Features/Selection/OverlayFallback/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/Features/Selection/index.vue +131 -217
- package/dist/runtime/components/Edit/Features/Selection/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue +50 -81
- package/dist/runtime/components/Edit/Features/Settings/Dialog/FeatureSetting/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue +73 -117
- package/dist/runtime/components/Edit/Features/Settings/Dialog/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Settings/index.vue +41 -53
- package/dist/runtime/components/Edit/Features/Settings/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue +65 -101
- package/dist/runtime/components/Edit/Features/Structure/List/Field/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue +71 -99
- package/dist/runtime/components/Edit/Features/Structure/List/Item/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Structure/List/index.vue +17 -26
- package/dist/runtime/components/Edit/Features/Structure/List/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/Structure/index.vue +31 -40
- package/dist/runtime/components/Edit/Features/Structure/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue +32 -53
- package/dist/runtime/components/Edit/Features/Theme/Color/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue +7 -10
- package/dist/runtime/components/Edit/Features/Theme/GeneratedCode/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Theme/index.vue +49 -63
- package/dist/runtime/components/Edit/Features/Theme/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue +9 -10
- package/dist/runtime/components/Edit/Features/TouchActionBar/Bar/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue +16 -19
- package/dist/runtime/components/Edit/Features/TouchActionBar/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue +117 -172
- package/dist/runtime/components/Edit/Features/Tour/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue +8 -10
- package/dist/runtime/components/Edit/Features/Tour/Popup/index.vue.d.ts +8 -0
- package/dist/runtime/components/Edit/Features/Tour/index.vue +21 -25
- package/dist/runtime/components/Edit/Features/Tour/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Transform/index.vue +80 -120
- package/dist/runtime/components/Edit/Features/Transform/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue +20 -28
- package/dist/runtime/components/Edit/Features/Translations/Banner/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Translations/index.vue +96 -139
- package/dist/runtime/components/Edit/Features/Translations/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue +21 -35
- package/dist/runtime/components/Edit/Features/Validations/Overlay/Item.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue +30 -39
- package/dist/runtime/components/Edit/Features/Validations/Overlay/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue +20 -28
- package/dist/runtime/components/Edit/Features/Validations/SidebarItem/index.vue.d.ts +9 -0
- package/dist/runtime/components/Edit/Features/Validations/index.vue +26 -32
- package/dist/runtime/components/Edit/Features/Validations/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Features/index.vue +33 -52
- package/dist/runtime/components/Edit/Features/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Form/Group/index.vue +23 -0
- package/dist/runtime/components/Edit/Form/Group/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Form/Item/index.vue +5 -0
- package/dist/runtime/components/Edit/Form/Item/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue +27 -0
- package/dist/runtime/components/Edit/Form/Textarea/index.vue.d.ts +16 -0
- package/dist/runtime/components/Edit/Form/Toggle/index.vue +21 -0
- package/dist/runtime/components/Edit/Form/Toggle/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue +11 -22
- package/dist/runtime/components/Edit/FormOverlay/Header/index.vue.d.ts +18 -0
- package/dist/runtime/components/Edit/FormOverlay/index.vue +15 -21
- package/dist/runtime/components/Edit/FormOverlay/index.vue.d.ts +25 -0
- package/dist/runtime/components/Edit/Highlight/index.vue +31 -70
- package/dist/runtime/components/Edit/Highlight/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Icon/index.vue +11 -14
- package/dist/runtime/components/Edit/Icon/index.vue.d.ts +7 -0
- package/dist/runtime/components/Edit/InfoBox/index.vue +5 -6
- package/dist/runtime/components/Edit/InfoBox/index.vue.d.ts +5 -0
- package/dist/runtime/components/Edit/ItemIcon/index.vue +13 -13
- package/dist/runtime/components/Edit/ItemIcon/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Loading/index.vue +8 -9
- package/dist/runtime/components/Edit/Loading/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/Messages/Item/index.vue +30 -41
- package/dist/runtime/components/Edit/Messages/Item/index.vue.d.ts +11 -0
- package/dist/runtime/components/Edit/Messages/index.vue +13 -17
- package/dist/runtime/components/Edit/Messages/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Pagination/index.vue +19 -0
- package/dist/runtime/components/Edit/Pagination/index.vue.d.ts +12 -0
- package/dist/runtime/components/Edit/PreviewProvider.vue +123 -177
- package/dist/runtime/components/Edit/PreviewProvider.vue.d.ts +24 -0
- package/dist/runtime/components/Edit/RelativeTime/index.vue +19 -25
- package/dist/runtime/components/Edit/RelativeTime/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/Resizable/index.vue +45 -55
- package/dist/runtime/components/Edit/Resizable/index.vue.d.ts +13 -0
- package/dist/runtime/components/Edit/ScaleToFit/index.vue +49 -36
- package/dist/runtime/components/Edit/ScaleToFit/index.vue.d.ts +15 -0
- package/dist/runtime/components/Edit/ScrollBoundary/index.vue +11 -27
- package/dist/runtime/components/Edit/ScrollBoundary/index.vue.d.ts +23 -0
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue +47 -59
- package/dist/runtime/components/Edit/ShortcutIndicator/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/Sortli/index.vue +45 -59
- package/dist/runtime/components/Edit/Sortli/index.vue.d.ts +14 -0
- package/dist/runtime/components/Edit/SystemRequirements/index.vue +29 -43
- package/dist/runtime/components/Edit/SystemRequirements/index.vue.d.ts +2 -0
- package/dist/runtime/components/Edit/Toolbar/index.vue +26 -41
- package/dist/runtime/components/Edit/Toolbar/index.vue.d.ts +6 -0
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue +29 -51
- package/dist/runtime/components/Edit/ViewportBlockingRect/index.vue.d.ts +20 -0
- package/dist/runtime/components/Edit/index.d.ts +6 -1
- package/dist/runtime/components/Edit/index.js +11 -1
- package/dist/runtime/composables/defineBlokkli.d.ts +3 -3
- package/dist/runtime/composables/defineBlokkli.js +40 -27
- package/dist/runtime/composables/defineBlokkliFeature.d.ts +1 -1
- package/dist/runtime/composables/defineBlokkliFeature.js +1 -1
- package/dist/runtime/composables/defineBlokkliFragment.d.ts +2 -2
- package/dist/runtime/composables/defineBlokkliFragment.js +16 -24
- package/dist/runtime/css/output.css +1 -1
- package/dist/runtime/helpers/definitionProvider.d.ts +18 -0
- package/dist/runtime/helpers/definitionProvider.js +96 -0
- package/dist/runtime/helpers/domProvider.d.ts +2 -1
- package/dist/runtime/helpers/domProvider.js +6 -3
- package/dist/runtime/helpers/editComponents/index.d.ts +2 -0
- package/dist/runtime/helpers/editComponents/index.js +10 -0
- package/dist/runtime/helpers/featuresProvider.d.ts +3 -2
- package/dist/runtime/helpers/featuresProvider.js +20 -11
- package/dist/runtime/helpers/frameEventBus.d.ts +1 -1
- package/dist/runtime/helpers/imports/index.d.ts +1 -0
- package/dist/runtime/helpers/imports/index.js +44 -0
- package/dist/runtime/helpers/index.d.ts +1 -0
- package/dist/runtime/helpers/index.js +11 -8
- package/dist/runtime/helpers/runtimeHelpers/index.d.ts +28 -2
- package/dist/runtime/helpers/runtimeHelpers/index.js +96 -10
- package/dist/runtime/helpers/stateProvider.d.ts +1 -1
- package/dist/runtime/helpers/storageProvider.js +1 -1
- package/dist/runtime/helpers/textProvider.d.ts +1 -1
- package/dist/runtime/helpers/textProvider.js +2 -2
- package/dist/runtime/helpers/themeProvider.js +5 -2
- package/dist/runtime/helpers/transform.d.ts +1 -1
- package/dist/runtime/helpers/typesProvider.d.ts +2 -2
- package/dist/runtime/helpers/uiProvider.js +4 -5
- package/dist/runtime/helpers/webgl/index.js +1 -1
- package/dist/runtime/icons/arrow-right-thin.svg +3 -0
- package/dist/runtime/public/_blokkli-assets/check.svg +6 -0
- package/dist/runtime/public/_blokkli-assets/loader.svg +1 -0
- package/dist/runtime/types/blokkOptions.d.ts +11 -2
- package/dist/runtime/types/index.d.ts +38 -15
- package/dist/shared/editor.gz_ac6uT.d.mts +431 -0
- package/dist/types.d.mts +1 -1
- package/package.json +26 -18
- package/dist/module.cjs +0 -5
- package/dist/module.d.ts +0 -129
- package/dist/runtime/adapter/drupal/graphql/base.graphql +0 -944
- package/dist/runtime/adapter/drupal/graphqlMiddleware.d.ts +0 -2
- package/dist/runtime/adapter/drupal/graphqlMiddleware.js +0 -680
- package/dist/runtime/helpers/options.d.ts +0 -2
- package/dist/runtime/helpers/options.js +0 -21
- package/dist/runtime/types/generatedModuleTypes.d.ts +0 -49
- package/dist/types.d.ts +0 -1
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/comments.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/fragments.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/search.graphql +0 -0
- /package/dist/{runtime/adapter/drupal/graphql → modules/drupal/graphql/features}/transform.graphql +0 -0
- /package/dist/runtime/{types/generatedModuleTypes.js → components/Edit/Features/Publish/Dialog/types.js} +0 -0
- /package/dist/runtime/public/{Inter.var.woff2 → _blokkli-assets/Inter.var.woff2} +0 -0
|
@@ -0,0 +1,762 @@
|
|
|
1
|
+
import { defineBlokkliEditAdapter } from '#blokkli/adapter';
|
|
2
|
+
import { falsy } from '#blokkli/helpers';
|
|
3
|
+
import { availableFeaturesAtBuild } from '#blokkli-build/features';
|
|
4
|
+
import { operationSources } from '#nuxt-graphql-middleware/sources';
|
|
5
|
+
import { computed, useGraphqlQuery, useRoute, useRouter, useGraphqlMutation } from '#imports';
|
|
6
|
+
import { ParagraphsBlokkliRemoteVideoProvider } from '#graphql-operations';
|
|
7
|
+
|
|
8
|
+
const index = defineBlokkliEditAdapter(
|
|
9
|
+
async (providedContext) => {
|
|
10
|
+
const availableFeatureIds = new Set(availableFeaturesAtBuild);
|
|
11
|
+
const availableGraphqlOperations = new Set(Object.keys(operationSources));
|
|
12
|
+
function hasQuery(name) {
|
|
13
|
+
return availableGraphqlOperations.has("query_" + name);
|
|
14
|
+
}
|
|
15
|
+
function hasMutation(name) {
|
|
16
|
+
return availableGraphqlOperations.has("mutation_" + name);
|
|
17
|
+
}
|
|
18
|
+
const ctx = computed(() => {
|
|
19
|
+
return {
|
|
20
|
+
entityType: providedContext.value.entityType.toUpperCase(),
|
|
21
|
+
entityBundle: providedContext.value.entityBundle,
|
|
22
|
+
entityUuid: providedContext.value.entityUuid,
|
|
23
|
+
langcode: providedContext.value.language
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
const config = await useGraphqlQuery("pbConfig", {
|
|
27
|
+
entityType: providedContext.value.entityType,
|
|
28
|
+
entityBundle: providedContext.value.entityBundle
|
|
29
|
+
}).then((v) => {
|
|
30
|
+
return {
|
|
31
|
+
clipboard: v.data.clipboards || [],
|
|
32
|
+
availableFeatures: v.data.features,
|
|
33
|
+
allTypes: (v.data.allTypes.items || []).filter(
|
|
34
|
+
(v2) => v2 && "icon" in v2
|
|
35
|
+
),
|
|
36
|
+
fieldConfig: v.data.fieldConfig || [],
|
|
37
|
+
editableFieldConfig: v.data.editableFieldConfig || [],
|
|
38
|
+
droppableFieldConfig: v.data.droppableFieldConfig || [],
|
|
39
|
+
urlPrefixes: v.data.urlPrefixes.reduce(
|
|
40
|
+
(acc, item) => {
|
|
41
|
+
if (item?.langcode) {
|
|
42
|
+
acc[item.langcode] = item.prefix;
|
|
43
|
+
}
|
|
44
|
+
return acc;
|
|
45
|
+
},
|
|
46
|
+
{}
|
|
47
|
+
)
|
|
48
|
+
};
|
|
49
|
+
});
|
|
50
|
+
const loadState = async () => {
|
|
51
|
+
const state = await useGraphqlQuery("pbEditState", {
|
|
52
|
+
...ctx.value
|
|
53
|
+
}).then((v) => v?.data.state);
|
|
54
|
+
if (!state) {
|
|
55
|
+
throw new Error("Failed to load state.");
|
|
56
|
+
}
|
|
57
|
+
return state;
|
|
58
|
+
};
|
|
59
|
+
const getAllBundles = () => {
|
|
60
|
+
return Promise.resolve(config.allTypes);
|
|
61
|
+
};
|
|
62
|
+
const getFieldConfig = () => {
|
|
63
|
+
return Promise.resolve(config.fieldConfig);
|
|
64
|
+
};
|
|
65
|
+
const mapState = (state) => {
|
|
66
|
+
const currentIndex = state?.currentIndex === null || state?.currentIndex === void 0 ? -1 : state.currentIndex;
|
|
67
|
+
const mutations = (state?.mutations || []).filter(falsy);
|
|
68
|
+
const currentUserIsOwner = !!state?.currentUserIsOwner;
|
|
69
|
+
const ownerName = state?.ownerName || "";
|
|
70
|
+
const fields = state?.mutatedState?.fields || [];
|
|
71
|
+
const violations = state.mutatedState?.violations || [];
|
|
72
|
+
const entity = state.entity;
|
|
73
|
+
const mutatedOptions = state.mutatedState?.mutatedOptions || {};
|
|
74
|
+
Object.keys(mutatedOptions).forEach((uuid) => {
|
|
75
|
+
mutatedOptions[uuid] = mutatedOptions[uuid]?.paragraphs_blokkli_data || {};
|
|
76
|
+
});
|
|
77
|
+
const translationState = {
|
|
78
|
+
isTranslatable: !!state.translationState?.isTranslatable,
|
|
79
|
+
sourceLanguage: state.translationState?.sourceLanguage || "",
|
|
80
|
+
availableLanguages: (state.translationState?.availableLanguages || []).map((language) => {
|
|
81
|
+
return {
|
|
82
|
+
id: language.id,
|
|
83
|
+
name: language.name
|
|
84
|
+
};
|
|
85
|
+
}),
|
|
86
|
+
translations: (state.translationState?.translations || []).map((v) => {
|
|
87
|
+
if (v.id && v.url && v.editUrl) {
|
|
88
|
+
return {
|
|
89
|
+
id: v.id,
|
|
90
|
+
url: v.url,
|
|
91
|
+
editUrl: v.editUrl,
|
|
92
|
+
exists: !!v.exists,
|
|
93
|
+
status: !!v.status
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
return null;
|
|
97
|
+
}).filter(falsy)
|
|
98
|
+
};
|
|
99
|
+
return {
|
|
100
|
+
currentIndex,
|
|
101
|
+
mutations,
|
|
102
|
+
currentUserIsOwner,
|
|
103
|
+
ownerName,
|
|
104
|
+
mutatedState: {
|
|
105
|
+
fields,
|
|
106
|
+
violations,
|
|
107
|
+
mutatedOptions
|
|
108
|
+
},
|
|
109
|
+
entity,
|
|
110
|
+
mutatedEntity: state.mutatedEntity,
|
|
111
|
+
translationState
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
const addNewBlock = (e) => useGraphqlMutation("pbAddParagraph", {
|
|
115
|
+
...ctx.value,
|
|
116
|
+
hostType: e.host.type,
|
|
117
|
+
hostFieldName: e.host.fieldName,
|
|
118
|
+
hostUuid: e.host.uuid,
|
|
119
|
+
afterUuid: e.afterUuid,
|
|
120
|
+
type: e.bundle
|
|
121
|
+
}).then(mapMutation);
|
|
122
|
+
const moveBlock = (e) => useGraphqlMutation("pbMoveParagraph", {
|
|
123
|
+
...ctx.value,
|
|
124
|
+
uuid: e.item.uuid,
|
|
125
|
+
hostType: e.host.type,
|
|
126
|
+
hostUuid: e.host.uuid,
|
|
127
|
+
hostFieldName: e.host.fieldName,
|
|
128
|
+
afterUuid: e.afterUuid
|
|
129
|
+
}).then(mapMutation);
|
|
130
|
+
const moveMultipleBlocks = (e) => useGraphqlMutation("pbMoveMultipleItems", {
|
|
131
|
+
...ctx.value,
|
|
132
|
+
uuids: e.uuids,
|
|
133
|
+
hostType: e.host.type,
|
|
134
|
+
hostUuid: e.host.uuid,
|
|
135
|
+
hostFieldName: e.host.fieldName,
|
|
136
|
+
afterUuid: e.afterUuid
|
|
137
|
+
}).then(mapMutation);
|
|
138
|
+
const loadStateAtIndex = (historyIndex) => useGraphqlQuery("pbEditState", {
|
|
139
|
+
...ctx.value,
|
|
140
|
+
historyIndex
|
|
141
|
+
}).then((v) => v?.data.state);
|
|
142
|
+
const getDisabledFeatures = () => {
|
|
143
|
+
const features = config.availableFeatures;
|
|
144
|
+
const disabled = [];
|
|
145
|
+
const mutations = features?.mutations || [];
|
|
146
|
+
if (!features?.comment) {
|
|
147
|
+
disabled.push("comments");
|
|
148
|
+
}
|
|
149
|
+
if (!features?.conversion) {
|
|
150
|
+
disabled.push("conversions");
|
|
151
|
+
}
|
|
152
|
+
if (!features?.library) {
|
|
153
|
+
disabled.push("library");
|
|
154
|
+
}
|
|
155
|
+
if (!mutations.includes("duplicate")) {
|
|
156
|
+
disabled.push("duplicate");
|
|
157
|
+
}
|
|
158
|
+
return Promise.resolve(disabled);
|
|
159
|
+
};
|
|
160
|
+
const mapMutation = (v) => v.data?.state?.action;
|
|
161
|
+
const route = useRoute();
|
|
162
|
+
const router = useRouter();
|
|
163
|
+
const changeLanguage = (translation) => {
|
|
164
|
+
return router.push({ path: translation.url, query: route.query });
|
|
165
|
+
};
|
|
166
|
+
const buildEditableFrameUrl = (e) => {
|
|
167
|
+
const url = "/" + [
|
|
168
|
+
"paragraphs_blokkli",
|
|
169
|
+
ctx.value.entityType,
|
|
170
|
+
ctx.value.entityUuid,
|
|
171
|
+
"edit",
|
|
172
|
+
"rich_text",
|
|
173
|
+
e.fieldName,
|
|
174
|
+
e.uuid
|
|
175
|
+
].filter(falsy).join("/");
|
|
176
|
+
return buildFormUrl(url, ctx.value.langcode).url;
|
|
177
|
+
};
|
|
178
|
+
const getEditableFieldConfig = () => {
|
|
179
|
+
return Promise.resolve(config.editableFieldConfig);
|
|
180
|
+
};
|
|
181
|
+
const getDroppableFieldConfig = () => {
|
|
182
|
+
return Promise.resolve(config.droppableFieldConfig);
|
|
183
|
+
};
|
|
184
|
+
const formFrameBuilder = (e) => {
|
|
185
|
+
const entityType = ctx.value.entityType.toLowerCase();
|
|
186
|
+
if (e.id === "block:add") {
|
|
187
|
+
return buildFormUrl(
|
|
188
|
+
[
|
|
189
|
+
"paragraphs_blokkli",
|
|
190
|
+
entityType,
|
|
191
|
+
ctx.value.entityUuid,
|
|
192
|
+
"add",
|
|
193
|
+
e.data.bundle,
|
|
194
|
+
e.data.host.type,
|
|
195
|
+
e.data.host.uuid,
|
|
196
|
+
e.data.host.fieldName,
|
|
197
|
+
e.data.afterUuid
|
|
198
|
+
],
|
|
199
|
+
ctx.value.langcode
|
|
200
|
+
);
|
|
201
|
+
} else if (e.id === "block:edit") {
|
|
202
|
+
return buildFormUrl(
|
|
203
|
+
`/paragraphs_blokkli/${entityType}/${ctx.value.entityUuid}/edit/${e.data.uuid}`,
|
|
204
|
+
ctx.value.langcode
|
|
205
|
+
);
|
|
206
|
+
} else if (e.id === "block:translate") {
|
|
207
|
+
return buildFormUrl(
|
|
208
|
+
`/paragraphs_blokkli/${entityType}/${ctx.value.entityUuid}/edit/${e.data.uuid}`,
|
|
209
|
+
e.langcode
|
|
210
|
+
);
|
|
211
|
+
} else if (e.id === "entity:edit") {
|
|
212
|
+
return buildFormUrl(
|
|
213
|
+
`/paragraphs_blokkli/${entityType}/${ctx.value.entityUuid}/edit_entity/${ctx.value.langcode}`,
|
|
214
|
+
ctx.value.langcode
|
|
215
|
+
);
|
|
216
|
+
} else if (e.id === "entity:translate") {
|
|
217
|
+
return buildFormUrl(
|
|
218
|
+
`/paragraphs_blokkli/${entityType}/${ctx.value.entityUuid}/edit_entity/${e.translation.id}`,
|
|
219
|
+
e.translation.id
|
|
220
|
+
);
|
|
221
|
+
} else if (e.id === "batchTranslate") {
|
|
222
|
+
return buildFormUrl(
|
|
223
|
+
`/paragraphs_blokkli/${entityType}/${ctx.value.entityUuid}/translate-paragraphs`,
|
|
224
|
+
ctx.value.langcode
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
const getLastChanged = () => $fetch(
|
|
229
|
+
`/paragraphs_blokkli/${ctx.value.entityType}/${ctx.value.entityUuid}/last_changed`
|
|
230
|
+
).then((v) => v.changed);
|
|
231
|
+
const adapter = {
|
|
232
|
+
addNewBlock,
|
|
233
|
+
buildEditableFrameUrl,
|
|
234
|
+
changeLanguage,
|
|
235
|
+
formFrameBuilder,
|
|
236
|
+
getAllBundles,
|
|
237
|
+
getDisabledFeatures,
|
|
238
|
+
getDroppableFieldConfig,
|
|
239
|
+
getEditableFieldConfig,
|
|
240
|
+
getFieldConfig,
|
|
241
|
+
getLastChanged,
|
|
242
|
+
loadState,
|
|
243
|
+
loadStateAtIndex,
|
|
244
|
+
mapState,
|
|
245
|
+
moveBlock,
|
|
246
|
+
moveMultipleBlocks
|
|
247
|
+
};
|
|
248
|
+
if (hasQuery("pbPublishOptions")) {
|
|
249
|
+
adapter.getPublishOptions = () => useGraphqlQuery("pbPublishOptions", ctx.value).then((v) => {
|
|
250
|
+
const options = v.data.state?.publishOptions;
|
|
251
|
+
if (!options) {
|
|
252
|
+
throw new Error("Failed to load publish options.");
|
|
253
|
+
}
|
|
254
|
+
return options;
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
if (hasQuery("pbGetImportSourceEntities")) {
|
|
258
|
+
adapter.getImportItems = (searchText) => useGraphqlQuery("pbGetImportSourceEntities", {
|
|
259
|
+
entityType: ctx.value.entityType.toLowerCase(),
|
|
260
|
+
entityUuid: ctx.value.entityUuid,
|
|
261
|
+
searchText
|
|
262
|
+
}).then((data) => {
|
|
263
|
+
return {
|
|
264
|
+
total: data?.data.pbGetImportSourceEntities?.total || 0,
|
|
265
|
+
items: (data?.data.pbGetImportSourceEntities?.items || []).map((item) => {
|
|
266
|
+
if (item?.uuid) {
|
|
267
|
+
return {
|
|
268
|
+
uuid: item.uuid,
|
|
269
|
+
label: item.label || item.uuid
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}).filter(falsy)
|
|
273
|
+
};
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
if (hasQuery("pbConversions")) {
|
|
277
|
+
adapter.getConversions = () => useGraphqlQuery("pbConversions").then(
|
|
278
|
+
(v) => v?.data.paragraphsBlokkliConversions || []
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
if (hasMutation("pbTakeOwnership")) {
|
|
282
|
+
adapter.takeOwnership = () => useGraphqlMutation("pbTakeOwnership", ctx.value).then(mapMutation);
|
|
283
|
+
}
|
|
284
|
+
if (hasMutation("pbSetHistoryIndex")) {
|
|
285
|
+
adapter.setHistoryIndex = (index) => useGraphqlMutation("pbSetHistoryIndex", {
|
|
286
|
+
...ctx.value,
|
|
287
|
+
index
|
|
288
|
+
}).then(mapMutation);
|
|
289
|
+
}
|
|
290
|
+
if (hasMutation("pbSetMutationItemStatus")) {
|
|
291
|
+
adapter.setMutationItemStatus = (index, status) => useGraphqlMutation("pbSetMutationItemStatus", {
|
|
292
|
+
...ctx.value,
|
|
293
|
+
index,
|
|
294
|
+
status
|
|
295
|
+
}).then(mapMutation);
|
|
296
|
+
}
|
|
297
|
+
if (hasMutation("pbPublish")) {
|
|
298
|
+
adapter.publish = (options) => useGraphqlMutation("pbPublish", {
|
|
299
|
+
entityType: options.hostEntityType.toUpperCase(),
|
|
300
|
+
entityUuid: options.hostEntityUuid,
|
|
301
|
+
createNewState: !options.closeAfterPublish,
|
|
302
|
+
// @ts-expect-error Might not exist.
|
|
303
|
+
publishIfUnpublished: options.publishIfUnpublished,
|
|
304
|
+
revisionLogMessage: options.revisionLogMessage
|
|
305
|
+
}).then(mapMutation);
|
|
306
|
+
}
|
|
307
|
+
if (hasMutation("pbCopyFromExisting")) {
|
|
308
|
+
adapter.importFromExisting = (e) => useGraphqlMutation("pbCopyFromExisting", {
|
|
309
|
+
...ctx.value,
|
|
310
|
+
sourceUuid: e.sourceUuid,
|
|
311
|
+
fields: e.sourceFields
|
|
312
|
+
}).then(mapMutation);
|
|
313
|
+
}
|
|
314
|
+
if (hasMutation("pbRevertAllChanges")) {
|
|
315
|
+
adapter.revertAllChanges = () => useGraphqlMutation("pbRevertAllChanges", ctx.value).then(mapMutation);
|
|
316
|
+
}
|
|
317
|
+
if (hasMutation("pbMakeParagraphReusable")) {
|
|
318
|
+
adapter.makeBlockReusable = (e) => useGraphqlMutation("pbMakeParagraphReusable", {
|
|
319
|
+
...ctx.value,
|
|
320
|
+
...e
|
|
321
|
+
}).then(mapMutation);
|
|
322
|
+
}
|
|
323
|
+
if (hasMutation("pbDuplicateParagraph")) {
|
|
324
|
+
adapter.duplicateBlocks = (uuids) => {
|
|
325
|
+
if (uuids.length === 1) {
|
|
326
|
+
return useGraphqlMutation("pbDuplicateParagraph", {
|
|
327
|
+
...ctx.value,
|
|
328
|
+
uuid: uuids[0]
|
|
329
|
+
}).then(mapMutation);
|
|
330
|
+
}
|
|
331
|
+
return useGraphqlMutation("pbDuplicateMultipleParagraphs", {
|
|
332
|
+
...ctx.value,
|
|
333
|
+
uuids
|
|
334
|
+
}).then(mapMutation);
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
if (hasMutation("pbDuplicateMultipleParagraphs")) {
|
|
338
|
+
adapter.pasteExistingBlocks = (e) => {
|
|
339
|
+
return useGraphqlMutation("pbDuplicateMultipleParagraphs", {
|
|
340
|
+
...ctx.value,
|
|
341
|
+
uuids: e.uuids,
|
|
342
|
+
afterUuid: e.preceedingUuid
|
|
343
|
+
}).then(mapMutation);
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
if (hasMutation("pbDetachReusableParagraph")) {
|
|
347
|
+
adapter.detachReusableBlock = (e) => {
|
|
348
|
+
return useGraphqlMutation("pbDetachReusableParagraph", {
|
|
349
|
+
...ctx.value,
|
|
350
|
+
uuids: e.uuids
|
|
351
|
+
}).then(mapMutation);
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
if (hasMutation("pbConvertParagraph") && hasMutation("pbConvertMultiple")) {
|
|
355
|
+
adapter.convertBlocks = (uuids, targetBundle) => {
|
|
356
|
+
if (uuids.length === 1) {
|
|
357
|
+
return useGraphqlMutation("pbConvertParagraph", {
|
|
358
|
+
...ctx.value,
|
|
359
|
+
uuid: uuids[0],
|
|
360
|
+
targetBundle
|
|
361
|
+
}).then(mapMutation);
|
|
362
|
+
}
|
|
363
|
+
return useGraphqlMutation("pbConvertMultiple", {
|
|
364
|
+
...ctx.value,
|
|
365
|
+
uuids,
|
|
366
|
+
targetBundle
|
|
367
|
+
}).then(mapMutation);
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
if (hasMutation("pbDeleteMultipleParagraphs")) {
|
|
371
|
+
adapter.deleteBlocks = (uuids) => useGraphqlMutation("pbDeleteMultipleParagraphs", {
|
|
372
|
+
...ctx.value,
|
|
373
|
+
uuids
|
|
374
|
+
}).then(mapMutation);
|
|
375
|
+
}
|
|
376
|
+
if (hasMutation("pbAddReusableParagraph")) {
|
|
377
|
+
adapter.addLibraryItem = (e) => useGraphqlMutation("pbAddReusableParagraph", {
|
|
378
|
+
...ctx.value,
|
|
379
|
+
libraryItemUuid: e.libraryItemUuid,
|
|
380
|
+
hostType: e.host.type,
|
|
381
|
+
hostUuid: e.host.uuid,
|
|
382
|
+
hostFieldName: e.host.fieldName,
|
|
383
|
+
afterUuid: e.afterUuid
|
|
384
|
+
}).then(mapMutation);
|
|
385
|
+
}
|
|
386
|
+
if (hasMutation("pbUpdateParagraphOption") && hasMutation("pbBulkUpdateParagraphBehaviorSettings")) {
|
|
387
|
+
adapter.updateOptions = (options) => {
|
|
388
|
+
if (options.length === 1) {
|
|
389
|
+
return useGraphqlMutation("pbUpdateParagraphOption", {
|
|
390
|
+
...ctx.value,
|
|
391
|
+
uuid: options[0].uuid,
|
|
392
|
+
key: options[0].key,
|
|
393
|
+
value: options[0].value,
|
|
394
|
+
pluginId: "paragraphs_blokkli_data"
|
|
395
|
+
}).then(mapMutation);
|
|
396
|
+
}
|
|
397
|
+
const persistItems = options.map((v) => {
|
|
398
|
+
return {
|
|
399
|
+
uuid: v.uuid,
|
|
400
|
+
key: v.key,
|
|
401
|
+
value: v.value,
|
|
402
|
+
pluginId: "paragraphs_blokkli_data"
|
|
403
|
+
};
|
|
404
|
+
});
|
|
405
|
+
return useGraphqlMutation("pbBulkUpdateParagraphBehaviorSettings", {
|
|
406
|
+
...ctx.value,
|
|
407
|
+
items: persistItems
|
|
408
|
+
}).then(mapMutation);
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
const mapComments = (comments) => comments.map((item) => {
|
|
412
|
+
if (item && "uuid" in item) {
|
|
413
|
+
return {
|
|
414
|
+
uuid: item.uuid,
|
|
415
|
+
blockUuids: (item.blockUuids || []).filter(falsy),
|
|
416
|
+
resolved: !!item.resolved,
|
|
417
|
+
body: item.body || "",
|
|
418
|
+
created: item.created?.first?.value || "",
|
|
419
|
+
user: {
|
|
420
|
+
label: item.user?.label || ""
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
return null;
|
|
425
|
+
}).filter(falsy);
|
|
426
|
+
if (hasQuery("pbComments")) {
|
|
427
|
+
adapter.loadComments = () => useGraphqlQuery("pbComments", ctx.value).then(
|
|
428
|
+
(v) => mapComments(v.data.state?.comments || [])
|
|
429
|
+
);
|
|
430
|
+
}
|
|
431
|
+
if (hasMutation("pbAddComment")) {
|
|
432
|
+
adapter.addComment = (blockUuids, body) => useGraphqlMutation("pbAddComment", {
|
|
433
|
+
...ctx.value,
|
|
434
|
+
blockUuids,
|
|
435
|
+
body
|
|
436
|
+
}).then((v) => mapComments(v.data.state?.action || []));
|
|
437
|
+
}
|
|
438
|
+
if (hasMutation("pbResolveComment")) {
|
|
439
|
+
adapter.resolveComment = (uuid) => useGraphqlMutation("pbResolveComment", {
|
|
440
|
+
...ctx.value,
|
|
441
|
+
uuid
|
|
442
|
+
}).then((v) => mapComments(v.data.state?.action || []));
|
|
443
|
+
}
|
|
444
|
+
if (hasQuery("pbLibraryItems")) {
|
|
445
|
+
adapter.getLibraryItems = (data) => {
|
|
446
|
+
return useGraphqlQuery("pbLibraryItems", {
|
|
447
|
+
bundles: data.bundles,
|
|
448
|
+
text: data.text,
|
|
449
|
+
page: data.page
|
|
450
|
+
}).then((response) => {
|
|
451
|
+
const items = response.data.result?.items?.map((v) => {
|
|
452
|
+
if (v && "uuid" in v && v.uuid) {
|
|
453
|
+
const paragraph = v.paragraphs;
|
|
454
|
+
const bundle = paragraph?.bundle;
|
|
455
|
+
if (bundle && paragraph && paragraph.props && paragraph) {
|
|
456
|
+
return {
|
|
457
|
+
uuid: v.uuid,
|
|
458
|
+
label: v.label,
|
|
459
|
+
bundle,
|
|
460
|
+
item: paragraph
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return null;
|
|
465
|
+
}).filter(falsy) || [];
|
|
466
|
+
return {
|
|
467
|
+
items,
|
|
468
|
+
perPage: response.data.result?.perPage || 16,
|
|
469
|
+
total: response.data.result?.total || 0
|
|
470
|
+
};
|
|
471
|
+
});
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
if (hasQuery("pbGetPreviewGrantUrl")) {
|
|
475
|
+
adapter.getPreviewGrantUrl = () => useGraphqlQuery("pbGetPreviewGrantUrl", ctx.value).then(
|
|
476
|
+
(v) => v.data.getParagraphsEditState?.previewUrl
|
|
477
|
+
);
|
|
478
|
+
}
|
|
479
|
+
if (hasQuery("pbGetTransformPlugins")) {
|
|
480
|
+
adapter.getTransformPlugins = () => useGraphqlQuery("pbGetTransformPlugins", ctx.value).then((v) => v.data.paragraphsBlokkliGetTransformPlugins || []).then(
|
|
481
|
+
(plugins) => plugins.map((plugin) => {
|
|
482
|
+
return {
|
|
483
|
+
id: plugin.id,
|
|
484
|
+
label: plugin.label,
|
|
485
|
+
bundles: plugin.bundles,
|
|
486
|
+
targetBundles: plugin.targetBundles,
|
|
487
|
+
min: plugin.min,
|
|
488
|
+
max: plugin.max
|
|
489
|
+
};
|
|
490
|
+
})
|
|
491
|
+
);
|
|
492
|
+
}
|
|
493
|
+
if (hasMutation("pbApplyTransformPlugin")) {
|
|
494
|
+
adapter.applyTransformPlugin = (e) => useGraphqlMutation("pbApplyTransformPlugin", {
|
|
495
|
+
...ctx.value,
|
|
496
|
+
...e
|
|
497
|
+
}).then(mapMutation);
|
|
498
|
+
}
|
|
499
|
+
const buildFormUrl = (parts, langcode) => {
|
|
500
|
+
const prefix = config.urlPrefixes[langcode];
|
|
501
|
+
if (prefix === null || prefix === void 0) {
|
|
502
|
+
throw new Error("Failed to get URL prefix for langcode: " + langcode);
|
|
503
|
+
}
|
|
504
|
+
const url = typeof parts === "string" ? parts : "/" + parts.join("/");
|
|
505
|
+
return { url: prefix + url + `?paragraphsBlokkli=true` };
|
|
506
|
+
};
|
|
507
|
+
if (availableFeatureIds.has("library")) {
|
|
508
|
+
adapter.getLibraryItemEditUrl = (uuid) => {
|
|
509
|
+
const url = buildFormUrl(
|
|
510
|
+
["blokkli", "library-item", uuid],
|
|
511
|
+
ctx.value.langcode
|
|
512
|
+
).url;
|
|
513
|
+
return `${url}&blokkliEditing=${uuid}&language=${ctx.value.langcode}`;
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
if (hasMutation("pbUpdateFieldValue")) {
|
|
517
|
+
adapter.updateFieldValue = (e) => useGraphqlMutation("pbUpdateFieldValue", {
|
|
518
|
+
...ctx.value,
|
|
519
|
+
uuid: e.uuid,
|
|
520
|
+
fieldName: e.fieldName,
|
|
521
|
+
value: e.fieldValue
|
|
522
|
+
}).then(mapMutation);
|
|
523
|
+
}
|
|
524
|
+
if (hasMutation("pbAddFragmentParagraph")) {
|
|
525
|
+
adapter.fragmentsAddBlock = (e) => useGraphqlMutation("pbAddFragmentParagraph", {
|
|
526
|
+
...ctx.value,
|
|
527
|
+
hostType: e.host.type,
|
|
528
|
+
hostFieldName: e.host.fieldName,
|
|
529
|
+
hostUuid: e.host.uuid,
|
|
530
|
+
afterUuid: e.preceedingUuid,
|
|
531
|
+
name: e.name
|
|
532
|
+
}).then(mapMutation);
|
|
533
|
+
}
|
|
534
|
+
if (hasMutation("pbReplaceMedia")) {
|
|
535
|
+
adapter.mediaLibraryReplaceMedia = (e) => useGraphqlMutation("pbReplaceMedia", {
|
|
536
|
+
...ctx.value,
|
|
537
|
+
uuid: e.host.uuid,
|
|
538
|
+
fieldName: e.host.fieldName,
|
|
539
|
+
mediaId: e.mediaId
|
|
540
|
+
}).then(mapMutation);
|
|
541
|
+
}
|
|
542
|
+
if (hasMutation("pbReplaceHostEntityMedia")) {
|
|
543
|
+
adapter.mediaLibraryReplaceEntityMedia = (e) => useGraphqlMutation("pbReplaceHostEntityMedia", {
|
|
544
|
+
...ctx.value,
|
|
545
|
+
fieldName: e.host.fieldName,
|
|
546
|
+
mediaId: e.mediaId
|
|
547
|
+
}).then(mapMutation);
|
|
548
|
+
}
|
|
549
|
+
if (hasMutation("pbUpdateHostEntityFieldValue")) {
|
|
550
|
+
adapter.updateEntityFieldValue = (e) => useGraphqlMutation("pbUpdateHostEntityFieldValue", {
|
|
551
|
+
...ctx.value,
|
|
552
|
+
fieldName: e.fieldName,
|
|
553
|
+
value: e.fieldValue
|
|
554
|
+
}).then(mapMutation);
|
|
555
|
+
}
|
|
556
|
+
if (hasQuery("pbMediaLibraryGetResults")) {
|
|
557
|
+
adapter.mediaLibraryGetResults = (e) => {
|
|
558
|
+
return useGraphqlQuery("pbMediaLibraryGetResults", {
|
|
559
|
+
text: e.filters.text,
|
|
560
|
+
bundle: e.filters.bundle,
|
|
561
|
+
page: e.page
|
|
562
|
+
}).then((data) => {
|
|
563
|
+
return {
|
|
564
|
+
filters: (data.data.pbMediaLibraryGetResults?.filters || []).reduce((acc, filter) => {
|
|
565
|
+
if (filter?.__typename === "ParagraphsBlokkliMediaLibraryFilterText") {
|
|
566
|
+
acc[filter.id] = {
|
|
567
|
+
type: "text",
|
|
568
|
+
placeholder: filter.placeholder,
|
|
569
|
+
label: filter.label
|
|
570
|
+
};
|
|
571
|
+
} else if (filter?.__typename === "ParagraphsBlokkliMediaLibraryFilterSelect") {
|
|
572
|
+
acc[filter.id] = {
|
|
573
|
+
type: "select",
|
|
574
|
+
label: filter.label,
|
|
575
|
+
default: filter.default,
|
|
576
|
+
options: filter.options
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return acc;
|
|
580
|
+
}, {}),
|
|
581
|
+
items: (data.data.pbMediaLibraryGetResults?.items || []).filter(
|
|
582
|
+
falsy
|
|
583
|
+
),
|
|
584
|
+
total: data.data.pbMediaLibraryGetResults?.total || 0,
|
|
585
|
+
perPage: data.data.pbMediaLibraryGetResults?.perPage || 50
|
|
586
|
+
};
|
|
587
|
+
});
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
if (hasMutation("pbAddEntityReference")) {
|
|
591
|
+
adapter.mediaLibraryAddBlock = (e) => {
|
|
592
|
+
return useGraphqlMutation("pbAddEntityReference", {
|
|
593
|
+
...ctx.value,
|
|
594
|
+
targetId: e.item.mediaId,
|
|
595
|
+
targetBundle: e.item.mediaBundle,
|
|
596
|
+
targetType: "media",
|
|
597
|
+
paragraphBundle: e.item.itemBundle,
|
|
598
|
+
hostType: e.host.type,
|
|
599
|
+
hostUuid: e.host.uuid,
|
|
600
|
+
hostFieldName: e.host.fieldName,
|
|
601
|
+
afterUuid: e.preceedingUuid
|
|
602
|
+
}).then(mapMutation);
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
if (hasMutation("pbAddEntityReferenceMultiple")) {
|
|
606
|
+
adapter.mediaLibraryAddBlocks = (e) => {
|
|
607
|
+
return useGraphqlMutation("pbAddEntityReferenceMultiple", {
|
|
608
|
+
...ctx.value,
|
|
609
|
+
references: e.items.map((item) => {
|
|
610
|
+
return {
|
|
611
|
+
targetId: item.mediaId,
|
|
612
|
+
targetType: "media",
|
|
613
|
+
targetBundle: item.mediaBundle,
|
|
614
|
+
paragraphBundle: item.itemBundle
|
|
615
|
+
};
|
|
616
|
+
}),
|
|
617
|
+
hostType: e.host.type,
|
|
618
|
+
hostUuid: e.host.uuid,
|
|
619
|
+
hostFieldName: e.host.fieldName,
|
|
620
|
+
afterUuid: e.preceedingUuid
|
|
621
|
+
}).then(mapMutation);
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
if (hasQuery("pbSearchTabs")) {
|
|
625
|
+
adapter.getContentSearchTabs = () => {
|
|
626
|
+
return useGraphqlQuery("pbSearchTabs").then((v) => {
|
|
627
|
+
return (v.data.tabs || []).reduce(
|
|
628
|
+
(acc, tab) => {
|
|
629
|
+
if (tab?.id) {
|
|
630
|
+
acc[tab.id] = tab.label;
|
|
631
|
+
}
|
|
632
|
+
return acc;
|
|
633
|
+
},
|
|
634
|
+
{}
|
|
635
|
+
);
|
|
636
|
+
});
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
if (hasQuery("pbSearch")) {
|
|
640
|
+
adapter.getContentSearchResults = (id, text) => {
|
|
641
|
+
return useGraphqlQuery("pbSearch", {
|
|
642
|
+
id,
|
|
643
|
+
text
|
|
644
|
+
}).then((v) => (v.data.paragraphsBlokkliSearch || []).filter(falsy));
|
|
645
|
+
};
|
|
646
|
+
}
|
|
647
|
+
if (hasMutation("pbAddEntityReference")) {
|
|
648
|
+
adapter.addContentSearchItem = (e) => {
|
|
649
|
+
return useGraphqlMutation("pbAddEntityReference", {
|
|
650
|
+
...ctx.value,
|
|
651
|
+
targetId: e.item.id,
|
|
652
|
+
targetType: e.item.entityType,
|
|
653
|
+
targetBundle: e.item.entityBundle,
|
|
654
|
+
paragraphBundle: e.bundle,
|
|
655
|
+
hostType: e.host.type,
|
|
656
|
+
hostUuid: e.host.uuid,
|
|
657
|
+
hostFieldName: e.host.fieldName,
|
|
658
|
+
afterUuid: e.afterUuid
|
|
659
|
+
}).then(mapMutation);
|
|
660
|
+
};
|
|
661
|
+
}
|
|
662
|
+
if (availableFeatureIds.has("comments")) {
|
|
663
|
+
adapter.clipboardMapBundle = (e) => {
|
|
664
|
+
if (e.type === "video") {
|
|
665
|
+
return config.clipboard.find((v) => {
|
|
666
|
+
if (v?.__typename === "ParagraphsBlokkliSupportedClipboardRemoteVideo") {
|
|
667
|
+
const providers = v.videoProviders;
|
|
668
|
+
if (e.videoService === "vimeo") {
|
|
669
|
+
return providers.includes(
|
|
670
|
+
ParagraphsBlokkliRemoteVideoProvider.VIMEO
|
|
671
|
+
);
|
|
672
|
+
} else if (e.videoService === "youtube") {
|
|
673
|
+
return providers.includes(
|
|
674
|
+
ParagraphsBlokkliRemoteVideoProvider.YOUTUBE
|
|
675
|
+
);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
return false;
|
|
679
|
+
})?.possibleParagraphBundles?.[0];
|
|
680
|
+
} else if (e.type === "plaintext") {
|
|
681
|
+
return config.clipboard.find((v) => {
|
|
682
|
+
return v?.__typename === "ParagraphsBlokkliSupportedClipboardRichText";
|
|
683
|
+
})?.possibleParagraphBundles?.[0];
|
|
684
|
+
} else if (e.type === "image") {
|
|
685
|
+
return config.clipboard.find((v) => {
|
|
686
|
+
return v?.__typename === "ParagraphsBlokkliSupportedClipboardImage";
|
|
687
|
+
})?.possibleParagraphBundles?.[0];
|
|
688
|
+
} else if (e.type === "file") {
|
|
689
|
+
return config.clipboard.find((v) => {
|
|
690
|
+
return v?.__typename === "ParagraphsBlokkliSupportedClipboardFile";
|
|
691
|
+
})?.possibleParagraphBundles?.[0];
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
}
|
|
695
|
+
adapter.addBlockFromClipboardItem = (e) => {
|
|
696
|
+
if (e.item.type === "text" && hasMutation("pbAddClipboardText")) {
|
|
697
|
+
return useGraphqlMutation("pbAddClipboardText", {
|
|
698
|
+
...ctx.value,
|
|
699
|
+
text: e.item.data,
|
|
700
|
+
hostType: e.host.type,
|
|
701
|
+
hostUuid: e.host.uuid,
|
|
702
|
+
hostFieldName: e.host.fieldName,
|
|
703
|
+
afterUuid: e.afterUuid
|
|
704
|
+
}).then(mapMutation);
|
|
705
|
+
} else if (e.item.type === "image" && hasMutation("pbAddImage")) {
|
|
706
|
+
return useGraphqlMutation("pbAddImage", {
|
|
707
|
+
...ctx.value,
|
|
708
|
+
data: e.item.data,
|
|
709
|
+
fileName: e.item.additional || "",
|
|
710
|
+
hostType: e.host.type,
|
|
711
|
+
hostUuid: e.host.uuid,
|
|
712
|
+
hostFieldName: e.host.fieldName,
|
|
713
|
+
afterUuid: e.afterUuid
|
|
714
|
+
}).then(mapMutation);
|
|
715
|
+
} else if (e.item.type === "file" && hasMutation("pbAddFile")) {
|
|
716
|
+
return useGraphqlMutation("pbAddFile", {
|
|
717
|
+
...ctx.value,
|
|
718
|
+
data: e.item.data,
|
|
719
|
+
fileName: e.item.additional || "",
|
|
720
|
+
hostType: e.host.type,
|
|
721
|
+
hostUuid: e.host.uuid,
|
|
722
|
+
hostFieldName: e.host.fieldName,
|
|
723
|
+
afterUuid: e.afterUuid
|
|
724
|
+
}).then(mapMutation);
|
|
725
|
+
} else if (e.item.type === "video" && hasMutation("pbAddVideoRemote")) {
|
|
726
|
+
return useGraphqlMutation("pbAddVideoRemote", {
|
|
727
|
+
...ctx.value,
|
|
728
|
+
url: e.item.data,
|
|
729
|
+
hostType: e.host.type,
|
|
730
|
+
hostUuid: e.host.uuid,
|
|
731
|
+
hostFieldName: e.host.fieldName,
|
|
732
|
+
afterUuid: e.afterUuid
|
|
733
|
+
}).then(mapMutation);
|
|
734
|
+
}
|
|
735
|
+
};
|
|
736
|
+
if (hasQuery("pbSearchEditStates")) {
|
|
737
|
+
adapter.getEditStates = (page) => {
|
|
738
|
+
return useGraphqlQuery("pbSearchEditStates", { page }).then((data) => {
|
|
739
|
+
return {
|
|
740
|
+
items: (data.data.pbSearchEditStates?.items || []).map((v) => {
|
|
741
|
+
if (v && v.uuid && v.hostEntityType && v.hostEntityUuid && v.label) {
|
|
742
|
+
return {
|
|
743
|
+
id: v.uuid,
|
|
744
|
+
hostEntityType: v.hostEntityType,
|
|
745
|
+
hostEntityUuid: v.hostEntityUuid,
|
|
746
|
+
label: v.label,
|
|
747
|
+
...v
|
|
748
|
+
};
|
|
749
|
+
}
|
|
750
|
+
return null;
|
|
751
|
+
}).filter(falsy),
|
|
752
|
+
total: data.data.pbSearchEditStates?.total || 0,
|
|
753
|
+
perPage: data.data.pbSearchEditStates?.perPage || 0
|
|
754
|
+
};
|
|
755
|
+
});
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
return adapter;
|
|
759
|
+
}
|
|
760
|
+
);
|
|
761
|
+
|
|
762
|
+
export { index as default };
|