Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Fix toggle button paths on windows (#206)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Etchells authored and jopit committed Sep 18, 2019
1 parent 4376167 commit 9ee4e9b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions dev/src/command/webview/ManageTemplateReposPage.ts
Original file line number Diff line number Diff line change
@@ -90,11 +90,11 @@ export default function getManageReposPage(repos: ITemplateRepo[]): string {
let newToggleImg, newToggleAlt;
if (newEnablement) {
newToggleImg = "${getStatusToggleIconSrc(true)}";
newToggleImg = "${getStatusToggleIconSrc(true, true)}";
newToggleAlt = "${getStatusToggleAlt(true)}";
}
else {
newToggleImg = "${getStatusToggleIconSrc(false)}";
newToggleImg = "${getStatusToggleIconSrc(false, true)}";
newToggleAlt = "${getStatusToggleAlt(false)}";
}
toggleBtn.src = newToggleImg;
@@ -187,8 +187,14 @@ function getStatusToggleAlt(enabled: boolean): string {
return enabled ? `Disable source` : `Enable source`;
}

function getStatusToggleIconSrc(enabled: boolean): string {
return WebviewUtil.getIcon(enabled ? Resources.Icons.ToggleOnThin : Resources.Icons.ToggleOffThin);
function getStatusToggleIconSrc(enabled: boolean, escapeBackslash = false): string {
let toggleIcon = WebviewUtil.getIcon(enabled ? Resources.Icons.ToggleOnThin : Resources.Icons.ToggleOffThin);
if (escapeBackslash) {
// The src that gets pulled directly into the frontend JS (for when the button is toggled) requires an extra escape on Windows
// https://github.com/eclipse/codewind/issues/476
toggleIcon = toggleIcon.replace(/\\/g, "\\\\")
}
return toggleIcon;
}

function getDeleteBtnTD(repo: ITemplateRepo): string {

0 comments on commit 9ee4e9b

Please sign in to comment.