Skip to content

Commit 1cc0690

Browse files
authored
Small bug fixes for the extension (#1122)
1 parent 7c215a3 commit 1cc0690

File tree

7 files changed

+44
-23
lines changed

7 files changed

+44
-23
lines changed

CHANGELOG-nightly.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
### 3.1.6.2000
22

3+
- Fixed the profile redirection when clicking on a user on the Twitch dashboard
4+
- Fixed some keyboard shortcuts not working
35
- Added an Always On autocompletion option for emotes
46
- Fixed an issue where the default highlight sound would not play on Firefox
57

src/app/chat/UserCard.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,8 @@ const props = defineProps<{
167167
target: ChatUser;
168168
}>();
169169
170+
const TWITCH_ROOT_URL = "https://twitch.tv";
171+
170172
const emit = defineEmits<{
171173
(e: "close"): void;
172174
(e: "mount-handle", handle: HTMLDivElement): void;
@@ -440,7 +442,7 @@ function highlightUserMessages(): void {
440442
}
441443
442444
function getProfileURL(): string {
443-
return window.location.origin + "/" + props.target.username;
445+
return `${TWITCH_ROOT_URL}/${props.target.username}`;
444446
}
445447
446448
function formatDateToString(date?: string): string {

src/app/emote-menu/EmoteMenuSet.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
<script setup lang="ts">
4949
import { onBeforeUnmount, onMounted, reactive, ref, watch, watchEffect } from "vue";
5050
import { useI18n } from "vue-i18n";
51-
import { onKeyDown, until, useMagicKeys, useTimeout } from "@vueuse/core";
51+
import { onKeyDown, until, useKeyModifier, useTimeout } from "@vueuse/core";
5252
import { debounceFn } from "@/common/Async";
5353
import { determineRatio } from "@/common/Image";
5454
import { useConfig } from "@/composable/useSettings";
@@ -82,7 +82,7 @@ const collapsedSets = useConfig<Set<string>>("ui.emote_menu.collapsed_sets");
8282
const favorites = useConfig<Set<string>>("ui.emote_menu.favorites");
8383
const usage = useConfig<Map<string, number>>("ui.emote_menu.usage");
8484
85-
const { alt } = useMagicKeys();
85+
const alt = useKeyModifier("Alt");
8686
const collapsed = ref(isCollapsed());
8787
8888
function sortCase(ae: SevenTV.ActiveEmote): number {

src/app/settings/SettingsMenu.vue

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@
123123
</template>
124124

125125
<script setup lang="ts">
126-
import { nextTick, onMounted, ref, watch } from "vue";
127-
import { useBreakpoints, useMagicKeys } from "@vueuse/core";
126+
import { nextTick, onMounted, ref, watch, watchEffect } from "vue";
127+
import { useBreakpoints, useEventListener, useKeyModifier } from "@vueuse/core";
128128
import { useActor } from "@/composable/useActor";
129129
import { useSettings } from "@/composable/useSettings";
130130
import useUpdater from "@/composable/useUpdater";
@@ -265,20 +265,36 @@ const openProfile = () => {
265265
nextTick(() => ctx.switchView("profile"));
266266
};
267267
268-
const keys = useMagicKeys();
269-
const paintToolShortcut = keys["Alt+Shift+P"];
270-
const storeShortcut = keys["Alt+Shift+S"];
268+
const isAlt = useKeyModifier("Alt");
269+
const isShift = useKeyModifier("Shift");
270+
const isMeta = useKeyModifier("Meta");
271+
const isCtrl = useKeyModifier("Control");
271272
272-
watch(paintToolShortcut, (press) => {
273-
if (!press) return;
274-
275-
ctx.switchView("paint");
273+
const keys = ref({
274+
p: false,
275+
s: false,
276276
});
277277
278-
watch(storeShortcut, (press) => {
279-
if (!press) return;
278+
useEventListener(window, "keydown", updateKeys, { capture: true });
279+
useEventListener(window, "keyup", updateKeys, { capture: true });
280+
281+
function updateKeys(e: KeyboardEvent) {
282+
const isPressed = e.type === "keydown";
283+
if (e.key.toUpperCase() === "S") {
284+
keys.value.s = isPressed;
285+
} else if (e.key.toUpperCase() === "P") {
286+
keys.value.p = isPressed;
287+
}
288+
}
280289
281-
ctx.switchView("store");
290+
watchEffect(() => {
291+
if (isAlt.value && isShift.value && !(isMeta.value || isCtrl.value)) {
292+
if (keys.value.p && !keys.value.s) {
293+
ctx.switchView("paint");
294+
} else if (keys.value.s && !keys.value.p) {
295+
ctx.switchView("store");
296+
}
297+
}
282298
});
283299
284300
watch(

src/site/kick.com/modules/chat-input/ChatInput.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
<script setup lang="ts">
3939
import { onUnmounted, reactive, ref, toRaw, toRef, watch } from "vue";
40-
import { useMagicKeys } from "@vueuse/core";
40+
import { useKeyModifier } from "@vueuse/core";
4141
import { useStore } from "@/store/main";
4242
import { TabToken, getSearchRange } from "@/common/Input";
4343
import { useChannelContext } from "@/composable/channel/useChannelContext";
@@ -111,7 +111,7 @@ function findCommandListener(predicate: (listener: Kick.Lexical.CommandListener<
111111
);
112112
}
113113
114-
const { shift: isShiftPressed } = useMagicKeys();
114+
const isShiftPressed = useKeyModifier("Shift");
115115
116116
function onKeyDown(ev: KeyboardEvent) {
117117
const editor = toRaw(editorRef.value);
@@ -134,7 +134,7 @@ function onKeyDown(ev: KeyboardEvent) {
134134
insertAtAnchor(colon.matches[colon.select].token);
135135
colon.active = false;
136136
} else if (ev.key === "Tab") {
137-
handleTab(node, selection, isShiftPressed.value);
137+
handleTab(node, selection, isShiftPressed.value ?? undefined);
138138
}
139139
break;
140140
case "ArrowUp":

src/site/twitch.tv/modules/chat-input/ChatInput.vue

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<!-- eslint-disable prettier/prettier -->
1414
<script setup lang="ts">
1515
import { onUnmounted, ref, watch } from "vue";
16-
import { useEventListener, useMagicKeys } from "@vueuse/core";
16+
import { useEventListener, useKeyModifier } from "@vueuse/core";
1717
import { useStore } from "@/store/main";
1818
import { REACT_TYPEOF_TOKEN } from "@/common/Constant";
1919
import { imageHostToSrcset } from "@/common/Image";
@@ -92,7 +92,8 @@ const preHistory = ref<Twitch.ChatSlateLeaf[] | undefined>();
9292
const history = ref<Twitch.ChatSlateLeaf[][]>([]);
9393
const historyLocation = ref(-1);
9494
95-
const { ctrl: isCtrl, shift: isShift } = useMagicKeys();
95+
const isCtrl = useKeyModifier("Control");
96+
const isShift = useKeyModifier("Shift");
9697
9798
useEventListener(window, "keydown", handleCapturedKeyDown, { capture: true });
9899
@@ -404,7 +405,7 @@ function onKeyDown(ev: KeyboardEvent) {
404405
405406
switch (ev.key) {
406407
case "Tab":
407-
handleTabPress(ev, isShift.value);
408+
handleTabPress(ev, isShift.value ?? undefined);
408409
break;
409410
case "ArrowUp":
410411
if (useHistory(true)) {

src/site/twitch.tv/modules/chat/ChatList.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
<script setup lang="ts">
2727
import { nextTick, reactive, ref, toRef, watch } from "vue";
28-
import { until, useDocumentVisibility, useMagicKeys, useTimeoutFn, watchDebounced } from "@vueuse/core";
28+
import { until, useDocumentVisibility, useKeyModifier, useTimeoutFn, watchDebounced } from "@vueuse/core";
2929
import { storeToRefs } from "pinia";
3030
import { useStore } from "@/store/main";
3131
import { normalizeUsername } from "@/common/Color";
@@ -503,7 +503,7 @@ watchDebounced(
503503
);
504504
505505
// Scroll Pausing on hotkey / hover
506-
const { alt } = useMagicKeys();
506+
const alt = useKeyModifier("Alt");
507507
508508
let pausedByHotkey = false;
509509
watch([alt, isHovering], ([isAlt, isHover]) => {

0 commit comments

Comments
 (0)