half working user pattern management

This commit is contained in:
Felix Roos 2023-10-29 14:00:13 +01:00
parent a2077f7be1
commit 53160c638a
4 changed files with 115 additions and 12 deletions

View file

@ -17,7 +17,7 @@ import { prebake } from './prebake.mjs';
import * as tunes from './tunes.mjs';
import PlayCircleIcon from '@heroicons/react/20/solid/PlayCircleIcon';
import { themes } from './themes.mjs';
import { settingsMap, useSettings, setLatestCode } from '../settings.mjs';
import { settingsMap, useSettings, setLatestCode, updateUserPattern } from '../settings.mjs';
import Loader from './Loader';
import { settingPatterns } from '../settings.mjs';
import { code2hash, hash2code } from './helpers.mjs';
@ -128,6 +128,7 @@ export function Repl({ embedded = false }) {
isLineWrappingEnabled,
panelPosition,
isZen,
activePattern,
} = useSettings();
const paintOptions = useMemo(() => ({ fontFamily }), [fontFamily]);
@ -144,6 +145,7 @@ export function Repl({ embedded = false }) {
cleanupDraw();
},
afterEval: ({ code, meta }) => {
updateUserPattern(code);
setMiniLocations(meta.miniLocations);
setWidgets(meta.widgets);
setPending(false);