|
19 | 19 | </div> |
20 | 20 | </div> |
21 | 21 |
|
22 | | - <AceEditor class="rounded shadow-lg border border-gray-700 mt-4" |
23 | | - v-model="editableConfig" |
| 22 | + <v-ace-editor class="rounded shadow-lg border border-gray-700 mt-4" |
| 23 | + v-model:value="editableConfig" |
24 | 24 | @init="editorInit" |
25 | 25 | lang="yaml" |
26 | 26 | theme="tomorrow_night" |
27 | | - :height="editorHeight" |
28 | | - ref="aceEditor" /> |
| 27 | + ref="aceEditor" |
| 28 | + v-options="{ |
| 29 | + useSoftTabs: true, |
| 30 | + tabSize: 2 |
| 31 | + }" |
| 32 | + :style="{ |
| 33 | + width: editorWidth + 'px', |
| 34 | + height: editorHeight + 'px', |
| 35 | + }" /> |
29 | 36 | </div> |
30 | 37 | </template> |
31 | 38 |
|
|
34 | 41 | import {ApiError} from "../../api"; |
35 | 42 | import { GuildState } from "../../store/types"; |
36 | 43 |
|
37 | | - import AceEditor from "vue2-ace-editor"; |
| 44 | + import { VAceEditor } from "vue3-ace-editor"; |
| 45 | +
|
| 46 | + import "ace-builds/src-noconflict/ext-language_tools"; |
| 47 | + import 'ace-builds/src-noconflict/ext-searchbox'; |
| 48 | + import "ace-builds/src-noconflict/mode-yaml"; |
| 49 | + import "ace-builds/src-noconflict/theme-tomorrow_night"; |
38 | 50 |
|
39 | 51 | let editorKeybindListener; |
40 | 52 | let windowResizeListener; |
41 | 53 |
|
42 | 54 | export default { |
43 | 55 | components: { |
44 | | - AceEditor, |
| 56 | + VAceEditor, |
45 | 57 | }, |
46 | 58 | async mounted() { |
47 | 59 | try { |
|
101 | 113 | }, |
102 | 114 | methods: { |
103 | 115 | editorInit() { |
104 | | - require("brace/ext/language_tools"); |
105 | | - require('brace/ext/searchbox'); |
106 | | - require("brace/mode/yaml"); |
107 | | - require("brace/theme/tomorrow_night"); |
108 | | -
|
109 | | - this.$refs.aceEditor.editor.setOptions({ |
110 | | - useSoftTabs: true, |
111 | | - tabSize: 2 |
112 | | - }); |
113 | | -
|
114 | 116 | // Add Ctrl+S/Cmd+S save shortcut |
115 | 117 | const isMac = /mac/i.test(navigator.platform); |
116 | 118 | const modKeyPressed = (ev: KeyboardEvent) => (isMac ? ev.metaKey : ev.ctrlKey); |
|
131 | 133 |
|
132 | 134 | if (shortcutModifierPressed(ev) && ev.key === "f") { |
133 | 135 | ev.preventDefault(); |
134 | | - this.$refs.aceEditor.editor.execCommand("find"); |
| 136 | + this.$refs.aceEditor.getAceInstance().execCommand("find"); |
135 | 137 | return; |
136 | 138 | } |
137 | 139 | }; |
|
171 | 173 | this.editorHeight = newHeight; |
172 | 174 |
|
173 | 175 | this.$nextTick(() => { |
174 | | - this.$refs.aceEditor.editor.resize(); |
| 176 | + this.$refs.aceEditor.getAceInstance().resize(); |
175 | 177 | }); |
176 | 178 | }, |
177 | 179 | async save() { |
|
0 commit comments