fix problem hint.

This commit is contained in:
2023-11-13 15:39:27 +08:00
parent c93f12a3ae
commit a9385c77c4

View File

@@ -268,9 +268,17 @@ function getTemplate() {
} }
} }
function filterHint() {
// 编辑器会自动添加一段 HTML
if (problem.hint === '<p><br></p>') {
problem.hint = ""
}
}
async function submit() { async function submit() {
const notCompleted = detectProblemCompletion() const notCompleted = detectProblemCompletion()
if (notCompleted) return if (notCompleted) return
filterHint()
getTemplate() getTemplate()
problem.tags = [...newTags.value, ...fromExistingTags.value] problem.tags = [...newTags.value, ...fromExistingTags.value]
const api = { const api = {
@@ -403,11 +411,7 @@ watch([fromExistingTags, newTags], (tags) => {
<n-button class="addSamples box" tertiary type="primary" @click="addSample"> <n-button class="addSamples box" tertiary type="primary" @click="addSample">
添加用例 添加用例
</n-button> </n-button>
<n-form> <TextEditor v-if="ready" v-model:value="problem.hint" title="提示" />
<n-form-item label="提示">
<n-input type="textarea" v-model:value="problem.hint" />
</n-form-item>
</n-form>
<n-form> <n-form>
<n-form-item label="题目的来源"> <n-form-item label="题目的来源">
<n-input <n-input