@@ -25,17 +25,61 @@ export default {
25
25
this .prefix = this .SelectFirst
26
26
this .url = this .SelectFirst
27
27
28
- tinymce .overrideDefaults ({
29
- menubar: false ,
30
- branding: false ,
31
- browser_spellcheck: true ,
32
- contextmenu: false ,
33
- height : ' 120' ,
34
- plugins: ' lists link image fullscreen media table preview autoresize' ,
35
- toolbar: ' undo redo | link unlink | media image | styleselect removeformat | outdent indent | numlist bullist table | preview fullscreen'
36
- })
28
+ this .initTMC ()
29
+ this .initAce ()
30
+ this .initChoice ()
37
31
},
38
32
methods: {
33
+ // editors
34
+ initTMC () {
35
+ tinymce .overrideDefaults ({
36
+ menubar: false ,
37
+ branding: false ,
38
+ browser_spellcheck: true ,
39
+ contextmenu: false ,
40
+ height : ' 120' ,
41
+ plugins: ' lists link image fullscreen media table preview autoresize' ,
42
+ toolbar: ' undo redo | link unlink | media image | styleselect removeformat | outdent indent | numlist bullist table | preview fullscreen'
43
+ })
44
+ },
45
+ initAce () {
46
+ let item = document .getElementById (' ace-editor' )
47
+
48
+ if (item) {
49
+ ace .require (' ace/ext/language_tools' )
50
+ let editor = ace .edit (' ace-editor' )
51
+ item .style .lineHeight = ' 2'
52
+ editor .setOptions ({
53
+ enableBasicAutocompletion: true ,
54
+ enableLiveAutocompletion: true ,
55
+ enableSnippets: true
56
+ })
57
+ editor .renderer .setOptions ({
58
+ animatedScroll: true ,
59
+ showInvisibles: true ,
60
+ showPrintMargin: false ,
61
+ fontSize: 14 ,
62
+ theme: ' ace/theme/monokai'
63
+ })
64
+ editor .session .setOptions ({
65
+ mode: ' ace/mode/php'
66
+ })
67
+
68
+ editor .getSession ().on (' change' , () => {
69
+ this .$refs .controllerFile .value = editor .getSession ().getValue ()
70
+ })
71
+ }
72
+ },
73
+ initChoice () {
74
+ new Choices (' .select2' , {
75
+ duplicateItems: false ,
76
+ removeItemButton: true ,
77
+ paste: false ,
78
+ placeholderValue: ' Select an option'
79
+ })
80
+ },
81
+
82
+ // toggle
39
83
showTitle (code ) {
40
84
return this .title == code
41
85
},
0 commit comments