Skip to content

Commit

Permalink
new header (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
wirekang authored Jan 29, 2024
1 parent 90360d6 commit 987df9a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/assets/color.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
#more-popup > .item > .button-container > .name {
border-color: var(--fg);
}

#more-popup > .item > .button-container:hover > .name {
background-color: var(--header-hover);
}
Expand Down
1 change: 1 addition & 0 deletions src/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ body {

#more-popup > .item > .text {
font-size: 0.7rem;
white-space: pre;
}

#more-popup > .item > .button-container {
Expand Down
12 changes: 6 additions & 6 deletions src/bootstrap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,13 @@ function setupSettingsController() {
});
}

const actionKey = DomUtils.isMac() ? "Cmd" : "Ctrl";
D.morePopupController.appendText("To share a playground, press 'Save'");
D.morePopupController.appendHeading("commands");
D.morePopupController.appendButton("Save", "Ctrl-S", save.bind(null, false));
D.morePopupController.appendButton("Save and shorten link", "Ctrl-Shift-S", save.bind(null, true));
D.morePopupController.appendButton("Toggle type-editor", "Ctrl-Q", toggleTypeEditor);
D.morePopupController.appendButton("Save", `${actionKey}-S`, save.bind(null, false));
D.morePopupController.appendButton("Save and shorten link", `${actionKey}-Shift-S`, save.bind(null, true));
D.morePopupController.appendButton("Toggle type-editor", `${actionKey}-Q`, toggleTypeEditor);
D.morePopupController.appendText(" ");

D.morePopupController.appendHeading("typescript-format");
append("semi", "ts-format:semi", formatEditors);
Expand Down Expand Up @@ -390,10 +392,8 @@ async function setupMonaco() {
function setupHotKeys() {
HotkeyUtils.register(["ctrl"], "s", save.bind(null, false));
HotkeyUtils.register(["ctrl", "shift"], "s", save.bind(null, true));
HotkeyUtils.register([], "f1", () => {
D.morePopupController.toggle();
});
HotkeyUtils.register(["ctrl"], "q", toggleTypeEditor);
HotkeyUtils.register([], "f1", D.morePopupController.toggle.bind(D.morePopupController));
}

async function save(shorten: boolean) {
Expand Down
4 changes: 4 additions & 0 deletions src/lib/utility/dom-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@ export class DomUtils {
return true;
}
}

static isMac() {
return navigator.userAgent.toLowerCase().includes("mac");
}
}
2 changes: 1 addition & 1 deletion src/lib/utility/hotkey-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export class HotkeyUtils {
window.addEventListener("keydown", (e) => {
if (
e.key.toLowerCase() === key.toLowerCase() &&
ctrl === e.ctrlKey &&
(ctrl === e.ctrlKey || ctrl === e.metaKey) &&
shift === e.shiftKey &&
alt === e.altKey
) {
Expand Down

0 comments on commit 987df9a

Please sign in to comment.