@rebasepro/cms 0.23.0 → 0.24.1-canary.g56af4a4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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.js +95 -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/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/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 +211 -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/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 +257 -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 +208 -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 +1 -0
- package/dist/index.js +149 -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 +93 -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 +44 -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,160 @@
|
|
|
1
|
+
import { defaultBorderMixin } from "@rebasepro/ui";
|
|
2
|
+
import { isStorageReference, storageTargetOfDownloadUrl } from "@rebasepro/types";
|
|
3
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
4
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
5
|
+
//#region src/editor/extensions/Image.ts
|
|
6
|
+
var ImageSrcResolverKey = new PluginKey("imageSrcResolver");
|
|
7
|
+
/**
|
|
8
|
+
* Carries the resolver to the image node views. They render in their own React
|
|
9
|
+
* roots (see `ReactNodeView`), out of reach of any context, so the editor state
|
|
10
|
+
* is where they can find it.
|
|
11
|
+
*/
|
|
12
|
+
var createImageSrcResolverPlugin = (resolve) => new Plugin({
|
|
13
|
+
key: ImageSrcResolverKey,
|
|
14
|
+
state: {
|
|
15
|
+
init: () => resolve,
|
|
16
|
+
apply: (_tr, value) => value
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
/** The resolver this editor was given, if any. */
|
|
20
|
+
function imageSrcResolverOf(state) {
|
|
21
|
+
return ImageSrcResolverKey.getState(state);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Whether a stored `src` is renewed when shown: a reference, or a private
|
|
25
|
+
* file's download URL saved before references (its token has expired).
|
|
26
|
+
*/
|
|
27
|
+
function isRenewableImageSrc(src) {
|
|
28
|
+
return isStorageReference(src) || storageTargetOfDownloadUrl(src) !== null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The URL to load for a stored `src`: a reference resolved, anything else as
|
|
32
|
+
* it is, and `undefined` for a reference this editor cannot resolve. A saved
|
|
33
|
+
* download URL is renewed, and kept as it is when it cannot be.
|
|
34
|
+
*/
|
|
35
|
+
async function loadableImageSrc(state, src) {
|
|
36
|
+
if (!isRenewableImageSrc(src)) return src;
|
|
37
|
+
const fallback = isStorageReference(src) ? void 0 : src;
|
|
38
|
+
try {
|
|
39
|
+
return await imageSrcResolverOf(state)?.(src) ?? fallback;
|
|
40
|
+
} catch {
|
|
41
|
+
return fallback;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
async function onFileRead(view, readerEvent, pos, upload, image) {
|
|
45
|
+
const { schema } = view.state;
|
|
46
|
+
const plugin = view.state.plugins.find((p) => p.spec.key === ImagePluginKey);
|
|
47
|
+
if (!plugin) {
|
|
48
|
+
console.error("Image plugin not found");
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const decoId = Math.random().toString(36).substring(7);
|
|
52
|
+
const placeholder = document.createElement("div");
|
|
53
|
+
const imageElement = document.createElement("img");
|
|
54
|
+
imageElement.setAttribute("class", "opacity-40 rounded-lg border " + defaultBorderMixin);
|
|
55
|
+
imageElement.src = readerEvent.target?.result;
|
|
56
|
+
placeholder.appendChild(imageElement);
|
|
57
|
+
const deco = Decoration.widget(pos, placeholder, { id: decoId });
|
|
58
|
+
let decorationSet = plugin.getState(view.state);
|
|
59
|
+
decorationSet = decorationSet?.add(view.state.doc, [deco]);
|
|
60
|
+
view.dispatch(view.state.tr.setMeta(plugin, { decorationSet }));
|
|
61
|
+
const src = await upload(image);
|
|
62
|
+
console.debug("Uploaded image", src);
|
|
63
|
+
const replacePlaceholder = () => {
|
|
64
|
+
let currentDecos = plugin.getState(view.state);
|
|
65
|
+
const foundDecos = currentDecos.find(void 0, void 0, (spec) => spec.id === decoId);
|
|
66
|
+
if (foundDecos.length === 0) {
|
|
67
|
+
console.warn("Image placeholder removed before upload completed.");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const currentPos = foundDecos[0].from;
|
|
71
|
+
const imageNode = view.state.schema.nodes.image.create({ src });
|
|
72
|
+
const tr = view.state.tr.replaceWith(currentPos, currentPos, imageNode);
|
|
73
|
+
currentDecos = currentDecos.remove(foundDecos);
|
|
74
|
+
tr.setMeta(plugin, { decorationSet: currentDecos });
|
|
75
|
+
view.dispatch(tr);
|
|
76
|
+
};
|
|
77
|
+
const preloadUrl = await loadableImageSrc(view.state, src);
|
|
78
|
+
if (!preloadUrl) {
|
|
79
|
+
replacePlaceholder();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
const preloader = new Image();
|
|
83
|
+
preloader.src = preloadUrl;
|
|
84
|
+
preloader.onload = replacePlaceholder;
|
|
85
|
+
preloader.onerror = replacePlaceholder;
|
|
86
|
+
}
|
|
87
|
+
var ImagePluginKey = new PluginKey("imagePlugin");
|
|
88
|
+
var createDropImagePlugin = (upload) => {
|
|
89
|
+
const plugin = new Plugin({
|
|
90
|
+
key: ImagePluginKey,
|
|
91
|
+
state: {
|
|
92
|
+
init: () => DecorationSet.empty,
|
|
93
|
+
apply: (tr, old) => {
|
|
94
|
+
const meta = tr.getMeta(plugin);
|
|
95
|
+
if (meta && meta.decorationSet) return meta.decorationSet;
|
|
96
|
+
return old.map(tr.mapping, tr.doc);
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
props: {
|
|
100
|
+
handleDOMEvents: {
|
|
101
|
+
dragover: (view, event) => {
|
|
102
|
+
if (event.dataTransfer?.types?.includes("Files")) {
|
|
103
|
+
event.preventDefault();
|
|
104
|
+
return true;
|
|
105
|
+
}
|
|
106
|
+
return false;
|
|
107
|
+
},
|
|
108
|
+
drop: (view, event) => {
|
|
109
|
+
if (!event.dataTransfer?.files || event.dataTransfer?.files.length === 0) return false;
|
|
110
|
+
event.preventDefault();
|
|
111
|
+
const images = Array.from(event.dataTransfer.files).filter((file) => /image/i.test(file.type));
|
|
112
|
+
if (images.length === 0) {
|
|
113
|
+
console.debug("No images found in dropped files");
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
images.forEach((image) => {
|
|
117
|
+
const position = view.posAtCoords({
|
|
118
|
+
left: event.clientX,
|
|
119
|
+
top: event.clientY
|
|
120
|
+
});
|
|
121
|
+
if (!position) return;
|
|
122
|
+
const reader = new FileReader();
|
|
123
|
+
reader.onload = async (readerEvent) => {
|
|
124
|
+
await onFileRead(view, readerEvent, position.pos, upload, image);
|
|
125
|
+
};
|
|
126
|
+
reader.readAsDataURL(image);
|
|
127
|
+
});
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
handlePaste(view, event) {
|
|
132
|
+
const html = event.clipboardData?.getData("text/html");
|
|
133
|
+
if (html && html.includes("<img")) return false;
|
|
134
|
+
const items = Array.from(event.clipboardData?.items || []);
|
|
135
|
+
const pos = view.state.selection.from;
|
|
136
|
+
let anyImageFound = false;
|
|
137
|
+
items.filter((item) => item.type.startsWith("image/")).forEach((item) => {
|
|
138
|
+
const image = item.getAsFile();
|
|
139
|
+
if (image) {
|
|
140
|
+
anyImageFound = true;
|
|
141
|
+
const reader = new FileReader();
|
|
142
|
+
reader.onload = async (readerEvent) => {
|
|
143
|
+
await onFileRead(view, readerEvent, pos, upload, image);
|
|
144
|
+
};
|
|
145
|
+
reader.readAsDataURL(image);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return anyImageFound;
|
|
149
|
+
},
|
|
150
|
+
decorations(state) {
|
|
151
|
+
return plugin.getState(state);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
return plugin;
|
|
156
|
+
};
|
|
157
|
+
//#endregion
|
|
158
|
+
export { ImagePluginKey, createDropImagePlugin, createImageSrcResolverPlugin, imageSrcResolverOf, isRenewableImageSrc, loadableImageSrc, onFileRead };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=Image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Image.js","names":[],"sources":["../../../src/editor/extensions/Image.ts"],"sourcesContent":["import { cls, defaultBorderMixin } from \"@rebasepro/ui\";\nimport { Decoration, DecorationSet, EditorView } from \"prosemirror-view\";\nimport { EditorState, Plugin, PluginKey } from \"prosemirror-state\";\nimport { isStorageReference, storageTargetOfDownloadUrl } from \"@rebasepro/types\";\n\nexport type UploadFn = (image: File) => Promise<string>;\n\n/**\n * Turns an image's stored `src` into one a browser can load.\n *\n * An uploaded image is stored as a `rebase-storage:` reference rather than a\n * URL — a private object's URL carries a token that expires in minutes — so\n * the editor asks for a URL each time it shows one.\n */\nexport type ImageSrcResolver = (src: string) => Promise<string | null | undefined>;\n\nconst ImageSrcResolverKey = new PluginKey<ImageSrcResolver | undefined>(\"imageSrcResolver\");\n\n/**\n * Carries the resolver to the image node views. They render in their own React\n * roots (see `ReactNodeView`), out of reach of any context, so the editor state\n * is where they can find it.\n */\nexport const createImageSrcResolverPlugin = (resolve: ImageSrcResolver): Plugin =>\n new Plugin<ImageSrcResolver | undefined>({\n key: ImageSrcResolverKey,\n state: {\n init: () => resolve,\n apply: (_tr, value) => value\n }\n });\n\n/** The resolver this editor was given, if any. */\nexport function imageSrcResolverOf(state: EditorState): ImageSrcResolver | undefined {\n return ImageSrcResolverKey.getState(state);\n}\n\n/**\n * Whether a stored `src` is renewed when shown: a reference, or a private\n * file's download URL saved before references (its token has expired).\n */\nexport function isRenewableImageSrc(src: string): boolean {\n return isStorageReference(src) || storageTargetOfDownloadUrl(src) !== null;\n}\n\n/**\n * The URL to load for a stored `src`: a reference resolved, anything else as\n * it is, and `undefined` for a reference this editor cannot resolve. A saved\n * download URL is renewed, and kept as it is when it cannot be.\n */\nexport async function loadableImageSrc(state: EditorState, src: string): Promise<string | undefined> {\n if (!isRenewableImageSrc(src)) return src;\n const fallback = isStorageReference(src) ? undefined : src;\n try {\n return (await imageSrcResolverOf(state)?.(src)) ?? fallback;\n } catch {\n return fallback;\n }\n}\n\nexport async function onFileRead(view: EditorView, readerEvent: ProgressEvent<FileReader>, pos: number, upload: UploadFn, image: File) {\n\n const { schema } = view.state;\n\n const state = view.state as typeof view.state & { plugins: Plugin[] };\n const plugin = state.plugins.find((p: Plugin) => p.spec.key === ImagePluginKey);\n if (!plugin) {\n console.error(\"Image plugin not found\");\n return;\n }\n\n const decoId = Math.random().toString(36).substring(7);\n const placeholder = document.createElement(\"div\");\n const imageElement = document.createElement(\"img\");\n imageElement.setAttribute(\"class\", \"opacity-40 rounded-lg border \" + defaultBorderMixin);\n imageElement.src = readerEvent.target?.result as string;\n placeholder.appendChild(imageElement);\n\n const deco = Decoration.widget(pos, placeholder, { id: decoId });\n let decorationSet = plugin.getState(view.state);\n decorationSet = decorationSet?.add(view.state.doc, [deco]);\n view.dispatch(view.state.tr.setMeta(plugin, { decorationSet }));\n\n // Image Upload Logic\n const src = await upload(image);\n console.debug(\"Uploaded image\", src);\n\n const replacePlaceholder = () => {\n // Retrieve the LATEST state after the async upload\n let currentDecos = plugin.getState(view.state) as DecorationSet;\n const foundDecos = currentDecos.find(undefined, undefined, spec => spec.id === decoId);\n\n if (foundDecos.length === 0) {\n console.warn(\"Image placeholder removed before upload completed.\");\n return;\n }\n\n // Get the mapped position of the decoration\n const currentPos = foundDecos[0].from;\n\n // Replace placeholder with actual image at the correct mapped position\n const imageNode = view.state.schema.nodes.image.create({ src });\n const tr = view.state.tr.replaceWith(currentPos, currentPos, imageNode);\n\n // Remove placeholder decoration using the LATEST decorationSet\n currentDecos = currentDecos.remove(foundDecos);\n tr.setMeta(plugin, { decorationSet: currentDecos });\n view.dispatch(tr);\n };\n\n // Preload the image so it doesn't cause a layout shift when replacing the\n // placeholder — from a URL, since what the upload returns is a reference.\n const preloadUrl = await loadableImageSrc(view.state, src);\n if (!preloadUrl) {\n replacePlaceholder();\n return;\n }\n const preloader = new Image();\n preloader.src = preloadUrl;\n preloader.onload = replacePlaceholder;\n preloader.onerror = replacePlaceholder;\n}\n\nexport const ImagePluginKey = new PluginKey(\"imagePlugin\");\n\nexport const createDropImagePlugin = (upload: UploadFn): Plugin => {\n const plugin: Plugin = new Plugin({\n key: ImagePluginKey,\n state: {\n // Initialize the plugin state with an empty DecorationSet\n init: () => DecorationSet.empty,\n // Apply transactions to update the state\n apply: (tr, old) => {\n // Handle custom transaction steps that update decorations\n const meta = tr.getMeta(plugin);\n if (meta && meta.decorationSet) {\n return meta.decorationSet;\n }\n // Map decorations to the new document structure\n return old.map(tr.mapping, tr.doc);\n }\n },\n props: {\n handleDOMEvents: {\n dragover: (view: EditorView, event: DragEvent) => {\n if (event.dataTransfer?.types?.includes(\"Files\")) {\n event.preventDefault();\n return true;\n }\n return false;\n },\n drop: (view: EditorView, event: DragEvent) => {\n if (!event.dataTransfer?.files || event.dataTransfer?.files.length === 0) {\n return false;\n }\n event.preventDefault();\n\n const files = Array.from(event.dataTransfer.files);\n const images = files.filter(file => /image/i.test(file.type));\n\n if (images.length === 0) {\n console.debug(\"No images found in dropped files\");\n return false;\n }\n\n images.forEach(image => {\n const position = view.posAtCoords({\n left: event.clientX,\n top: event.clientY\n });\n if (!position) return;\n\n const reader = new FileReader();\n reader.onload = async (readerEvent) => {\n await onFileRead(view, readerEvent, position.pos, upload, image);\n };\n reader.readAsDataURL(image);\n });\n\n return true;\n }\n },\n handlePaste(view: EditorView, event: ClipboardEvent) {\n const html = event.clipboardData?.getData(\"text/html\");\n if (html && html.includes(\"<img\")) {\n // Let ProseMirror handle the HTML paste natively (e.g. copy-pasted from the editor itself or a webpage)\n return false;\n }\n\n const items = Array.from(event.clipboardData?.items || []);\n const pos = view.state.selection.from;\n let anyImageFound = false;\n\n items\n .filter((item) => item.type.startsWith(\"image/\"))\n .forEach((item) => {\n const image = item.getAsFile();\n if (image) {\n anyImageFound = true;\n const reader = new FileReader();\n reader.onload = async (readerEvent) => {\n await onFileRead(view, readerEvent, pos, upload, image);\n };\n reader.readAsDataURL(image);\n }\n });\n\n return anyImageFound;\n },\n decorations(state) {\n return plugin.getState(state);\n }\n }\n });\n\n return plugin;\n};\n\n\n"],"mappings":";;;;;AAgBA,IAAM,sBAAsB,IAAI,UAAwC,kBAAkB;;;;;;AAO1F,IAAa,gCAAgC,YACzC,IAAI,OAAqC;CACrC,KAAK;CACL,OAAO;EACH,YAAY;EACZ,QAAQ,KAAK,UAAU;CAC3B;AACJ,CAAC;;AAGL,SAAgB,mBAAmB,OAAkD;CACjF,OAAO,oBAAoB,SAAS,KAAK;AAC7C;;;;;AAMA,SAAgB,oBAAoB,KAAsB;CACtD,OAAO,mBAAmB,GAAG,KAAK,2BAA2B,GAAG,MAAM;AAC1E;;;;;;AAOA,eAAsB,iBAAiB,OAAoB,KAA0C;CACjG,IAAI,CAAC,oBAAoB,GAAG,GAAG,OAAO;CACtC,MAAM,WAAW,mBAAmB,GAAG,IAAI,KAAA,IAAY;CACvD,IAAI;EACA,OAAQ,MAAM,mBAAmB,KAAK,CAAC,GAAG,GAAG,KAAM;CACvD,QAAQ;EACJ,OAAO;CACX;AACJ;AAEA,eAAsB,WAAW,MAAkB,aAAwC,KAAa,QAAkB,OAAa;CAEnI,MAAM,EAAE,WAAW,KAAK;CAGxB,MAAM,SADQ,KAAK,MACE,QAAQ,MAAM,MAAc,EAAE,KAAK,QAAQ,cAAc;CAC9E,IAAI,CAAC,QAAQ;EACT,QAAQ,MAAM,wBAAwB;EACtC;CACJ;CAEA,MAAM,SAAS,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC;CACrD,MAAM,cAAc,SAAS,cAAc,KAAK;CAChD,MAAM,eAAe,SAAS,cAAc,KAAK;CACjD,aAAa,aAAa,SAAS,kCAAkC,kBAAkB;CACvF,aAAa,MAAM,YAAY,QAAQ;CACvC,YAAY,YAAY,YAAY;CAEpC,MAAM,OAAO,WAAW,OAAO,KAAK,aAAa,EAAE,IAAI,OAAO,CAAC;CAC/D,IAAI,gBAAgB,OAAO,SAAS,KAAK,KAAK;CAC9C,gBAAgB,eAAe,IAAI,KAAK,MAAM,KAAK,CAAC,IAAI,CAAC;CACzD,KAAK,SAAS,KAAK,MAAM,GAAG,QAAQ,QAAQ,EAAE,cAAc,CAAC,CAAC;CAG9D,MAAM,MAAM,MAAM,OAAO,KAAK;CAC9B,QAAQ,MAAM,kBAAkB,GAAG;CAEnC,MAAM,2BAA2B;EAE7B,IAAI,eAAe,OAAO,SAAS,KAAK,KAAK;EAC7C,MAAM,aAAa,aAAa,KAAK,KAAA,GAAW,KAAA,IAAW,SAAQ,KAAK,OAAO,MAAM;EAErF,IAAI,WAAW,WAAW,GAAG;GACzB,QAAQ,KAAK,oDAAoD;GACjE;EACJ;EAGA,MAAM,aAAa,WAAW,EAAE,CAAC;EAGjC,MAAM,YAAY,KAAK,MAAM,OAAO,MAAM,MAAM,OAAO,EAAE,IAAI,CAAC;EAC9D,MAAM,KAAK,KAAK,MAAM,GAAG,YAAY,YAAY,YAAY,SAAS;EAGtE,eAAe,aAAa,OAAO,UAAU;EAC7C,GAAG,QAAQ,QAAQ,EAAE,eAAe,aAAa,CAAC;EAClD,KAAK,SAAS,EAAE;CACpB;CAIA,MAAM,aAAa,MAAM,iBAAiB,KAAK,OAAO,GAAG;CACzD,IAAI,CAAC,YAAY;EACb,mBAAmB;EACnB;CACJ;CACA,MAAM,YAAY,IAAI,MAAM;CAC5B,UAAU,MAAM;CAChB,UAAU,SAAS;CACnB,UAAU,UAAU;AACxB;AAEA,IAAa,iBAAiB,IAAI,UAAU,aAAa;AAEzD,IAAa,yBAAyB,WAA6B;CAC/D,MAAM,SAAiB,IAAI,OAAO;EAC9B,KAAK;EACL,OAAO;GAEH,YAAY,cAAc;GAE1B,QAAQ,IAAI,QAAQ;IAEhB,MAAM,OAAO,GAAG,QAAQ,MAAM;IAC9B,IAAI,QAAQ,KAAK,eACb,OAAO,KAAK;IAGhB,OAAO,IAAI,IAAI,GAAG,SAAS,GAAG,GAAG;GACrC;EACJ;EACA,OAAO;GACH,iBAAiB;IACb,WAAW,MAAkB,UAAqB;KAC9C,IAAI,MAAM,cAAc,OAAO,SAAS,OAAO,GAAG;MAC9C,MAAM,eAAe;MACrB,OAAO;KACX;KACA,OAAO;IACX;IACA,OAAO,MAAkB,UAAqB;KAC1C,IAAI,CAAC,MAAM,cAAc,SAAS,MAAM,cAAc,MAAM,WAAW,GACnE,OAAO;KAEX,MAAM,eAAe;KAGrB,MAAM,SADQ,MAAM,KAAK,MAAM,aAAa,KAC7B,CAAA,CAAM,QAAO,SAAQ,SAAS,KAAK,KAAK,IAAI,CAAC;KAE5D,IAAI,OAAO,WAAW,GAAG;MACrB,QAAQ,MAAM,kCAAkC;MAChD,OAAO;KACX;KAEA,OAAO,SAAQ,UAAS;MACpB,MAAM,WAAW,KAAK,YAAY;OAC9B,MAAM,MAAM;OACZ,KAAK,MAAM;MACf,CAAC;MACD,IAAI,CAAC,UAAU;MAEf,MAAM,SAAS,IAAI,WAAW;MAC9B,OAAO,SAAS,OAAO,gBAAgB;OACnC,MAAM,WAAW,MAAM,aAAa,SAAS,KAAK,QAAQ,KAAK;MACnE;MACA,OAAO,cAAc,KAAK;KAC9B,CAAC;KAED,OAAO;IACX;GACJ;GACA,YAAY,MAAkB,OAAuB;IACjD,MAAM,OAAO,MAAM,eAAe,QAAQ,WAAW;IACrD,IAAI,QAAQ,KAAK,SAAS,MAAM,GAE5B,OAAO;IAGX,MAAM,QAAQ,MAAM,KAAK,MAAM,eAAe,SAAS,CAAC,CAAC;IACzD,MAAM,MAAM,KAAK,MAAM,UAAU;IACjC,IAAI,gBAAgB;IAEpB,MACK,QAAQ,SAAS,KAAK,KAAK,WAAW,QAAQ,CAAC,CAAC,CAChD,SAAS,SAAS;KACf,MAAM,QAAQ,KAAK,UAAU;KAC7B,IAAI,OAAO;MACP,gBAAgB;MAChB,MAAM,SAAS,IAAI,WAAW;MAC9B,OAAO,SAAS,OAAO,gBAAgB;OACnC,MAAM,WAAW,MAAM,aAAa,KAAK,QAAQ,KAAK;MAC1D;MACA,OAAO,cAAc,KAAK;KAC9B;IACJ,CAAC;IAEL,OAAO;GACX;GACA,YAAY,OAAO;IACf,OAAO,OAAO,SAAS,KAAK;GAChC;EACJ;CACJ,CAAC;CAED,OAAO;AACX"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { parseSanitizedHtml } from "../sanitize-html.js";
|
|
2
|
+
import { Plugin, PluginKey } from "prosemirror-state";
|
|
3
|
+
import { Decoration, DecorationSet } from "prosemirror-view";
|
|
4
|
+
//#region src/editor/extensions/TextLoadingDecorationExtension.tsx
|
|
5
|
+
var loadingDecorationKey = new PluginKey("loadingDecoration");
|
|
6
|
+
var textLoadingCommands = {
|
|
7
|
+
toggleLoadingDecoration: (state, dispatch, loadingHtml) => {
|
|
8
|
+
const { selection } = state;
|
|
9
|
+
const pos = selection.from;
|
|
10
|
+
if (!dispatch) return false;
|
|
11
|
+
dispatch(state.tr.setMeta(loadingDecorationKey, {
|
|
12
|
+
pos,
|
|
13
|
+
type: "loadingDecoration",
|
|
14
|
+
remove: false,
|
|
15
|
+
loadingHtml
|
|
16
|
+
}));
|
|
17
|
+
return true;
|
|
18
|
+
},
|
|
19
|
+
removeLoadingDecoration: (state, dispatch) => {
|
|
20
|
+
if (!dispatch) return false;
|
|
21
|
+
dispatch(state.tr.setMeta(loadingDecorationKey, {
|
|
22
|
+
pos: 0,
|
|
23
|
+
type: "loadingDecoration",
|
|
24
|
+
remove: true
|
|
25
|
+
}));
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* This plugin is used to display streaming content from an LLM.
|
|
31
|
+
*/
|
|
32
|
+
var textLoadingDecorationPlugin = () => {
|
|
33
|
+
return new Plugin({
|
|
34
|
+
key: loadingDecorationKey,
|
|
35
|
+
state: {
|
|
36
|
+
init() {
|
|
37
|
+
return {
|
|
38
|
+
decorationSet: DecorationSet.empty,
|
|
39
|
+
hasDecoration: false
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
apply(tr, oldState) {
|
|
43
|
+
const action = tr.getMeta(loadingDecorationKey);
|
|
44
|
+
if (action?.type === "loadingDecoration") {
|
|
45
|
+
const { pos, remove, loadingHtml } = action;
|
|
46
|
+
if (remove) return {
|
|
47
|
+
decorationSet: DecorationSet.empty,
|
|
48
|
+
hasDecoration: false
|
|
49
|
+
};
|
|
50
|
+
const decoration = Decoration.widget(pos, () => {
|
|
51
|
+
const container = document.createElement("span");
|
|
52
|
+
container.className = "loading-decoration";
|
|
53
|
+
if (loadingHtml) {
|
|
54
|
+
const safe = parseSanitizedHtml(loadingHtml);
|
|
55
|
+
while (safe.firstChild) container.appendChild(safe.firstChild);
|
|
56
|
+
} else {
|
|
57
|
+
const span = document.createElement("span");
|
|
58
|
+
span.innerText = "loading...";
|
|
59
|
+
container.appendChild(span);
|
|
60
|
+
}
|
|
61
|
+
return container;
|
|
62
|
+
});
|
|
63
|
+
return {
|
|
64
|
+
decorationSet: DecorationSet.empty.add(tr.doc, [decoration]),
|
|
65
|
+
hasDecoration: true
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
decorationSet: oldState.decorationSet.map(tr.mapping, tr.doc),
|
|
70
|
+
hasDecoration: oldState.hasDecoration
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
props: { decorations(state) {
|
|
75
|
+
return this.getState(state)?.decorationSet || DecorationSet.empty;
|
|
76
|
+
} }
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
//#endregion
|
|
80
|
+
export { loadingDecorationKey, textLoadingCommands, textLoadingDecorationPlugin };
|
|
81
|
+
|
|
82
|
+
//# sourceMappingURL=TextLoadingDecorationExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextLoadingDecorationExtension.js","names":[],"sources":["../../../src/editor/extensions/TextLoadingDecorationExtension.tsx"],"sourcesContent":["import { Plugin, PluginKey, Transaction, EditorState } from \"prosemirror-state\";\nimport { Decoration, DecorationSet } from \"prosemirror-view\";\nimport { parseSanitizedHtml } from \"../sanitize-html\";\n\n// Define and export the plugin key\nexport const loadingDecorationKey = new PluginKey<LoadingDecorationState>(\"loadingDecoration\");\n\ninterface LoadingDecorationState {\n decorationSet: DecorationSet;\n hasDecoration: boolean;\n}\n\nexport const textLoadingCommands = {\n toggleLoadingDecoration: (state: EditorState, dispatch: ((tr: Transaction) => void) | undefined, loadingHtml?: string): boolean => {\n const { selection } = state;\n const pos = selection.from;\n\n if (!dispatch) return false;\n\n const tr = state.tr.setMeta(loadingDecorationKey, {\n pos,\n type: \"loadingDecoration\",\n remove: false,\n loadingHtml\n });\n\n dispatch(tr);\n return true;\n },\n\n removeLoadingDecoration: (state: EditorState, dispatch: ((tr: Transaction) => void) | undefined): boolean => {\n if (!dispatch) return false;\n\n const tr = state.tr.setMeta(loadingDecorationKey, {\n pos: 0, // We can pass any position as it will remove the entire decoration set\n type: \"loadingDecoration\",\n remove: true\n });\n\n dispatch(tr);\n return true;\n }\n};\n\n/**\n * This plugin is used to display streaming content from an LLM.\n */\nexport const textLoadingDecorationPlugin = () => {\n return new Plugin<LoadingDecorationState>({\n key: loadingDecorationKey,\n\n state: {\n init() {\n return {\n decorationSet: DecorationSet.empty,\n hasDecoration: false\n };\n },\n\n apply(tr, oldState) {\n const action = tr.getMeta(loadingDecorationKey);\n\n if (action?.type === \"loadingDecoration\") {\n const { pos, remove, loadingHtml } = action;\n\n if (remove) {\n return {\n decorationSet: DecorationSet.empty,\n hasDecoration: false\n };\n }\n\n const decoration = Decoration.widget(pos, () => {\n const container = document.createElement(\"span\");\n container.className = \"loading-decoration\";\n\n // The comment here said \"Sanitize and append HTML\" and\n // the line below it did neither: `innerHTML` on an\n // element of the LIVE document runs what it is given.\n // `<img src=x onerror=…>` fires during the assignment.\n //\n // What arrives is an AI completion, and its context is\n // the surrounding document — a customer's content, often\n // typed by somebody else. So this is where a record\n // holding a payload gets it read back and executed, in\n // the console's own origin.\n if (loadingHtml) {\n const safe = parseSanitizedHtml(loadingHtml);\n while (safe.firstChild) container.appendChild(safe.firstChild);\n } else {\n const span = document.createElement(\"span\");\n span.innerText = \"loading...\";\n container.appendChild(span);\n }\n\n return container;\n });\n\n return {\n decorationSet: DecorationSet.empty.add(tr.doc, [decoration]),\n hasDecoration: true\n };\n }\n\n return {\n decorationSet: oldState.decorationSet.map(tr.mapping, tr.doc),\n hasDecoration: oldState.hasDecoration\n };\n }\n },\n\n props: {\n decorations(state) {\n return this.getState(state)?.decorationSet || DecorationSet.empty;\n }\n }\n });\n};\n"],"mappings":";;;;AAKA,IAAa,uBAAuB,IAAI,UAAkC,mBAAmB;AAO7F,IAAa,sBAAsB;CAC/B,0BAA0B,OAAoB,UAAmD,gBAAkC;EAC/H,MAAM,EAAE,cAAc;EACtB,MAAM,MAAM,UAAU;EAEtB,IAAI,CAAC,UAAU,OAAO;EAStB,SAPW,MAAM,GAAG,QAAQ,sBAAsB;GAC9C;GACA,MAAM;GACN,QAAQ;GACR;EACJ,CAES,CAAE;EACX,OAAO;CACX;CAEA,0BAA0B,OAAoB,aAA+D;EACzG,IAAI,CAAC,UAAU,OAAO;EAQtB,SANW,MAAM,GAAG,QAAQ,sBAAsB;GAC9C,KAAK;GACL,MAAM;GACN,QAAQ;EACZ,CAES,CAAE;EACX,OAAO;CACX;AACJ;;;;AAKA,IAAa,oCAAoC;CAC7C,OAAO,IAAI,OAA+B;EACtC,KAAK;EAEL,OAAO;GACH,OAAO;IACH,OAAO;KACH,eAAe,cAAc;KAC7B,eAAe;IACnB;GACJ;GAEA,MAAM,IAAI,UAAU;IAChB,MAAM,SAAS,GAAG,QAAQ,oBAAoB;IAE9C,IAAI,QAAQ,SAAS,qBAAqB;KACtC,MAAM,EAAE,KAAK,QAAQ,gBAAgB;KAErC,IAAI,QACA,OAAO;MACH,eAAe,cAAc;MAC7B,eAAe;KACnB;KAGJ,MAAM,aAAa,WAAW,OAAO,WAAW;MAC5C,MAAM,YAAY,SAAS,cAAc,MAAM;MAC/C,UAAU,YAAY;MAYtB,IAAI,aAAa;OACb,MAAM,OAAO,mBAAmB,WAAW;OAC3C,OAAO,KAAK,YAAY,UAAU,YAAY,KAAK,UAAU;MACjE,OAAO;OACH,MAAM,OAAO,SAAS,cAAc,MAAM;OAC1C,KAAK,YAAY;OACjB,UAAU,YAAY,IAAI;MAC9B;MAEA,OAAO;KACX,CAAC;KAED,OAAO;MACH,eAAe,cAAc,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC;MAC3D,eAAe;KACnB;IACJ;IAEA,OAAO;KACH,eAAe,SAAS,cAAc,IAAI,GAAG,SAAS,GAAG,GAAG;KAC5D,eAAe,SAAS;IAC5B;GACJ;EACJ;EAEA,OAAO,EACH,YAAY,OAAO;GACf,OAAO,KAAK,SAAS,KAAK,CAAC,EAAE,iBAAiB,cAAc;EAChE,EACJ;CACJ,CAAC;AACL"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { DOMSerializer } from "prosemirror-model";
|
|
2
|
+
//#region src/editor/extensions/clipboard.ts
|
|
3
|
+
function serializeForClipboard(view, slice) {
|
|
4
|
+
view.someProp("transformCopied", (f) => {
|
|
5
|
+
slice = f(slice, view);
|
|
6
|
+
});
|
|
7
|
+
const context = [];
|
|
8
|
+
let { content, openStart, openEnd } = slice;
|
|
9
|
+
while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild.childCount == 1) {
|
|
10
|
+
openStart--;
|
|
11
|
+
openEnd--;
|
|
12
|
+
const node = content.firstChild;
|
|
13
|
+
const nodeType = node.type;
|
|
14
|
+
context.push(node.type.name, node.attrs != nodeType.defaultAttrs ? node.attrs : null);
|
|
15
|
+
content = node.content;
|
|
16
|
+
}
|
|
17
|
+
const serializer = view.someProp("clipboardSerializer") || DOMSerializer.fromSchema(view.state.schema);
|
|
18
|
+
const doc = detachedDoc(), wrap = doc.createElement("div");
|
|
19
|
+
wrap.appendChild(serializer.serializeFragment(content, { document: doc }));
|
|
20
|
+
let firstChild = wrap.firstChild, needsWrap, wrappers = 0;
|
|
21
|
+
while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {
|
|
22
|
+
for (let i = needsWrap.length - 1; i >= 0; i--) {
|
|
23
|
+
const wrapper = doc.createElement(needsWrap[i]);
|
|
24
|
+
while (wrap.firstChild) wrapper.appendChild(wrap.firstChild);
|
|
25
|
+
wrap.appendChild(wrapper);
|
|
26
|
+
wrappers++;
|
|
27
|
+
}
|
|
28
|
+
firstChild = wrap.firstChild;
|
|
29
|
+
}
|
|
30
|
+
if (firstChild && firstChild.nodeType == 1) firstChild.setAttribute("data-pm-slice", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : ""} ${JSON.stringify(context)}`);
|
|
31
|
+
return {
|
|
32
|
+
dom: wrap,
|
|
33
|
+
text: view.someProp("clipboardTextSerializer", (f) => f(slice, view)) || slice.content.textBetween(0, slice.content.size, "\n\n"),
|
|
34
|
+
slice
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
var wrapMap = {
|
|
38
|
+
thead: ["table"],
|
|
39
|
+
tbody: ["table"],
|
|
40
|
+
tfoot: ["table"],
|
|
41
|
+
caption: ["table"],
|
|
42
|
+
colgroup: ["table"],
|
|
43
|
+
col: ["table", "colgroup"],
|
|
44
|
+
tr: ["table", "tbody"],
|
|
45
|
+
td: [
|
|
46
|
+
"table",
|
|
47
|
+
"tbody",
|
|
48
|
+
"tr"
|
|
49
|
+
],
|
|
50
|
+
th: [
|
|
51
|
+
"table",
|
|
52
|
+
"tbody",
|
|
53
|
+
"tr"
|
|
54
|
+
]
|
|
55
|
+
};
|
|
56
|
+
var _detachedDoc = null;
|
|
57
|
+
function detachedDoc() {
|
|
58
|
+
return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument("title"));
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { serializeForClipboard };
|
|
62
|
+
|
|
63
|
+
//# sourceMappingURL=clipboard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clipboard.js","names":[],"sources":["../../../src/editor/extensions/clipboard.ts"],"sourcesContent":["import { DOMSerializer, Slice } from \"prosemirror-model\"\nimport { EditorView } from \"prosemirror-view\";\n\nexport function serializeForClipboard(view: EditorView, slice: Slice) {\n view.someProp(\"transformCopied\", f => {\n slice = f(slice!, view)\n })\n\n const context = [];\n let {\n content,\n openStart,\n openEnd\n } = slice\n while (openStart > 1 && openEnd > 1 && content.childCount == 1 && content.firstChild!.childCount == 1) {\n openStart--\n openEnd--\n const node = content.firstChild!\n const nodeType = node.type as typeof node.type & { defaultAttrs?: unknown };\n context.push(node.type.name, node.attrs != nodeType.defaultAttrs ? node.attrs : null)\n content = node.content\n }\n\n const serializer = view.someProp(\"clipboardSerializer\") || DOMSerializer.fromSchema(view.state.schema)\n const doc = detachedDoc(), wrap = doc.createElement(\"div\")\n wrap.appendChild(serializer.serializeFragment(content, { document: doc }))\n\n let firstChild = wrap.firstChild, needsWrap, wrappers = 0\n while (firstChild && firstChild.nodeType == 1 && (needsWrap = wrapMap[firstChild.nodeName.toLowerCase()])) {\n for (let i = needsWrap.length - 1; i >= 0; i--) {\n const wrapper = doc.createElement(needsWrap[i])\n while (wrap.firstChild) wrapper.appendChild(wrap.firstChild)\n wrap.appendChild(wrapper)\n wrappers++\n }\n firstChild = wrap.firstChild\n }\n\n if (firstChild && firstChild.nodeType == 1)\n (firstChild as HTMLElement).setAttribute(\n \"data-pm-slice\", `${openStart} ${openEnd}${wrappers ? ` -${wrappers}` : \"\"} ${JSON.stringify(context)}`)\n\n const text = view.someProp(\"clipboardTextSerializer\", f => f(slice, view)) ||\n slice.content.textBetween(0, slice.content.size, \"\\n\\n\")\n\n return {\n dom: wrap,\n text,\n slice\n }\n}\n\n// Trick from jQuery -- some elements must be wrapped in other\n// elements for innerHTML to work. I.e. if you do `div.innerHTML =\n// \"<td>..</td>\"` the table cells are ignored.\nconst wrapMap: { [node: string]: string[] } = {\n thead: [\"table\"],\n tbody: [\"table\"],\n tfoot: [\"table\"],\n caption: [\"table\"],\n colgroup: [\"table\"],\n col: [\"table\", \"colgroup\"],\n tr: [\"table\", \"tbody\"],\n td: [\"table\", \"tbody\", \"tr\"],\n th: [\"table\", \"tbody\", \"tr\"]\n}\n\nlet _detachedDoc: Document | null = null\n\nfunction detachedDoc() {\n return _detachedDoc || (_detachedDoc = document.implementation.createHTMLDocument(\"title\"))\n}\n"],"mappings":";;AAGA,SAAgB,sBAAsB,MAAkB,OAAc;CAClE,KAAK,SAAS,oBAAmB,MAAK;EAClC,QAAQ,EAAE,OAAQ,IAAI;CAC1B,CAAC;CAED,MAAM,UAAU,CAAC;CACjB,IAAI,EACA,SACA,WACA,YACA;CACJ,OAAO,YAAY,KAAK,UAAU,KAAK,QAAQ,cAAc,KAAK,QAAQ,WAAY,cAAc,GAAG;EACnG;EACA;EACA,MAAM,OAAO,QAAQ;EACrB,MAAM,WAAW,KAAK;EACtB,QAAQ,KAAK,KAAK,KAAK,MAAM,KAAK,SAAS,SAAS,eAAe,KAAK,QAAQ,IAAI;EACpF,UAAU,KAAK;CACnB;CAEA,MAAM,aAAa,KAAK,SAAS,qBAAqB,KAAK,cAAc,WAAW,KAAK,MAAM,MAAM;CACrG,MAAM,MAAM,YAAY,GAAG,OAAO,IAAI,cAAc,KAAK;CACzD,KAAK,YAAY,WAAW,kBAAkB,SAAS,EAAE,UAAU,IAAI,CAAC,CAAC;CAEzE,IAAI,aAAa,KAAK,YAAY,WAAW,WAAW;CACxD,OAAO,cAAc,WAAW,YAAY,MAAM,YAAY,QAAQ,WAAW,SAAS,YAAY,KAAK;EACvG,KAAK,IAAI,IAAI,UAAU,SAAS,GAAG,KAAK,GAAG,KAAK;GAC5C,MAAM,UAAU,IAAI,cAAc,UAAU,EAAE;GAC9C,OAAO,KAAK,YAAY,QAAQ,YAAY,KAAK,UAAU;GAC3D,KAAK,YAAY,OAAO;GACxB;EACJ;EACA,aAAa,KAAK;CACtB;CAEA,IAAI,cAAc,WAAW,YAAY,GACrC,WAA4B,aACxB,iBAAiB,GAAG,UAAU,GAAG,UAAU,WAAW,KAAK,aAAa,GAAG,GAAG,KAAK,UAAU,OAAO,GAAG;CAK/G,OAAO;EACH,KAAK;EACL,MALS,KAAK,SAAS,4BAA2B,MAAK,EAAE,OAAO,IAAI,CAAC,KACrE,MAAM,QAAQ,YAAY,GAAG,MAAM,QAAQ,MAAM,MAAM;EAKvD;CACJ;AACJ;AAKA,IAAM,UAAwC;CAC1C,OAAO,CAAC,OAAO;CACf,OAAO,CAAC,OAAO;CACf,OAAO,CAAC,OAAO;CACf,SAAS,CAAC,OAAO;CACjB,UAAU,CAAC,OAAO;CAClB,KAAK,CAAC,SAAS,UAAU;CACzB,IAAI,CAAC,SAAS,OAAO;CACrB,IAAI;EAAC;EAAS;EAAS;CAAI;CAC3B,IAAI;EAAC;EAAS;EAAS;CAAI;AAC/B;AAEA,IAAI,eAAgC;AAEpC,SAAS,cAAc;CACnB,OAAO,iBAAiB,eAAe,SAAS,eAAe,mBAAmB,OAAO;AAC7F"}
|