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
.toJSON()
.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) => {
if (cachedValue.value !== newVal) {
view.value?.dispatch({
filter: false,
changes: {
from: 0,
to: view.value.state.doc.length,