resetState methods for block
This commit is contained in:
@@ -30,9 +30,6 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
|
||||
readonly name = this.#data.asObservablePart(() => 'block');
|
||||
readonly unique = this.#data.asObservablePart((data) => data?.contentElementTypeKey);
|
||||
|
||||
#properties = new UmbArrayState<PropertyEditorSettingsProperty>([], (x) => x.alias);
|
||||
readonly properties = this.#properties.asObservable();
|
||||
|
||||
constructor(host: UmbControllerHost, args: { manifest: ManifestWorkspace }) {
|
||||
super(host, args.manifest.alias);
|
||||
const manifest = args.manifest;
|
||||
@@ -73,7 +70,7 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
|
||||
protected override resetState() {
|
||||
super.resetState();
|
||||
this.#data.setValue(undefined);
|
||||
this.#properties.setValue([]);
|
||||
this.removeUmbControllerByAlias('isNewRedirectController');
|
||||
}
|
||||
|
||||
createPropertyDatasetContext(host: UmbControllerHost): UmbPropertyDatasetContext {
|
||||
@@ -168,7 +165,6 @@ export class UmbBlockTypeWorkspaceContext<BlockTypeData extends UmbBlockTypeWith
|
||||
|
||||
public override destroy(): void {
|
||||
this.#data.destroy();
|
||||
this.#properties.destroy();
|
||||
super.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,13 +112,24 @@ export class UmbBlockWorkspaceContext<LayoutDataType extends UmbBlockLayoutBaseM
|
||||
]);
|
||||
}
|
||||
|
||||
protected override resetState() {
|
||||
super.resetState();
|
||||
this.#label.setValue(undefined);
|
||||
this.#layout.setValue(undefined);
|
||||
this.#initialLayout = undefined;
|
||||
this.#initialContent = undefined;
|
||||
this.#initialSettings = undefined;
|
||||
this.content.reset();
|
||||
this.settings.reset();
|
||||
this.removeUmbControllerByAlias('isNewRedirectController');
|
||||
}
|
||||
|
||||
async load(unique: string) {
|
||||
await this.#retrieveBlockManager;
|
||||
await this.#retrieveBlockEntries;
|
||||
await this.#editorConfigPromise;
|
||||
if (!this.#blockManager || !this.#blockEntries) {
|
||||
throw new Error('Block manager not found');
|
||||
return;
|
||||
}
|
||||
|
||||
this.observe(
|
||||
|
||||
Reference in New Issue
Block a user