add cache for admin problem detail

This commit is contained in:
2024-06-11 23:46:29 +08:00
parent 89114a9296
commit 73db76e605
5 changed files with 126 additions and 98 deletions

View File

@@ -20,7 +20,6 @@ const styleTheme = EditorView.baseTheme({
})
interface Props {
modelValue: string
language?: LANGUAGE
fontSize?: number
height?: string
@@ -36,28 +35,16 @@ const props = withDefaults(defineProps<Props>(), {
placeholder: "",
})
const code = ref(props.modelValue)
const code = defineModel<string>("value")
const isDark = useDark()
watch(
() => props.modelValue,
(v) => {
code.value = v
},
)
const emit = defineEmits(["update:modelValue"])
const lang = computed(() => {
if (props.language === "Python3" || props.language === "Python2") {
return python()
}
return cpp()
})
function onChange(v: string) {
emit("update:modelValue", v)
}
</script>
<template>
<Codemirror
@@ -68,6 +55,5 @@ function onChange(v: string) {
:tabSize="4"
:placeholder="props.placeholder"
:style="{ height: props.height, fontSize: props.fontSize + 'px' }"
@change="onChange"
/>
</template>

View File

@@ -5,21 +5,18 @@ import { Editor, Toolbar } from "@wangeditor/editor-for-vue"
import { uploadImage } from "../../admin/api"
interface Props {
value: string
title: string
minHeight?: number
}
const rawHtml = defineModel<string>("value")
type InsertFnType = (url: string, alt: string, href: string) => void
const props = withDefaults(defineProps<Props>(), {
minHeight: 0,
})
const emit = defineEmits(["update:value"])
const message = useMessage()
const rawHtml = ref(props.value)
watch(rawHtml, () => emit("update:value", rawHtml.value))
const editorRef = shallowRef<IDomEditor>()