mirror of
https://github.com/Matysh/houseplan-card
synced 2026-10-06 22:49:16 +00:00
fix: await draft deletion through the card facade (#405)
Issue: #405 User-Visible: no
This commit is contained in:
@@ -218,8 +218,9 @@ export class EditorSecondaryController {
|
||||
};
|
||||
}
|
||||
|
||||
runContext(capturedContext: string, currentContext: string, action: () => void): void {
|
||||
if (capturedContext === currentContext) action();
|
||||
runContext<T>(capturedContext: string, currentContext: string, action: () => T): T | undefined {
|
||||
if (capturedContext === currentContext) return action();
|
||||
return undefined;
|
||||
}
|
||||
|
||||
render(model: EditorSecondaryModel | null, blocked: boolean): TemplateResult {
|
||||
|
||||
@@ -7894,7 +7894,7 @@ export class HouseplanCard extends LitElement {
|
||||
return this._editorRuntimeOrThrow()._savePhysicalDialog();
|
||||
}
|
||||
|
||||
private _deletePhysicalSelection = (): void => {
|
||||
private _deletePhysicalSelection = (): Promise<void> => {
|
||||
return this._editorRuntimeOrThrow()._deletePhysicalSelection();
|
||||
}
|
||||
|
||||
@@ -8926,7 +8926,7 @@ export class HouseplanCard extends LitElement {
|
||||
return `${base}:none`;
|
||||
}
|
||||
|
||||
private _runEditorContext(contextId: string, action: () => void): void {
|
||||
private _runEditorContext<T>(contextId: string, action: () => T): T | undefined {
|
||||
return this._editorRuntimeOrThrow()._runEditorContext(contextId, action);
|
||||
}
|
||||
|
||||
|
||||
@@ -3070,11 +3070,11 @@ public _savePhysicalDialog = (): void => {
|
||||
if (!committed) this.host.requestUpdate();
|
||||
};
|
||||
|
||||
public _deletePhysicalSelection = (): void => {
|
||||
public _deletePhysicalSelection = async (): Promise<void> => {
|
||||
const sel = this.host._physicalSel;
|
||||
const sp = this.host._curSpaceCfg as any;
|
||||
if (!sel || !sp) return;
|
||||
if (sel.kind === 'draft') { this._deleteDraftWhole(); return; }
|
||||
if (sel.kind === 'draft') { await this._deleteDraftWhole(); return; }
|
||||
const before = this._geometrySnapshot();
|
||||
if (sel.kind === 'partition') {
|
||||
const hosted = (sp.openings || [])
|
||||
@@ -5287,8 +5287,10 @@ public _renderEditorGroupLauncher(group: EditorToolbarGroup): TemplateResult {
|
||||
);
|
||||
}
|
||||
|
||||
public _runEditorContext(contextId: string, action: () => void): void {
|
||||
this.host._editorSecondary.runContext(contextId, this.host._editorSecondaryContextId, action);
|
||||
public _runEditorContext<T>(contextId: string, action: () => T): T | undefined {
|
||||
return this.host._editorSecondary.runContext(
|
||||
contextId, this.host._editorSecondaryContextId, action,
|
||||
);
|
||||
}
|
||||
|
||||
public _renderEditorGroupModel(group: EditorToolbarGroup): EditorSecondaryModel {
|
||||
|
||||
Reference in New Issue
Block a user