v0.1.4-pre.018
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: crates/ksp-app-config-desk/frontend/ts/documents.ts
|
||||
// version: 1
|
||||
// version: 2
|
||||
|
||||
//! Documents panel backed exclusively by ksp-config-lib inventory, validation and management APIs.
|
||||
|
||||
@@ -13,6 +13,7 @@ import type { ConfigDocumentSaveResultDto } from "./bindings/ksp_app_config_desk
|
||||
import type { ConfigDocumentSummaryDto } from "./bindings/ksp_app_config_desk/documents/ConfigDocumentSummaryDto";
|
||||
import { frontendDebug, frontendTrace, frontendWarn } from "./frontend_log";
|
||||
import { invokeKsp } from "./invoke";
|
||||
import { requestViewActivation, specializedEditorForFileId } from "./shell_registry";
|
||||
|
||||
interface DocumentsDataTable {
|
||||
destroy(): unknown;
|
||||
@@ -84,6 +85,12 @@ function renderDetail(detail: ConfigDocumentDetailDto): void {
|
||||
if (saveButton) {
|
||||
saveButton.disabled = detail.source === null;
|
||||
}
|
||||
const specializedEditor = specializedEditorForFileId(detail.summary.fileId);
|
||||
const specializedButton = document.querySelector<HTMLButtonElement>("#openSpecializedEditor");
|
||||
if (specializedButton) {
|
||||
specializedButton.hidden = specializedEditor === null;
|
||||
specializedButton.textContent = specializedEditor?.label ?? "Ouvrir l'éditeur spécialisé";
|
||||
}
|
||||
const detailPanel = document.querySelector<HTMLElement>("#documentDetailPanel");
|
||||
if (detailPanel) {
|
||||
detailPanel.hidden = false;
|
||||
@@ -270,6 +277,15 @@ function bindDocumentActions(): void {
|
||||
frontendTrace("main", "Document save button clicked");
|
||||
void saveActiveDocument();
|
||||
});
|
||||
document.querySelector<HTMLButtonElement>("#openSpecializedEditor")?.addEventListener("click", () => {
|
||||
const fileId = activeDocument?.summary.fileId ?? "";
|
||||
const descriptor = specializedEditorForFileId(fileId);
|
||||
if (!descriptor) {
|
||||
return;
|
||||
}
|
||||
frontendDebug("main", "Specialized Config editor requested", { fileId, viewId: descriptor.viewId });
|
||||
requestViewActivation(descriptor.viewId);
|
||||
});
|
||||
frontendTrace("main", "Documents panel handlers installed");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user