feat: use monaco instead of vue-prism-editor and support switching color scheme for the editor

This commit is contained in:
Justineo
2021-11-25 15:51:03 +08:00
parent 5226ec968c
commit f5238985a7
7 changed files with 315 additions and 61 deletions

View File

@@ -36,3 +36,20 @@ export function getLink ({ slug, link, children }) {
}
return `/${slug}`
}
const PREF_KEY = 'veui.preferences'
export function loadPref (key) {
try {
const pref = JSON.parse(localStorage.getItem(PREF_KEY))
return pref[key]
} catch (e) {
return null
}
}
export function savePref (key, value) {
const pref = JSON.parse(localStorage.getItem(PREF_KEY)) || {}
pref[key] = value
localStorage.setItem(PREF_KEY, JSON.stringify(pref))
}