fix: error on updating readonly editor

This commit is contained in:
liyasthomas
2021-11-15 16:43:10 +05:30
parent 2bee4342b8
commit feb1991da3

View File

@@ -197,7 +197,8 @@ export function useCodemirror(
cachedValue.value = update.state.doc cachedValue.value = update.state.doc
.toJSON() .toJSON()
.join(update.state.lineBreak) .join(update.state.lineBreak)
value.value = cachedValue.value if (!options.extendedEditorConfig.readOnly)
value.value = cachedValue.value
} }
} }
} }
@@ -248,6 +249,7 @@ export function useCodemirror(
watch(value, (newVal) => { watch(value, (newVal) => {
if (cachedValue.value !== newVal) { if (cachedValue.value !== newVal) {
view.value?.dispatch({ view.value?.dispatch({
filter: false,
changes: { changes: {
from: 0, from: 0,
to: view.value.state.doc.length, to: view.value.state.doc.length,