Merge branch 'main' into themes
This commit is contained in:
commit
a500f983f5
2 changed files with 23 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ import styles from './MiniRepl.module.css';
|
||||||
import './style.css';
|
import './style.css';
|
||||||
import { logger } from '@strudel.cycles/core';
|
import { logger } from '@strudel.cycles/core';
|
||||||
import useEvent from '../hooks/useEvent.mjs';
|
import useEvent from '../hooks/useEvent.mjs';
|
||||||
|
import useKeydown from '../hooks/useKeydown.mjs';
|
||||||
|
|
||||||
const getTime = () => getAudioContext().currentTime;
|
const getTime = () => getAudioContext().currentTime;
|
||||||
|
|
||||||
|
|
@ -74,6 +75,27 @@ export function MiniRepl({
|
||||||
color: highlightColor,
|
color: highlightColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// keyboard shortcuts
|
||||||
|
useKeydown(
|
||||||
|
useCallback(
|
||||||
|
async (e) => {
|
||||||
|
if (view?.hasFocus) {
|
||||||
|
if (e.ctrlKey || e.altKey) {
|
||||||
|
if (e.code === 'Enter') {
|
||||||
|
e.preventDefault();
|
||||||
|
flash(view);
|
||||||
|
await activateCode();
|
||||||
|
} else if (e.code === 'Period') {
|
||||||
|
stop();
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[activateCode, stop, view],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
// set active pattern on ctrl+enter
|
// set active pattern on ctrl+enter
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (enableKeyboard) {
|
if (enableKeyboard) {
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ export default defineConfig({
|
||||||
[
|
[
|
||||||
/^https:\/\/raw\.githubusercontent\.com\/.*/i,
|
/^https:\/\/raw\.githubusercontent\.com\/.*/i,
|
||||||
/^https:\/\/freesound\.org\/.*/i,
|
/^https:\/\/freesound\.org\/.*/i,
|
||||||
|
/^https:\/\/cdn\.freesound\.org\/.*/i,
|
||||||
/^https:\/\/shabda\.ndre\.gr\/.*/i,
|
/^https:\/\/shabda\.ndre\.gr\/.*/i,
|
||||||
].some((regex) => regex.test(url)),
|
].some((regex) => regex.test(url)),
|
||||||
handler: 'CacheFirst',
|
handler: 'CacheFirst',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue