datocms-plugin-sdk 1.1.0 → 2.0.0
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 +1 -1
- package/dist/cjs/connect.js +75 -208
- package/dist/cjs/connect.js.map +1 -1
- package/dist/cjs/{types.js → ctx/base.js} +1 -1
- package/dist/cjs/ctx/base.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/field.js +3 -0
- package/dist/cjs/ctx/commonExtras/field.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/itemForm.js +3 -0
- package/dist/cjs/ctx/commonExtras/itemForm.js.map +1 -0
- package/dist/cjs/ctx/commonExtras/sizing.js +3 -0
- package/dist/cjs/ctx/commonExtras/sizing.js.map +1 -0
- package/dist/cjs/ctx/pluginFrame.js +3 -0
- package/dist/cjs/ctx/pluginFrame.js.map +1 -0
- package/dist/cjs/hooks/assetSources.js +3 -0
- package/dist/cjs/hooks/assetSources.js.map +1 -0
- package/dist/cjs/hooks/buildItemPresentationInfo.js +3 -0
- package/dist/cjs/hooks/buildItemPresentationInfo.js.map +1 -0
- package/dist/cjs/hooks/contentAreaSidebarItems.js +3 -0
- package/dist/cjs/hooks/contentAreaSidebarItems.js.map +1 -0
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js +3 -0
- package/dist/cjs/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
- package/dist/cjs/hooks/customMarksForStructuredTextField.js +3 -0
- package/dist/cjs/hooks/customMarksForStructuredTextField.js.map +1 -0
- package/dist/cjs/hooks/executeFieldDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeFieldDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeItemFormDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeItemFormDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeItemsDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeItemsDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/executeUploadsDropdownAction.js +3 -0
- package/dist/cjs/hooks/executeUploadsDropdownAction.js.map +1 -0
- package/dist/cjs/hooks/fieldDropdownActions.js +3 -0
- package/dist/cjs/hooks/fieldDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js +3 -0
- package/dist/cjs/hooks/initialLocationQueryForItemSelector.js.map +1 -0
- package/dist/cjs/hooks/itemCollectionOutlets.js +3 -0
- package/dist/cjs/hooks/itemCollectionOutlets.js.map +1 -0
- package/dist/cjs/hooks/itemFormDropdownActions.js +3 -0
- package/dist/cjs/hooks/itemFormDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/itemFormOutlets.js +3 -0
- package/dist/cjs/hooks/itemFormOutlets.js.map +1 -0
- package/dist/cjs/hooks/itemFormSidebarPanels.js +3 -0
- package/dist/cjs/hooks/itemFormSidebarPanels.js.map +1 -0
- package/dist/cjs/hooks/itemFormSidebars.js +3 -0
- package/dist/cjs/hooks/itemFormSidebars.js.map +1 -0
- package/dist/cjs/hooks/itemsDropdownActions.js +3 -0
- package/dist/cjs/hooks/itemsDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/mainNavigationTabs.js +3 -0
- package/dist/cjs/hooks/mainNavigationTabs.js.map +1 -0
- package/dist/cjs/hooks/manualFieldExtensions.js +3 -0
- package/dist/cjs/hooks/manualFieldExtensions.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemUpsert.js +3 -0
- package/dist/cjs/hooks/onBeforeItemUpsert.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsDestroy.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsDestroy.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsPublish.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsPublish.js.map +1 -0
- package/dist/cjs/hooks/onBeforeItemsUnpublish.js +3 -0
- package/dist/cjs/hooks/onBeforeItemsUnpublish.js.map +1 -0
- package/dist/cjs/hooks/onBoot.js +3 -0
- package/dist/cjs/hooks/onBoot.js.map +1 -0
- package/dist/cjs/hooks/overrideFieldExtensions.js +3 -0
- package/dist/cjs/hooks/overrideFieldExtensions.js.map +1 -0
- package/dist/cjs/hooks/renderAssetSource.js +11 -0
- package/dist/cjs/hooks/renderAssetSource.js.map +1 -0
- package/dist/cjs/hooks/renderConfigScreen.js +11 -0
- package/dist/cjs/hooks/renderConfigScreen.js.map +1 -0
- package/dist/cjs/hooks/renderFieldExtension.js +11 -0
- package/dist/cjs/hooks/renderFieldExtension.js.map +1 -0
- package/dist/cjs/hooks/renderItemCollectionOutlet.js +11 -0
- package/dist/cjs/hooks/renderItemCollectionOutlet.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormOutlet.js +11 -0
- package/dist/cjs/hooks/renderItemFormOutlet.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormSidebar.js +11 -0
- package/dist/cjs/hooks/renderItemFormSidebar.js.map +1 -0
- package/dist/cjs/hooks/renderItemFormSidebarPanel.js +11 -0
- package/dist/cjs/hooks/renderItemFormSidebarPanel.js.map +1 -0
- package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js +11 -0
- package/dist/cjs/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
- package/dist/cjs/hooks/renderModal.js +11 -0
- package/dist/cjs/hooks/renderModal.js.map +1 -0
- package/dist/cjs/hooks/renderPage.js +11 -0
- package/dist/cjs/hooks/renderPage.js.map +1 -0
- package/dist/cjs/hooks/renderUploadSidebar.js +11 -0
- package/dist/cjs/hooks/renderUploadSidebar.js.map +1 -0
- package/dist/cjs/hooks/renderUploadSidebarPanel.js +11 -0
- package/dist/cjs/hooks/renderUploadSidebarPanel.js.map +1 -0
- package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js +3 -0
- package/dist/cjs/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
- package/dist/cjs/hooks/uploadSidebarPanels.js +3 -0
- package/dist/cjs/hooks/uploadSidebarPanels.js.map +1 -0
- package/dist/cjs/hooks/uploadSidebars.js +3 -0
- package/dist/cjs/hooks/uploadSidebars.js.map +1 -0
- package/dist/cjs/hooks/uploadsDropdownActions.js +3 -0
- package/dist/cjs/hooks/uploadsDropdownActions.js.map +1 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js +3 -0
- package/dist/cjs/hooks/validateManualFieldExtensionParameters.js.map +1 -0
- package/dist/cjs/icon.js +3 -0
- package/dist/cjs/icon.js.map +1 -0
- package/dist/cjs/index.js +46 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/manifest.js +2909 -0
- package/dist/cjs/manifest.js.map +1 -0
- package/dist/cjs/manifestTypes.js +3 -0
- package/dist/cjs/manifestTypes.js.map +1 -0
- package/dist/cjs/shared.js +3 -0
- package/dist/cjs/shared.js.map +1 -0
- package/dist/cjs/utils.js +136 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/esm/connect.d.ts +44 -242
- package/dist/esm/connect.js +74 -206
- package/dist/esm/connect.js.map +1 -1
- package/dist/esm/ctx/base.d.ts +670 -0
- package/dist/esm/ctx/base.js +2 -0
- package/dist/esm/ctx/base.js.map +1 -0
- package/dist/esm/ctx/commonExtras/field.d.ts +29 -0
- package/dist/esm/ctx/commonExtras/field.js +2 -0
- package/dist/esm/ctx/commonExtras/field.js.map +1 -0
- package/dist/esm/ctx/commonExtras/itemForm.d.ts +148 -0
- package/dist/esm/ctx/commonExtras/itemForm.js +2 -0
- package/dist/esm/ctx/commonExtras/itemForm.js.map +1 -0
- package/dist/esm/ctx/commonExtras/sizing.d.ts +23 -0
- package/dist/esm/ctx/commonExtras/sizing.js +2 -0
- package/dist/esm/ctx/commonExtras/sizing.js.map +1 -0
- package/dist/esm/ctx/pluginFrame.d.ts +12 -0
- package/dist/esm/ctx/pluginFrame.js +2 -0
- package/dist/esm/ctx/pluginFrame.js.map +1 -0
- package/dist/esm/hooks/assetSources.d.ts +41 -0
- package/dist/esm/hooks/assetSources.js +2 -0
- package/dist/esm/hooks/assetSources.js.map +1 -0
- package/dist/esm/hooks/buildItemPresentationInfo.d.ts +28 -0
- package/dist/esm/hooks/buildItemPresentationInfo.js +2 -0
- package/dist/esm/hooks/buildItemPresentationInfo.js.map +1 -0
- package/dist/esm/hooks/contentAreaSidebarItems.d.ts +39 -0
- package/dist/esm/hooks/contentAreaSidebarItems.js +2 -0
- package/dist/esm/hooks/contentAreaSidebarItems.js.map +1 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js +2 -0
- package/dist/esm/hooks/customBlockStylesForStructuredTextField.js.map +1 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.d.ts +57 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.js +2 -0
- package/dist/esm/hooks/customMarksForStructuredTextField.js.map +1 -0
- package/dist/esm/hooks/executeFieldDropdownAction.d.ts +9 -0
- package/dist/esm/hooks/executeFieldDropdownAction.js +2 -0
- package/dist/esm/hooks/executeFieldDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.d.ts +8 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.js +2 -0
- package/dist/esm/hooks/executeItemFormDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeItemsDropdownAction.d.ts +10 -0
- package/dist/esm/hooks/executeItemsDropdownAction.js +2 -0
- package/dist/esm/hooks/executeItemsDropdownAction.js.map +1 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.d.ts +10 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.js +2 -0
- package/dist/esm/hooks/executeUploadsDropdownAction.js.map +1 -0
- package/dist/esm/hooks/fieldDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/fieldDropdownActions.js +2 -0
- package/dist/esm/hooks/fieldDropdownActions.js.map +1 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js +2 -0
- package/dist/esm/hooks/initialLocationQueryForItemSelector.js.map +1 -0
- package/dist/esm/hooks/itemCollectionOutlets.d.ts +24 -0
- package/dist/esm/hooks/itemCollectionOutlets.js +2 -0
- package/dist/esm/hooks/itemCollectionOutlets.js.map +1 -0
- package/dist/esm/hooks/itemFormDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/itemFormDropdownActions.js +2 -0
- package/dist/esm/hooks/itemFormDropdownActions.js.map +1 -0
- package/dist/esm/hooks/itemFormOutlets.d.ts +29 -0
- package/dist/esm/hooks/itemFormOutlets.js +2 -0
- package/dist/esm/hooks/itemFormOutlets.js.map +1 -0
- package/dist/esm/hooks/itemFormSidebarPanels.d.ts +47 -0
- package/dist/esm/hooks/itemFormSidebarPanels.js +2 -0
- package/dist/esm/hooks/itemFormSidebarPanels.js.map +1 -0
- package/dist/esm/hooks/itemFormSidebars.d.ts +37 -0
- package/dist/esm/hooks/itemFormSidebars.js +2 -0
- package/dist/esm/hooks/itemFormSidebars.js.map +1 -0
- package/dist/esm/hooks/itemsDropdownActions.d.ts +11 -0
- package/dist/esm/hooks/itemsDropdownActions.js +2 -0
- package/dist/esm/hooks/itemsDropdownActions.js.map +1 -0
- package/dist/esm/hooks/mainNavigationTabs.d.ts +43 -0
- package/dist/esm/hooks/mainNavigationTabs.js +2 -0
- package/dist/esm/hooks/mainNavigationTabs.js.map +1 -0
- package/dist/esm/hooks/manualFieldExtensions.d.ts +58 -0
- package/dist/esm/hooks/manualFieldExtensions.js +2 -0
- package/dist/esm/hooks/manualFieldExtensions.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemUpsert.d.ts +15 -0
- package/dist/esm/hooks/onBeforeItemUpsert.js +2 -0
- package/dist/esm/hooks/onBeforeItemUpsert.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.js +2 -0
- package/dist/esm/hooks/onBeforeItemsDestroy.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsPublish.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsPublish.js +2 -0
- package/dist/esm/hooks/onBeforeItemsPublish.js.map +1 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.d.ts +14 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.js +2 -0
- package/dist/esm/hooks/onBeforeItemsUnpublish.js.map +1 -0
- package/dist/esm/hooks/onBoot.d.ts +11 -0
- package/dist/esm/hooks/onBoot.js +2 -0
- package/dist/esm/hooks/onBoot.js.map +1 -0
- package/dist/esm/hooks/overrideFieldExtensions.d.ts +88 -0
- package/dist/esm/hooks/overrideFieldExtensions.js +2 -0
- package/dist/esm/hooks/overrideFieldExtensions.js.map +1 -0
- package/dist/esm/hooks/renderAssetSource.d.ts +98 -0
- package/dist/esm/hooks/renderAssetSource.js +8 -0
- package/dist/esm/hooks/renderAssetSource.js.map +1 -0
- package/dist/esm/hooks/renderConfigScreen.d.ts +12 -0
- package/dist/esm/hooks/renderConfigScreen.js +8 -0
- package/dist/esm/hooks/renderConfigScreen.js.map +1 -0
- package/dist/esm/hooks/renderFieldExtension.d.ts +20 -0
- package/dist/esm/hooks/renderFieldExtension.js +8 -0
- package/dist/esm/hooks/renderFieldExtension.js.map +1 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.d.ts +9 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.js +8 -0
- package/dist/esm/hooks/renderItemCollectionOutlet.js.map +1 -0
- package/dist/esm/hooks/renderItemFormOutlet.d.ts +16 -0
- package/dist/esm/hooks/renderItemFormOutlet.js +8 -0
- package/dist/esm/hooks/renderItemFormOutlet.js.map +1 -0
- package/dist/esm/hooks/renderItemFormSidebar.d.ts +21 -0
- package/dist/esm/hooks/renderItemFormSidebar.js +8 -0
- package/dist/esm/hooks/renderItemFormSidebar.js.map +1 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.d.ts +21 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.js +8 -0
- package/dist/esm/hooks/renderItemFormSidebarPanel.js.map +1 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js +8 -0
- package/dist/esm/hooks/renderManualFieldExtensionConfigScreen.js.map +1 -0
- package/dist/esm/hooks/renderModal.d.ts +37 -0
- package/dist/esm/hooks/renderModal.js +8 -0
- package/dist/esm/hooks/renderModal.js.map +1 -0
- package/dist/esm/hooks/renderPage.d.ts +16 -0
- package/dist/esm/hooks/renderPage.js +8 -0
- package/dist/esm/hooks/renderPage.js.map +1 -0
- package/dist/esm/hooks/renderUploadSidebar.d.ts +25 -0
- package/dist/esm/hooks/renderUploadSidebar.js +8 -0
- package/dist/esm/hooks/renderUploadSidebar.js.map +1 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.d.ts +25 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.js +8 -0
- package/dist/esm/hooks/renderUploadSidebarPanel.js.map +1 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.js +2 -0
- package/dist/esm/hooks/settingsAreaSidebarItemGroups.js.map +1 -0
- package/dist/esm/hooks/uploadSidebarPanels.d.ts +47 -0
- package/dist/esm/hooks/uploadSidebarPanels.js +2 -0
- package/dist/esm/hooks/uploadSidebarPanels.js.map +1 -0
- package/dist/esm/hooks/uploadSidebars.d.ts +34 -0
- package/dist/esm/hooks/uploadSidebars.js +2 -0
- package/dist/esm/hooks/uploadSidebars.js.map +1 -0
- package/dist/esm/hooks/uploadsDropdownActions.d.ts +5 -0
- package/dist/esm/hooks/uploadsDropdownActions.js +2 -0
- package/dist/esm/hooks/uploadsDropdownActions.js.map +1 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js +2 -0
- package/dist/esm/hooks/validateManualFieldExtensionParameters.js.map +1 -0
- package/dist/esm/icon.d.ts +6 -0
- package/dist/esm/icon.js +2 -0
- package/dist/esm/icon.js.map +1 -0
- package/dist/esm/index.d.ts +57 -12
- package/dist/esm/index.js +46 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/manifest.d.ts +2 -0
- package/dist/esm/manifest.js +2906 -0
- package/dist/esm/manifest.js.map +1 -0
- package/dist/esm/manifestTypes.d.ts +51 -0
- package/dist/esm/manifestTypes.js +2 -0
- package/dist/esm/manifestTypes.js.map +1 -0
- package/dist/esm/shared.d.ts +56 -0
- package/dist/esm/shared.js +2 -0
- package/dist/esm/shared.js.map +1 -0
- package/dist/esm/utils.d.ts +31 -0
- package/dist/esm/utils.js +129 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/types/connect.d.ts +44 -242
- package/dist/types/ctx/base.d.ts +670 -0
- package/dist/types/ctx/commonExtras/field.d.ts +29 -0
- package/dist/types/ctx/commonExtras/itemForm.d.ts +148 -0
- package/dist/types/ctx/commonExtras/sizing.d.ts +23 -0
- package/dist/types/ctx/pluginFrame.d.ts +12 -0
- package/dist/types/hooks/assetSources.d.ts +41 -0
- package/dist/types/hooks/buildItemPresentationInfo.d.ts +28 -0
- package/dist/types/hooks/contentAreaSidebarItems.d.ts +39 -0
- package/dist/types/hooks/customBlockStylesForStructuredTextField.d.ts +36 -0
- package/dist/types/hooks/customMarksForStructuredTextField.d.ts +57 -0
- package/dist/types/hooks/executeFieldDropdownAction.d.ts +9 -0
- package/dist/types/hooks/executeItemFormDropdownAction.d.ts +8 -0
- package/dist/types/hooks/executeItemsDropdownAction.d.ts +10 -0
- package/dist/types/hooks/executeUploadsDropdownAction.d.ts +10 -0
- package/dist/types/hooks/fieldDropdownActions.d.ts +11 -0
- package/dist/types/hooks/initialLocationQueryForItemSelector.d.ts +26 -0
- package/dist/types/hooks/itemCollectionOutlets.d.ts +24 -0
- package/dist/types/hooks/itemFormDropdownActions.d.ts +11 -0
- package/dist/types/hooks/itemFormOutlets.d.ts +29 -0
- package/dist/types/hooks/itemFormSidebarPanels.d.ts +47 -0
- package/dist/types/hooks/itemFormSidebars.d.ts +37 -0
- package/dist/types/hooks/itemsDropdownActions.d.ts +11 -0
- package/dist/types/hooks/mainNavigationTabs.d.ts +43 -0
- package/dist/types/hooks/manualFieldExtensions.d.ts +58 -0
- package/dist/types/hooks/onBeforeItemUpsert.d.ts +15 -0
- package/dist/types/hooks/onBeforeItemsDestroy.d.ts +14 -0
- package/dist/types/hooks/onBeforeItemsPublish.d.ts +14 -0
- package/dist/types/hooks/onBeforeItemsUnpublish.d.ts +14 -0
- package/dist/types/hooks/onBoot.d.ts +11 -0
- package/dist/types/hooks/overrideFieldExtensions.d.ts +88 -0
- package/dist/types/hooks/renderAssetSource.d.ts +98 -0
- package/dist/types/hooks/renderConfigScreen.d.ts +12 -0
- package/dist/types/hooks/renderFieldExtension.d.ts +20 -0
- package/dist/types/hooks/renderItemCollectionOutlet.d.ts +9 -0
- package/dist/types/hooks/renderItemFormOutlet.d.ts +16 -0
- package/dist/types/hooks/renderItemFormSidebar.d.ts +21 -0
- package/dist/types/hooks/renderItemFormSidebarPanel.d.ts +21 -0
- package/dist/types/hooks/renderManualFieldExtensionConfigScreen.d.ts +55 -0
- package/dist/types/hooks/renderModal.d.ts +37 -0
- package/dist/types/hooks/renderPage.d.ts +16 -0
- package/dist/types/hooks/renderUploadSidebar.d.ts +25 -0
- package/dist/types/hooks/renderUploadSidebarPanel.d.ts +25 -0
- package/dist/types/hooks/settingsAreaSidebarItemGroups.d.ts +52 -0
- package/dist/types/hooks/uploadSidebarPanels.d.ts +47 -0
- package/dist/types/hooks/uploadSidebars.d.ts +34 -0
- package/dist/types/hooks/uploadsDropdownActions.d.ts +5 -0
- package/dist/types/hooks/validateManualFieldExtensionParameters.d.ts +9 -0
- package/dist/types/icon.d.ts +6 -0
- package/dist/types/index.d.ts +57 -12
- package/dist/types/manifest.d.ts +2 -0
- package/dist/types/manifestTypes.d.ts +51 -0
- package/dist/types/shared.d.ts +56 -0
- package/dist/types/utils.d.ts +31 -0
- package/manifest.json +2905 -0
- package/package.json +7 -6
- package/src/connect.ts +207 -698
- package/src/ctx/base.ts +714 -0
- package/src/ctx/commonExtras/field.ts +27 -0
- package/src/ctx/commonExtras/itemForm.ts +155 -0
- package/src/ctx/commonExtras/sizing.ts +27 -0
- package/src/ctx/pluginFrame.ts +39 -0
- package/src/hooks/assetSources.ts +43 -0
- package/src/hooks/buildItemPresentationInfo.ts +33 -0
- package/src/hooks/contentAreaSidebarItems.ts +41 -0
- package/src/hooks/customBlockStylesForStructuredTextField.ts +42 -0
- package/src/hooks/customMarksForStructuredTextField.ts +64 -0
- package/src/hooks/executeFieldDropdownAction.ts +21 -0
- package/src/hooks/executeItemFormDropdownAction.ts +19 -0
- package/src/hooks/executeItemsDropdownAction.ts +16 -0
- package/src/hooks/executeUploadsDropdownAction.ts +15 -0
- package/src/hooks/fieldDropdownActions.ts +18 -0
- package/src/hooks/initialLocationQueryForItemSelector.ts +33 -0
- package/src/hooks/itemCollectionOutlets.ts +29 -0
- package/src/hooks/itemFormDropdownActions.ts +18 -0
- package/src/hooks/itemFormOutlets.ts +31 -0
- package/src/hooks/itemFormSidebarPanels.ts +52 -0
- package/src/hooks/itemFormSidebars.ts +39 -0
- package/src/hooks/itemsDropdownActions.ts +16 -0
- package/src/hooks/mainNavigationTabs.ts +45 -0
- package/src/hooks/manualFieldExtensions.ts +78 -0
- package/src/hooks/onBeforeItemUpsert.ts +19 -0
- package/src/hooks/onBeforeItemsDestroy.ts +15 -0
- package/src/hooks/onBeforeItemsPublish.ts +15 -0
- package/src/hooks/onBeforeItemsUnpublish.ts +15 -0
- package/src/hooks/onBoot.ts +13 -0
- package/src/hooks/overrideFieldExtensions.ts +95 -0
- package/src/hooks/renderAssetSource.ts +119 -0
- package/src/hooks/renderConfigScreen.ts +27 -0
- package/src/hooks/renderFieldExtension.ts +46 -0
- package/src/hooks/renderItemCollectionOutlet.ts +29 -0
- package/src/hooks/renderItemFormOutlet.ts +40 -0
- package/src/hooks/renderItemFormSidebar.ts +45 -0
- package/src/hooks/renderItemFormSidebarPanel.ts +46 -0
- package/src/hooks/renderManualFieldExtensionConfigScreen.ts +83 -0
- package/src/hooks/renderModal.ts +54 -0
- package/src/hooks/renderPage.ts +33 -0
- package/src/hooks/renderUploadSidebar.ts +44 -0
- package/src/hooks/renderUploadSidebarPanel.ts +47 -0
- package/src/hooks/settingsAreaSidebarItemGroups.ts +55 -0
- package/src/hooks/uploadSidebarPanels.ts +57 -0
- package/src/hooks/uploadSidebars.ts +36 -0
- package/src/hooks/uploadsDropdownActions.ts +8 -0
- package/src/hooks/validateManualFieldExtensionParameters.ts +12 -0
- package/src/{types.ts → icon.ts} +0 -1739
- package/src/index.ts +49 -4
- package/src/manifest.ts +3062 -0
- package/src/manifestTypes.ts +56 -0
- package/src/shared.ts +67 -0
- package/src/utils.ts +253 -0
- package/dist/cjs/guards.js +0 -19
- package/dist/cjs/guards.js.map +0 -1
- package/dist/cjs/types.js.map +0 -1
- package/dist/esm/guards.d.ts +0 -37
- package/dist/esm/guards.js +0 -16
- package/dist/esm/guards.js.map +0 -1
- package/dist/esm/types.d.ts +0 -1569
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/dist/types/guards.d.ts +0 -37
- package/dist/types/types.d.ts +0 -1569
- package/src/guards.ts +0 -51
- package/types.json +0 -37395
|
@@ -0,0 +1,2906 @@
|
|
|
1
|
+
export var manifest = {
|
|
2
|
+
hooks: {
|
|
3
|
+
validateManualFieldExtensionParameters: {
|
|
4
|
+
name: 'validateManualFieldExtensionParameters',
|
|
5
|
+
comment: {
|
|
6
|
+
comment: 'This function will be called each time the configuration object changes. It\nmust return an object containing possible validation errors',
|
|
7
|
+
tag: 'manualFieldExtensions',
|
|
8
|
+
},
|
|
9
|
+
nonCtxArguments: [
|
|
10
|
+
{
|
|
11
|
+
name: 'fieldExtensionId',
|
|
12
|
+
typeName: 'string',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'parameters',
|
|
16
|
+
typeName: 'Record<string, unknown>',
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
ctxArgument: null,
|
|
20
|
+
returnType: 'Record<string, unknown> | Promise<Record<string, unknown>>',
|
|
21
|
+
location: {
|
|
22
|
+
filePath: 'src/hooks/validateManualFieldExtensionParameters.ts',
|
|
23
|
+
lineNumber: 8,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
uploadsDropdownActions: {
|
|
27
|
+
name: 'uploadsDropdownActions',
|
|
28
|
+
comment: null,
|
|
29
|
+
nonCtxArguments: [],
|
|
30
|
+
ctxArgument: {
|
|
31
|
+
type: 'Ctx',
|
|
32
|
+
additionalProperties: null,
|
|
33
|
+
additionalMethods: null,
|
|
34
|
+
},
|
|
35
|
+
returnType: 'Array<DropdownAction | DropdownActionGroup>',
|
|
36
|
+
location: {
|
|
37
|
+
filePath: 'src/hooks/uploadsDropdownActions.ts',
|
|
38
|
+
lineNumber: 5,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
uploadSidebars: {
|
|
42
|
+
name: 'uploadSidebars',
|
|
43
|
+
comment: {
|
|
44
|
+
comment: 'Use this function to declare new sidebar to be shown when the user opens\nup an asset in the Media Area',
|
|
45
|
+
tag: 'sidebarPanels',
|
|
46
|
+
},
|
|
47
|
+
nonCtxArguments: [],
|
|
48
|
+
ctxArgument: {
|
|
49
|
+
type: 'Ctx',
|
|
50
|
+
additionalProperties: null,
|
|
51
|
+
additionalMethods: null,
|
|
52
|
+
},
|
|
53
|
+
returnType: 'UploadSidebar[]',
|
|
54
|
+
location: {
|
|
55
|
+
filePath: 'src/hooks/uploadSidebars.ts',
|
|
56
|
+
lineNumber: 10,
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
uploadSidebarPanels: {
|
|
60
|
+
name: 'uploadSidebarPanels',
|
|
61
|
+
comment: {
|
|
62
|
+
comment: 'Use this function to declare new sidebar panels to be shown when the user\nopens up an asset in the Media Area',
|
|
63
|
+
tag: 'sidebarPanels',
|
|
64
|
+
},
|
|
65
|
+
nonCtxArguments: [],
|
|
66
|
+
ctxArgument: {
|
|
67
|
+
type: 'Ctx',
|
|
68
|
+
additionalProperties: null,
|
|
69
|
+
additionalMethods: null,
|
|
70
|
+
},
|
|
71
|
+
returnType: 'UploadSidebarPanel[]',
|
|
72
|
+
location: {
|
|
73
|
+
filePath: 'src/hooks/uploadSidebarPanels.ts',
|
|
74
|
+
lineNumber: 10,
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
settingsAreaSidebarItemGroups: {
|
|
78
|
+
name: 'settingsAreaSidebarItemGroups',
|
|
79
|
+
comment: {
|
|
80
|
+
comment: 'Use this function to declare new navigation sections in the Settings Area\nsidebar',
|
|
81
|
+
tag: 'pages',
|
|
82
|
+
},
|
|
83
|
+
nonCtxArguments: [],
|
|
84
|
+
ctxArgument: {
|
|
85
|
+
type: 'Ctx',
|
|
86
|
+
additionalProperties: null,
|
|
87
|
+
additionalMethods: null,
|
|
88
|
+
},
|
|
89
|
+
returnType: 'SettingsAreaSidebarItemGroup[]',
|
|
90
|
+
location: {
|
|
91
|
+
filePath: 'src/hooks/settingsAreaSidebarItemGroups.ts',
|
|
92
|
+
lineNumber: 11,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
renderUploadSidebarPanel: {
|
|
96
|
+
name: 'renderUploadSidebarPanel',
|
|
97
|
+
comment: {
|
|
98
|
+
comment: 'This function will be called when the plugin needs to render a sidebar panel\n(see the `uploadSidebarPanels` function)',
|
|
99
|
+
tag: 'sidebarPanels',
|
|
100
|
+
},
|
|
101
|
+
nonCtxArguments: [
|
|
102
|
+
{
|
|
103
|
+
name: 'sidebarPaneId',
|
|
104
|
+
typeName: 'string',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
ctxArgument: {
|
|
108
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
109
|
+
additionalProperties: {
|
|
110
|
+
sidebarPaneId: {
|
|
111
|
+
comment: {
|
|
112
|
+
comment: 'The ID of the sidebar panel that needs to be rendered',
|
|
113
|
+
},
|
|
114
|
+
location: {
|
|
115
|
+
filePath: 'src/hooks/renderUploadSidebarPanel.ts',
|
|
116
|
+
lineNumber: 24,
|
|
117
|
+
},
|
|
118
|
+
type: 'string',
|
|
119
|
+
},
|
|
120
|
+
parameters: {
|
|
121
|
+
comment: {
|
|
122
|
+
comment: 'The arbitrary `parameters` of the panel declared in the\n`uploadSidebarPanels` function',
|
|
123
|
+
},
|
|
124
|
+
location: {
|
|
125
|
+
filePath: 'src/hooks/renderUploadSidebarPanel.ts',
|
|
126
|
+
lineNumber: 30,
|
|
127
|
+
},
|
|
128
|
+
type: 'Record<string, unknown>',
|
|
129
|
+
},
|
|
130
|
+
upload: {
|
|
131
|
+
comment: {
|
|
132
|
+
comment: 'The active asset',
|
|
133
|
+
},
|
|
134
|
+
location: {
|
|
135
|
+
filePath: 'src/hooks/renderUploadSidebarPanel.ts',
|
|
136
|
+
lineNumber: 33,
|
|
137
|
+
},
|
|
138
|
+
type: 'Upload',
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
additionalMethods: null,
|
|
142
|
+
},
|
|
143
|
+
returnType: 'void',
|
|
144
|
+
location: {
|
|
145
|
+
filePath: 'src/hooks/renderUploadSidebarPanel.ts',
|
|
146
|
+
lineNumber: 14,
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
renderUploadSidebar: {
|
|
150
|
+
name: 'renderUploadSidebar',
|
|
151
|
+
comment: {
|
|
152
|
+
comment: 'This function will be called when the plugin needs to render a sidebar (see\nthe `uploadSidebars` function)',
|
|
153
|
+
tag: 'sidebarPanels',
|
|
154
|
+
},
|
|
155
|
+
nonCtxArguments: [
|
|
156
|
+
{
|
|
157
|
+
name: 'sidebarId',
|
|
158
|
+
typeName: 'string',
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
ctxArgument: {
|
|
162
|
+
type: 'ImposedSizePluginFrameCtx',
|
|
163
|
+
additionalProperties: {
|
|
164
|
+
sidebarId: {
|
|
165
|
+
comment: {
|
|
166
|
+
comment: 'The ID of the sidebar that needs to be rendered',
|
|
167
|
+
},
|
|
168
|
+
location: {
|
|
169
|
+
filePath: 'src/hooks/renderUploadSidebar.ts',
|
|
170
|
+
lineNumber: 21,
|
|
171
|
+
},
|
|
172
|
+
type: 'string',
|
|
173
|
+
},
|
|
174
|
+
parameters: {
|
|
175
|
+
comment: {
|
|
176
|
+
comment: 'The arbitrary `parameters` of the declared in the `uploadSidebars`\nfunction',
|
|
177
|
+
},
|
|
178
|
+
location: {
|
|
179
|
+
filePath: 'src/hooks/renderUploadSidebar.ts',
|
|
180
|
+
lineNumber: 27,
|
|
181
|
+
},
|
|
182
|
+
type: 'Record<string, unknown>',
|
|
183
|
+
},
|
|
184
|
+
upload: {
|
|
185
|
+
comment: {
|
|
186
|
+
comment: 'The active asset',
|
|
187
|
+
},
|
|
188
|
+
location: {
|
|
189
|
+
filePath: 'src/hooks/renderUploadSidebar.ts',
|
|
190
|
+
lineNumber: 30,
|
|
191
|
+
},
|
|
192
|
+
type: 'Upload',
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
additionalMethods: null,
|
|
196
|
+
},
|
|
197
|
+
returnType: 'void',
|
|
198
|
+
location: {
|
|
199
|
+
filePath: 'src/hooks/renderUploadSidebar.ts',
|
|
200
|
+
lineNumber: 14,
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
renderPage: {
|
|
204
|
+
name: 'renderPage',
|
|
205
|
+
comment: {
|
|
206
|
+
comment: 'This function will be called when the plugin needs to render a specific\npage (see the `mainNavigationTabs`, `settingsAreaSidebarItemGroups` and\n`contentAreaSidebarItems` functions)',
|
|
207
|
+
tag: 'pages',
|
|
208
|
+
},
|
|
209
|
+
nonCtxArguments: [
|
|
210
|
+
{
|
|
211
|
+
name: 'pageId',
|
|
212
|
+
typeName: 'string',
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
ctxArgument: {
|
|
216
|
+
type: 'ImposedSizePluginFrameCtx',
|
|
217
|
+
additionalProperties: {
|
|
218
|
+
pageId: {
|
|
219
|
+
comment: {
|
|
220
|
+
comment: 'The ID of the page that needs to be rendered',
|
|
221
|
+
},
|
|
222
|
+
location: {
|
|
223
|
+
filePath: 'src/hooks/renderPage.ts',
|
|
224
|
+
lineNumber: 19,
|
|
225
|
+
},
|
|
226
|
+
type: 'string',
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
additionalMethods: null,
|
|
230
|
+
},
|
|
231
|
+
returnType: 'void',
|
|
232
|
+
location: {
|
|
233
|
+
filePath: 'src/hooks/renderPage.ts',
|
|
234
|
+
lineNumber: 12,
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
renderModal: {
|
|
238
|
+
name: 'renderModal',
|
|
239
|
+
comment: {
|
|
240
|
+
comment: 'This function will be called when the plugin requested to open a modal (see\nthe `openModal` function)',
|
|
241
|
+
tag: 'modals',
|
|
242
|
+
},
|
|
243
|
+
nonCtxArguments: [
|
|
244
|
+
{
|
|
245
|
+
name: 'modalId',
|
|
246
|
+
typeName: 'string',
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
ctxArgument: {
|
|
250
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
251
|
+
additionalProperties: {
|
|
252
|
+
modalId: {
|
|
253
|
+
comment: {
|
|
254
|
+
comment: 'The ID of the modal that needs to be rendered',
|
|
255
|
+
},
|
|
256
|
+
location: {
|
|
257
|
+
filePath: 'src/hooks/renderModal.ts',
|
|
258
|
+
lineNumber: 17,
|
|
259
|
+
},
|
|
260
|
+
type: 'string',
|
|
261
|
+
},
|
|
262
|
+
parameters: {
|
|
263
|
+
comment: {
|
|
264
|
+
comment: 'The arbitrary `parameters` of the modal declared in the `openModal`\nfunction',
|
|
265
|
+
},
|
|
266
|
+
location: {
|
|
267
|
+
filePath: 'src/hooks/renderModal.ts',
|
|
268
|
+
lineNumber: 22,
|
|
269
|
+
},
|
|
270
|
+
type: 'Record<string, unknown>',
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
additionalMethods: {
|
|
274
|
+
resolve: {
|
|
275
|
+
comment: {
|
|
276
|
+
comment: 'A function to be called by the plugin to close the modal. The `openModal`\ncall will be resolved with the passed return value',
|
|
277
|
+
example: "const returnValue = prompt(\n 'Please specify the value to return to the caller:',\n 'success',\n);\n\nawait ctx.resolve(returnValue);",
|
|
278
|
+
},
|
|
279
|
+
location: {
|
|
280
|
+
filePath: 'src/hooks/renderModal.ts',
|
|
281
|
+
lineNumber: 40,
|
|
282
|
+
},
|
|
283
|
+
type: '(returnValue: unknown) => Promise<void>',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
returnType: 'void',
|
|
288
|
+
location: {
|
|
289
|
+
filePath: 'src/hooks/renderModal.ts',
|
|
290
|
+
lineNumber: 11,
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
renderManualFieldExtensionConfigScreen: {
|
|
294
|
+
name: 'renderManualFieldExtensionConfigScreen',
|
|
295
|
+
comment: null,
|
|
296
|
+
nonCtxArguments: [
|
|
297
|
+
{
|
|
298
|
+
name: 'fieldExtensionId',
|
|
299
|
+
typeName: 'string',
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
ctxArgument: {
|
|
303
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
304
|
+
additionalProperties: {
|
|
305
|
+
fieldExtensionId: {
|
|
306
|
+
comment: {
|
|
307
|
+
comment: 'The ID of the field extension for which we need to render the parameters\nform',
|
|
308
|
+
},
|
|
309
|
+
location: {
|
|
310
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
311
|
+
lineNumber: 23,
|
|
312
|
+
},
|
|
313
|
+
type: 'string',
|
|
314
|
+
},
|
|
315
|
+
parameters: {
|
|
316
|
+
comment: {
|
|
317
|
+
comment: 'The current value of the parameters (you can change the value with the\n`setParameters` function)',
|
|
318
|
+
},
|
|
319
|
+
location: {
|
|
320
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
321
|
+
lineNumber: 28,
|
|
322
|
+
},
|
|
323
|
+
type: 'Record<string, unknown>',
|
|
324
|
+
},
|
|
325
|
+
errors: {
|
|
326
|
+
comment: {
|
|
327
|
+
comment: 'The current validation errors for the parameters (you can set them\nimplementing the `validateManualFieldExtensionParameters` function)',
|
|
328
|
+
},
|
|
329
|
+
location: {
|
|
330
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
331
|
+
lineNumber: 33,
|
|
332
|
+
},
|
|
333
|
+
type: 'Record<string, unknown>',
|
|
334
|
+
},
|
|
335
|
+
pendingField: {
|
|
336
|
+
comment: {
|
|
337
|
+
comment: 'The field entity that is being edited in the form',
|
|
338
|
+
},
|
|
339
|
+
location: {
|
|
340
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
341
|
+
lineNumber: 36,
|
|
342
|
+
},
|
|
343
|
+
type: 'PendingField',
|
|
344
|
+
},
|
|
345
|
+
itemType: {
|
|
346
|
+
comment: {
|
|
347
|
+
comment: 'The model for the field being edited',
|
|
348
|
+
},
|
|
349
|
+
location: {
|
|
350
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
351
|
+
lineNumber: 39,
|
|
352
|
+
},
|
|
353
|
+
type: 'ItemType',
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
additionalMethods: {
|
|
357
|
+
setParameters: {
|
|
358
|
+
comment: {
|
|
359
|
+
comment: 'Sets a new value for the parameters',
|
|
360
|
+
example: "await ctx.setParameters({ color: '#ff0000' });",
|
|
361
|
+
},
|
|
362
|
+
location: {
|
|
363
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
364
|
+
lineNumber: 51,
|
|
365
|
+
},
|
|
366
|
+
type: '(params: Record<string, unknown>) => Promise<void>',
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
},
|
|
370
|
+
returnType: 'void',
|
|
371
|
+
location: {
|
|
372
|
+
filePath: 'src/hooks/renderManualFieldExtensionConfigScreen.ts',
|
|
373
|
+
lineNumber: 9,
|
|
374
|
+
},
|
|
375
|
+
},
|
|
376
|
+
renderItemFormSidebarPanel: {
|
|
377
|
+
name: 'renderItemFormSidebarPanel',
|
|
378
|
+
comment: {
|
|
379
|
+
comment: 'This function will be called when the plugin needs to render a sidebar panel\n(see the `itemFormSidebarPanels` function)',
|
|
380
|
+
tag: 'sidebarPanels',
|
|
381
|
+
},
|
|
382
|
+
nonCtxArguments: [
|
|
383
|
+
{
|
|
384
|
+
name: 'sidebarPaneId',
|
|
385
|
+
typeName: 'string',
|
|
386
|
+
},
|
|
387
|
+
],
|
|
388
|
+
ctxArgument: {
|
|
389
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
390
|
+
additionalProperties: {
|
|
391
|
+
locale: {
|
|
392
|
+
comment: {
|
|
393
|
+
comment: 'The currently active locale for the record',
|
|
394
|
+
},
|
|
395
|
+
location: {
|
|
396
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
397
|
+
lineNumber: 12,
|
|
398
|
+
},
|
|
399
|
+
type: 'string',
|
|
400
|
+
},
|
|
401
|
+
item: {
|
|
402
|
+
comment: {
|
|
403
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
404
|
+
},
|
|
405
|
+
location: {
|
|
406
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
407
|
+
lineNumber: 17,
|
|
408
|
+
},
|
|
409
|
+
type: 'Item | null',
|
|
410
|
+
},
|
|
411
|
+
itemType: {
|
|
412
|
+
comment: {
|
|
413
|
+
comment: 'The model for the record being edited',
|
|
414
|
+
},
|
|
415
|
+
location: {
|
|
416
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
417
|
+
lineNumber: 19,
|
|
418
|
+
},
|
|
419
|
+
type: 'ItemType',
|
|
420
|
+
},
|
|
421
|
+
formValues: {
|
|
422
|
+
comment: {
|
|
423
|
+
comment: 'The complete internal form state',
|
|
424
|
+
},
|
|
425
|
+
location: {
|
|
426
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
427
|
+
lineNumber: 21,
|
|
428
|
+
},
|
|
429
|
+
type: 'Record<string, unknown>',
|
|
430
|
+
},
|
|
431
|
+
itemStatus: {
|
|
432
|
+
comment: {
|
|
433
|
+
comment: 'The current status of the record being edited',
|
|
434
|
+
},
|
|
435
|
+
location: {
|
|
436
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
437
|
+
lineNumber: 23,
|
|
438
|
+
},
|
|
439
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
440
|
+
},
|
|
441
|
+
isSubmitting: {
|
|
442
|
+
comment: {
|
|
443
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
444
|
+
},
|
|
445
|
+
location: {
|
|
446
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
447
|
+
lineNumber: 25,
|
|
448
|
+
},
|
|
449
|
+
type: 'boolean',
|
|
450
|
+
},
|
|
451
|
+
isFormDirty: {
|
|
452
|
+
comment: {
|
|
453
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
454
|
+
},
|
|
455
|
+
location: {
|
|
456
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
457
|
+
lineNumber: 27,
|
|
458
|
+
},
|
|
459
|
+
type: 'boolean',
|
|
460
|
+
},
|
|
461
|
+
blocksAnalysis: {
|
|
462
|
+
comment: {
|
|
463
|
+
comment: 'Current number of blocks present in form state',
|
|
464
|
+
},
|
|
465
|
+
location: {
|
|
466
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
467
|
+
lineNumber: 29,
|
|
468
|
+
},
|
|
469
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
470
|
+
},
|
|
471
|
+
sidebarPaneId: {
|
|
472
|
+
comment: {
|
|
473
|
+
comment: 'The ID of the sidebar panel that needs to be rendered',
|
|
474
|
+
},
|
|
475
|
+
location: {
|
|
476
|
+
filePath: 'src/hooks/renderItemFormSidebarPanel.ts',
|
|
477
|
+
lineNumber: 25,
|
|
478
|
+
},
|
|
479
|
+
type: 'string',
|
|
480
|
+
},
|
|
481
|
+
parameters: {
|
|
482
|
+
comment: {
|
|
483
|
+
comment: 'The arbitrary `parameters` of the panel declared in the\n`itemFormSidebarPanels` function',
|
|
484
|
+
},
|
|
485
|
+
location: {
|
|
486
|
+
filePath: 'src/hooks/renderItemFormSidebarPanel.ts',
|
|
487
|
+
lineNumber: 31,
|
|
488
|
+
},
|
|
489
|
+
type: 'Record<string, unknown>',
|
|
490
|
+
},
|
|
491
|
+
},
|
|
492
|
+
additionalMethods: {
|
|
493
|
+
toggleField: {
|
|
494
|
+
comment: {
|
|
495
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
496
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
497
|
+
},
|
|
498
|
+
location: {
|
|
499
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
500
|
+
lineNumber: 65,
|
|
501
|
+
},
|
|
502
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
503
|
+
},
|
|
504
|
+
disableField: {
|
|
505
|
+
comment: {
|
|
506
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
507
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
508
|
+
},
|
|
509
|
+
location: {
|
|
510
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
511
|
+
lineNumber: 80,
|
|
512
|
+
},
|
|
513
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
514
|
+
},
|
|
515
|
+
scrollToField: {
|
|
516
|
+
comment: {
|
|
517
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
518
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
519
|
+
},
|
|
520
|
+
location: {
|
|
521
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
522
|
+
lineNumber: 97,
|
|
523
|
+
},
|
|
524
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
525
|
+
},
|
|
526
|
+
setFieldValue: {
|
|
527
|
+
comment: {
|
|
528
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
529
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
530
|
+
},
|
|
531
|
+
location: {
|
|
532
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
533
|
+
lineNumber: 112,
|
|
534
|
+
},
|
|
535
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
536
|
+
},
|
|
537
|
+
formValuesToItem: {
|
|
538
|
+
comment: {
|
|
539
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
540
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
541
|
+
},
|
|
542
|
+
location: {
|
|
543
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
544
|
+
lineNumber: 129,
|
|
545
|
+
},
|
|
546
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
547
|
+
},
|
|
548
|
+
itemToFormValues: {
|
|
549
|
+
comment: {
|
|
550
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
551
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
552
|
+
},
|
|
553
|
+
location: {
|
|
554
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
555
|
+
lineNumber: 142,
|
|
556
|
+
},
|
|
557
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
558
|
+
},
|
|
559
|
+
saveCurrentItem: {
|
|
560
|
+
comment: {
|
|
561
|
+
comment: 'Triggers a submit form for current record',
|
|
562
|
+
example: 'await ctx.saveCurrentItem();',
|
|
563
|
+
},
|
|
564
|
+
location: {
|
|
565
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
566
|
+
lineNumber: 154,
|
|
567
|
+
},
|
|
568
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
569
|
+
},
|
|
570
|
+
},
|
|
571
|
+
},
|
|
572
|
+
returnType: 'void',
|
|
573
|
+
location: {
|
|
574
|
+
filePath: 'src/hooks/renderItemFormSidebarPanel.ts',
|
|
575
|
+
lineNumber: 15,
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
renderItemFormSidebar: {
|
|
579
|
+
name: 'renderItemFormSidebar',
|
|
580
|
+
comment: {
|
|
581
|
+
comment: 'This function will be called when the plugin needs to render a sidebar (see\nthe `itemFormSidebars` function)',
|
|
582
|
+
tag: 'sidebarPanels',
|
|
583
|
+
},
|
|
584
|
+
nonCtxArguments: [
|
|
585
|
+
{
|
|
586
|
+
name: 'sidebarId',
|
|
587
|
+
typeName: 'string',
|
|
588
|
+
},
|
|
589
|
+
],
|
|
590
|
+
ctxArgument: {
|
|
591
|
+
type: 'ImposedSizePluginFrameCtx',
|
|
592
|
+
additionalProperties: {
|
|
593
|
+
locale: {
|
|
594
|
+
comment: {
|
|
595
|
+
comment: 'The currently active locale for the record',
|
|
596
|
+
},
|
|
597
|
+
location: {
|
|
598
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
599
|
+
lineNumber: 12,
|
|
600
|
+
},
|
|
601
|
+
type: 'string',
|
|
602
|
+
},
|
|
603
|
+
item: {
|
|
604
|
+
comment: {
|
|
605
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
606
|
+
},
|
|
607
|
+
location: {
|
|
608
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
609
|
+
lineNumber: 17,
|
|
610
|
+
},
|
|
611
|
+
type: 'Item | null',
|
|
612
|
+
},
|
|
613
|
+
itemType: {
|
|
614
|
+
comment: {
|
|
615
|
+
comment: 'The model for the record being edited',
|
|
616
|
+
},
|
|
617
|
+
location: {
|
|
618
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
619
|
+
lineNumber: 19,
|
|
620
|
+
},
|
|
621
|
+
type: 'ItemType',
|
|
622
|
+
},
|
|
623
|
+
formValues: {
|
|
624
|
+
comment: {
|
|
625
|
+
comment: 'The complete internal form state',
|
|
626
|
+
},
|
|
627
|
+
location: {
|
|
628
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
629
|
+
lineNumber: 21,
|
|
630
|
+
},
|
|
631
|
+
type: 'Record<string, unknown>',
|
|
632
|
+
},
|
|
633
|
+
itemStatus: {
|
|
634
|
+
comment: {
|
|
635
|
+
comment: 'The current status of the record being edited',
|
|
636
|
+
},
|
|
637
|
+
location: {
|
|
638
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
639
|
+
lineNumber: 23,
|
|
640
|
+
},
|
|
641
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
642
|
+
},
|
|
643
|
+
isSubmitting: {
|
|
644
|
+
comment: {
|
|
645
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
646
|
+
},
|
|
647
|
+
location: {
|
|
648
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
649
|
+
lineNumber: 25,
|
|
650
|
+
},
|
|
651
|
+
type: 'boolean',
|
|
652
|
+
},
|
|
653
|
+
isFormDirty: {
|
|
654
|
+
comment: {
|
|
655
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
656
|
+
},
|
|
657
|
+
location: {
|
|
658
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
659
|
+
lineNumber: 27,
|
|
660
|
+
},
|
|
661
|
+
type: 'boolean',
|
|
662
|
+
},
|
|
663
|
+
blocksAnalysis: {
|
|
664
|
+
comment: {
|
|
665
|
+
comment: 'Current number of blocks present in form state',
|
|
666
|
+
},
|
|
667
|
+
location: {
|
|
668
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
669
|
+
lineNumber: 29,
|
|
670
|
+
},
|
|
671
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
672
|
+
},
|
|
673
|
+
sidebarId: {
|
|
674
|
+
comment: {
|
|
675
|
+
comment: 'The ID of the sidebar that needs to be rendered',
|
|
676
|
+
},
|
|
677
|
+
location: {
|
|
678
|
+
filePath: 'src/hooks/renderItemFormSidebar.ts',
|
|
679
|
+
lineNumber: 25,
|
|
680
|
+
},
|
|
681
|
+
type: 'string',
|
|
682
|
+
},
|
|
683
|
+
parameters: {
|
|
684
|
+
comment: {
|
|
685
|
+
comment: 'The arbitrary `parameters` of the declared in the `itemFormSidebars`\nfunction',
|
|
686
|
+
},
|
|
687
|
+
location: {
|
|
688
|
+
filePath: 'src/hooks/renderItemFormSidebar.ts',
|
|
689
|
+
lineNumber: 30,
|
|
690
|
+
},
|
|
691
|
+
type: 'Record<string, unknown>',
|
|
692
|
+
},
|
|
693
|
+
},
|
|
694
|
+
additionalMethods: {
|
|
695
|
+
toggleField: {
|
|
696
|
+
comment: {
|
|
697
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
698
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
699
|
+
},
|
|
700
|
+
location: {
|
|
701
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
702
|
+
lineNumber: 65,
|
|
703
|
+
},
|
|
704
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
705
|
+
},
|
|
706
|
+
disableField: {
|
|
707
|
+
comment: {
|
|
708
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
709
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
710
|
+
},
|
|
711
|
+
location: {
|
|
712
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
713
|
+
lineNumber: 80,
|
|
714
|
+
},
|
|
715
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
716
|
+
},
|
|
717
|
+
scrollToField: {
|
|
718
|
+
comment: {
|
|
719
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
720
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
721
|
+
},
|
|
722
|
+
location: {
|
|
723
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
724
|
+
lineNumber: 97,
|
|
725
|
+
},
|
|
726
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
727
|
+
},
|
|
728
|
+
setFieldValue: {
|
|
729
|
+
comment: {
|
|
730
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
731
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
732
|
+
},
|
|
733
|
+
location: {
|
|
734
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
735
|
+
lineNumber: 112,
|
|
736
|
+
},
|
|
737
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
738
|
+
},
|
|
739
|
+
formValuesToItem: {
|
|
740
|
+
comment: {
|
|
741
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
742
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
743
|
+
},
|
|
744
|
+
location: {
|
|
745
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
746
|
+
lineNumber: 129,
|
|
747
|
+
},
|
|
748
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
749
|
+
},
|
|
750
|
+
itemToFormValues: {
|
|
751
|
+
comment: {
|
|
752
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
753
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
754
|
+
},
|
|
755
|
+
location: {
|
|
756
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
757
|
+
lineNumber: 142,
|
|
758
|
+
},
|
|
759
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
760
|
+
},
|
|
761
|
+
saveCurrentItem: {
|
|
762
|
+
comment: {
|
|
763
|
+
comment: 'Triggers a submit form for current record',
|
|
764
|
+
example: 'await ctx.saveCurrentItem();',
|
|
765
|
+
},
|
|
766
|
+
location: {
|
|
767
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
768
|
+
lineNumber: 154,
|
|
769
|
+
},
|
|
770
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
771
|
+
},
|
|
772
|
+
},
|
|
773
|
+
},
|
|
774
|
+
returnType: 'void',
|
|
775
|
+
location: {
|
|
776
|
+
filePath: 'src/hooks/renderItemFormSidebar.ts',
|
|
777
|
+
lineNumber: 15,
|
|
778
|
+
},
|
|
779
|
+
},
|
|
780
|
+
renderItemFormOutlet: {
|
|
781
|
+
name: 'renderItemFormOutlet',
|
|
782
|
+
comment: {
|
|
783
|
+
comment: 'This function will be called when the plugin needs to render an outlet (see\nthe `itemFormOutlets` function)',
|
|
784
|
+
tag: 'itemFormOutlets',
|
|
785
|
+
},
|
|
786
|
+
nonCtxArguments: [
|
|
787
|
+
{
|
|
788
|
+
name: 'itemFormOutletId',
|
|
789
|
+
typeName: 'string',
|
|
790
|
+
},
|
|
791
|
+
],
|
|
792
|
+
ctxArgument: {
|
|
793
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
794
|
+
additionalProperties: {
|
|
795
|
+
locale: {
|
|
796
|
+
comment: {
|
|
797
|
+
comment: 'The currently active locale for the record',
|
|
798
|
+
},
|
|
799
|
+
location: {
|
|
800
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
801
|
+
lineNumber: 12,
|
|
802
|
+
},
|
|
803
|
+
type: 'string',
|
|
804
|
+
},
|
|
805
|
+
item: {
|
|
806
|
+
comment: {
|
|
807
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
808
|
+
},
|
|
809
|
+
location: {
|
|
810
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
811
|
+
lineNumber: 17,
|
|
812
|
+
},
|
|
813
|
+
type: 'Item | null',
|
|
814
|
+
},
|
|
815
|
+
itemType: {
|
|
816
|
+
comment: {
|
|
817
|
+
comment: 'The model for the record being edited',
|
|
818
|
+
},
|
|
819
|
+
location: {
|
|
820
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
821
|
+
lineNumber: 19,
|
|
822
|
+
},
|
|
823
|
+
type: 'ItemType',
|
|
824
|
+
},
|
|
825
|
+
formValues: {
|
|
826
|
+
comment: {
|
|
827
|
+
comment: 'The complete internal form state',
|
|
828
|
+
},
|
|
829
|
+
location: {
|
|
830
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
831
|
+
lineNumber: 21,
|
|
832
|
+
},
|
|
833
|
+
type: 'Record<string, unknown>',
|
|
834
|
+
},
|
|
835
|
+
itemStatus: {
|
|
836
|
+
comment: {
|
|
837
|
+
comment: 'The current status of the record being edited',
|
|
838
|
+
},
|
|
839
|
+
location: {
|
|
840
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
841
|
+
lineNumber: 23,
|
|
842
|
+
},
|
|
843
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
844
|
+
},
|
|
845
|
+
isSubmitting: {
|
|
846
|
+
comment: {
|
|
847
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
848
|
+
},
|
|
849
|
+
location: {
|
|
850
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
851
|
+
lineNumber: 25,
|
|
852
|
+
},
|
|
853
|
+
type: 'boolean',
|
|
854
|
+
},
|
|
855
|
+
isFormDirty: {
|
|
856
|
+
comment: {
|
|
857
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
858
|
+
},
|
|
859
|
+
location: {
|
|
860
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
861
|
+
lineNumber: 27,
|
|
862
|
+
},
|
|
863
|
+
type: 'boolean',
|
|
864
|
+
},
|
|
865
|
+
blocksAnalysis: {
|
|
866
|
+
comment: {
|
|
867
|
+
comment: 'Current number of blocks present in form state',
|
|
868
|
+
},
|
|
869
|
+
location: {
|
|
870
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
871
|
+
lineNumber: 29,
|
|
872
|
+
},
|
|
873
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
874
|
+
},
|
|
875
|
+
itemFormOutletId: {
|
|
876
|
+
comment: {
|
|
877
|
+
comment: 'The ID of the outlet that needs to be rendered',
|
|
878
|
+
},
|
|
879
|
+
location: {
|
|
880
|
+
filePath: 'src/hooks/renderItemFormOutlet.ts',
|
|
881
|
+
lineNumber: 25,
|
|
882
|
+
},
|
|
883
|
+
type: 'string',
|
|
884
|
+
},
|
|
885
|
+
},
|
|
886
|
+
additionalMethods: {
|
|
887
|
+
toggleField: {
|
|
888
|
+
comment: {
|
|
889
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
890
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
891
|
+
},
|
|
892
|
+
location: {
|
|
893
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
894
|
+
lineNumber: 65,
|
|
895
|
+
},
|
|
896
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
897
|
+
},
|
|
898
|
+
disableField: {
|
|
899
|
+
comment: {
|
|
900
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
901
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
902
|
+
},
|
|
903
|
+
location: {
|
|
904
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
905
|
+
lineNumber: 80,
|
|
906
|
+
},
|
|
907
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
908
|
+
},
|
|
909
|
+
scrollToField: {
|
|
910
|
+
comment: {
|
|
911
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
912
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
913
|
+
},
|
|
914
|
+
location: {
|
|
915
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
916
|
+
lineNumber: 97,
|
|
917
|
+
},
|
|
918
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
919
|
+
},
|
|
920
|
+
setFieldValue: {
|
|
921
|
+
comment: {
|
|
922
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
923
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
924
|
+
},
|
|
925
|
+
location: {
|
|
926
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
927
|
+
lineNumber: 112,
|
|
928
|
+
},
|
|
929
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
930
|
+
},
|
|
931
|
+
formValuesToItem: {
|
|
932
|
+
comment: {
|
|
933
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
934
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
935
|
+
},
|
|
936
|
+
location: {
|
|
937
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
938
|
+
lineNumber: 129,
|
|
939
|
+
},
|
|
940
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
941
|
+
},
|
|
942
|
+
itemToFormValues: {
|
|
943
|
+
comment: {
|
|
944
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
945
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
946
|
+
},
|
|
947
|
+
location: {
|
|
948
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
949
|
+
lineNumber: 142,
|
|
950
|
+
},
|
|
951
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
952
|
+
},
|
|
953
|
+
saveCurrentItem: {
|
|
954
|
+
comment: {
|
|
955
|
+
comment: 'Triggers a submit form for current record',
|
|
956
|
+
example: 'await ctx.saveCurrentItem();',
|
|
957
|
+
},
|
|
958
|
+
location: {
|
|
959
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
960
|
+
lineNumber: 154,
|
|
961
|
+
},
|
|
962
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
963
|
+
},
|
|
964
|
+
},
|
|
965
|
+
},
|
|
966
|
+
returnType: 'void',
|
|
967
|
+
location: {
|
|
968
|
+
filePath: 'src/hooks/renderItemFormOutlet.ts',
|
|
969
|
+
lineNumber: 15,
|
|
970
|
+
},
|
|
971
|
+
},
|
|
972
|
+
renderItemCollectionOutlet: {
|
|
973
|
+
name: 'renderItemCollectionOutlet',
|
|
974
|
+
comment: null,
|
|
975
|
+
nonCtxArguments: [
|
|
976
|
+
{
|
|
977
|
+
name: 'itemCollectionOutletId',
|
|
978
|
+
typeName: 'string',
|
|
979
|
+
},
|
|
980
|
+
],
|
|
981
|
+
ctxArgument: {
|
|
982
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
983
|
+
additionalProperties: {
|
|
984
|
+
itemCollectionOutletId: {
|
|
985
|
+
comment: {
|
|
986
|
+
comment: 'The ID of the outlet that needs to be rendered',
|
|
987
|
+
},
|
|
988
|
+
location: {
|
|
989
|
+
filePath: 'src/hooks/renderItemCollectionOutlet.ts',
|
|
990
|
+
lineNumber: 15,
|
|
991
|
+
},
|
|
992
|
+
type: 'string',
|
|
993
|
+
},
|
|
994
|
+
},
|
|
995
|
+
additionalMethods: null,
|
|
996
|
+
},
|
|
997
|
+
returnType: 'void',
|
|
998
|
+
location: {
|
|
999
|
+
filePath: 'src/hooks/renderItemCollectionOutlet.ts',
|
|
1000
|
+
lineNumber: 5,
|
|
1001
|
+
},
|
|
1002
|
+
},
|
|
1003
|
+
renderFieldExtension: {
|
|
1004
|
+
name: 'renderFieldExtension',
|
|
1005
|
+
comment: {
|
|
1006
|
+
comment: 'This function will be called when the plugin needs to render a field\nextension (see the `manualFieldExtensions` and `overrideFieldExtensions`\nfunctions)',
|
|
1007
|
+
tag: 'forcedFieldExtensions',
|
|
1008
|
+
},
|
|
1009
|
+
nonCtxArguments: [
|
|
1010
|
+
{
|
|
1011
|
+
name: 'fieldExtensionId',
|
|
1012
|
+
typeName: 'string',
|
|
1013
|
+
},
|
|
1014
|
+
],
|
|
1015
|
+
ctxArgument: {
|
|
1016
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
1017
|
+
additionalProperties: {
|
|
1018
|
+
locale: {
|
|
1019
|
+
comment: {
|
|
1020
|
+
comment: 'The currently active locale for the record',
|
|
1021
|
+
},
|
|
1022
|
+
location: {
|
|
1023
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1024
|
+
lineNumber: 12,
|
|
1025
|
+
},
|
|
1026
|
+
type: 'string',
|
|
1027
|
+
},
|
|
1028
|
+
item: {
|
|
1029
|
+
comment: {
|
|
1030
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
1031
|
+
},
|
|
1032
|
+
location: {
|
|
1033
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1034
|
+
lineNumber: 17,
|
|
1035
|
+
},
|
|
1036
|
+
type: 'Item | null',
|
|
1037
|
+
},
|
|
1038
|
+
itemType: {
|
|
1039
|
+
comment: {
|
|
1040
|
+
comment: 'The model for the record being edited',
|
|
1041
|
+
},
|
|
1042
|
+
location: {
|
|
1043
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1044
|
+
lineNumber: 19,
|
|
1045
|
+
},
|
|
1046
|
+
type: 'ItemType',
|
|
1047
|
+
},
|
|
1048
|
+
formValues: {
|
|
1049
|
+
comment: {
|
|
1050
|
+
comment: 'The complete internal form state',
|
|
1051
|
+
},
|
|
1052
|
+
location: {
|
|
1053
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1054
|
+
lineNumber: 21,
|
|
1055
|
+
},
|
|
1056
|
+
type: 'Record<string, unknown>',
|
|
1057
|
+
},
|
|
1058
|
+
itemStatus: {
|
|
1059
|
+
comment: {
|
|
1060
|
+
comment: 'The current status of the record being edited',
|
|
1061
|
+
},
|
|
1062
|
+
location: {
|
|
1063
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1064
|
+
lineNumber: 23,
|
|
1065
|
+
},
|
|
1066
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
1067
|
+
},
|
|
1068
|
+
isSubmitting: {
|
|
1069
|
+
comment: {
|
|
1070
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
1071
|
+
},
|
|
1072
|
+
location: {
|
|
1073
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1074
|
+
lineNumber: 25,
|
|
1075
|
+
},
|
|
1076
|
+
type: 'boolean',
|
|
1077
|
+
},
|
|
1078
|
+
isFormDirty: {
|
|
1079
|
+
comment: {
|
|
1080
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
1081
|
+
},
|
|
1082
|
+
location: {
|
|
1083
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1084
|
+
lineNumber: 27,
|
|
1085
|
+
},
|
|
1086
|
+
type: 'boolean',
|
|
1087
|
+
},
|
|
1088
|
+
blocksAnalysis: {
|
|
1089
|
+
comment: {
|
|
1090
|
+
comment: 'Current number of blocks present in form state',
|
|
1091
|
+
},
|
|
1092
|
+
location: {
|
|
1093
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1094
|
+
lineNumber: 29,
|
|
1095
|
+
},
|
|
1096
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
1097
|
+
},
|
|
1098
|
+
disabled: {
|
|
1099
|
+
comment: {
|
|
1100
|
+
comment: 'Whether the field is currently disabled or not',
|
|
1101
|
+
},
|
|
1102
|
+
location: {
|
|
1103
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1104
|
+
lineNumber: 8,
|
|
1105
|
+
},
|
|
1106
|
+
type: 'boolean',
|
|
1107
|
+
},
|
|
1108
|
+
fieldPath: {
|
|
1109
|
+
comment: {
|
|
1110
|
+
comment: 'The path in the `formValues` object where to find the current value for the\nfield',
|
|
1111
|
+
},
|
|
1112
|
+
location: {
|
|
1113
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1114
|
+
lineNumber: 13,
|
|
1115
|
+
},
|
|
1116
|
+
type: 'string',
|
|
1117
|
+
},
|
|
1118
|
+
field: {
|
|
1119
|
+
comment: {
|
|
1120
|
+
comment: 'The field where the field extension is installed to',
|
|
1121
|
+
},
|
|
1122
|
+
location: {
|
|
1123
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1124
|
+
lineNumber: 15,
|
|
1125
|
+
},
|
|
1126
|
+
type: 'Field',
|
|
1127
|
+
},
|
|
1128
|
+
parentField: {
|
|
1129
|
+
comment: {
|
|
1130
|
+
comment: 'If the field extension is installed in a field of a block, returns the top\nlevel Modular Content/Structured Text field containing the block itself',
|
|
1131
|
+
},
|
|
1132
|
+
location: {
|
|
1133
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1134
|
+
lineNumber: 20,
|
|
1135
|
+
},
|
|
1136
|
+
type: 'Field | undefined',
|
|
1137
|
+
},
|
|
1138
|
+
block: {
|
|
1139
|
+
comment: {
|
|
1140
|
+
comment: 'If the field extension is installed in a field of a block, returns the ID\nof the block — or `undefined` if the block is still not persisted — and the\nblock model.',
|
|
1141
|
+
},
|
|
1142
|
+
location: {
|
|
1143
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1144
|
+
lineNumber: 26,
|
|
1145
|
+
},
|
|
1146
|
+
type: 'undefined | { id: string | undefined; blockModel: ItemType }',
|
|
1147
|
+
},
|
|
1148
|
+
fieldExtensionId: {
|
|
1149
|
+
comment: {
|
|
1150
|
+
comment: 'The ID of the field extension that needs to be rendered',
|
|
1151
|
+
},
|
|
1152
|
+
location: {
|
|
1153
|
+
filePath: 'src/hooks/renderFieldExtension.ts',
|
|
1154
|
+
lineNumber: 29,
|
|
1155
|
+
},
|
|
1156
|
+
type: 'string',
|
|
1157
|
+
},
|
|
1158
|
+
parameters: {
|
|
1159
|
+
comment: {
|
|
1160
|
+
comment: 'The arbitrary `parameters` of the field extension',
|
|
1161
|
+
},
|
|
1162
|
+
location: {
|
|
1163
|
+
filePath: 'src/hooks/renderFieldExtension.ts',
|
|
1164
|
+
lineNumber: 31,
|
|
1165
|
+
},
|
|
1166
|
+
type: 'Record<string, unknown>',
|
|
1167
|
+
},
|
|
1168
|
+
},
|
|
1169
|
+
additionalMethods: {
|
|
1170
|
+
toggleField: {
|
|
1171
|
+
comment: {
|
|
1172
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
1173
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
1174
|
+
},
|
|
1175
|
+
location: {
|
|
1176
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1177
|
+
lineNumber: 65,
|
|
1178
|
+
},
|
|
1179
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
1180
|
+
},
|
|
1181
|
+
disableField: {
|
|
1182
|
+
comment: {
|
|
1183
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
1184
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
1185
|
+
},
|
|
1186
|
+
location: {
|
|
1187
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1188
|
+
lineNumber: 80,
|
|
1189
|
+
},
|
|
1190
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
1191
|
+
},
|
|
1192
|
+
scrollToField: {
|
|
1193
|
+
comment: {
|
|
1194
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
1195
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
1196
|
+
},
|
|
1197
|
+
location: {
|
|
1198
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1199
|
+
lineNumber: 97,
|
|
1200
|
+
},
|
|
1201
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
1202
|
+
},
|
|
1203
|
+
setFieldValue: {
|
|
1204
|
+
comment: {
|
|
1205
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
1206
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
1207
|
+
},
|
|
1208
|
+
location: {
|
|
1209
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1210
|
+
lineNumber: 112,
|
|
1211
|
+
},
|
|
1212
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
1213
|
+
},
|
|
1214
|
+
formValuesToItem: {
|
|
1215
|
+
comment: {
|
|
1216
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
1217
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
1218
|
+
},
|
|
1219
|
+
location: {
|
|
1220
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1221
|
+
lineNumber: 129,
|
|
1222
|
+
},
|
|
1223
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
1224
|
+
},
|
|
1225
|
+
itemToFormValues: {
|
|
1226
|
+
comment: {
|
|
1227
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
1228
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
1229
|
+
},
|
|
1230
|
+
location: {
|
|
1231
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1232
|
+
lineNumber: 142,
|
|
1233
|
+
},
|
|
1234
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
1235
|
+
},
|
|
1236
|
+
saveCurrentItem: {
|
|
1237
|
+
comment: {
|
|
1238
|
+
comment: 'Triggers a submit form for current record',
|
|
1239
|
+
example: 'await ctx.saveCurrentItem();',
|
|
1240
|
+
},
|
|
1241
|
+
location: {
|
|
1242
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1243
|
+
lineNumber: 154,
|
|
1244
|
+
},
|
|
1245
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
1246
|
+
},
|
|
1247
|
+
},
|
|
1248
|
+
},
|
|
1249
|
+
returnType: 'void',
|
|
1250
|
+
location: {
|
|
1251
|
+
filePath: 'src/hooks/renderFieldExtension.ts',
|
|
1252
|
+
lineNumber: 18,
|
|
1253
|
+
},
|
|
1254
|
+
},
|
|
1255
|
+
renderConfigScreen: {
|
|
1256
|
+
name: 'renderConfigScreen',
|
|
1257
|
+
comment: {
|
|
1258
|
+
comment: "This function will be called when the plugin needs to render the plugin's\nconfiguration form",
|
|
1259
|
+
tag: 'configScreen',
|
|
1260
|
+
},
|
|
1261
|
+
nonCtxArguments: [],
|
|
1262
|
+
ctxArgument: {
|
|
1263
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
1264
|
+
additionalProperties: null,
|
|
1265
|
+
additionalMethods: null,
|
|
1266
|
+
},
|
|
1267
|
+
returnType: 'void',
|
|
1268
|
+
location: {
|
|
1269
|
+
filePath: 'src/hooks/renderConfigScreen.ts',
|
|
1270
|
+
lineNumber: 11,
|
|
1271
|
+
},
|
|
1272
|
+
},
|
|
1273
|
+
renderAssetSource: {
|
|
1274
|
+
name: 'renderAssetSource',
|
|
1275
|
+
comment: {
|
|
1276
|
+
comment: "This function will be called when the user selects one of the plugin's\nasset sources to upload a new media file.",
|
|
1277
|
+
tag: 'assetSources',
|
|
1278
|
+
},
|
|
1279
|
+
nonCtxArguments: [
|
|
1280
|
+
{
|
|
1281
|
+
name: 'assetSourceId',
|
|
1282
|
+
typeName: 'string',
|
|
1283
|
+
},
|
|
1284
|
+
],
|
|
1285
|
+
ctxArgument: {
|
|
1286
|
+
type: 'SelfResizingPluginFrameCtx',
|
|
1287
|
+
additionalProperties: {
|
|
1288
|
+
assetSourceId: {
|
|
1289
|
+
comment: {
|
|
1290
|
+
comment: 'The ID of the assetSource that needs to be rendered',
|
|
1291
|
+
},
|
|
1292
|
+
location: {
|
|
1293
|
+
filePath: 'src/hooks/renderAssetSource.ts',
|
|
1294
|
+
lineNumber: 18,
|
|
1295
|
+
},
|
|
1296
|
+
type: 'string',
|
|
1297
|
+
},
|
|
1298
|
+
},
|
|
1299
|
+
additionalMethods: {
|
|
1300
|
+
select: {
|
|
1301
|
+
comment: {
|
|
1302
|
+
comment: 'Function to be called when the user selects the asset: it will trigger the\ncreation of a new `Upload` that will be added in the Media Area.',
|
|
1303
|
+
example: "await ctx.select({\n resource: {\n url: 'https://images.unsplash.com/photo-1416339306562-f3d12fefd36f',\n filename: 'man-drinking-coffee.jpg',\n },\n copyright: 'Royalty free (Unsplash)',\n author: 'Jeff Sheldon',\n notes: 'A man drinking a coffee',\n tags: ['man', 'coffee'],\n});",
|
|
1304
|
+
},
|
|
1305
|
+
location: {
|
|
1306
|
+
filePath: 'src/hooks/renderAssetSource.ts',
|
|
1307
|
+
lineNumber: 40,
|
|
1308
|
+
},
|
|
1309
|
+
type: '(newUpload: NewUpload) => void',
|
|
1310
|
+
},
|
|
1311
|
+
},
|
|
1312
|
+
},
|
|
1313
|
+
returnType: 'void',
|
|
1314
|
+
location: {
|
|
1315
|
+
filePath: 'src/hooks/renderAssetSource.ts',
|
|
1316
|
+
lineNumber: 11,
|
|
1317
|
+
},
|
|
1318
|
+
},
|
|
1319
|
+
overrideFieldExtensions: {
|
|
1320
|
+
name: 'overrideFieldExtensions',
|
|
1321
|
+
comment: {
|
|
1322
|
+
comment: 'Use this function to automatically force one or more field extensions to a\nparticular field',
|
|
1323
|
+
tag: 'forcedFieldExtensions',
|
|
1324
|
+
},
|
|
1325
|
+
nonCtxArguments: [
|
|
1326
|
+
{
|
|
1327
|
+
name: 'field',
|
|
1328
|
+
typeName: 'Field',
|
|
1329
|
+
},
|
|
1330
|
+
],
|
|
1331
|
+
ctxArgument: {
|
|
1332
|
+
type: 'Ctx',
|
|
1333
|
+
additionalProperties: {
|
|
1334
|
+
itemType: {
|
|
1335
|
+
comment: null,
|
|
1336
|
+
location: {
|
|
1337
|
+
filePath: 'src/hooks/overrideFieldExtensions.ts',
|
|
1338
|
+
lineNumber: 22,
|
|
1339
|
+
},
|
|
1340
|
+
type: 'ItemType',
|
|
1341
|
+
},
|
|
1342
|
+
},
|
|
1343
|
+
additionalMethods: null,
|
|
1344
|
+
},
|
|
1345
|
+
returnType: 'FieldExtensionOverride | undefined',
|
|
1346
|
+
location: {
|
|
1347
|
+
filePath: 'src/hooks/overrideFieldExtensions.ts',
|
|
1348
|
+
lineNumber: 15,
|
|
1349
|
+
},
|
|
1350
|
+
},
|
|
1351
|
+
onBoot: {
|
|
1352
|
+
name: 'onBoot',
|
|
1353
|
+
comment: {
|
|
1354
|
+
comment: 'This function will be called once at boot time and can be used to perform\nie. some initial integrity checks on the configuration.',
|
|
1355
|
+
tag: 'boot',
|
|
1356
|
+
},
|
|
1357
|
+
nonCtxArguments: [],
|
|
1358
|
+
ctxArgument: {
|
|
1359
|
+
type: 'ImposedSizePluginFrameCtx',
|
|
1360
|
+
additionalProperties: null,
|
|
1361
|
+
additionalMethods: null,
|
|
1362
|
+
},
|
|
1363
|
+
returnType: 'void',
|
|
1364
|
+
location: {
|
|
1365
|
+
filePath: 'src/hooks/onBoot.ts',
|
|
1366
|
+
lineNumber: 10,
|
|
1367
|
+
},
|
|
1368
|
+
},
|
|
1369
|
+
onBeforeItemsUnpublish: {
|
|
1370
|
+
name: 'onBeforeItemsUnpublish',
|
|
1371
|
+
comment: {
|
|
1372
|
+
comment: 'This function will be called before unpublishing records. You can stop the\naction by returning `false`',
|
|
1373
|
+
tag: 'beforeHooks',
|
|
1374
|
+
},
|
|
1375
|
+
nonCtxArguments: [
|
|
1376
|
+
{
|
|
1377
|
+
name: 'items',
|
|
1378
|
+
typeName: 'Item[]',
|
|
1379
|
+
},
|
|
1380
|
+
],
|
|
1381
|
+
ctxArgument: {
|
|
1382
|
+
type: 'Ctx',
|
|
1383
|
+
additionalProperties: null,
|
|
1384
|
+
additionalMethods: null,
|
|
1385
|
+
},
|
|
1386
|
+
returnType: 'MaybePromise<boolean>',
|
|
1387
|
+
location: {
|
|
1388
|
+
filePath: 'src/hooks/onBeforeItemsUnpublish.ts',
|
|
1389
|
+
lineNumber: 14,
|
|
1390
|
+
},
|
|
1391
|
+
},
|
|
1392
|
+
onBeforeItemsPublish: {
|
|
1393
|
+
name: 'onBeforeItemsPublish',
|
|
1394
|
+
comment: {
|
|
1395
|
+
comment: 'This function will be called before publishing records. You can stop the\naction by returning `false`',
|
|
1396
|
+
tag: 'beforeHooks',
|
|
1397
|
+
},
|
|
1398
|
+
nonCtxArguments: [
|
|
1399
|
+
{
|
|
1400
|
+
name: 'items',
|
|
1401
|
+
typeName: 'Item[]',
|
|
1402
|
+
},
|
|
1403
|
+
],
|
|
1404
|
+
ctxArgument: {
|
|
1405
|
+
type: 'Ctx',
|
|
1406
|
+
additionalProperties: null,
|
|
1407
|
+
additionalMethods: null,
|
|
1408
|
+
},
|
|
1409
|
+
returnType: 'MaybePromise<boolean>',
|
|
1410
|
+
location: {
|
|
1411
|
+
filePath: 'src/hooks/onBeforeItemsPublish.ts',
|
|
1412
|
+
lineNumber: 14,
|
|
1413
|
+
},
|
|
1414
|
+
},
|
|
1415
|
+
onBeforeItemsDestroy: {
|
|
1416
|
+
name: 'onBeforeItemsDestroy',
|
|
1417
|
+
comment: {
|
|
1418
|
+
comment: 'This function will be called before destroying records. You can stop the\naction by returning `false`',
|
|
1419
|
+
tag: 'beforeHooks',
|
|
1420
|
+
},
|
|
1421
|
+
nonCtxArguments: [
|
|
1422
|
+
{
|
|
1423
|
+
name: 'items',
|
|
1424
|
+
typeName: 'Item[]',
|
|
1425
|
+
},
|
|
1426
|
+
],
|
|
1427
|
+
ctxArgument: {
|
|
1428
|
+
type: 'Ctx',
|
|
1429
|
+
additionalProperties: null,
|
|
1430
|
+
additionalMethods: null,
|
|
1431
|
+
},
|
|
1432
|
+
returnType: 'MaybePromise<boolean>',
|
|
1433
|
+
location: {
|
|
1434
|
+
filePath: 'src/hooks/onBeforeItemsDestroy.ts',
|
|
1435
|
+
lineNumber: 14,
|
|
1436
|
+
},
|
|
1437
|
+
},
|
|
1438
|
+
onBeforeItemUpsert: {
|
|
1439
|
+
name: 'onBeforeItemUpsert',
|
|
1440
|
+
comment: {
|
|
1441
|
+
comment: 'This function will be called before saving a new version of a record. You\ncan stop the action by returning `false`',
|
|
1442
|
+
tag: 'beforeHooks',
|
|
1443
|
+
},
|
|
1444
|
+
nonCtxArguments: [
|
|
1445
|
+
{
|
|
1446
|
+
name: 'createOrUpdateItemPayload',
|
|
1447
|
+
typeName: 'ItemUpdateSchema | ItemCreateSchema',
|
|
1448
|
+
},
|
|
1449
|
+
],
|
|
1450
|
+
ctxArgument: {
|
|
1451
|
+
type: 'Ctx',
|
|
1452
|
+
additionalProperties: null,
|
|
1453
|
+
additionalMethods: null,
|
|
1454
|
+
},
|
|
1455
|
+
returnType: 'MaybePromise<boolean>',
|
|
1456
|
+
location: {
|
|
1457
|
+
filePath: 'src/hooks/onBeforeItemUpsert.ts',
|
|
1458
|
+
lineNumber: 15,
|
|
1459
|
+
},
|
|
1460
|
+
},
|
|
1461
|
+
manualFieldExtensions: {
|
|
1462
|
+
name: 'manualFieldExtensions',
|
|
1463
|
+
comment: {
|
|
1464
|
+
comment: 'Use this function to declare new field extensions that users will be able\nto install manually in some field',
|
|
1465
|
+
tag: 'manualFieldExtensions',
|
|
1466
|
+
},
|
|
1467
|
+
nonCtxArguments: [],
|
|
1468
|
+
ctxArgument: {
|
|
1469
|
+
type: 'Ctx',
|
|
1470
|
+
additionalProperties: null,
|
|
1471
|
+
additionalMethods: null,
|
|
1472
|
+
},
|
|
1473
|
+
returnType: 'ManualFieldExtension[]',
|
|
1474
|
+
location: {
|
|
1475
|
+
filePath: 'src/hooks/manualFieldExtensions.ts',
|
|
1476
|
+
lineNumber: 10,
|
|
1477
|
+
},
|
|
1478
|
+
},
|
|
1479
|
+
mainNavigationTabs: {
|
|
1480
|
+
name: 'mainNavigationTabs',
|
|
1481
|
+
comment: {
|
|
1482
|
+
comment: 'Use this function to declare new tabs you want to add in the top-bar of the\nUI',
|
|
1483
|
+
tag: 'pages',
|
|
1484
|
+
},
|
|
1485
|
+
nonCtxArguments: [],
|
|
1486
|
+
ctxArgument: {
|
|
1487
|
+
type: 'Ctx',
|
|
1488
|
+
additionalProperties: null,
|
|
1489
|
+
additionalMethods: null,
|
|
1490
|
+
},
|
|
1491
|
+
returnType: 'MainNavigationTab[]',
|
|
1492
|
+
location: {
|
|
1493
|
+
filePath: 'src/hooks/mainNavigationTabs.ts',
|
|
1494
|
+
lineNumber: 11,
|
|
1495
|
+
},
|
|
1496
|
+
},
|
|
1497
|
+
itemsDropdownActions: {
|
|
1498
|
+
name: 'itemsDropdownActions',
|
|
1499
|
+
comment: null,
|
|
1500
|
+
nonCtxArguments: [
|
|
1501
|
+
{
|
|
1502
|
+
name: 'itemType',
|
|
1503
|
+
typeName: 'ItemType',
|
|
1504
|
+
},
|
|
1505
|
+
],
|
|
1506
|
+
ctxArgument: {
|
|
1507
|
+
type: 'Ctx',
|
|
1508
|
+
additionalProperties: {
|
|
1509
|
+
itemType: {
|
|
1510
|
+
comment: null,
|
|
1511
|
+
location: {
|
|
1512
|
+
filePath: 'src/hooks/itemsDropdownActions.ts',
|
|
1513
|
+
lineNumber: 15,
|
|
1514
|
+
},
|
|
1515
|
+
type: 'ItemType',
|
|
1516
|
+
},
|
|
1517
|
+
},
|
|
1518
|
+
additionalMethods: null,
|
|
1519
|
+
},
|
|
1520
|
+
returnType: 'Array<DropdownAction | DropdownActionGroup>',
|
|
1521
|
+
location: {
|
|
1522
|
+
filePath: 'src/hooks/itemsDropdownActions.ts',
|
|
1523
|
+
lineNumber: 8,
|
|
1524
|
+
},
|
|
1525
|
+
},
|
|
1526
|
+
itemFormSidebars: {
|
|
1527
|
+
name: 'itemFormSidebars',
|
|
1528
|
+
comment: {
|
|
1529
|
+
comment: 'Use this function to declare new sidebar to be shown when the user edits\nrecords of a particular model',
|
|
1530
|
+
tag: 'sidebarPanels',
|
|
1531
|
+
},
|
|
1532
|
+
nonCtxArguments: [
|
|
1533
|
+
{
|
|
1534
|
+
name: 'itemType',
|
|
1535
|
+
typeName: 'ItemType',
|
|
1536
|
+
},
|
|
1537
|
+
],
|
|
1538
|
+
ctxArgument: {
|
|
1539
|
+
type: 'Ctx',
|
|
1540
|
+
additionalProperties: null,
|
|
1541
|
+
additionalMethods: null,
|
|
1542
|
+
},
|
|
1543
|
+
returnType: 'ItemFormSidebar[]',
|
|
1544
|
+
location: {
|
|
1545
|
+
filePath: 'src/hooks/itemFormSidebars.ts',
|
|
1546
|
+
lineNumber: 13,
|
|
1547
|
+
},
|
|
1548
|
+
},
|
|
1549
|
+
itemFormSidebarPanels: {
|
|
1550
|
+
name: 'itemFormSidebarPanels',
|
|
1551
|
+
comment: {
|
|
1552
|
+
comment: 'Use this function to declare new sidebar panels to be shown when the user\nedits records of a particular model',
|
|
1553
|
+
tag: 'sidebarPanels',
|
|
1554
|
+
},
|
|
1555
|
+
nonCtxArguments: [
|
|
1556
|
+
{
|
|
1557
|
+
name: 'itemType',
|
|
1558
|
+
typeName: 'ItemType',
|
|
1559
|
+
},
|
|
1560
|
+
],
|
|
1561
|
+
ctxArgument: {
|
|
1562
|
+
type: 'Ctx',
|
|
1563
|
+
additionalProperties: null,
|
|
1564
|
+
additionalMethods: null,
|
|
1565
|
+
},
|
|
1566
|
+
returnType: 'ItemFormSidebarPanel[]',
|
|
1567
|
+
location: {
|
|
1568
|
+
filePath: 'src/hooks/itemFormSidebarPanels.ts',
|
|
1569
|
+
lineNumber: 14,
|
|
1570
|
+
},
|
|
1571
|
+
},
|
|
1572
|
+
itemFormOutlets: {
|
|
1573
|
+
name: 'itemFormOutlets',
|
|
1574
|
+
comment: {
|
|
1575
|
+
comment: "Use this function to declare custom outlets to be shown at the top of the\nrecord's editing page",
|
|
1576
|
+
tag: 'itemFormOutlets',
|
|
1577
|
+
},
|
|
1578
|
+
nonCtxArguments: [
|
|
1579
|
+
{
|
|
1580
|
+
name: 'itemType',
|
|
1581
|
+
typeName: 'ItemType',
|
|
1582
|
+
},
|
|
1583
|
+
],
|
|
1584
|
+
ctxArgument: {
|
|
1585
|
+
type: 'Ctx',
|
|
1586
|
+
additionalProperties: null,
|
|
1587
|
+
additionalMethods: null,
|
|
1588
|
+
},
|
|
1589
|
+
returnType: 'ItemFormOutlet[]',
|
|
1590
|
+
location: {
|
|
1591
|
+
filePath: 'src/hooks/itemFormOutlets.ts',
|
|
1592
|
+
lineNumber: 13,
|
|
1593
|
+
},
|
|
1594
|
+
},
|
|
1595
|
+
itemFormDropdownActions: {
|
|
1596
|
+
name: 'itemFormDropdownActions',
|
|
1597
|
+
comment: null,
|
|
1598
|
+
nonCtxArguments: [
|
|
1599
|
+
{
|
|
1600
|
+
name: 'itemType',
|
|
1601
|
+
typeName: 'ItemType',
|
|
1602
|
+
},
|
|
1603
|
+
],
|
|
1604
|
+
ctxArgument: {
|
|
1605
|
+
type: 'Ctx',
|
|
1606
|
+
additionalProperties: {
|
|
1607
|
+
locale: {
|
|
1608
|
+
comment: {
|
|
1609
|
+
comment: 'The currently active locale for the record',
|
|
1610
|
+
},
|
|
1611
|
+
location: {
|
|
1612
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1613
|
+
lineNumber: 12,
|
|
1614
|
+
},
|
|
1615
|
+
type: 'string',
|
|
1616
|
+
},
|
|
1617
|
+
item: {
|
|
1618
|
+
comment: {
|
|
1619
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
1620
|
+
},
|
|
1621
|
+
location: {
|
|
1622
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1623
|
+
lineNumber: 17,
|
|
1624
|
+
},
|
|
1625
|
+
type: 'Item | null',
|
|
1626
|
+
},
|
|
1627
|
+
itemType: {
|
|
1628
|
+
comment: {
|
|
1629
|
+
comment: 'The model for the record being edited',
|
|
1630
|
+
},
|
|
1631
|
+
location: {
|
|
1632
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1633
|
+
lineNumber: 19,
|
|
1634
|
+
},
|
|
1635
|
+
type: 'ItemType',
|
|
1636
|
+
},
|
|
1637
|
+
formValues: {
|
|
1638
|
+
comment: {
|
|
1639
|
+
comment: 'The complete internal form state',
|
|
1640
|
+
},
|
|
1641
|
+
location: {
|
|
1642
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1643
|
+
lineNumber: 21,
|
|
1644
|
+
},
|
|
1645
|
+
type: 'Record<string, unknown>',
|
|
1646
|
+
},
|
|
1647
|
+
itemStatus: {
|
|
1648
|
+
comment: {
|
|
1649
|
+
comment: 'The current status of the record being edited',
|
|
1650
|
+
},
|
|
1651
|
+
location: {
|
|
1652
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1653
|
+
lineNumber: 23,
|
|
1654
|
+
},
|
|
1655
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
1656
|
+
},
|
|
1657
|
+
isSubmitting: {
|
|
1658
|
+
comment: {
|
|
1659
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
1660
|
+
},
|
|
1661
|
+
location: {
|
|
1662
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1663
|
+
lineNumber: 25,
|
|
1664
|
+
},
|
|
1665
|
+
type: 'boolean',
|
|
1666
|
+
},
|
|
1667
|
+
isFormDirty: {
|
|
1668
|
+
comment: {
|
|
1669
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
1670
|
+
},
|
|
1671
|
+
location: {
|
|
1672
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1673
|
+
lineNumber: 27,
|
|
1674
|
+
},
|
|
1675
|
+
type: 'boolean',
|
|
1676
|
+
},
|
|
1677
|
+
blocksAnalysis: {
|
|
1678
|
+
comment: {
|
|
1679
|
+
comment: 'Current number of blocks present in form state',
|
|
1680
|
+
},
|
|
1681
|
+
location: {
|
|
1682
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1683
|
+
lineNumber: 29,
|
|
1684
|
+
},
|
|
1685
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
1686
|
+
},
|
|
1687
|
+
},
|
|
1688
|
+
additionalMethods: null,
|
|
1689
|
+
},
|
|
1690
|
+
returnType: 'Array<DropdownAction | DropdownActionGroup>',
|
|
1691
|
+
location: {
|
|
1692
|
+
filePath: 'src/hooks/itemFormDropdownActions.ts',
|
|
1693
|
+
lineNumber: 9,
|
|
1694
|
+
},
|
|
1695
|
+
},
|
|
1696
|
+
itemCollectionOutlets: {
|
|
1697
|
+
name: 'itemCollectionOutlets',
|
|
1698
|
+
comment: null,
|
|
1699
|
+
nonCtxArguments: [
|
|
1700
|
+
{
|
|
1701
|
+
name: 'itemType',
|
|
1702
|
+
typeName: 'ItemType',
|
|
1703
|
+
},
|
|
1704
|
+
],
|
|
1705
|
+
ctxArgument: {
|
|
1706
|
+
type: 'Ctx',
|
|
1707
|
+
additionalProperties: null,
|
|
1708
|
+
additionalMethods: null,
|
|
1709
|
+
},
|
|
1710
|
+
returnType: 'ItemCollectionOutlet[]',
|
|
1711
|
+
location: {
|
|
1712
|
+
filePath: 'src/hooks/itemCollectionOutlets.ts',
|
|
1713
|
+
lineNumber: 7,
|
|
1714
|
+
},
|
|
1715
|
+
},
|
|
1716
|
+
initialLocationQueryForItemSelector: {
|
|
1717
|
+
name: 'initialLocationQueryForItemSelector',
|
|
1718
|
+
comment: {
|
|
1719
|
+
comment: 'Use this function to customize the initial filters when opening a record\nselector via a "Single link" or "Multiple links" field',
|
|
1720
|
+
tag: 'locationQuery',
|
|
1721
|
+
},
|
|
1722
|
+
nonCtxArguments: [
|
|
1723
|
+
{
|
|
1724
|
+
name: 'openerField',
|
|
1725
|
+
typeName: 'Field',
|
|
1726
|
+
},
|
|
1727
|
+
{
|
|
1728
|
+
name: 'itemType',
|
|
1729
|
+
typeName: 'ItemType',
|
|
1730
|
+
},
|
|
1731
|
+
],
|
|
1732
|
+
ctxArgument: {
|
|
1733
|
+
type: 'Ctx',
|
|
1734
|
+
additionalProperties: null,
|
|
1735
|
+
additionalMethods: null,
|
|
1736
|
+
},
|
|
1737
|
+
returnType: 'MaybePromise<InitialLocationQueryForItemSelector | undefined>',
|
|
1738
|
+
location: {
|
|
1739
|
+
filePath: 'src/hooks/initialLocationQueryForItemSelector.ts',
|
|
1740
|
+
lineNumber: 16,
|
|
1741
|
+
},
|
|
1742
|
+
},
|
|
1743
|
+
fieldDropdownActions: {
|
|
1744
|
+
name: 'fieldDropdownActions',
|
|
1745
|
+
comment: null,
|
|
1746
|
+
nonCtxArguments: [
|
|
1747
|
+
{
|
|
1748
|
+
name: 'field',
|
|
1749
|
+
typeName: 'Field',
|
|
1750
|
+
},
|
|
1751
|
+
],
|
|
1752
|
+
ctxArgument: {
|
|
1753
|
+
type: 'Ctx',
|
|
1754
|
+
additionalProperties: {
|
|
1755
|
+
locale: {
|
|
1756
|
+
comment: {
|
|
1757
|
+
comment: 'The currently active locale for the record',
|
|
1758
|
+
},
|
|
1759
|
+
location: {
|
|
1760
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1761
|
+
lineNumber: 12,
|
|
1762
|
+
},
|
|
1763
|
+
type: 'string',
|
|
1764
|
+
},
|
|
1765
|
+
item: {
|
|
1766
|
+
comment: {
|
|
1767
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
1768
|
+
},
|
|
1769
|
+
location: {
|
|
1770
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1771
|
+
lineNumber: 17,
|
|
1772
|
+
},
|
|
1773
|
+
type: 'Item | null',
|
|
1774
|
+
},
|
|
1775
|
+
itemType: {
|
|
1776
|
+
comment: {
|
|
1777
|
+
comment: 'The model for the record being edited',
|
|
1778
|
+
},
|
|
1779
|
+
location: {
|
|
1780
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1781
|
+
lineNumber: 19,
|
|
1782
|
+
},
|
|
1783
|
+
type: 'ItemType',
|
|
1784
|
+
},
|
|
1785
|
+
formValues: {
|
|
1786
|
+
comment: {
|
|
1787
|
+
comment: 'The complete internal form state',
|
|
1788
|
+
},
|
|
1789
|
+
location: {
|
|
1790
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1791
|
+
lineNumber: 21,
|
|
1792
|
+
},
|
|
1793
|
+
type: 'Record<string, unknown>',
|
|
1794
|
+
},
|
|
1795
|
+
itemStatus: {
|
|
1796
|
+
comment: {
|
|
1797
|
+
comment: 'The current status of the record being edited',
|
|
1798
|
+
},
|
|
1799
|
+
location: {
|
|
1800
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1801
|
+
lineNumber: 23,
|
|
1802
|
+
},
|
|
1803
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
1804
|
+
},
|
|
1805
|
+
isSubmitting: {
|
|
1806
|
+
comment: {
|
|
1807
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
1808
|
+
},
|
|
1809
|
+
location: {
|
|
1810
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1811
|
+
lineNumber: 25,
|
|
1812
|
+
},
|
|
1813
|
+
type: 'boolean',
|
|
1814
|
+
},
|
|
1815
|
+
isFormDirty: {
|
|
1816
|
+
comment: {
|
|
1817
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
1818
|
+
},
|
|
1819
|
+
location: {
|
|
1820
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1821
|
+
lineNumber: 27,
|
|
1822
|
+
},
|
|
1823
|
+
type: 'boolean',
|
|
1824
|
+
},
|
|
1825
|
+
blocksAnalysis: {
|
|
1826
|
+
comment: {
|
|
1827
|
+
comment: 'Current number of blocks present in form state',
|
|
1828
|
+
},
|
|
1829
|
+
location: {
|
|
1830
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1831
|
+
lineNumber: 29,
|
|
1832
|
+
},
|
|
1833
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
1834
|
+
},
|
|
1835
|
+
disabled: {
|
|
1836
|
+
comment: {
|
|
1837
|
+
comment: 'Whether the field is currently disabled or not',
|
|
1838
|
+
},
|
|
1839
|
+
location: {
|
|
1840
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1841
|
+
lineNumber: 8,
|
|
1842
|
+
},
|
|
1843
|
+
type: 'boolean',
|
|
1844
|
+
},
|
|
1845
|
+
fieldPath: {
|
|
1846
|
+
comment: {
|
|
1847
|
+
comment: 'The path in the `formValues` object where to find the current value for the\nfield',
|
|
1848
|
+
},
|
|
1849
|
+
location: {
|
|
1850
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1851
|
+
lineNumber: 13,
|
|
1852
|
+
},
|
|
1853
|
+
type: 'string',
|
|
1854
|
+
},
|
|
1855
|
+
field: {
|
|
1856
|
+
comment: {
|
|
1857
|
+
comment: 'The field where the field extension is installed to',
|
|
1858
|
+
},
|
|
1859
|
+
location: {
|
|
1860
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1861
|
+
lineNumber: 15,
|
|
1862
|
+
},
|
|
1863
|
+
type: 'Field',
|
|
1864
|
+
},
|
|
1865
|
+
parentField: {
|
|
1866
|
+
comment: {
|
|
1867
|
+
comment: 'If the field extension is installed in a field of a block, returns the top\nlevel Modular Content/Structured Text field containing the block itself',
|
|
1868
|
+
},
|
|
1869
|
+
location: {
|
|
1870
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1871
|
+
lineNumber: 20,
|
|
1872
|
+
},
|
|
1873
|
+
type: 'Field | undefined',
|
|
1874
|
+
},
|
|
1875
|
+
block: {
|
|
1876
|
+
comment: {
|
|
1877
|
+
comment: 'If the field extension is installed in a field of a block, returns the ID\nof the block — or `undefined` if the block is still not persisted — and the\nblock model.',
|
|
1878
|
+
},
|
|
1879
|
+
location: {
|
|
1880
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
1881
|
+
lineNumber: 26,
|
|
1882
|
+
},
|
|
1883
|
+
type: 'undefined | { id: string | undefined; blockModel: ItemType }',
|
|
1884
|
+
},
|
|
1885
|
+
},
|
|
1886
|
+
additionalMethods: null,
|
|
1887
|
+
},
|
|
1888
|
+
returnType: 'Array<DropdownAction | DropdownActionGroup>',
|
|
1889
|
+
location: {
|
|
1890
|
+
filePath: 'src/hooks/fieldDropdownActions.ts',
|
|
1891
|
+
lineNumber: 10,
|
|
1892
|
+
},
|
|
1893
|
+
},
|
|
1894
|
+
executeUploadsDropdownAction: {
|
|
1895
|
+
name: 'executeUploadsDropdownAction',
|
|
1896
|
+
comment: null,
|
|
1897
|
+
nonCtxArguments: [
|
|
1898
|
+
{
|
|
1899
|
+
name: 'actionId',
|
|
1900
|
+
typeName: 'string',
|
|
1901
|
+
},
|
|
1902
|
+
{
|
|
1903
|
+
name: 'uploads',
|
|
1904
|
+
typeName: 'Upload[]',
|
|
1905
|
+
},
|
|
1906
|
+
],
|
|
1907
|
+
ctxArgument: {
|
|
1908
|
+
type: 'Ctx',
|
|
1909
|
+
additionalProperties: {
|
|
1910
|
+
parameters: {
|
|
1911
|
+
comment: null,
|
|
1912
|
+
location: {
|
|
1913
|
+
filePath: 'src/hooks/executeUploadsDropdownAction.ts',
|
|
1914
|
+
lineNumber: 14,
|
|
1915
|
+
},
|
|
1916
|
+
type: 'Record<string, unknown> | undefined',
|
|
1917
|
+
},
|
|
1918
|
+
},
|
|
1919
|
+
additionalMethods: null,
|
|
1920
|
+
},
|
|
1921
|
+
returnType: 'Promise<void>',
|
|
1922
|
+
location: {
|
|
1923
|
+
filePath: 'src/hooks/executeUploadsDropdownAction.ts',
|
|
1924
|
+
lineNumber: 7,
|
|
1925
|
+
},
|
|
1926
|
+
},
|
|
1927
|
+
executeItemsDropdownAction: {
|
|
1928
|
+
name: 'executeItemsDropdownAction',
|
|
1929
|
+
comment: null,
|
|
1930
|
+
nonCtxArguments: [
|
|
1931
|
+
{
|
|
1932
|
+
name: 'actionId',
|
|
1933
|
+
typeName: 'string',
|
|
1934
|
+
},
|
|
1935
|
+
{
|
|
1936
|
+
name: 'items',
|
|
1937
|
+
typeName: 'Item[]',
|
|
1938
|
+
},
|
|
1939
|
+
],
|
|
1940
|
+
ctxArgument: {
|
|
1941
|
+
type: 'Ctx',
|
|
1942
|
+
additionalProperties: {
|
|
1943
|
+
parameters: {
|
|
1944
|
+
comment: null,
|
|
1945
|
+
location: {
|
|
1946
|
+
filePath: 'src/hooks/executeItemsDropdownAction.ts',
|
|
1947
|
+
lineNumber: 15,
|
|
1948
|
+
},
|
|
1949
|
+
type: 'Record<string, unknown> | undefined',
|
|
1950
|
+
},
|
|
1951
|
+
},
|
|
1952
|
+
additionalMethods: null,
|
|
1953
|
+
},
|
|
1954
|
+
returnType: 'Promise<void>',
|
|
1955
|
+
location: {
|
|
1956
|
+
filePath: 'src/hooks/executeItemsDropdownAction.ts',
|
|
1957
|
+
lineNumber: 7,
|
|
1958
|
+
},
|
|
1959
|
+
},
|
|
1960
|
+
executeItemFormDropdownAction: {
|
|
1961
|
+
name: 'executeItemFormDropdownAction',
|
|
1962
|
+
comment: null,
|
|
1963
|
+
nonCtxArguments: [
|
|
1964
|
+
{
|
|
1965
|
+
name: 'actionId',
|
|
1966
|
+
typeName: 'string',
|
|
1967
|
+
},
|
|
1968
|
+
],
|
|
1969
|
+
ctxArgument: {
|
|
1970
|
+
type: 'Ctx',
|
|
1971
|
+
additionalProperties: {
|
|
1972
|
+
locale: {
|
|
1973
|
+
comment: {
|
|
1974
|
+
comment: 'The currently active locale for the record',
|
|
1975
|
+
},
|
|
1976
|
+
location: {
|
|
1977
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1978
|
+
lineNumber: 12,
|
|
1979
|
+
},
|
|
1980
|
+
type: 'string',
|
|
1981
|
+
},
|
|
1982
|
+
item: {
|
|
1983
|
+
comment: {
|
|
1984
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
1985
|
+
},
|
|
1986
|
+
location: {
|
|
1987
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1988
|
+
lineNumber: 17,
|
|
1989
|
+
},
|
|
1990
|
+
type: 'Item | null',
|
|
1991
|
+
},
|
|
1992
|
+
itemType: {
|
|
1993
|
+
comment: {
|
|
1994
|
+
comment: 'The model for the record being edited',
|
|
1995
|
+
},
|
|
1996
|
+
location: {
|
|
1997
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
1998
|
+
lineNumber: 19,
|
|
1999
|
+
},
|
|
2000
|
+
type: 'ItemType',
|
|
2001
|
+
},
|
|
2002
|
+
formValues: {
|
|
2003
|
+
comment: {
|
|
2004
|
+
comment: 'The complete internal form state',
|
|
2005
|
+
},
|
|
2006
|
+
location: {
|
|
2007
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2008
|
+
lineNumber: 21,
|
|
2009
|
+
},
|
|
2010
|
+
type: 'Record<string, unknown>',
|
|
2011
|
+
},
|
|
2012
|
+
itemStatus: {
|
|
2013
|
+
comment: {
|
|
2014
|
+
comment: 'The current status of the record being edited',
|
|
2015
|
+
},
|
|
2016
|
+
location: {
|
|
2017
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2018
|
+
lineNumber: 23,
|
|
2019
|
+
},
|
|
2020
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
2021
|
+
},
|
|
2022
|
+
isSubmitting: {
|
|
2023
|
+
comment: {
|
|
2024
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
2025
|
+
},
|
|
2026
|
+
location: {
|
|
2027
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2028
|
+
lineNumber: 25,
|
|
2029
|
+
},
|
|
2030
|
+
type: 'boolean',
|
|
2031
|
+
},
|
|
2032
|
+
isFormDirty: {
|
|
2033
|
+
comment: {
|
|
2034
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
2035
|
+
},
|
|
2036
|
+
location: {
|
|
2037
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2038
|
+
lineNumber: 27,
|
|
2039
|
+
},
|
|
2040
|
+
type: 'boolean',
|
|
2041
|
+
},
|
|
2042
|
+
blocksAnalysis: {
|
|
2043
|
+
comment: {
|
|
2044
|
+
comment: 'Current number of blocks present in form state',
|
|
2045
|
+
},
|
|
2046
|
+
location: {
|
|
2047
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2048
|
+
lineNumber: 29,
|
|
2049
|
+
},
|
|
2050
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
2051
|
+
},
|
|
2052
|
+
parameters: {
|
|
2053
|
+
comment: null,
|
|
2054
|
+
location: {
|
|
2055
|
+
filePath: 'src/hooks/executeItemFormDropdownAction.ts',
|
|
2056
|
+
lineNumber: 16,
|
|
2057
|
+
},
|
|
2058
|
+
type: 'Record<string, unknown> | undefined',
|
|
2059
|
+
},
|
|
2060
|
+
},
|
|
2061
|
+
additionalMethods: {
|
|
2062
|
+
toggleField: {
|
|
2063
|
+
comment: {
|
|
2064
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
2065
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
2066
|
+
},
|
|
2067
|
+
location: {
|
|
2068
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2069
|
+
lineNumber: 65,
|
|
2070
|
+
},
|
|
2071
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
2072
|
+
},
|
|
2073
|
+
disableField: {
|
|
2074
|
+
comment: {
|
|
2075
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
2076
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
2077
|
+
},
|
|
2078
|
+
location: {
|
|
2079
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2080
|
+
lineNumber: 80,
|
|
2081
|
+
},
|
|
2082
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
2083
|
+
},
|
|
2084
|
+
scrollToField: {
|
|
2085
|
+
comment: {
|
|
2086
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
2087
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
2088
|
+
},
|
|
2089
|
+
location: {
|
|
2090
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2091
|
+
lineNumber: 97,
|
|
2092
|
+
},
|
|
2093
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
2094
|
+
},
|
|
2095
|
+
setFieldValue: {
|
|
2096
|
+
comment: {
|
|
2097
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
2098
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
2099
|
+
},
|
|
2100
|
+
location: {
|
|
2101
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2102
|
+
lineNumber: 112,
|
|
2103
|
+
},
|
|
2104
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
2105
|
+
},
|
|
2106
|
+
formValuesToItem: {
|
|
2107
|
+
comment: {
|
|
2108
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
2109
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
2110
|
+
},
|
|
2111
|
+
location: {
|
|
2112
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2113
|
+
lineNumber: 129,
|
|
2114
|
+
},
|
|
2115
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
2116
|
+
},
|
|
2117
|
+
itemToFormValues: {
|
|
2118
|
+
comment: {
|
|
2119
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
2120
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
2121
|
+
},
|
|
2122
|
+
location: {
|
|
2123
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2124
|
+
lineNumber: 142,
|
|
2125
|
+
},
|
|
2126
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
2127
|
+
},
|
|
2128
|
+
saveCurrentItem: {
|
|
2129
|
+
comment: {
|
|
2130
|
+
comment: 'Triggers a submit form for current record',
|
|
2131
|
+
example: 'await ctx.saveCurrentItem();',
|
|
2132
|
+
},
|
|
2133
|
+
location: {
|
|
2134
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2135
|
+
lineNumber: 154,
|
|
2136
|
+
},
|
|
2137
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
2138
|
+
},
|
|
2139
|
+
},
|
|
2140
|
+
},
|
|
2141
|
+
returnType: 'Promise<void>',
|
|
2142
|
+
location: {
|
|
2143
|
+
filePath: 'src/hooks/executeItemFormDropdownAction.ts',
|
|
2144
|
+
lineNumber: 8,
|
|
2145
|
+
},
|
|
2146
|
+
},
|
|
2147
|
+
executeFieldDropdownAction: {
|
|
2148
|
+
name: 'executeFieldDropdownAction',
|
|
2149
|
+
comment: null,
|
|
2150
|
+
nonCtxArguments: [
|
|
2151
|
+
{
|
|
2152
|
+
name: 'actionId',
|
|
2153
|
+
typeName: 'string',
|
|
2154
|
+
},
|
|
2155
|
+
],
|
|
2156
|
+
ctxArgument: {
|
|
2157
|
+
type: 'Ctx',
|
|
2158
|
+
additionalProperties: {
|
|
2159
|
+
locale: {
|
|
2160
|
+
comment: {
|
|
2161
|
+
comment: 'The currently active locale for the record',
|
|
2162
|
+
},
|
|
2163
|
+
location: {
|
|
2164
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2165
|
+
lineNumber: 12,
|
|
2166
|
+
},
|
|
2167
|
+
type: 'string',
|
|
2168
|
+
},
|
|
2169
|
+
item: {
|
|
2170
|
+
comment: {
|
|
2171
|
+
comment: 'If an already persisted record is being edited, returns the full record\nentity',
|
|
2172
|
+
},
|
|
2173
|
+
location: {
|
|
2174
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2175
|
+
lineNumber: 17,
|
|
2176
|
+
},
|
|
2177
|
+
type: 'Item | null',
|
|
2178
|
+
},
|
|
2179
|
+
itemType: {
|
|
2180
|
+
comment: {
|
|
2181
|
+
comment: 'The model for the record being edited',
|
|
2182
|
+
},
|
|
2183
|
+
location: {
|
|
2184
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2185
|
+
lineNumber: 19,
|
|
2186
|
+
},
|
|
2187
|
+
type: 'ItemType',
|
|
2188
|
+
},
|
|
2189
|
+
formValues: {
|
|
2190
|
+
comment: {
|
|
2191
|
+
comment: 'The complete internal form state',
|
|
2192
|
+
},
|
|
2193
|
+
location: {
|
|
2194
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2195
|
+
lineNumber: 21,
|
|
2196
|
+
},
|
|
2197
|
+
type: 'Record<string, unknown>',
|
|
2198
|
+
},
|
|
2199
|
+
itemStatus: {
|
|
2200
|
+
comment: {
|
|
2201
|
+
comment: 'The current status of the record being edited',
|
|
2202
|
+
},
|
|
2203
|
+
location: {
|
|
2204
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2205
|
+
lineNumber: 23,
|
|
2206
|
+
},
|
|
2207
|
+
type: "'new' | 'draft' | 'updated' | 'published'",
|
|
2208
|
+
},
|
|
2209
|
+
isSubmitting: {
|
|
2210
|
+
comment: {
|
|
2211
|
+
comment: 'Whether the form is currently submitting itself or not',
|
|
2212
|
+
},
|
|
2213
|
+
location: {
|
|
2214
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2215
|
+
lineNumber: 25,
|
|
2216
|
+
},
|
|
2217
|
+
type: 'boolean',
|
|
2218
|
+
},
|
|
2219
|
+
isFormDirty: {
|
|
2220
|
+
comment: {
|
|
2221
|
+
comment: 'Whether the form has some non-persisted changes or not',
|
|
2222
|
+
},
|
|
2223
|
+
location: {
|
|
2224
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2225
|
+
lineNumber: 27,
|
|
2226
|
+
},
|
|
2227
|
+
type: 'boolean',
|
|
2228
|
+
},
|
|
2229
|
+
blocksAnalysis: {
|
|
2230
|
+
comment: {
|
|
2231
|
+
comment: 'Current number of blocks present in form state',
|
|
2232
|
+
},
|
|
2233
|
+
location: {
|
|
2234
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2235
|
+
lineNumber: 29,
|
|
2236
|
+
},
|
|
2237
|
+
type: '{\n usage: {\n /** Total number of blocks present in form state */\n total: number;\n /** Total number of blocks present in non-localized fields */\n nonLocalized: number;\n /** Total number of blocks present in localized fields, per locale */\n perLocale: Record<string, number>;\n };\n /** Maximum number of blocks per item */\n maximumPerItem: number;\n }',
|
|
2238
|
+
},
|
|
2239
|
+
disabled: {
|
|
2240
|
+
comment: {
|
|
2241
|
+
comment: 'Whether the field is currently disabled or not',
|
|
2242
|
+
},
|
|
2243
|
+
location: {
|
|
2244
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
2245
|
+
lineNumber: 8,
|
|
2246
|
+
},
|
|
2247
|
+
type: 'boolean',
|
|
2248
|
+
},
|
|
2249
|
+
fieldPath: {
|
|
2250
|
+
comment: {
|
|
2251
|
+
comment: 'The path in the `formValues` object where to find the current value for the\nfield',
|
|
2252
|
+
},
|
|
2253
|
+
location: {
|
|
2254
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
2255
|
+
lineNumber: 13,
|
|
2256
|
+
},
|
|
2257
|
+
type: 'string',
|
|
2258
|
+
},
|
|
2259
|
+
field: {
|
|
2260
|
+
comment: {
|
|
2261
|
+
comment: 'The field where the field extension is installed to',
|
|
2262
|
+
},
|
|
2263
|
+
location: {
|
|
2264
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
2265
|
+
lineNumber: 15,
|
|
2266
|
+
},
|
|
2267
|
+
type: 'Field',
|
|
2268
|
+
},
|
|
2269
|
+
parentField: {
|
|
2270
|
+
comment: {
|
|
2271
|
+
comment: 'If the field extension is installed in a field of a block, returns the top\nlevel Modular Content/Structured Text field containing the block itself',
|
|
2272
|
+
},
|
|
2273
|
+
location: {
|
|
2274
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
2275
|
+
lineNumber: 20,
|
|
2276
|
+
},
|
|
2277
|
+
type: 'Field | undefined',
|
|
2278
|
+
},
|
|
2279
|
+
block: {
|
|
2280
|
+
comment: {
|
|
2281
|
+
comment: 'If the field extension is installed in a field of a block, returns the ID\nof the block — or `undefined` if the block is still not persisted — and the\nblock model.',
|
|
2282
|
+
},
|
|
2283
|
+
location: {
|
|
2284
|
+
filePath: 'src/ctx/commonExtras/field.ts',
|
|
2285
|
+
lineNumber: 26,
|
|
2286
|
+
},
|
|
2287
|
+
type: 'undefined | { id: string | undefined; blockModel: ItemType }',
|
|
2288
|
+
},
|
|
2289
|
+
parameters: {
|
|
2290
|
+
comment: null,
|
|
2291
|
+
location: {
|
|
2292
|
+
filePath: 'src/hooks/executeFieldDropdownAction.ts',
|
|
2293
|
+
lineNumber: 18,
|
|
2294
|
+
},
|
|
2295
|
+
type: 'Record<string, unknown> | undefined',
|
|
2296
|
+
},
|
|
2297
|
+
},
|
|
2298
|
+
additionalMethods: {
|
|
2299
|
+
toggleField: {
|
|
2300
|
+
comment: {
|
|
2301
|
+
comment: 'Hides/shows a specific field in the form. Please be aware that when a field\nis hidden, the field editor for that field will be removed from the DOM\nitself, including any associated plugins. When it is shown again, its\nplugins will be reinitialized.',
|
|
2302
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.toggleField(fieldPath, true);",
|
|
2303
|
+
},
|
|
2304
|
+
location: {
|
|
2305
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2306
|
+
lineNumber: 65,
|
|
2307
|
+
},
|
|
2308
|
+
type: '(path: string, show: boolean) => Promise<void>',
|
|
2309
|
+
},
|
|
2310
|
+
disableField: {
|
|
2311
|
+
comment: {
|
|
2312
|
+
comment: 'Disables/re-enables a specific field in the form',
|
|
2313
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.disableField(fieldPath, true);",
|
|
2314
|
+
},
|
|
2315
|
+
location: {
|
|
2316
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2317
|
+
lineNumber: 80,
|
|
2318
|
+
},
|
|
2319
|
+
type: '(path: string, disable: boolean) => Promise<void>',
|
|
2320
|
+
},
|
|
2321
|
+
scrollToField: {
|
|
2322
|
+
comment: {
|
|
2323
|
+
comment: 'Smoothly navigates to a specific field in the form. If the field is\nlocalized it will switch language tab and then navigate to the chosen\nfield.',
|
|
2324
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.scrollToField(fieldPath);",
|
|
2325
|
+
},
|
|
2326
|
+
location: {
|
|
2327
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2328
|
+
lineNumber: 97,
|
|
2329
|
+
},
|
|
2330
|
+
type: '(path: string, locale?: string) => Promise<void>',
|
|
2331
|
+
},
|
|
2332
|
+
setFieldValue: {
|
|
2333
|
+
comment: {
|
|
2334
|
+
comment: 'Changes a specific path of the `formValues` object',
|
|
2335
|
+
example: "const fieldPath = prompt(\n 'Please insert the path of a field in the form',\n ctx.fieldPath,\n);\n\nawait ctx.setFieldValue(fieldPath, 'new value');",
|
|
2336
|
+
},
|
|
2337
|
+
location: {
|
|
2338
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2339
|
+
lineNumber: 112,
|
|
2340
|
+
},
|
|
2341
|
+
type: '(path: string, value: unknown) => Promise<void>',
|
|
2342
|
+
},
|
|
2343
|
+
formValuesToItem: {
|
|
2344
|
+
comment: {
|
|
2345
|
+
comment: 'Takes the internal form state, and transforms it into an Item entity\ncompatible with DatoCMS API.\n\nWhen `skipUnchangedFields`, only the fields that changed value will be\nserialized.\n\nIf the required nested blocks are still not loaded, this method will return\n`undefined`.',
|
|
2346
|
+
example: 'await ctx.formValuesToItem(ctx.formValues, false);',
|
|
2347
|
+
},
|
|
2348
|
+
location: {
|
|
2349
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2350
|
+
lineNumber: 129,
|
|
2351
|
+
},
|
|
2352
|
+
type: "(\n formValues: Record<string, unknown>,\n skipUnchangedFields?: boolean,\n ) => Promise<Omit<Item, 'id' | 'meta'> | undefined>",
|
|
2353
|
+
},
|
|
2354
|
+
itemToFormValues: {
|
|
2355
|
+
comment: {
|
|
2356
|
+
comment: 'Takes an Item entity, and converts it into the internal form state',
|
|
2357
|
+
example: 'await ctx.itemToFormValues(ctx.item);',
|
|
2358
|
+
},
|
|
2359
|
+
location: {
|
|
2360
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2361
|
+
lineNumber: 142,
|
|
2362
|
+
},
|
|
2363
|
+
type: "(\n item: Omit<Item, 'id' | 'meta'>,\n ) => Promise<Record<string, unknown>>",
|
|
2364
|
+
},
|
|
2365
|
+
saveCurrentItem: {
|
|
2366
|
+
comment: {
|
|
2367
|
+
comment: 'Triggers a submit form for current record',
|
|
2368
|
+
example: 'await ctx.saveCurrentItem();',
|
|
2369
|
+
},
|
|
2370
|
+
location: {
|
|
2371
|
+
filePath: 'src/ctx/commonExtras/itemForm.ts',
|
|
2372
|
+
lineNumber: 154,
|
|
2373
|
+
},
|
|
2374
|
+
type: '(showToast?: boolean) => Promise<void>',
|
|
2375
|
+
},
|
|
2376
|
+
},
|
|
2377
|
+
},
|
|
2378
|
+
returnType: 'Promise<void>',
|
|
2379
|
+
location: {
|
|
2380
|
+
filePath: 'src/hooks/executeFieldDropdownAction.ts',
|
|
2381
|
+
lineNumber: 9,
|
|
2382
|
+
},
|
|
2383
|
+
},
|
|
2384
|
+
customMarksForStructuredTextField: {
|
|
2385
|
+
name: 'customMarksForStructuredTextField',
|
|
2386
|
+
comment: {
|
|
2387
|
+
comment: 'Use this function to define a number of custom marks for a specific\nStructured Text field',
|
|
2388
|
+
tag: 'structuredText',
|
|
2389
|
+
},
|
|
2390
|
+
nonCtxArguments: [
|
|
2391
|
+
{
|
|
2392
|
+
name: 'field',
|
|
2393
|
+
typeName: 'Field',
|
|
2394
|
+
},
|
|
2395
|
+
],
|
|
2396
|
+
ctxArgument: {
|
|
2397
|
+
type: 'Ctx',
|
|
2398
|
+
additionalProperties: {
|
|
2399
|
+
itemType: {
|
|
2400
|
+
comment: null,
|
|
2401
|
+
location: {
|
|
2402
|
+
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2403
|
+
lineNumber: 22,
|
|
2404
|
+
},
|
|
2405
|
+
type: 'ItemType',
|
|
2406
|
+
},
|
|
2407
|
+
},
|
|
2408
|
+
additionalMethods: null,
|
|
2409
|
+
},
|
|
2410
|
+
returnType: 'StructuredTextCustomMark[] | undefined',
|
|
2411
|
+
location: {
|
|
2412
|
+
filePath: 'src/hooks/customMarksForStructuredTextField.ts',
|
|
2413
|
+
lineNumber: 15,
|
|
2414
|
+
},
|
|
2415
|
+
},
|
|
2416
|
+
customBlockStylesForStructuredTextField: {
|
|
2417
|
+
name: 'customBlockStylesForStructuredTextField',
|
|
2418
|
+
comment: {
|
|
2419
|
+
comment: 'Use this function to define a number of custom block styles for a specific\nStructured Text field',
|
|
2420
|
+
tag: 'structuredText',
|
|
2421
|
+
},
|
|
2422
|
+
nonCtxArguments: [
|
|
2423
|
+
{
|
|
2424
|
+
name: 'field',
|
|
2425
|
+
typeName: 'Field',
|
|
2426
|
+
},
|
|
2427
|
+
],
|
|
2428
|
+
ctxArgument: {
|
|
2429
|
+
type: 'Ctx',
|
|
2430
|
+
additionalProperties: {
|
|
2431
|
+
itemType: {
|
|
2432
|
+
comment: null,
|
|
2433
|
+
location: {
|
|
2434
|
+
filePath: 'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2435
|
+
lineNumber: 22,
|
|
2436
|
+
},
|
|
2437
|
+
type: 'ItemType',
|
|
2438
|
+
},
|
|
2439
|
+
},
|
|
2440
|
+
additionalMethods: null,
|
|
2441
|
+
},
|
|
2442
|
+
returnType: 'StructuredTextCustomBlockStyle[] | undefined',
|
|
2443
|
+
location: {
|
|
2444
|
+
filePath: 'src/hooks/customBlockStylesForStructuredTextField.ts',
|
|
2445
|
+
lineNumber: 15,
|
|
2446
|
+
},
|
|
2447
|
+
},
|
|
2448
|
+
contentAreaSidebarItems: {
|
|
2449
|
+
name: 'contentAreaSidebarItems',
|
|
2450
|
+
comment: {
|
|
2451
|
+
comment: 'Use this function to declare new items in the content area sidebar',
|
|
2452
|
+
tag: 'sidebarItems',
|
|
2453
|
+
},
|
|
2454
|
+
nonCtxArguments: [],
|
|
2455
|
+
ctxArgument: {
|
|
2456
|
+
type: 'Ctx',
|
|
2457
|
+
additionalProperties: null,
|
|
2458
|
+
additionalMethods: null,
|
|
2459
|
+
},
|
|
2460
|
+
returnType: 'ContentAreaSidebarItem[]',
|
|
2461
|
+
location: {
|
|
2462
|
+
filePath: 'src/hooks/contentAreaSidebarItems.ts',
|
|
2463
|
+
lineNumber: 10,
|
|
2464
|
+
},
|
|
2465
|
+
},
|
|
2466
|
+
buildItemPresentationInfo: {
|
|
2467
|
+
name: 'buildItemPresentationInfo',
|
|
2468
|
+
comment: {
|
|
2469
|
+
comment: 'Use this function to customize the presentation of a record in records\ncollections and "Single link" or "Multiple links" field',
|
|
2470
|
+
tag: 'presentation',
|
|
2471
|
+
},
|
|
2472
|
+
nonCtxArguments: [
|
|
2473
|
+
{
|
|
2474
|
+
name: 'item',
|
|
2475
|
+
typeName: 'Item',
|
|
2476
|
+
},
|
|
2477
|
+
],
|
|
2478
|
+
ctxArgument: {
|
|
2479
|
+
type: 'Ctx',
|
|
2480
|
+
additionalProperties: null,
|
|
2481
|
+
additionalMethods: null,
|
|
2482
|
+
},
|
|
2483
|
+
returnType: 'MaybePromise<ItemPresentationInfo | undefined>',
|
|
2484
|
+
location: {
|
|
2485
|
+
filePath: 'src/hooks/buildItemPresentationInfo.ts',
|
|
2486
|
+
lineNumber: 14,
|
|
2487
|
+
},
|
|
2488
|
+
},
|
|
2489
|
+
assetSources: {
|
|
2490
|
+
name: 'assetSources',
|
|
2491
|
+
comment: {
|
|
2492
|
+
comment: 'Use this function to declare additional sources to be shown when users want\nto upload new assets',
|
|
2493
|
+
tag: 'assetSources',
|
|
2494
|
+
},
|
|
2495
|
+
nonCtxArguments: [],
|
|
2496
|
+
ctxArgument: {
|
|
2497
|
+
type: 'Ctx',
|
|
2498
|
+
additionalProperties: null,
|
|
2499
|
+
additionalMethods: null,
|
|
2500
|
+
},
|
|
2501
|
+
returnType: 'AssetSource[] | undefined',
|
|
2502
|
+
location: {
|
|
2503
|
+
filePath: 'src/hooks/assetSources.ts',
|
|
2504
|
+
lineNumber: 11,
|
|
2505
|
+
},
|
|
2506
|
+
},
|
|
2507
|
+
},
|
|
2508
|
+
baseCtx: {
|
|
2509
|
+
properties: {
|
|
2510
|
+
site: {
|
|
2511
|
+
comment: {
|
|
2512
|
+
comment: 'The current DatoCMS project',
|
|
2513
|
+
},
|
|
2514
|
+
location: {
|
|
2515
|
+
filePath: 'src/ctx/base.ts',
|
|
2516
|
+
lineNumber: 24,
|
|
2517
|
+
},
|
|
2518
|
+
type: 'Site',
|
|
2519
|
+
},
|
|
2520
|
+
environment: {
|
|
2521
|
+
comment: {
|
|
2522
|
+
comment: 'The ID of the current environment',
|
|
2523
|
+
},
|
|
2524
|
+
location: {
|
|
2525
|
+
filePath: 'src/ctx/base.ts',
|
|
2526
|
+
lineNumber: 26,
|
|
2527
|
+
},
|
|
2528
|
+
type: 'string',
|
|
2529
|
+
},
|
|
2530
|
+
itemTypes: {
|
|
2531
|
+
comment: {
|
|
2532
|
+
comment: 'All the models of the current DatoCMS project, indexed by ID',
|
|
2533
|
+
},
|
|
2534
|
+
location: {
|
|
2535
|
+
filePath: 'src/ctx/base.ts',
|
|
2536
|
+
lineNumber: 28,
|
|
2537
|
+
},
|
|
2538
|
+
type: 'Partial<Record<string, ItemType>>',
|
|
2539
|
+
},
|
|
2540
|
+
currentUser: {
|
|
2541
|
+
comment: {
|
|
2542
|
+
comment: 'The current DatoCMS user. It can either be the owner or one of the\ncollaborators (regular or SSO).',
|
|
2543
|
+
},
|
|
2544
|
+
location: {
|
|
2545
|
+
filePath: 'src/ctx/base.ts',
|
|
2546
|
+
lineNumber: 33,
|
|
2547
|
+
},
|
|
2548
|
+
type: 'User | SsoUser | Account | Organization',
|
|
2549
|
+
},
|
|
2550
|
+
currentRole: {
|
|
2551
|
+
comment: {
|
|
2552
|
+
comment: 'The role for the current DatoCMS user',
|
|
2553
|
+
},
|
|
2554
|
+
location: {
|
|
2555
|
+
filePath: 'src/ctx/base.ts',
|
|
2556
|
+
lineNumber: 35,
|
|
2557
|
+
},
|
|
2558
|
+
type: 'Role',
|
|
2559
|
+
},
|
|
2560
|
+
currentUserAccessToken: {
|
|
2561
|
+
comment: {
|
|
2562
|
+
comment: 'The access token to perform API calls on behalf of the current user. Only\navailable if `currentUserAccessToken` additional permission is granted',
|
|
2563
|
+
},
|
|
2564
|
+
location: {
|
|
2565
|
+
filePath: 'src/ctx/base.ts',
|
|
2566
|
+
lineNumber: 40,
|
|
2567
|
+
},
|
|
2568
|
+
type: 'string | undefined',
|
|
2569
|
+
},
|
|
2570
|
+
plugin: {
|
|
2571
|
+
comment: {
|
|
2572
|
+
comment: 'The current plugin',
|
|
2573
|
+
},
|
|
2574
|
+
location: {
|
|
2575
|
+
filePath: 'src/ctx/base.ts',
|
|
2576
|
+
lineNumber: 42,
|
|
2577
|
+
},
|
|
2578
|
+
type: 'Plugin',
|
|
2579
|
+
},
|
|
2580
|
+
ui: {
|
|
2581
|
+
comment: {
|
|
2582
|
+
comment: 'UI preferences of the current user (right now, only the preferred locale is\navailable)',
|
|
2583
|
+
},
|
|
2584
|
+
location: {
|
|
2585
|
+
filePath: 'src/ctx/base.ts',
|
|
2586
|
+
lineNumber: 47,
|
|
2587
|
+
},
|
|
2588
|
+
type: '{\n /** Preferred locale */\n locale: string;\n }',
|
|
2589
|
+
},
|
|
2590
|
+
fields: {
|
|
2591
|
+
comment: {
|
|
2592
|
+
comment: 'All the fields currently loaded for the current DatoCMS project, indexed by\nID. It will always contain the current model fields and all the fields of\nthe blocks it might contain via Modular Content/Structured Text fields. If\nsome fields you need are not present, use the `loadItemTypeFields` function\nto load them.',
|
|
2593
|
+
},
|
|
2594
|
+
location: {
|
|
2595
|
+
filePath: 'src/ctx/base.ts',
|
|
2596
|
+
lineNumber: 58,
|
|
2597
|
+
},
|
|
2598
|
+
type: 'Partial<Record<string, Field>>',
|
|
2599
|
+
},
|
|
2600
|
+
fieldsets: {
|
|
2601
|
+
comment: {
|
|
2602
|
+
comment: 'All the fieldsets currently loaded for the current DatoCMS project, indexed\nby ID. It will always contain the current model fields and all the fields\nof the blocks it might contain via Modular Content/Structured Text fields.\nIf some fields you need are not present, use the `loadItemTypeFieldsets`\nfunction to load them.',
|
|
2603
|
+
},
|
|
2604
|
+
location: {
|
|
2605
|
+
filePath: 'src/ctx/base.ts',
|
|
2606
|
+
lineNumber: 66,
|
|
2607
|
+
},
|
|
2608
|
+
type: 'Partial<Record<string, Fieldset>>',
|
|
2609
|
+
},
|
|
2610
|
+
theme: {
|
|
2611
|
+
comment: {
|
|
2612
|
+
comment: 'An object containing the theme colors for the current DatoCMS project',
|
|
2613
|
+
},
|
|
2614
|
+
location: {
|
|
2615
|
+
filePath: 'src/ctx/base.ts',
|
|
2616
|
+
lineNumber: 68,
|
|
2617
|
+
},
|
|
2618
|
+
type: 'Theme',
|
|
2619
|
+
},
|
|
2620
|
+
users: {
|
|
2621
|
+
comment: {
|
|
2622
|
+
comment: 'All the regular users currently loaded for the current DatoCMS project,\nindexed by ID. It will always contain the current user. If some users you\nneed are not present, use the `loadUsers` function to load them.',
|
|
2623
|
+
},
|
|
2624
|
+
location: {
|
|
2625
|
+
filePath: 'src/ctx/base.ts',
|
|
2626
|
+
lineNumber: 74,
|
|
2627
|
+
},
|
|
2628
|
+
type: 'Partial<Record<string, User>>',
|
|
2629
|
+
},
|
|
2630
|
+
ssoUsers: {
|
|
2631
|
+
comment: {
|
|
2632
|
+
comment: 'All the SSO users currently loaded for the current DatoCMS project, indexed\nby ID. It will always contain the current user. If some users you need are\nnot present, use the `loadSsoUsers` function to load them.',
|
|
2633
|
+
},
|
|
2634
|
+
location: {
|
|
2635
|
+
filePath: 'src/ctx/base.ts',
|
|
2636
|
+
lineNumber: 80,
|
|
2637
|
+
},
|
|
2638
|
+
type: 'Partial<Record<string, SsoUser>>',
|
|
2639
|
+
},
|
|
2640
|
+
account: {
|
|
2641
|
+
comment: {
|
|
2642
|
+
comment: 'The account that is the project owner',
|
|
2643
|
+
},
|
|
2644
|
+
location: {
|
|
2645
|
+
filePath: 'src/ctx/base.ts',
|
|
2646
|
+
lineNumber: 87,
|
|
2647
|
+
},
|
|
2648
|
+
type: 'Account | undefined',
|
|
2649
|
+
},
|
|
2650
|
+
owner: {
|
|
2651
|
+
comment: {
|
|
2652
|
+
comment: 'The account that is the project owner',
|
|
2653
|
+
},
|
|
2654
|
+
location: {
|
|
2655
|
+
filePath: 'src/ctx/base.ts',
|
|
2656
|
+
lineNumber: 89,
|
|
2657
|
+
},
|
|
2658
|
+
type: 'Account | Organization',
|
|
2659
|
+
},
|
|
2660
|
+
},
|
|
2661
|
+
methods: {
|
|
2662
|
+
loadItemTypeFields: {
|
|
2663
|
+
comment: {
|
|
2664
|
+
comment: 'Loads all the fields for a specific model (or block). Fields will be\nreturned and will also be available in the the `fields` property.',
|
|
2665
|
+
example: "const itemTypeId = prompt('Please insert a model ID:');\n\nconst fields = await ctx.loadItemTypeFields(itemTypeId);\n\nctx.notice(\n `Success! ${fields\n .map((field) => field.attributes.api_key)\n .join(', ')}`,\n);",
|
|
2666
|
+
},
|
|
2667
|
+
location: {
|
|
2668
|
+
filePath: 'src/ctx/base.ts',
|
|
2669
|
+
lineNumber: 133,
|
|
2670
|
+
},
|
|
2671
|
+
type: '(itemTypeId: string) => Promise<Field[]>',
|
|
2672
|
+
},
|
|
2673
|
+
loadItemTypeFieldsets: {
|
|
2674
|
+
comment: {
|
|
2675
|
+
comment: 'Loads all the fieldsets for a specific model (or block). Fieldsets will be\nreturned and will also be available in the the `fieldsets` property.',
|
|
2676
|
+
example: "const itemTypeId = prompt('Please insert a model ID:');\n\nconst fieldsets = await ctx.loadItemTypeFieldsets(itemTypeId);\n\nctx.notice(\n `Success! ${fieldsets\n .map((fieldset) => fieldset.attributes.title)\n .join(', ')}`,\n);",
|
|
2677
|
+
},
|
|
2678
|
+
location: {
|
|
2679
|
+
filePath: 'src/ctx/base.ts',
|
|
2680
|
+
lineNumber: 152,
|
|
2681
|
+
},
|
|
2682
|
+
type: '(itemTypeId: string) => Promise<Fieldset[]>',
|
|
2683
|
+
},
|
|
2684
|
+
loadFieldsUsingPlugin: {
|
|
2685
|
+
comment: {
|
|
2686
|
+
comment: 'Loads all the fields in the project that are currently using the plugin for\none of its manual field extensions.',
|
|
2687
|
+
example: "const fields = await ctx.loadFieldsUsingPlugin();\n\nctx.notice(\n `Success! ${fields\n .map((field) => field.attributes.api_key)\n .join(', ')}`,\n);",
|
|
2688
|
+
},
|
|
2689
|
+
location: {
|
|
2690
|
+
filePath: 'src/ctx/base.ts',
|
|
2691
|
+
lineNumber: 169,
|
|
2692
|
+
},
|
|
2693
|
+
type: '() => Promise<Field[]>',
|
|
2694
|
+
},
|
|
2695
|
+
loadUsers: {
|
|
2696
|
+
comment: {
|
|
2697
|
+
comment: 'Loads all regular users. Users will be returned and will also be available\nin the the `users` property.',
|
|
2698
|
+
example: "const users = await ctx.loadUsers();\n\nctx.notice(`Success! ${users.map((user) => user.id).join(', ')}`);",
|
|
2699
|
+
},
|
|
2700
|
+
location: {
|
|
2701
|
+
filePath: 'src/ctx/base.ts',
|
|
2702
|
+
lineNumber: 182,
|
|
2703
|
+
},
|
|
2704
|
+
type: '() => Promise<User[]>',
|
|
2705
|
+
},
|
|
2706
|
+
loadSsoUsers: {
|
|
2707
|
+
comment: {
|
|
2708
|
+
comment: 'Loads all SSO users. Users will be returned and will also be available in\nthe the `ssoUsers` property.',
|
|
2709
|
+
example: "const users = await ctx.loadSsoUsers();\n\nctx.notice(`Success! ${users.map((user) => user.id).join(', ')}`);",
|
|
2710
|
+
},
|
|
2711
|
+
location: {
|
|
2712
|
+
filePath: 'src/ctx/base.ts',
|
|
2713
|
+
lineNumber: 195,
|
|
2714
|
+
},
|
|
2715
|
+
type: '() => Promise<SsoUser[]>',
|
|
2716
|
+
},
|
|
2717
|
+
updatePluginParameters: {
|
|
2718
|
+
comment: {
|
|
2719
|
+
comment: 'Updates the plugin parameters.\n\nAlways check `ctx.currentRole.meta.final_permissions.can_edit_schema`\nbefore calling this, as the user might not have the permission to perform\nthe operation.',
|
|
2720
|
+
example: "await ctx.updatePluginParameters({ debugMode: true });\nawait ctx.notice('Plugin parameters successfully updated!');",
|
|
2721
|
+
},
|
|
2722
|
+
location: {
|
|
2723
|
+
filePath: 'src/ctx/base.ts',
|
|
2724
|
+
lineNumber: 217,
|
|
2725
|
+
},
|
|
2726
|
+
type: '(params: Record<string, unknown>) => Promise<void>',
|
|
2727
|
+
},
|
|
2728
|
+
updateFieldAppearance: {
|
|
2729
|
+
comment: {
|
|
2730
|
+
comment: 'Performs changes in the appearance of a field. You can install/remove a\nmanual field extension, or tweak their parameters. If multiple changes are\npassed, they will be applied sequencially.\n\nAlways check `ctx.currentRole.meta.final_permissions.can_edit_schema`\nbefore calling this, as the user might not have the permission to perform\nthe operation.',
|
|
2731
|
+
example: "const fields = await ctx.loadFieldsUsingPlugin();\n\nif (fields.length === 0) {\n ctx.alert('No field is using this plugin as a manual extension!');\n return;\n}\n\nfor (const field of fields) {\n const { appearance } = field.attributes;\n const operations = [];\n\n if (appearance.editor === ctx.plugin.id) {\n operations.push({\n operation: 'updateEditor',\n newParameters: {\n ...appearance.parameters,\n foo: 'bar',\n },\n });\n }\n\n appearance.addons.forEach((addon, i) => {\n if (addon.id !== ctx.plugin.id) {\n return;\n }\n\n operations.push({\n operation: 'updateAddon',\n index: i,\n newParameters: { ...addon.parameters, foo: 'bar' },\n });\n });\n\n await ctx.updateFieldAppearance(field.id, operations);\n ctx.notice(`Successfully edited field ${field.attributes.api_key}`);\n}",
|
|
2732
|
+
},
|
|
2733
|
+
location: {
|
|
2734
|
+
filePath: 'src/ctx/base.ts',
|
|
2735
|
+
lineNumber: 268,
|
|
2736
|
+
},
|
|
2737
|
+
type: '(\n fieldId: string,\n changes: FieldAppearanceChange[],\n ) => Promise<void>',
|
|
2738
|
+
},
|
|
2739
|
+
alert: {
|
|
2740
|
+
comment: {
|
|
2741
|
+
comment: 'Triggers an "error" toast displaying the selected message',
|
|
2742
|
+
example: "const message = prompt(\n 'Please insert a message:',\n 'This is an alert message!',\n);\n\nawait ctx.alert(message);",
|
|
2743
|
+
},
|
|
2744
|
+
location: {
|
|
2745
|
+
filePath: 'src/ctx/base.ts',
|
|
2746
|
+
lineNumber: 373,
|
|
2747
|
+
},
|
|
2748
|
+
type: '(message: string) => Promise<void>',
|
|
2749
|
+
},
|
|
2750
|
+
notice: {
|
|
2751
|
+
comment: {
|
|
2752
|
+
comment: 'Triggers a "success" toast displaying the selected message',
|
|
2753
|
+
example: "const message = prompt(\n 'Please insert a message:',\n 'This is a notice message!',\n);\n\nawait ctx.notice(message);",
|
|
2754
|
+
},
|
|
2755
|
+
location: {
|
|
2756
|
+
filePath: 'src/ctx/base.ts',
|
|
2757
|
+
lineNumber: 388,
|
|
2758
|
+
},
|
|
2759
|
+
type: '(message: string) => Promise<void>',
|
|
2760
|
+
},
|
|
2761
|
+
customToast: {
|
|
2762
|
+
comment: {
|
|
2763
|
+
comment: 'Triggers a custom toast displaying the selected message (and optionally a\nCTA)',
|
|
2764
|
+
example: "const result = await ctx.customToast({\n type: 'warning',\n message: 'Just a sample warning notification!',\n dismissOnPageChange: true,\n dismissAfterTimeout: 5000,\n cta: {\n label: 'Execute call-to-action',\n value: 'cta',\n },\n});\n\nif (result === 'cta') {\n ctx.notice(`Clicked CTA!`);\n}",
|
|
2765
|
+
},
|
|
2766
|
+
location: {
|
|
2767
|
+
filePath: 'src/ctx/base.ts',
|
|
2768
|
+
lineNumber: 412,
|
|
2769
|
+
},
|
|
2770
|
+
type: '<CtaValue = unknown>(\n toast: Toast<CtaValue>,\n ) => Promise<CtaValue | null>',
|
|
2771
|
+
},
|
|
2772
|
+
createNewItem: {
|
|
2773
|
+
comment: {
|
|
2774
|
+
comment: 'Opens a dialog for creating a new record. It returns a promise resolved\nwith the newly created record or `null` if the user closes the dialog\nwithout creating anything.',
|
|
2775
|
+
example: "const itemTypeId = prompt('Please insert a model ID:');\n\nconst item = await ctx.createNewItem(itemTypeId);\n\nif (item) {\n ctx.notice(`Success! ${item.id}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2776
|
+
},
|
|
2777
|
+
location: {
|
|
2778
|
+
filePath: 'src/ctx/base.ts',
|
|
2779
|
+
lineNumber: 298,
|
|
2780
|
+
},
|
|
2781
|
+
type: '(itemTypeId: string) => Promise<Item | null>',
|
|
2782
|
+
},
|
|
2783
|
+
selectItem: {
|
|
2784
|
+
comment: {
|
|
2785
|
+
comment: 'Opens a dialog for selecting one (or multiple) record(s) from a list of\nexisting records of type `itemTypeId`. It returns a promise resolved with\nthe selected record(s), or `null` if the user closes the dialog without\nchoosing any record.',
|
|
2786
|
+
example: "const itemTypeId = prompt('Please insert a model ID:');\n\nconst items = await ctx.selectItem(itemTypeId, { multiple: true });\n\nif (items) {\n ctx.notice(`Success! ${items.map((i) => i.id).join(', ')}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2787
|
+
},
|
|
2788
|
+
location: {
|
|
2789
|
+
filePath: 'src/ctx/base.ts',
|
|
2790
|
+
lineNumber: 319,
|
|
2791
|
+
},
|
|
2792
|
+
type: '{\n (\n itemTypeId: string,\n options: { multiple: true; initialLocationQuery?: ItemListLocationQuery },\n ): Promise<Item[] | null>;\n (\n itemTypeId: string,\n options?: {\n multiple: false;\n initialLocationQuery?: ItemListLocationQuery;\n },\n ): Promise<Item | null>;\n }',
|
|
2793
|
+
},
|
|
2794
|
+
editItem: {
|
|
2795
|
+
comment: {
|
|
2796
|
+
comment: 'Opens a dialog for editing an existing record. It returns a promise\nresolved with the edited record, or `null` if the user closes the dialog\nwithout persisting any change.',
|
|
2797
|
+
example: "const itemId = prompt('Please insert a record ID:');\n\nconst item = await ctx.editItem(itemId);\n\nif (item) {\n ctx.notice(`Success! ${item.id}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2798
|
+
},
|
|
2799
|
+
location: {
|
|
2800
|
+
filePath: 'src/ctx/base.ts',
|
|
2801
|
+
lineNumber: 351,
|
|
2802
|
+
},
|
|
2803
|
+
type: '(itemId: string) => Promise<Item | null>',
|
|
2804
|
+
},
|
|
2805
|
+
selectUpload: {
|
|
2806
|
+
comment: {
|
|
2807
|
+
comment: 'Opens a dialog for selecting one (or multiple) existing asset(s). It\nreturns a promise resolved with the selected asset(s), or `null` if the\nuser closes the dialog without selecting any upload.',
|
|
2808
|
+
example: "const item = await ctx.selectUpload({ multiple: false });\n\nif (item) {\n ctx.notice(`Success! ${item.id}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2809
|
+
},
|
|
2810
|
+
location: {
|
|
2811
|
+
filePath: 'src/ctx/base.ts',
|
|
2812
|
+
lineNumber: 439,
|
|
2813
|
+
},
|
|
2814
|
+
type: '{\n (options: { multiple: true }): Promise<Upload[] | null>;\n (options?: { multiple: false }): Promise<Upload | null>;\n }',
|
|
2815
|
+
},
|
|
2816
|
+
editUpload: {
|
|
2817
|
+
comment: {
|
|
2818
|
+
comment: 'Opens a dialog for editing a Media Area asset. It returns a promise\nresolved with:\n\n- The updated asset, if the user persists some changes to the asset itself\n- `null`, if the user closes the dialog without persisting any change\n- An asset structure with an additional `deleted` property set to true, if\n the user deletes the asset',
|
|
2819
|
+
example: "const uploadId = prompt('Please insert an asset ID:');\n\nconst item = await ctx.editUpload(uploadId);\n\nif (item) {\n ctx.notice(`Success! ${item.id}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2820
|
+
},
|
|
2821
|
+
location: {
|
|
2822
|
+
filePath: 'src/ctx/base.ts',
|
|
2823
|
+
lineNumber: 467,
|
|
2824
|
+
},
|
|
2825
|
+
type: '(\n uploadId: string,\n ) => Promise<(Upload & { deleted?: true }) | null>',
|
|
2826
|
+
},
|
|
2827
|
+
editUploadMetadata: {
|
|
2828
|
+
comment: {
|
|
2829
|
+
comment: 'Opens a dialog for editing a "single asset" field structure. It returns a\npromise resolved with the updated structure, or `null` if the user closes\nthe dialog without persisting any change.',
|
|
2830
|
+
example: "const uploadId = prompt('Please insert an asset ID:');\n\nconst result = await ctx.editUploadMetadata({\n upload_id: uploadId,\n alt: null,\n title: null,\n custom_data: {},\n focal_point: null,\n});\n\nif (result) {\n ctx.notice(`Success! ${JSON.stringify(result)}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2831
|
+
},
|
|
2832
|
+
location: {
|
|
2833
|
+
filePath: 'src/ctx/base.ts',
|
|
2834
|
+
lineNumber: 495,
|
|
2835
|
+
},
|
|
2836
|
+
type: '(\n /** The "single asset" field structure */\n fileFieldValue: FileFieldValue,\n /** Shows metadata information for a specific locale */\n locale?: string,\n ) => Promise<FileFieldValue | null>',
|
|
2837
|
+
},
|
|
2838
|
+
openModal: {
|
|
2839
|
+
comment: {
|
|
2840
|
+
comment: 'Opens a custom modal. Returns a promise resolved with what the modal itself\nreturns calling the `resolve()` function',
|
|
2841
|
+
example: "const result = await ctx.openModal({\n id: 'regular',\n title: 'Custom title!',\n width: 'l',\n parameters: { foo: 'bar' },\n});\n\nif (result) {\n ctx.notice(`Success! ${JSON.stringify(result)}`);\n} else {\n ctx.alert('Closed!');\n}",
|
|
2842
|
+
},
|
|
2843
|
+
location: {
|
|
2844
|
+
filePath: 'src/ctx/base.ts',
|
|
2845
|
+
lineNumber: 526,
|
|
2846
|
+
},
|
|
2847
|
+
type: '(modal: Modal) => Promise<unknown>',
|
|
2848
|
+
},
|
|
2849
|
+
openConfirm: {
|
|
2850
|
+
comment: {
|
|
2851
|
+
comment: 'Opens a UI-consistent confirmation dialog. Returns a promise resolved with\nthe value of the choice made by the user',
|
|
2852
|
+
example: "const result = await ctx.openConfirm({\n title: 'Custom title',\n content:\n 'Lorem Ipsum is simply dummy text of the printing and typesetting industry',\n choices: [\n {\n label: 'Positive',\n value: 'positive',\n intent: 'positive',\n },\n {\n label: 'Negative',\n value: 'negative',\n intent: 'negative',\n },\n ],\n cancel: {\n label: 'Cancel',\n value: false,\n },\n});\n\nif (result) {\n ctx.notice(`Success! ${result}`);\n} else {\n ctx.alert('Cancelled!');\n}",
|
|
2853
|
+
},
|
|
2854
|
+
location: {
|
|
2855
|
+
filePath: 'src/ctx/base.ts',
|
|
2856
|
+
lineNumber: 563,
|
|
2857
|
+
},
|
|
2858
|
+
type: '(options: ConfirmOptions) => Promise<unknown>',
|
|
2859
|
+
},
|
|
2860
|
+
navigateTo: {
|
|
2861
|
+
comment: {
|
|
2862
|
+
comment: 'Moves the user to another URL internal to the backend',
|
|
2863
|
+
example: "await ctx.navigateTo('/');",
|
|
2864
|
+
},
|
|
2865
|
+
location: {
|
|
2866
|
+
filePath: 'src/ctx/base.ts',
|
|
2867
|
+
lineNumber: 577,
|
|
2868
|
+
},
|
|
2869
|
+
type: '(path: string) => Promise<void>',
|
|
2870
|
+
},
|
|
2871
|
+
},
|
|
2872
|
+
},
|
|
2873
|
+
selfResizingPluginFrameCtxSizingUtilities: {
|
|
2874
|
+
startAutoResizer: {
|
|
2875
|
+
comment: {
|
|
2876
|
+
comment: "Listens for DOM changes and automatically calls `setHeight` when it detects\na change. If you're using `datocms-react-ui` package, the `<Canvas />`\ncomponent already takes care of calling this method for you.",
|
|
2877
|
+
},
|
|
2878
|
+
location: {
|
|
2879
|
+
filePath: 'src/ctx/commonExtras/sizing.ts',
|
|
2880
|
+
lineNumber: 7,
|
|
2881
|
+
},
|
|
2882
|
+
type: '() => void',
|
|
2883
|
+
},
|
|
2884
|
+
stopAutoResizer: {
|
|
2885
|
+
comment: {
|
|
2886
|
+
comment: 'Stops resizing the iframe automatically',
|
|
2887
|
+
},
|
|
2888
|
+
location: {
|
|
2889
|
+
filePath: 'src/ctx/commonExtras/sizing.ts',
|
|
2890
|
+
lineNumber: 10,
|
|
2891
|
+
},
|
|
2892
|
+
type: '() => void',
|
|
2893
|
+
},
|
|
2894
|
+
updateHeight: {
|
|
2895
|
+
comment: {
|
|
2896
|
+
comment: "Triggers a change in the size of the iframe. If you don't explicitely pass\na `newHeight` it will be automatically calculated using the iframe content\nat the moment",
|
|
2897
|
+
},
|
|
2898
|
+
location: {
|
|
2899
|
+
filePath: 'src/ctx/commonExtras/sizing.ts',
|
|
2900
|
+
lineNumber: 17,
|
|
2901
|
+
},
|
|
2902
|
+
type: '(newHeight?: number) => void',
|
|
2903
|
+
},
|
|
2904
|
+
},
|
|
2905
|
+
};
|
|
2906
|
+
//# sourceMappingURL=manifest.js.map
|