Commit 45e708d4 by pangchong

feat: create CommonXmlEditor component with CodeMirror 6 and custom theme support

parent bc1ecc6a
...@@ -379,7 +379,8 @@ const xmlCompletionSource = (context: CompletionContext) => { ...@@ -379,7 +379,8 @@ const xmlCompletionSource = (context: CompletionContext) => {
return { return {
from: wordMatch.from, from: wordMatch.from,
options options,
validFor: /^[a-zA-Z0-9_-]*$/
} }
} }
} }
...@@ -602,9 +603,9 @@ const initCodeMirror = () => { ...@@ -602,9 +603,9 @@ const initCodeMirror = () => {
emit('update:modelValue', newValue) emit('update:modelValue', newValue)
} }
// 如果是用户输入导致的变化,且当前正处于可能需要提示的上下文中,自动激活提示 // 如果是用户编辑(输入或删除)导致的变化,且当前正处于可能需要提示的上下文中,自动激活提示
const isType = update.transactions.some((tr) => tr.isUserEvent('input.type')) const isUserEdit = update.transactions.some((tr) => tr.isUserEvent('input') || tr.isUserEvent('delete'))
if (isType) { if (isUserEdit) {
const mainSelection = update.state.selection.main const mainSelection = update.state.selection.main
if (mainSelection.empty) { if (mainSelection.empty) {
const pos = mainSelection.head const pos = mainSelection.head
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment