@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef
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/README.md +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +2 -1
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.d.ts +38 -18
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +6 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/types/config_controller.d.ts +11 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +5 -5
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +6 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +5 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.d.ts +7 -1
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.d.ts +29 -4
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.d.ts +16 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.d.ts +15 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.d.ts +37 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.d.ts +11 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/components/index.d.ts +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.d.ts +81 -4
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.d.ts +48 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.d.ts +7 -1
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +28 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.d.ts +4 -1
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3085
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +48 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +27 -0
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.d.ts +28 -6
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.d.ts +21 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +25 -0
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3793
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +11 -0
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +95 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +8 -3
- package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.d.ts +15 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +42 -1
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.d.ts +20 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-DLHCka00.js +0 -3630
- package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
- package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
- package/dist/SchemaChangeDialog-BeP0A4MJ.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-4bJWdlDK.js +0 -520
- package/dist/export-4bJWdlDK.js.map +0 -1
- package/dist/history-BElrZ5Rw.js +0 -313
- package/dist/history-BElrZ5Rw.js.map +0 -1
- package/dist/import-TCgkTVlS.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-CC0ozHoD.js.map +0 -1
- package/dist/util-DybQBkug.js +0 -26390
- package/dist/util-DybQBkug.js.map +0 -1
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
import { serializeForClipboard } from "./clipboard.js";
|
|
2
|
+
import { NodeSelection, Plugin } from "prosemirror-state";
|
|
3
|
+
import { dropPoint } from "prosemirror-transform";
|
|
4
|
+
//#region src/editor/extensions/drag-and-drop.tsx
|
|
5
|
+
function absoluteRect(element) {
|
|
6
|
+
const data = element.getBoundingClientRect();
|
|
7
|
+
let ancestor = element.parentElement;
|
|
8
|
+
while (ancestor && window.getComputedStyle(ancestor).position === "static") ancestor = ancestor.parentElement;
|
|
9
|
+
const ancestorRect = ancestor?.getBoundingClientRect();
|
|
10
|
+
return {
|
|
11
|
+
top: data.top - (ancestorRect?.top ?? 0),
|
|
12
|
+
left: data.left - (ancestorRect?.left ?? 0),
|
|
13
|
+
width: data.width
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function nodeDOMAtCoords(coords, view) {
|
|
17
|
+
const editorRect = view.dom.getBoundingClientRect();
|
|
18
|
+
if (coords.y < editorRect.top || coords.y > editorRect.bottom) return void 0;
|
|
19
|
+
if (coords.x < editorRect.left - 100 || coords.x > editorRect.right + 50) return void 0;
|
|
20
|
+
const blockSelector = "li, p, pre, blockquote, h1, h2, h3, h4, h5, h6, img, [data-type=\"taskList\"]";
|
|
21
|
+
const block = document.elementFromPoint(coords.x, coords.y)?.closest(blockSelector);
|
|
22
|
+
if (block && view.dom.contains(block) && block.textContent?.trim()) {
|
|
23
|
+
const li = block.closest("li");
|
|
24
|
+
return li && view.dom.contains(li) ? li : block;
|
|
25
|
+
}
|
|
26
|
+
const probeX = editorRect.left + Math.min(60, editorRect.width / 4);
|
|
27
|
+
if (coords.x > probeX) return void 0;
|
|
28
|
+
const probeBlock = document.elementFromPoint(probeX, coords.y)?.closest(blockSelector);
|
|
29
|
+
if (probeBlock && probeBlock.textContent?.trim()) {
|
|
30
|
+
if (view.dom.contains(probeBlock)) {
|
|
31
|
+
const li = probeBlock.closest("li");
|
|
32
|
+
return li && view.dom.contains(li) ? li : probeBlock;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function nodePosAtDOM(node, view, options) {
|
|
37
|
+
try {
|
|
38
|
+
if (!view.dom.contains(node)) return null;
|
|
39
|
+
const pos = view.posAtDOM(node, 0);
|
|
40
|
+
const $pos = view.state.doc.resolve(pos);
|
|
41
|
+
if ($pos.depth > 0) return $pos.before();
|
|
42
|
+
return pos;
|
|
43
|
+
} catch (e) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function dragHandlePlugin(options = { dragHandleWidth: 24 }) {
|
|
48
|
+
function handleDragStart(event, view) {
|
|
49
|
+
view.focus();
|
|
50
|
+
if (!event.dataTransfer) return;
|
|
51
|
+
const node = nodeDOMAtCoords({
|
|
52
|
+
x: event.clientX,
|
|
53
|
+
y: event.clientY
|
|
54
|
+
}, view);
|
|
55
|
+
if (!(node instanceof Element)) return;
|
|
56
|
+
const nodePos = nodePosAtDOM(node, view, options);
|
|
57
|
+
if (nodePos == null || nodePos < 0) return;
|
|
58
|
+
const draggedNodeSelection = NodeSelection.create(view.state.doc, nodePos);
|
|
59
|
+
view.dispatch(view.state.tr.setSelection(draggedNodeSelection));
|
|
60
|
+
const slice = view.state.selection.content();
|
|
61
|
+
const { dom, text } = serializeForClipboard(view, slice);
|
|
62
|
+
event.dataTransfer.clearData();
|
|
63
|
+
event.dataTransfer.setData("text/html", dom.innerHTML);
|
|
64
|
+
event.dataTransfer.setData("text/plain", text);
|
|
65
|
+
event.dataTransfer.effectAllowed = "copyMove";
|
|
66
|
+
event.dataTransfer.setDragImage(node, 0, 0);
|
|
67
|
+
view.dragging = {
|
|
68
|
+
slice,
|
|
69
|
+
move: true,
|
|
70
|
+
node: draggedNodeSelection
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function handleClick(event, view) {
|
|
74
|
+
view.focus();
|
|
75
|
+
view.dom.classList.remove("dragging");
|
|
76
|
+
const node = nodeDOMAtCoords({
|
|
77
|
+
x: event.clientX,
|
|
78
|
+
y: event.clientY
|
|
79
|
+
}, view);
|
|
80
|
+
if (!(node instanceof Element)) return;
|
|
81
|
+
const nodePos = nodePosAtDOM(node, view, options);
|
|
82
|
+
if (!nodePos) return;
|
|
83
|
+
view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos)));
|
|
84
|
+
}
|
|
85
|
+
let dragHandleElement = null;
|
|
86
|
+
function hideDragHandle() {
|
|
87
|
+
if (dragHandleElement) {
|
|
88
|
+
dragHandleElement.classList.add("hide");
|
|
89
|
+
dragHandleElement.style.opacity = "0";
|
|
90
|
+
dragHandleElement.style.pointerEvents = "none";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function showDragHandle() {
|
|
94
|
+
if (dragHandleElement) {
|
|
95
|
+
dragHandleElement.classList.remove("hide");
|
|
96
|
+
dragHandleElement.style.opacity = "1";
|
|
97
|
+
dragHandleElement.style.pointerEvents = "auto";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return new Plugin({
|
|
101
|
+
view: (view) => {
|
|
102
|
+
dragHandleElement = document.createElement("div");
|
|
103
|
+
dragHandleElement.draggable = true;
|
|
104
|
+
dragHandleElement.dataset.dragHandle = "";
|
|
105
|
+
dragHandleElement.classList.add("drag-handle");
|
|
106
|
+
dragHandleElement.addEventListener("dragstart", (e) => {
|
|
107
|
+
handleDragStart(e, view);
|
|
108
|
+
});
|
|
109
|
+
dragHandleElement.addEventListener("click", (e) => {
|
|
110
|
+
handleClick(e, view);
|
|
111
|
+
});
|
|
112
|
+
const onMouseMove = (event) => {
|
|
113
|
+
if (!view.editable) return;
|
|
114
|
+
const node = nodeDOMAtCoords({
|
|
115
|
+
x: event.clientX,
|
|
116
|
+
y: event.clientY
|
|
117
|
+
}, view);
|
|
118
|
+
if (!(node instanceof Element)) {
|
|
119
|
+
hideDragHandle();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const compStyle = window.getComputedStyle(node);
|
|
123
|
+
const lineHeight = parseInt(compStyle.lineHeight, 10);
|
|
124
|
+
const paddingTop = parseInt(compStyle.paddingTop, 10);
|
|
125
|
+
const rect = absoluteRect(node);
|
|
126
|
+
if (!rect) {
|
|
127
|
+
hideDragHandle();
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
rect.top += (lineHeight - 24) / 2;
|
|
131
|
+
rect.top += paddingTop;
|
|
132
|
+
if (node.matches("ul:not([data-type=taskList]) li, ol li")) rect.left -= options.dragHandleWidth;
|
|
133
|
+
rect.width = options.dragHandleWidth;
|
|
134
|
+
if (!dragHandleElement) return;
|
|
135
|
+
dragHandleElement.style.left = `${rect.left - rect.width}px`;
|
|
136
|
+
dragHandleElement.style.top = `${rect.top}px`;
|
|
137
|
+
showDragHandle();
|
|
138
|
+
};
|
|
139
|
+
window.addEventListener("mousemove", onMouseMove);
|
|
140
|
+
hideDragHandle();
|
|
141
|
+
view?.dom?.parentElement?.appendChild(dragHandleElement);
|
|
142
|
+
return { destroy: () => {
|
|
143
|
+
window.removeEventListener("mousemove", onMouseMove);
|
|
144
|
+
dragHandleElement?.remove?.();
|
|
145
|
+
dragHandleElement = null;
|
|
146
|
+
} };
|
|
147
|
+
},
|
|
148
|
+
props: { handleDOMEvents: {
|
|
149
|
+
keydown: () => {
|
|
150
|
+
hideDragHandle();
|
|
151
|
+
},
|
|
152
|
+
mousewheel: () => {
|
|
153
|
+
hideDragHandle();
|
|
154
|
+
},
|
|
155
|
+
dragstart: (view) => {
|
|
156
|
+
view.dom.classList.add("dragging");
|
|
157
|
+
},
|
|
158
|
+
drop: (view) => {
|
|
159
|
+
view.dom.classList.remove("dragging");
|
|
160
|
+
},
|
|
161
|
+
dragend: (view) => {
|
|
162
|
+
view.dom.classList.remove("dragging");
|
|
163
|
+
}
|
|
164
|
+
} }
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function globalDragDropPlugin() {
|
|
168
|
+
let dropCursorElement = null;
|
|
169
|
+
let cleanup = null;
|
|
170
|
+
function updateDropCursorColor(el) {
|
|
171
|
+
const isDark = document.documentElement.getAttribute("data-theme") === "dark";
|
|
172
|
+
const varName = isDark ? "--color-surface-accent-300" : "--color-surface-accent-600";
|
|
173
|
+
const color = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();
|
|
174
|
+
el.style.backgroundColor = color || (isDark ? "#cbd5e1" : "#475569");
|
|
175
|
+
}
|
|
176
|
+
return new Plugin({ view(editorView) {
|
|
177
|
+
dropCursorElement = document.createElement("div");
|
|
178
|
+
dropCursorElement.className = "prosemirror-dropcursor-block";
|
|
179
|
+
dropCursorElement.style.cssText = "position: absolute; z-index: 50; pointer-events: none; height: 2px;";
|
|
180
|
+
updateDropCursorColor(dropCursorElement);
|
|
181
|
+
const observer = new MutationObserver(() => {
|
|
182
|
+
if (dropCursorElement) updateDropCursorColor(dropCursorElement);
|
|
183
|
+
});
|
|
184
|
+
observer.observe(document.documentElement, {
|
|
185
|
+
attributes: true,
|
|
186
|
+
attributeFilter: ["data-theme"]
|
|
187
|
+
});
|
|
188
|
+
const removeCursor = () => {
|
|
189
|
+
if (dropCursorElement && dropCursorElement.parentNode) dropCursorElement.parentNode.removeChild(dropCursorElement);
|
|
190
|
+
};
|
|
191
|
+
const getBlockInsertionPoint = (event, clampedX) => {
|
|
192
|
+
const pos = editorView.posAtCoords({
|
|
193
|
+
left: clampedX,
|
|
194
|
+
top: event.clientY
|
|
195
|
+
});
|
|
196
|
+
if (!pos) return null;
|
|
197
|
+
const $pos = editorView.state.doc.resolve(pos.pos);
|
|
198
|
+
let blockDepth = 0;
|
|
199
|
+
for (let i = $pos.depth; i > 0; i--) {
|
|
200
|
+
const name = $pos.node(i).type.name;
|
|
201
|
+
if (name === "list_item" || name === "taskItem") {
|
|
202
|
+
blockDepth = i;
|
|
203
|
+
break;
|
|
204
|
+
}
|
|
205
|
+
if ($pos.node(i).isBlock && name !== "bullet_list" && name !== "ordered_list" && name !== "taskList") blockDepth = i;
|
|
206
|
+
}
|
|
207
|
+
if (blockDepth === 0) return pos.pos;
|
|
208
|
+
const nodeBeforePos = $pos.before(blockDepth);
|
|
209
|
+
const nodeAfterPos = $pos.after(blockDepth);
|
|
210
|
+
const domNode = editorView.nodeDOM(nodeBeforePos);
|
|
211
|
+
if (domNode instanceof HTMLElement) {
|
|
212
|
+
const rect = domNode.getBoundingClientRect();
|
|
213
|
+
return event.clientY < rect.top + rect.height / 2 ? nodeBeforePos : nodeAfterPos;
|
|
214
|
+
}
|
|
215
|
+
return pos.pos;
|
|
216
|
+
};
|
|
217
|
+
const handleDragOver = (event) => {
|
|
218
|
+
if (!editorView.editable || !editorView.dragging) return;
|
|
219
|
+
if (!editorView.dragging?.node) {
|
|
220
|
+
removeCursor();
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
event.preventDefault();
|
|
224
|
+
const editorRect = editorView.dom.getBoundingClientRect();
|
|
225
|
+
const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));
|
|
226
|
+
const target = getBlockInsertionPoint(event, clampedX);
|
|
227
|
+
if (target === null) {
|
|
228
|
+
removeCursor();
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
const $pos = editorView.state.doc.resolve(target);
|
|
232
|
+
let rect;
|
|
233
|
+
const before = $pos.nodeBefore;
|
|
234
|
+
const after = $pos.nodeAfter;
|
|
235
|
+
if (before || after) {
|
|
236
|
+
const nodeDOM = editorView.nodeDOM(target - (before ? before.nodeSize : 0));
|
|
237
|
+
if (nodeDOM && nodeDOM instanceof HTMLElement) {
|
|
238
|
+
const nodeRect = nodeDOM.getBoundingClientRect();
|
|
239
|
+
let top = before ? nodeRect.bottom : nodeRect.top;
|
|
240
|
+
if (before && after) {
|
|
241
|
+
const afterDOM = editorView.nodeDOM(target);
|
|
242
|
+
if (afterDOM && afterDOM instanceof HTMLElement) top = (top + afterDOM.getBoundingClientRect().top) / 2;
|
|
243
|
+
}
|
|
244
|
+
rect = {
|
|
245
|
+
left: nodeRect.left,
|
|
246
|
+
right: nodeRect.right,
|
|
247
|
+
top: top - 1,
|
|
248
|
+
bottom: top + 1
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (!rect) {
|
|
253
|
+
const coords = editorView.coordsAtPos(target);
|
|
254
|
+
rect = {
|
|
255
|
+
left: editorRect.left + 50,
|
|
256
|
+
right: editorRect.right - 50,
|
|
257
|
+
top: coords.top - 1,
|
|
258
|
+
bottom: coords.top + 1
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const parent = editorView.dom.offsetParent;
|
|
262
|
+
let parentLeft = 0;
|
|
263
|
+
let parentTop = 0;
|
|
264
|
+
if (parent && parent !== document.body && getComputedStyle(parent).position !== "static") {
|
|
265
|
+
const parentRect = parent.getBoundingClientRect();
|
|
266
|
+
parentLeft = parentRect.left - parent.scrollLeft;
|
|
267
|
+
parentTop = parentRect.top - parent.scrollTop;
|
|
268
|
+
}
|
|
269
|
+
if (!dropCursorElement.parentNode) parent.appendChild(dropCursorElement);
|
|
270
|
+
dropCursorElement.style.left = `${rect.left - parentLeft}px`;
|
|
271
|
+
dropCursorElement.style.top = `${rect.top - parentTop}px`;
|
|
272
|
+
dropCursorElement.style.width = `${rect.right - rect.left}px`;
|
|
273
|
+
};
|
|
274
|
+
const handleDrop = (event) => {
|
|
275
|
+
if (!editorView.editable || !editorView.dragging) return;
|
|
276
|
+
if (!editorView.dragging?.node) {
|
|
277
|
+
removeCursor();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
event.preventDefault();
|
|
281
|
+
removeCursor();
|
|
282
|
+
editorView.dom.classList.remove("dragging");
|
|
283
|
+
const editorRect = editorView.dom.getBoundingClientRect();
|
|
284
|
+
const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));
|
|
285
|
+
const targetPos = getBlockInsertionPoint(event, clampedX);
|
|
286
|
+
if (targetPos === null) return;
|
|
287
|
+
const dragging = editorView.dragging;
|
|
288
|
+
if (dragging && dragging.slice) {
|
|
289
|
+
let tr = editorView.state.tr;
|
|
290
|
+
if (dragging.move) {
|
|
291
|
+
const { node } = dragging;
|
|
292
|
+
if (node) node.replace(tr);
|
|
293
|
+
else tr = tr.deleteSelection();
|
|
294
|
+
}
|
|
295
|
+
const mappedTarget = tr.mapping.map(targetPos);
|
|
296
|
+
const beforeInsert = tr.doc;
|
|
297
|
+
const { node, slice } = dragging;
|
|
298
|
+
if (node && node.node) {
|
|
299
|
+
let nodeToInsert = node.node;
|
|
300
|
+
const parentName = tr.doc.resolve(mappedTarget).parent.type.name;
|
|
301
|
+
const isTargetList = parentName === "bullet_list" || parentName === "ordered_list";
|
|
302
|
+
const isTargetTaskList = parentName === "taskList";
|
|
303
|
+
if ("type" in nodeToInsert && nodeToInsert.type.name === "list_item" && !isTargetList) nodeToInsert = nodeToInsert.content;
|
|
304
|
+
else if ("type" in nodeToInsert && nodeToInsert.type.name === "taskItem" && !isTargetTaskList) nodeToInsert = nodeToInsert.content;
|
|
305
|
+
if (!("type" in nodeToInsert) || "type" in nodeToInsert && nodeToInsert.type.name !== "list_item" && nodeToInsert.type.name !== "taskItem") {
|
|
306
|
+
if (isTargetList) {
|
|
307
|
+
const listItemType = editorView.state.schema.nodes.list_item;
|
|
308
|
+
if (listItemType) nodeToInsert = listItemType.create(null, nodeToInsert);
|
|
309
|
+
} else if (isTargetTaskList) {
|
|
310
|
+
const taskItemType = editorView.state.schema.nodes.taskItem;
|
|
311
|
+
if (taskItemType) nodeToInsert = taskItemType.create({ checked: false }, nodeToInsert);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
try {
|
|
315
|
+
tr = tr.insert(mappedTarget, nodeToInsert);
|
|
316
|
+
} catch (e) {
|
|
317
|
+
console.warn("Could not insert dragged node exactly at target. Attempting fallback.", e);
|
|
318
|
+
const point = dropPoint(tr.doc, mappedTarget, slice);
|
|
319
|
+
if (point !== null) tr = tr.replace(point, point, slice);
|
|
320
|
+
}
|
|
321
|
+
} else if (slice) {
|
|
322
|
+
const point = dropPoint(tr.doc, mappedTarget, slice);
|
|
323
|
+
const finalTarget = point !== null ? point : mappedTarget;
|
|
324
|
+
tr = tr.replace(finalTarget, finalTarget, slice);
|
|
325
|
+
}
|
|
326
|
+
if (!tr.doc.eq(beforeInsert)) {
|
|
327
|
+
editorView.dispatch(tr.setMeta("uiEvent", "drop"));
|
|
328
|
+
editorView.focus();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
editorView.dragging = null;
|
|
332
|
+
};
|
|
333
|
+
const handleDragEnd = () => {
|
|
334
|
+
removeCursor();
|
|
335
|
+
};
|
|
336
|
+
window.addEventListener("dragover", handleDragOver, { capture: true });
|
|
337
|
+
window.addEventListener("drop", handleDrop, { capture: true });
|
|
338
|
+
window.addEventListener("dragend", handleDragEnd, { capture: true });
|
|
339
|
+
cleanup = () => {
|
|
340
|
+
removeCursor();
|
|
341
|
+
observer.disconnect();
|
|
342
|
+
window.removeEventListener("dragover", handleDragOver, { capture: true });
|
|
343
|
+
window.removeEventListener("drop", handleDrop, { capture: true });
|
|
344
|
+
window.removeEventListener("dragend", handleDragEnd, { capture: true });
|
|
345
|
+
};
|
|
346
|
+
return { destroy() {
|
|
347
|
+
if (cleanup) cleanup();
|
|
348
|
+
} };
|
|
349
|
+
} });
|
|
350
|
+
}
|
|
351
|
+
//#endregion
|
|
352
|
+
export { dragHandlePlugin, globalDragDropPlugin };
|
|
353
|
+
|
|
354
|
+
//# sourceMappingURL=drag-and-drop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drag-and-drop.js","names":[],"sources":["../../../src/editor/extensions/drag-and-drop.tsx"],"sourcesContent":["import { NodeSelection, Plugin } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\nimport { Slice } from \"prosemirror-model\";\nimport { serializeForClipboard } from \"./clipboard\";\n\n/** ProseMirror internal drag state — not exposed in type definitions */\ninterface ProseMirrorDragState {\n slice: Slice;\n move: boolean;\n node?: NodeSelection;\n}\n\n/** EditorView with access to the internal `dragging` property */\ninterface EditorViewWithDrag extends EditorView {\n dragging: ProseMirrorDragState | null;\n}\n\nexport interface DragHandleOptions {\n /**\n * The width of the drag handle\n */\n dragHandleWidth: number;\n}\n\nfunction absoluteRect(element: Element) {\n const data = element.getBoundingClientRect();\n\n let ancestor = element.parentElement;\n while (ancestor && window.getComputedStyle(ancestor).position === \"static\") {\n ancestor = ancestor.parentElement;\n }\n const ancestorRect = ancestor?.getBoundingClientRect();\n\n return {\n top: data.top - (ancestorRect?.top ?? 0),\n left: data.left - (ancestorRect?.left ?? 0),\n width: data.width\n };\n}\n\nfunction nodeDOMAtCoords(coords: { x: number; y: number }, view: EditorView) {\n const editorRect = view.dom.getBoundingClientRect();\n\n // 0. Give up if outside vertical bounds or too far horizontally\n if (coords.y < editorRect.top || coords.y > editorRect.bottom) return undefined;\n if (coords.x < editorRect.left - 100 || coords.x > editorRect.right + 50) return undefined;\n\n const blockSelector = 'li, p, pre, blockquote, h1, h2, h3, h4, h5, h6, img, [data-type=\"taskList\"]';\n\n // 1. First probe exactly at the mouse coordinates\n const elem = document.elementFromPoint(coords.x, coords.y);\n const block = elem?.closest(blockSelector);\n if (block && view.dom.contains(block) && block.textContent?.trim()) {\n const li = block.closest(\"li\");\n return (li && view.dom.contains(li)) ? li : block;\n }\n\n // 2. If mouse is in the left gutter, probe horizontally into the editor\n const probeX = editorRect.left + Math.min(60, editorRect.width / 4);\n if (coords.x > probeX) return undefined;\n\n const probeElem = document.elementFromPoint(probeX, coords.y);\n const probeBlock = probeElem?.closest(blockSelector);\n if (probeBlock && probeBlock.textContent?.trim()) {\n // Ensure the found block is actually inside our editor\n if (view.dom.contains(probeBlock)) {\n const li = probeBlock.closest(\"li\");\n return (li && view.dom.contains(li)) ? li : probeBlock;\n }\n }\n\n return undefined;\n}\n\nfunction nodePosAtDOM(node: Element, view: EditorView, options: DragHandleOptions) {\n try {\n if (!view.dom.contains(node)) return null;\n const pos = view.posAtDOM(node, 0);\n const $pos = view.state.doc.resolve(pos);\n // posAtDOM(node, 0) generally returns the position inside the node.\n // We want the position right before the node to create a NodeSelection.\n if ($pos.depth > 0) {\n return $pos.before();\n }\n return pos;\n } catch (e) {\n return null;\n }\n}\n\nexport function dragHandlePlugin(options: DragHandleOptions = { dragHandleWidth: 24 }) {\n function handleDragStart(event: DragEvent, view: EditorView) {\n view.focus();\n\n if (!event.dataTransfer) return;\n\n const node = nodeDOMAtCoords({\n x: event.clientX,\n y: event.clientY\n }, view);\n\n if (!(node instanceof Element)) return;\n\n const nodePos = nodePosAtDOM(node, view, options);\n if (nodePos == null || nodePos < 0) return;\n\n const draggedNodeSelection = NodeSelection.create(view.state.doc, nodePos);\n view.dispatch(view.state.tr.setSelection(draggedNodeSelection));\n\n const slice = view.state.selection.content();\n const {\n dom,\n text\n } = serializeForClipboard(view as EditorViewWithDrag, slice);\n\n event.dataTransfer.clearData();\n event.dataTransfer.setData(\"text/html\", dom.innerHTML);\n event.dataTransfer.setData(\"text/plain\", text);\n event.dataTransfer.effectAllowed = \"copyMove\";\n\n event.dataTransfer.setDragImage(node, 0, 0);\n\n (view as EditorViewWithDrag).dragging = {\n slice,\n move: true,\n node: draggedNodeSelection\n };\n }\n\n function handleClick(event: MouseEvent, view: EditorView) {\n view.focus();\n\n view.dom.classList.remove(\"dragging\");\n\n const node = nodeDOMAtCoords({\n x: event.clientX,\n y: event.clientY\n }, view);\n\n if (!(node instanceof Element)) return;\n\n const nodePos = nodePosAtDOM(node, view, options);\n if (!nodePos) return;\n\n view.dispatch(view.state.tr.setSelection(NodeSelection.create(view.state.doc, nodePos)));\n }\n\n let dragHandleElement: HTMLElement | null = null;\n\n function hideDragHandle() {\n if (dragHandleElement) {\n dragHandleElement.classList.add(\"hide\");\n dragHandleElement.style.opacity = \"0\";\n dragHandleElement.style.pointerEvents = \"none\";\n }\n }\n\n function showDragHandle() {\n if (dragHandleElement) {\n dragHandleElement.classList.remove(\"hide\");\n dragHandleElement.style.opacity = \"1\";\n dragHandleElement.style.pointerEvents = \"auto\";\n }\n }\n\n return new Plugin({\n view: (view) => {\n dragHandleElement = document.createElement(\"div\");\n dragHandleElement.draggable = true;\n dragHandleElement.dataset.dragHandle = \"\";\n dragHandleElement.classList.add(\"drag-handle\");\n dragHandleElement.addEventListener(\"dragstart\", (e) => {\n handleDragStart(e, view);\n });\n dragHandleElement.addEventListener(\"click\", (e) => {\n handleClick(e, view);\n });\n const onMouseMove = (event: MouseEvent) => {\n if (!view.editable) {\n return;\n }\n\n const node = nodeDOMAtCoords({\n x: event.clientX,\n y: event.clientY\n }, view);\n\n if (!(node instanceof Element)) {\n hideDragHandle();\n return;\n }\n\n const compStyle = window.getComputedStyle(node);\n const lineHeight = parseInt(compStyle.lineHeight, 10);\n const paddingTop = parseInt(compStyle.paddingTop, 10);\n\n const rect = absoluteRect(node);\n if (!rect) {\n hideDragHandle();\n return;\n }\n\n rect.top += (lineHeight - 24) / 2;\n rect.top += paddingTop;\n // Li markers\n if (node.matches(\"ul:not([data-type=taskList]) li, ol li\")) {\n rect.left -= options.dragHandleWidth;\n }\n rect.width = options.dragHandleWidth;\n\n if (!dragHandleElement) return;\n\n dragHandleElement.style.left = `${rect.left - rect.width}px`;\n dragHandleElement.style.top = `${rect.top}px`;\n showDragHandle();\n };\n\n window.addEventListener(\"mousemove\", onMouseMove);\n\n hideDragHandle();\n\n view?.dom?.parentElement?.appendChild(dragHandleElement);\n\n return {\n destroy: () => {\n window.removeEventListener(\"mousemove\", onMouseMove);\n dragHandleElement?.remove?.();\n dragHandleElement = null;\n }\n };\n },\n props: {\n handleDOMEvents: {\n keydown: () => {\n hideDragHandle();\n },\n mousewheel: () => {\n hideDragHandle();\n },\n // dragging class is used for CSS\n dragstart: (view) => {\n view.dom.classList.add(\"dragging\");\n },\n drop: (view) => {\n view.dom.classList.remove(\"dragging\");\n },\n dragend: (view) => {\n view.dom.classList.remove(\"dragging\");\n }\n }\n }\n });\n}\n\nimport { dropPoint } from \"prosemirror-transform\";\n\nexport function globalDragDropPlugin() {\n let dropCursorElement: HTMLElement | null = null;\n let cleanup: (() => void) | null = null;\n\n function updateDropCursorColor(el: HTMLElement) {\n const isDark = document.documentElement.getAttribute(\"data-theme\") === \"dark\";\n const varName = isDark ? \"--color-surface-accent-300\" : \"--color-surface-accent-600\";\n const color = getComputedStyle(document.documentElement).getPropertyValue(varName).trim();\n el.style.backgroundColor = color || (isDark ? \"#cbd5e1\" : \"#475569\");\n }\n\n return new Plugin({\n view(editorView) {\n dropCursorElement = document.createElement(\"div\");\n dropCursorElement.className = \"prosemirror-dropcursor-block\";\n dropCursorElement.style.cssText = \"position: absolute; z-index: 50; pointer-events: none; height: 2px;\";\n updateDropCursorColor(dropCursorElement);\n\n // Watch for theme changes\n const observer = new MutationObserver(() => {\n if (dropCursorElement) updateDropCursorColor(dropCursorElement);\n });\n observer.observe(document.documentElement, { attributes: true,\nattributeFilter: [\"data-theme\"] });\n\n const removeCursor = () => {\n if (dropCursorElement && dropCursorElement.parentNode) {\n dropCursorElement.parentNode.removeChild(dropCursorElement);\n }\n };\n\n const getBlockInsertionPoint = (event: DragEvent, clampedX: number) => {\n const pos = editorView.posAtCoords({ left: clampedX,\ntop: event.clientY });\n if (!pos) return null;\n\n const $pos = editorView.state.doc.resolve(pos.pos);\n\n let blockDepth = 0;\n for (let i = $pos.depth; i > 0; i--) {\n const name = $pos.node(i).type.name;\n if (name === \"list_item\" || name === \"taskItem\") {\n blockDepth = i;\n break;\n }\n if ($pos.node(i).isBlock && name !== \"bullet_list\" && name !== \"ordered_list\" && name !== \"taskList\") {\n blockDepth = i;\n }\n }\n\n if (blockDepth === 0) return pos.pos;\n\n const nodeBeforePos = $pos.before(blockDepth);\n const nodeAfterPos = $pos.after(blockDepth);\n\n const domNode = editorView.nodeDOM(nodeBeforePos);\n if (domNode instanceof HTMLElement) {\n const rect = domNode.getBoundingClientRect();\n const isTopHalf = event.clientY < rect.top + rect.height / 2;\n return isTopHalf ? nodeBeforePos : nodeAfterPos;\n }\n return pos.pos;\n };\n\n const handleDragOver = (event: DragEvent) => {\n if (!editorView.editable || !editorView.dragging) return;\n\n // If it's a native slice drag (no explicitly captured node from our drag handle)\n // then we bail out here and let ProseMirror native drop logic and native dropcursor handle it\n if (!((editorView as EditorViewWithDrag).dragging as ProseMirrorDragState | null & { node?: unknown })?.node) {\n removeCursor();\n return;\n }\n\n event.preventDefault(); // browser requires this to allow drop\n\n const editorRect = editorView.dom.getBoundingClientRect();\n const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));\n\n const target = getBlockInsertionPoint(event, clampedX);\n if (target === null) {\n removeCursor();\n return;\n }\n\n const $pos = editorView.state.doc.resolve(target);\n\n let rect;\n const before = $pos.nodeBefore;\n const after = $pos.nodeAfter;\n\n if (before || after) {\n const nodeDOM = editorView.nodeDOM(target - (before ? before.nodeSize : 0));\n if (nodeDOM && nodeDOM instanceof HTMLElement) {\n const nodeRect = nodeDOM.getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after) {\n const afterDOM = editorView.nodeDOM(target);\n if (afterDOM && afterDOM instanceof HTMLElement) {\n top = (top + afterDOM.getBoundingClientRect().top) / 2;\n }\n }\n rect = { left: nodeRect.left,\nright: nodeRect.right,\ntop: top - 1,\nbottom: top + 1 };\n }\n }\n\n if (!rect) {\n const coords = editorView.coordsAtPos(target);\n rect = { left: editorRect.left + 50,\nright: editorRect.right - 50,\ntop: coords.top - 1,\nbottom: coords.top + 1 };\n }\n\n const parent = editorView.dom.offsetParent as HTMLElement;\n let parentLeft = 0;\n let parentTop = 0;\n if (parent && parent !== document.body && getComputedStyle(parent).position !== \"static\") {\n const parentRect = parent.getBoundingClientRect();\n parentLeft = parentRect.left - parent.scrollLeft;\n parentTop = parentRect.top - parent.scrollTop;\n }\n\n if (!dropCursorElement!.parentNode) {\n parent.appendChild(dropCursorElement!);\n }\n\n dropCursorElement!.style.left = `${rect.left - parentLeft}px`;\n dropCursorElement!.style.top = `${rect.top - parentTop}px`;\n dropCursorElement!.style.width = `${rect.right - rect.left}px`;\n };\n\n const handleDrop = (event: DragEvent) => {\n if (!editorView.editable || !editorView.dragging) return;\n\n if (!((editorView as EditorViewWithDrag).dragging as ProseMirrorDragState | null & { node?: unknown })?.node) {\n removeCursor();\n return;\n }\n\n event.preventDefault();\n removeCursor();\n editorView.dom.classList.remove(\"dragging\");\n\n const editorRect = editorView.dom.getBoundingClientRect();\n const clampedX = Math.max(editorRect.left + 10, Math.min(event.clientX, editorRect.right - 10));\n\n const targetPos = getBlockInsertionPoint(event, clampedX);\n if (targetPos === null) return;\n\n const dragging = (editorView as EditorViewWithDrag).dragging;\n if (dragging && dragging.slice) {\n let tr = editorView.state.tr;\n if (dragging.move) {\n const { node } = dragging;\n if (node) {\n node.replace(tr); // exact native ProseMirror delete\n } else {\n tr = tr.deleteSelection();\n }\n }\n\n const mappedTarget = tr.mapping.map(targetPos);\n const beforeInsert = tr.doc;\n\n const { node, slice } = dragging;\n\n if (node && node.node) {\n let nodeToInsert: import(\"prosemirror-model\").Node | import(\"prosemirror-model\").Fragment = node.node;\n const $mapped = tr.doc.resolve(mappedTarget);\n const parentName = $mapped.parent.type.name;\n\n const isTargetList = parentName === \"bullet_list\" || parentName === \"ordered_list\";\n const isTargetTaskList = parentName === \"taskList\";\n\n // 1. Unwrap incoming lists if they don't match the destination perfectly\n if (\"type\" in nodeToInsert && nodeToInsert.type.name === \"list_item\" && !isTargetList) {\n nodeToInsert = nodeToInsert.content;\n } else if (\"type\" in nodeToInsert && nodeToInsert.type.name === \"taskItem\" && !isTargetTaskList) {\n nodeToInsert = nodeToInsert.content;\n }\n\n // 2. Wrap incoming blocks/fragments into exactly the target list type\n const isFragment = !(\"type\" in nodeToInsert);\n const needsWrap = isFragment || (\"type\" in nodeToInsert && nodeToInsert.type.name !== \"list_item\" && nodeToInsert.type.name !== \"taskItem\");\n\n if (needsWrap) {\n if (isTargetList) {\n const listItemType = editorView.state.schema.nodes.list_item;\n if (listItemType) nodeToInsert = listItemType.create(null, nodeToInsert);\n } else if (isTargetTaskList) {\n const taskItemType = editorView.state.schema.nodes.taskItem;\n if (taskItemType) nodeToInsert = taskItemType.create({ checked: false }, nodeToInsert);\n }\n }\n\n // 3. Force insertion. tr.replace slices and splits lists. tr.insert preserves the explicit boundary.\n try {\n tr = tr.insert(mappedTarget, nodeToInsert);\n } catch (e) {\n console.warn(\"Could not insert dragged node exactly at target. Attempting fallback.\", e);\n const point = dropPoint(tr.doc, mappedTarget, slice);\n if (point !== null) {\n tr = tr.replace(point, point, slice);\n }\n }\n } else if (slice) {\n // For generic slices (e.g native image dragging), we MUST use dropPoint\n // so ProseMirror finds a schema-valid depth to insert the node structure natively.\n const point = dropPoint(tr.doc, mappedTarget, slice);\n const finalTarget = point !== null ? point : mappedTarget;\n tr = tr.replace(finalTarget, finalTarget, slice);\n }\n\n if (!tr.doc.eq(beforeInsert)) {\n editorView.dispatch(tr.setMeta(\"uiEvent\", \"drop\"));\n editorView.focus();\n }\n }\n\n (editorView as EditorViewWithDrag).dragging = null;\n };\n\n const handleDragEnd = () => {\n removeCursor();\n };\n\n window.addEventListener(\"dragover\", handleDragOver, { capture: true });\n window.addEventListener(\"drop\", handleDrop, { capture: true });\n window.addEventListener(\"dragend\", handleDragEnd, { capture: true });\n\n cleanup = () => {\n removeCursor();\n observer.disconnect();\n window.removeEventListener(\"dragover\", handleDragOver, { capture: true });\n window.removeEventListener(\"drop\", handleDrop, { capture: true });\n window.removeEventListener(\"dragend\", handleDragE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E,OAAO,oBAAoB,WAAW,eAAe,EAAE,SAAS,KAAK,CAAC;EAC1E;EAEA,OAAO,EACH,UAAU;GACN,IAAI,SAAS,QAAQ;EACzB,EACJ;CACJ,EACJ,CAAC;AACL"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { EditorState } from "prosemirror-state";
|
|
2
2
|
import { EditorView } from "prosemirror-view";
|
|
3
|
+
import { type ImageSrcResolver } from "../extensions/Image.js";
|
|
3
4
|
interface UseProseMirrorProps {
|
|
4
5
|
initialContent?: string | any;
|
|
5
6
|
editable?: boolean;
|
|
6
7
|
handleImageUpload?: (file: File) => Promise<string>;
|
|
8
|
+
/** See {@link RichTextEditorProps.resolveImageSrc}. */
|
|
9
|
+
resolveImageSrc?: ImageSrcResolver;
|
|
7
10
|
}
|
|
8
|
-
export declare function useProseMirror({ initialContent, editable, handleImageUpload }: UseProseMirrorProps): {
|
|
11
|
+
export declare function useProseMirror({ initialContent, editable, handleImageUpload, resolveImageSrc }: UseProseMirrorProps): {
|
|
9
12
|
state: EditorState;
|
|
10
13
|
view: EditorView | null;
|
|
11
14
|
editorRef: import("react").RefObject<HTMLDivElement | null>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { schema } from "../schema.js";
|
|
2
|
+
import { createDropImagePlugin, createImageSrcResolverPlugin } from "../extensions/Image.js";
|
|
3
|
+
import { parseSanitizedHtml } from "../sanitize-html.js";
|
|
4
|
+
import { parser } from "../markdown.js";
|
|
5
|
+
import { getCorePlugins } from "../plugins/index.js";
|
|
6
|
+
import { nodeViews } from "../nodeViews/index.js";
|
|
7
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
8
|
+
import { EditorState, Plugin } from "prosemirror-state";
|
|
9
|
+
import { columnResizing, tableEditing } from "prosemirror-tables";
|
|
10
|
+
import { EditorView } from "prosemirror-view";
|
|
11
|
+
//#region src/editor/hooks/useProseMirror.ts
|
|
12
|
+
var trailingNodePlugin = new Plugin({ appendTransaction: (_, oldState, newState) => {
|
|
13
|
+
const doc = newState.doc;
|
|
14
|
+
if (doc.lastChild && doc.lastChild.type.name !== "paragraph") return newState.tr.insert(doc.content.size, newState.schema.nodes.paragraph.create());
|
|
15
|
+
return null;
|
|
16
|
+
} });
|
|
17
|
+
function useProseMirror({ initialContent, editable = true, handleImageUpload, resolveImageSrc }) {
|
|
18
|
+
const resolveImageSrcRef = useRef(resolveImageSrc);
|
|
19
|
+
resolveImageSrcRef.current = resolveImageSrc;
|
|
20
|
+
const plugins = [
|
|
21
|
+
...getCorePlugins(),
|
|
22
|
+
columnResizing(),
|
|
23
|
+
tableEditing(),
|
|
24
|
+
trailingNodePlugin,
|
|
25
|
+
createImageSrcResolverPlugin(async (src) => resolveImageSrcRef.current ? resolveImageSrcRef.current(src) : void 0)
|
|
26
|
+
];
|
|
27
|
+
if (handleImageUpload) plugins.push(createDropImagePlugin(handleImageUpload));
|
|
28
|
+
const defaultState = EditorState.create({
|
|
29
|
+
doc: typeof initialContent === "string" ? parser.parse(initialContent) : initialContent ? schema.nodeFromJSON(initialContent) : schema.node("doc", null, [schema.node("paragraph")]),
|
|
30
|
+
schema,
|
|
31
|
+
plugins
|
|
32
|
+
});
|
|
33
|
+
const [state, setState] = useState(defaultState);
|
|
34
|
+
const [view, setView] = useState(null);
|
|
35
|
+
const editorRef = useRef(null);
|
|
36
|
+
const viewRef = useRef(null);
|
|
37
|
+
useLayoutEffect(() => {
|
|
38
|
+
if (!editorRef.current) return;
|
|
39
|
+
const editorView = new EditorView(editorRef.current, {
|
|
40
|
+
state: defaultState,
|
|
41
|
+
editable: () => editable,
|
|
42
|
+
dispatchTransaction: (tr) => {
|
|
43
|
+
const newState = editorView.state.apply(tr);
|
|
44
|
+
editorView.updateState(newState);
|
|
45
|
+
setState(newState);
|
|
46
|
+
},
|
|
47
|
+
nodeViews,
|
|
48
|
+
transformPastedHTML(html) {
|
|
49
|
+
const div = parseSanitizedHtml(html);
|
|
50
|
+
div.querySelectorAll("*").forEach((el) => {
|
|
51
|
+
el.removeAttribute("style");
|
|
52
|
+
el.removeAttribute("class");
|
|
53
|
+
el.removeAttribute("color");
|
|
54
|
+
el.removeAttribute("bgcolor");
|
|
55
|
+
el.removeAttribute("face");
|
|
56
|
+
});
|
|
57
|
+
return div.innerHTML;
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const originalPosAtCoords = editorView.posAtCoords.bind(editorView);
|
|
61
|
+
editorView.posAtCoords = (coords) => {
|
|
62
|
+
const res = originalPosAtCoords(coords);
|
|
63
|
+
if (!res) {
|
|
64
|
+
const editorRect = editorView.dom.getBoundingClientRect();
|
|
65
|
+
if (coords.left <= editorRect.left) {
|
|
66
|
+
const probeX = editorRect.left + Math.min(60, editorRect.width / 4);
|
|
67
|
+
return originalPosAtCoords({
|
|
68
|
+
left: probeX,
|
|
69
|
+
top: coords.top
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (coords.left >= editorRect.right) {
|
|
73
|
+
const probeX = editorRect.right - Math.min(60, editorRect.width / 4);
|
|
74
|
+
return originalPosAtCoords({
|
|
75
|
+
left: probeX,
|
|
76
|
+
top: coords.top
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return res;
|
|
81
|
+
};
|
|
82
|
+
viewRef.current = editorView;
|
|
83
|
+
setView(editorView);
|
|
84
|
+
return () => {
|
|
85
|
+
editorView.destroy();
|
|
86
|
+
viewRef.current = null;
|
|
87
|
+
};
|
|
88
|
+
}, []);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (viewRef.current) viewRef.current.setProps({ editable: () => editable });
|
|
91
|
+
}, [editable]);
|
|
92
|
+
return {
|
|
93
|
+
state,
|
|
94
|
+
view,
|
|
95
|
+
editorRef
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { useProseMirror };
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=useProseMirror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProseMirror.js","names":[],"sources":["../../../src/editor/hooks/useProseMirror.ts"],"sourcesContent":["import { useState, useEffect, useRef, useLayoutEffect } from \"react\";\nimport { EditorState, Transaction, Plugin } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\nimport { schema } from \"../schema\";\nimport { getCorePlugins } from \"../plugins\";\nimport { parser } from \"../markdown\";\nimport { nodeViews } from \"../nodeViews\";\nimport { createDropImagePlugin, createImageSrcResolverPlugin, type ImageSrcResolver } from \"../extensions/Image\";\nimport { columnResizing, tableEditing } from \"prosemirror-tables\";\nimport { parseSanitizedHtml } from \"../sanitize-html\";\n\nconst trailingNodePlugin = new Plugin({\n appendTransaction: (_, oldState, newState) => {\n const doc = newState.doc;\n if (doc.lastChild && doc.lastChild.type.name !== \"paragraph\") {\n return newState.tr.insert(doc.content.size, newState.schema.nodes.paragraph.create());\n }\n return null;\n }\n});\n\ninterface UseProseMirrorProps {\n initialContent?: string | any;\n editable?: boolean;\n handleImageUpload?: (file: File) => Promise<string>;\n /** See {@link RichTextEditorProps.resolveImageSrc}. */\n resolveImageSrc?: ImageSrcResolver;\n}\n\nexport function useProseMirror({ initialContent, editable = true, handleImageUpload, resolveImageSrc }: UseProseMirrorProps) {\n // The view is built once, so the plugin holds a function that reads the\n // latest resolver rather than the first one — storage sources can arrive\n // after the editor mounts.\n const resolveImageSrcRef = useRef(resolveImageSrc);\n resolveImageSrcRef.current = resolveImageSrc;\n\n const plugins = [\n ...getCorePlugins(),\n columnResizing(),\n tableEditing(),\n trailingNodePlugin,\n createImageSrcResolverPlugin(async (src) => resolveImageSrcRef.current ? resolveImageSrcRef.current(src) : undefined)\n ];\n if (handleImageUpload) {\n plugins.push(createDropImagePlugin(handleImageUpload));\n }\n\n const defaultState = EditorState.create({\n doc: typeof initialContent === \"string\"\n ? parser.parse(initialContent)\n : initialContent\n ? schema.nodeFromJSON(initialContent)\n : schema.node(\"doc\", null, [schema.node(\"paragraph\")]),\n schema,\n plugins\n });\n\n const [state, setState] = useState<EditorState>(defaultState);\n const [view, setView] = useState<EditorView | null>(null);\n\n const editorRef = useRef<HTMLDivElement>(null);\n const viewRef = useRef<EditorView | null>(null);\n\n useLayoutEffect(() => {\n if (!editorRef.current) return;\n\n const editorView = new EditorView(editorRef.current, {\n state: defaultState,\n editable: () => editable,\n dispatchTransaction: (tr: Transaction) => {\n const newState = editorView.state.apply(tr);\n editorView.updateState(newState);\n setState(newState);\n },\n nodeViews: nodeViews,\n transformPastedHTML(html: string) {\n // Strip inline styles and classes from pasted HTML so we don't\n // get textStyle marks (color, font-size, etc.) that have no\n // markdown representation. This makes paste look consistent.\n //\n // Parsed inertly rather than through `document.createElement` +\n // `innerHTML`, which builds the content in the LIVE document —\n // so `<img src=x onerror=…>` in a clipboard fired here, before\n // this function had decided anything. A person pasting from a\n // page they were reading is the ordinary case, which is what\n // makes it worth closing.\n const div = parseSanitizedHtml(html);\n div.querySelectorAll(\"*\").forEach((el) => {\n el.removeAttribute(\"style\");\n el.removeAttribute(\"class\");\n el.removeAttribute(\"color\");\n el.removeAttribute(\"bgcolor\");\n el.removeAttribute(\"face\");\n });\n return div.innerHTML;\n }\n });\n\n // Patch posAtCoords to allow dropping/interacting anywhere horizontally natively\n const originalPosAtCoords = editorView.posAtCoords.bind(editorView);\n editorView.posAtCoords = (coords: { left: number, top: number }) => {\n const res = originalPosAtCoords(coords);\n if (!res) {\n const editorRect = editorView.dom.getBoundingClientRect();\n // If it's literally anywhere to the left of the actual ProseMirror content block\n if (coords.left <= editorRect.left) {\n const probeX = editorRect.left + Math.min(60, editorRect.width / 4);\n return originalPosAtCoords({ left: probeX,\ntop: coords.top });\n }\n // Or if it's anywhere to the right\n if (coords.left >= editorRect.right) {\n const probeX = editorRect.right - Math.min(60, editorRect.width / 4);\n return originalPosAtCoords({ left: probeX,\ntop: coords.top });\n }\n }\n return res;\n };\n\n viewRef.current = editorView;\n setView(editorView);\n\n return () => {\n editorView.destroy();\n viewRef.current = null;\n };\n }, []);\n\n // Effect to update editable status without re-mounting\n useEffect(() => {\n if (viewRef.current) {\n viewRef.current.setProps({ editable: () => editable });\n }\n }, [editable]);\n\n return {\n state,\n view,\n editorRef\n };\n}\n"],"mappings":";;;;;;;;;;;AAWA,IAAM,qBAAqB,IAAI,OAAO,EAClC,oBAAoB,GAAG,UAAU,aAAa;CAC1C,MAAM,MAAM,SAAS;CACrB,IAAI,IAAI,aAAa,IAAI,UAAU,KAAK,SAAS,aAC7C,OAAO,SAAS,GAAG,OAAO,IAAI,QAAQ,MAAM,SAAS,OAAO,MAAM,UAAU,OAAO,CAAC;CAExF,OAAO;AACX,EACJ,CAAC;AAUD,SAAgB,eAAe,EAAE,gBAAgB,WAAW,MAAM,mBAAmB,mBAAwC;CAIzH,MAAM,qBAAqB,OAAO,eAAe;CACjD,mBAAmB,UAAU;CAE7B,MAAM,UAAU;EACZ,GAAG,eAAe;EAClB,eAAe;EACf,aAAa;EACb;EACA,6BAA6B,OAAO,QAAQ,mBAAmB,UAAU,mBAAmB,QAAQ,GAAG,IAAI,KAAA,CAAS;CACxH;CACA,IAAI,mBACA,QAAQ,KAAK,sBAAsB,iBAAiB,CAAC;CAGzD,MAAM,eAAe,YAAY,OAAO;EACpC,KAAK,OAAO,mBAAmB,WACzB,OAAO,MAAM,cAAc,IAC3B,iBACI,OAAO,aAAa,cAAc,IAClC,OAAO,KAAK,OAAO,MAAM,CAAC,OAAO,KAAK,WAAW,CAAC,CAAC;EAC7D;EACA;CACJ,CAAC;CAED,MAAM,CAAC,OAAO,YAAY,SAAsB,YAAY;CAC5D,MAAM,CAAC,MAAM,WAAW,SAA4B,IAAI;CAExD,MAAM,YAAY,OAAuB,IAAI;CAC7C,MAAM,UAAU,OAA0B,IAAI;CAE9C,sBAAsB;EAClB,IAAI,CAAC,UAAU,SAAS;EAExB,MAAM,aAAa,IAAI,WAAW,UAAU,SAAS;GACjD,OAAO;GACP,gBAAgB;GAChB,sBAAsB,OAAoB;IAC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{ createContext, useContext } from "react";
|
|
2
|
+
//#region src/editor/hooks/useProseMirrorContext.ts
|
|
3
|
+
var ProseMirrorContext = createContext({
|
|
4
|
+
state: null,
|
|
5
|
+
view: null
|
|
6
|
+
});
|
|
7
|
+
var useProseMirrorContext = () => useContext(ProseMirrorContext);
|
|
8
|
+
//#endregion
|
|
9
|
+
export { ProseMirrorContext, useProseMirrorContext };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=useProseMirrorContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useProseMirrorContext.js","names":[],"sources":["../../../src/editor/hooks/useProseMirrorContext.ts"],"sourcesContent":["import React, { createContext, useContext } from \"react\";\nimport { EditorState } from \"prosemirror-state\";\nimport { EditorView } from \"prosemirror-view\";\n\nexport interface ProseMirrorContextType {\n state: EditorState | null;\n view: EditorView | null;\n}\n\nexport const ProseMirrorContext = createContext<ProseMirrorContextType>({\n state: null,\n view: null\n});\n\nexport const useProseMirrorContext = () => useContext(ProseMirrorContext);\n"],"mappings":";;AASA,IAAa,qBAAqB,cAAsC;CACpE,OAAO;CACP,MAAM;AACV,CAAC;AAED,IAAa,8BAA8B,WAAW,kBAAkB"}
|