Skip to content

Commit d743649

Browse files
committed
fix web site
1 parent 6b10d63 commit d743649

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/.vuepress/components/eslint-playground.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<template>
22
<eslint-editor
3+
ref="editor"
34
:linter="linter"
45
:config="config"
56
:code="cookedCode"
@@ -99,6 +100,31 @@ export default {
99100
for (const ruleId of Object.keys(rules)) {
100101
linter.defineRule(`es-x/${ruleId}`, rules[ruleId])
101102
}
103+
104+
const editor = this.$refs.editor
105+
106+
editor.$watch("codeEditor", () => {
107+
if (editor.codeEditor) {
108+
editor.codeEditor.onDidChangeModelDecorations(() =>
109+
this.onDidChangeModelDecorations(editor.codeEditor),
110+
)
111+
}
112+
})
113+
editor.$watch("fixedCodeEditor", () => {
114+
if (editor.fixedCodeEditor) {
115+
editor.fixedCodeEditor.onDidChangeModelDecorations(() =>
116+
this.onDidChangeModelDecorations(editor.fixedCodeEditor),
117+
)
118+
}
119+
})
120+
},
121+
122+
methods: {
123+
onDidChangeModelDecorations(editor) {
124+
const { monaco } = this.$refs.editor
125+
const model = editor.getModel()
126+
monaco.editor.setModelMarkers(model, "javascript", [])
127+
},
102128
},
103129
}
104130
</script>

0 commit comments

Comments
 (0)