chore: add temporary debug info for code mirror (#2806)
chore: temp debug info
This commit is contained in:
@@ -40,6 +40,8 @@ import {
|
|||||||
import { HoppEnvironmentPlugin } from "@helpers/editor/extensions/HoppEnvironment"
|
import { HoppEnvironmentPlugin } from "@helpers/editor/extensions/HoppEnvironment"
|
||||||
// TODO: Migrate from legacy mode
|
// TODO: Migrate from legacy mode
|
||||||
|
|
||||||
|
import { captureException } from "@sentry/vue"
|
||||||
|
|
||||||
type ExtendedEditorConfig = {
|
type ExtendedEditorConfig = {
|
||||||
mode: string
|
mode: string
|
||||||
placeholder: string
|
placeholder: string
|
||||||
@@ -286,16 +288,31 @@ export function useCodemirror(
|
|||||||
view.value?.destroy()
|
view.value?.destroy()
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(value, (newVal) => {
|
watch(value, (newVal, oldVal) => {
|
||||||
if (cachedValue.value !== newVal) {
|
if (cachedValue.value !== newVal) {
|
||||||
view.value?.dispatch({
|
try {
|
||||||
filter: false,
|
view.value?.dispatch({
|
||||||
changes: {
|
filter: false,
|
||||||
from: 0,
|
changes: {
|
||||||
to: view.value.state.doc.length,
|
from: 0,
|
||||||
insert: newVal,
|
to: view.value.state.doc.length,
|
||||||
},
|
insert: newVal,
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
} catch (e) {
|
||||||
|
captureException(e, {
|
||||||
|
extra: {
|
||||||
|
newVal,
|
||||||
|
oldVal,
|
||||||
|
changes: {
|
||||||
|
from: 0,
|
||||||
|
to: view.value?.state.doc.length,
|
||||||
|
insert: newVal,
|
||||||
|
cachedValue,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cachedValue.value = newVal
|
cachedValue.value = newVal
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user