#1 Add monaco editor #4

Merged
stuzer05 merged 1 commits from stuzer05/random-web-tools#1 into master 2024-03-07 14:11:52 +02:00
3 changed files with 12 additions and 5 deletions
Showing only changes of commit df73dcde7e - Show all commits

@ -36,9 +36,6 @@ input:disabled, textarea:disabled {
textarea[id=data] { textarea[id=data] {
height: 200px; height: 200px;
} }
textarea[id=result] {
height: 350px;
}
div[id=result] { div[id=result] {
height: 350px; height: 350px;
} }

@ -28,16 +28,22 @@ export default {
}, },
}, },
mounted() { mounted() {
console.log(monacoResultInst);
loader.init().then((monaco) => { loader.init().then((monaco) => {
monacoResultInst = monaco; monacoResultInst = monaco;
monaco.editor.create(document.querySelector(`#${this.name}`), { monaco.editor.create(document.querySelector(`#${this.name}`), {
value: '', value: this.value,
language: this.language, language: this.language,
readOnly: this.readonly, readOnly: this.readonly,
}); });
}); });
}, },
unmounted() {
if (monacoResultInst) {
monacoResultInst.editor.getModels().forEach(model => model.dispose());
}
},
watch: { watch: {
value: { value: {
// the callback will be called immediately after the start of the observation // the callback will be called immediately after the start of the observation

@ -17,15 +17,19 @@
<div class="input-group"> <div class="input-group">
<label for="result">Result</label> <label for="result">Result</label>
<textarea id="result" v-model="toolResult"></textarea> <MonacoEditor name="result" language="json" :value="toolResult"></MonacoEditor>
</div> </div>
</template> </template>
<script> <script>
import axios from 'axios' import axios from 'axios'
import { config } from '../../config'; import { config } from '../../config';
import MonacoEditor from "@/components/MonacoEditor.vue";
export default { export default {
components: {
MonacoEditor
},
data() { data() {
return { return {
toolData: { toolData: {