|
20 | 20 | <ul class="input_list"> |
21 | 21 | <li v-for="(item, index) in input.value" :key="index"> |
22 | 22 | <!--Text--> |
23 | | - <div class="prism_editor_outer_wrapper" v-if="input.type == 'text' || input.type == 'molang'"> |
24 | | - <prism-editor :highlight="input.type == 'molang' ? highlightMolang : highlightGeneric" language="" :line-numbers="false" |
25 | | - v-model="input.value[index]" |
26 | | - v-bind:placeholder="input.placeholder" |
27 | | - v-bind:index="index" |
28 | | - v-on:input="input.emitInput($event)" |
29 | | - v-on:focus="input.focus(index, $event)" /> |
30 | | - </div> |
| 23 | + <prism-editor :highlight="input.type == 'molang' ? highlightMolang : highlightGeneric" language="" :line-numbers="false" |
| 24 | + v-if="input.type == 'text' || input.type == 'molang'" |
| 25 | + v-model="input.value[index]" |
| 26 | + v-bind:placeholder="input.placeholder" |
| 27 | + v-bind:index="index" |
| 28 | + :autocomplete="input.type == 'molang' ? autocomplete : null" |
| 29 | + v-on:input="input.emitInput($event)" |
| 30 | + v-on:focus="input.focus(index, $event)" |
| 31 | + /> |
31 | 32 | <!--Number--> |
32 | 33 | <input |
33 | 34 | v-if="input.type == 'number'" type="number" |
|
42 | 43 |
|
43 | 44 | <template v-if="input.axis_count == 1"> |
44 | 45 | <!--Text--> |
45 | | - <div class="prism_editor_outer_wrapper" v-if="input.type == 'text' || input.type == 'molang'"> |
46 | | - <prism-editor :highlight="input.type == 'molang' ? highlightMolang : highlightGeneric" language="" :line-numbers="false" |
47 | | - v-model="input.value" |
48 | | - :value="input.value.toString()" |
49 | | - v-bind:placeholder="input.placeholder" |
50 | | - v-on:input="input.emitInput($event)" |
51 | | - v-on:focus="input.focus(-1, $event)" /> |
52 | | - </div> |
| 46 | + <prism-editor :highlight="input.type == 'molang' ? highlightMolang : highlightGeneric" language="" :line-numbers="false" |
| 47 | + v-if="input.type == 'text' || input.type == 'molang'" |
| 48 | + v-model="input.value" |
| 49 | + :value="input.value.toString()" |
| 50 | + v-bind:placeholder="input.placeholder" |
| 51 | + :autocomplete="input.type == 'molang' ? autocomplete : null" |
| 52 | + v-on:input="input.emitInput($event)" |
| 53 | + v-on:focus="input.focus(-1, $event)" |
| 54 | + /> |
53 | 55 | <!--Number--> |
54 | 56 | <input |
55 | 57 | v-if="input.type == 'number'" type="number" |
|
65 | 67 | <prism-editor :highlight="input.type == 'molang' ? highlightMolang : highlightGeneric" :line-numbers="false" |
66 | 68 | v-model="input.value[i-1]" |
67 | 69 | :value="input.value[i-1].toString()" |
68 | | - v-bind:index="i-1" |
69 | | - v-bind:placeholder="input.placeholder" |
| 70 | + :index="i-1" |
| 71 | + :placeholder="input.placeholder" |
| 72 | + :autocomplete="input.type == 'molang' ? autocomplete : null" |
70 | 73 | v-on:input="input.emitInput($event)" |
71 | 74 | v-on:focus="input.focus(i-1, $event)" /> |
72 | 75 | </div> |
|
78 | 81 | :key="i" |
79 | 82 | v-model="input.value[i-1]" |
80 | 83 | :step="input.step" :min="input.min" :max="input.max" |
81 | | - v-bind:index="i-1" |
| 84 | + :index="i-1" |
82 | 85 | v-on:input="input.change($event)"> |
83 | 86 | </template> |
84 | 87 | </template> |
@@ -124,7 +127,7 @@ import VueColor from 'vue-color' |
124 | 127 | import Gradient from './Gradient'; |
125 | 128 |
|
126 | 129 |
|
127 | | -
|
| 130 | +import getAutocompleteData from './../../molang_autocomplete' |
128 | 131 | import 'root/packages/vue-prism-editor/dist/prismeditor.min.css'; |
129 | 132 | import Prism from 'prismjs/components/prism-core'; |
130 | 133 | import {PrismEditor} from "root/packages/vue-prism-editor"; |
@@ -163,6 +166,9 @@ export default { |
163 | 166 | highlightGeneric(code) { |
164 | 167 | return Prism.highlight(code, Languages.generic) |
165 | 168 | }, |
| 169 | + autocomplete(text, position) { |
| 170 | + return getAutocompleteData(text, position, 'input') |
| 171 | + }, |
166 | 172 | toggleExpand(input) { |
167 | 173 | if (input.expandable) { |
168 | 174 | input.expanded = !input.expanded; |
@@ -215,7 +221,7 @@ export default { |
215 | 221 | .input_list li { |
216 | 222 | margin: 2px 0; |
217 | 223 | } |
218 | | - ul.input_list input, ul.input_list .prism_editor_outer_wrapper { |
| 224 | + ul.input_list input, ul.input_list .prism-editor-component { |
219 | 225 | width: calc(100% - 80px); |
220 | 226 | margin-left: 52px; |
221 | 227 | float: left; |
|
0 commit comments