1
1
<template >
2
- <div ref =" editor" class =" editor " />
2
+ <div ref =" editor" class =" w-100 " />
3
3
</template >
4
4
5
5
<script setup>
@@ -34,12 +34,16 @@ async function buildEditor() {
34
34
const themeUrl = await import (` ace-builds/src-noconflict/theme-${ props .theme } ?url` );
35
35
ace .config .setModuleUrl (modePath, modeUrl);
36
36
ace .config .setModuleUrl (themePath, themeUrl);
37
- ace .edit (editor .value , {
38
- value: props .modelValue ,
39
- theme: themePath,
37
+ const aceEditor = ace .edit (editor .value , {
38
+ highlightActiveLine: false ,
39
+ highlightGutterLine: false ,
40
+ maxLines: 30 ,
41
+ minLines: 1 ,
40
42
mode: modePath,
41
43
showPrintMargin: false ,
44
+ theme: themePath,
42
45
useWorker: false ,
46
+ value: props .modelValue ,
43
47
});
44
48
45
49
/* / Update modelValue when editor content changes
@@ -49,6 +53,15 @@ async function buildEditor() {
49
53
const newValue = aceEditor.getValue();
50
54
emit('update:modelValue', newValue);
51
55
});*/
56
+
57
+ aceEditor .on (" focus" , () => {
58
+ aceEditor .setOption (" highlightActiveLine" , true );
59
+ aceEditor .setOption (" highlightGutterLine" , true );
60
+ });
61
+ aceEditor .on (" blur" , () => {
62
+ aceEditor .setOption (" highlightActiveLine" , false );
63
+ aceEditor .setOption (" highlightGutterLine" , false );
64
+ });
52
65
}
53
66
54
67
// Initialize the Ace editor
@@ -66,11 +79,3 @@ onMounted(() => {
66
79
}
67
80
);*/
68
81
</script >
69
-
70
- <style >
71
- .editor {
72
- width : 100% ;
73
- height : 300px ;
74
- border : 1px solid #ddd ;
75
- }
76
- </style >
0 commit comments