ui: save editor state to localstorage

This commit is contained in:
undefined committed 2021-05-22 13:24:21 +08:00
1 parent 41110dde90
commit 9b9243a87c
2 files changed
+3 -2

No files matched your search

@@ -1,9 +1,10 @@
export default function reducer(state = {
lang: UiContext.codeLang,
code: UiContext.codeTemplate,
code: localStorage.getItem(`${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`) || UiContext.codeTemplate,
}, action) {
switch (action.type) {
case 'SCRATCHPAD_EDITOR_UPDATE_CODE': {
localStorage.setItem(`${UiContext.pdoc.domainId}/${UiContext.pdoc.docId}`, action.payload);
return {
...state,
code: action.payload,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@hydrooj/ui-default",
"version": "4.8.38",
"version": "4.8.39",
"author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0",
"main": "hydro.js",