|
@@ -79,7 +79,7 @@
|
|
|
</div>
|
|
|
<div class="text-text-secondary flex-1 py-0 text-xs">
|
|
|
<div
|
|
|
- class="break-all"
|
|
|
+ class="pb-1 break-all"
|
|
|
style="line-height: 1.2"
|
|
|
ref="ref_textarea"
|
|
|
@input="handleInput"
|
|
@@ -138,12 +138,14 @@ const ref_textarea = ref()
|
|
|
watch(
|
|
|
() => props.modelValue,
|
|
|
(n) => {
|
|
|
- console.log(n)
|
|
|
if (props.readonly) {
|
|
|
ref_textarea.value.innerHTML = n.replace(
|
|
|
/\{\{#([^#]+)#\}\}/g,
|
|
|
(match, p1) => {
|
|
|
- const k = p1.split('_')
|
|
|
+ const k = [
|
|
|
+ p1.substring(0, p1.indexOf('_')),
|
|
|
+ p1.substring(p1.indexOf('_') + 1),
|
|
|
+ ]
|
|
|
const vars = state.optionsMap.get(`${k[0]}_${k[1]}`)
|
|
|
const dom = document.createElement('div')
|
|
|
dom.appendChild(initVarsDom(vars))
|
|
@@ -224,7 +226,7 @@ const handleInput = (e) => {
|
|
|
newSelection.addRange(newRange)
|
|
|
}
|
|
|
state.textCount = e.target.innerText?.trim().length || 0
|
|
|
- isSlashBeforeCursorEnhanced()
|
|
|
+ // isSlashBeforeCursorEnhanced()
|
|
|
emitValue()
|
|
|
}
|
|
|
function isSlashBeforeCursorEnhanced() {
|
|
@@ -355,7 +357,6 @@ const setVars = (vars) => {
|
|
|
// 恢复选区
|
|
|
const sel: any = window.getSelection()
|
|
|
sel.removeAllRanges()
|
|
|
- console.log(state.lastSelection)
|
|
|
sel.addRange(state.lastSelection)
|
|
|
|
|
|
// 插入内容
|
|
@@ -441,7 +442,6 @@ onMounted(() => {
|
|
|
// cancelable: true,
|
|
|
// }),
|
|
|
// )
|
|
|
- console.log(123)
|
|
|
ref_textarea.value.innerHTML = props.modelValue.replace(
|
|
|
/\{\{#([^#]+)#\}\}/g,
|
|
|
(match, p1) => {
|