File tree Expand file tree Collapse file tree 3 files changed +29
-2
lines changed
src/Umbraco.Web.UI.Client/src/packages/property-editors Expand file tree Collapse file tree 3 files changed +29
-2
lines changed Original file line number Diff line number Diff line change 1+ import { manifests as entityDataPickerManifests } from './manifests.js' ;
2+ import type { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api' ;
3+ import type { ManifestPropertyEditorDataSource } from '@umbraco-cms/backoffice/property-editor-data-source' ;
4+
5+ export const onInit : UmbEntryPointOnInit = ( host , extensionRegistry ) => {
6+ let initialized = false ;
7+
8+ /* We register the Entity Data Picker only if any picker data sources have been registered.
9+ This prevents an unusable Property Editor UI from appearing in the list of Property Editors out of the box.
10+ We can remove this code when data sources become more common. */
11+ extensionRegistry
12+ . byTypeAndFilter < 'propertyEditorDataSource' , ManifestPropertyEditorDataSource > (
13+ 'propertyEditorDataSource' ,
14+ ( manifest ) => manifest . dataSourceType === 'picker' ,
15+ )
16+ . subscribe ( ( pickerPropertyEditorDataSource ) => {
17+ if ( pickerPropertyEditorDataSource . length > 0 && ! initialized ) {
18+ extensionRegistry . registerMany ( entityDataPickerManifests ) ;
19+ initialized = true ;
20+ }
21+ } ) ;
22+ } ;
Original file line number Diff line number Diff line change 1+ import { onInit as entityDataPickerOnInit } from './entity-data-picker/entry-point.js' ;
2+ import type { UmbEntryPointOnInit } from '@umbraco-cms/backoffice/extension-api' ;
13import './checkbox-list/components/index.js' ;
24import './content-picker/components/index.js' ;
5+
6+ export const onInit : UmbEntryPointOnInit = ( host , extensionRegistry ) => {
7+ // We do not have a package for the Entity Data Picker, so we proxy the init call here
8+ entityDataPickerOnInit ( host , extensionRegistry ) ;
9+ } ;
Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import { manifests as textareaManifests } from './textarea/manifests.js';
2525import { manifests as textBoxManifests } from './text-box/manifests.js' ;
2626import { manifests as toggleManifests } from './toggle/manifests.js' ;
2727import { manifests as contentPickerManifests } from './content-picker/manifests.js' ;
28- import { manifests as entityDataPickerManifests } from './entity-data-picker/manifests.js' ;
2928
3029export const manifests : Array < UmbExtensionManifest > = [
3130 ...checkboxListManifests ,
@@ -46,7 +45,6 @@ export const manifests: Array<UmbExtensionManifest> = [
4645 ...textBoxManifests ,
4746 ...toggleManifests ,
4847 ...contentPickerManifests ,
49- ...entityDataPickerManifests ,
5048 acceptedType ,
5149 colorEditor ,
5250 dimensions ,
You can’t perform that action at this time.
0 commit comments