From f4dc6b77eca3e6b21e89260847b4fc640e27984c Mon Sep 17 00:00:00 2001 From: Aleix Soler Date: Thu, 19 Mar 2026 18:44:40 +0100 Subject: [PATCH] fix(file-explorer): inject icon as sibling to prevent inclusion in filename during rename --- .../file-explorer-integration.tsx | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/integrations/file-explorer/file-explorer-integration.tsx b/integrations/file-explorer/file-explorer-integration.tsx index 01eb037..0c7d097 100644 --- a/integrations/file-explorer/file-explorer-integration.tsx +++ b/integrations/file-explorer/file-explorer-integration.tsx @@ -161,10 +161,16 @@ export class FileExplorerIntegration implements IElementProcessor { statuses: GroupedStatuses, defaultTagName: string, ): void { - // Remove existing icon - const existingIcon = element.querySelector(`.${this.ICON_CLASS}`); - if (existingIcon) { - existingIcon.remove(); + // Remove existing icon (it may be a sibling or a child from older renders) + const existingSiblingIcon = element.parentElement?.querySelector( + `.${this.ICON_CLASS}`, + ); + if (existingSiblingIcon) { + existingSiblingIcon.remove(); + } + const existingChildIcon = element.querySelector(`.${this.ICON_CLASS}`); + if (existingChildIcon) { + existingChildIcon.remove(); } if (!settingsService.settings.showStatusIconsInExplorer) { @@ -179,6 +185,8 @@ export class FileExplorerIntegration implements IElementProcessor { positionClassName = "custom-icon__absolute-right"; } const icon = createSpan({ cls: [this.ICON_CLASS, positionClassName] }); + icon.setAttribute("contenteditable", "false"); + const root = createRoot(icon); root.render(