11<!--
22 Copyright (C) 2022 MCSManager <[email protected] > 33-->
4-
54<template >
65 <Panel >
76 <template #title >
87 {{ $t("fileManagerEditor.title") }}
98 {{ target }}
10- <el-tag type =" warning" effect =" plain" size =" small" v-if =" editStatus === 'edit'" >编辑中</el-tag >
11- <el-tag type =" success" effect =" plain" size =" small" v-if =" editStatus === 'success'" >已保存</el-tag >
9+ <el-tag type =" warning" effect =" plain" size =" small" v-if =" editStatus === 'edit'" >{{
10+ $t("CommonText.032")
11+ }}</el-tag >
12+ <el-tag type =" success" effect =" plain" size =" small" v-if =" editStatus === 'success'" >{{
13+ $t("CommonText.033")
14+ }}</el-tag >
1215 </template >
1316 <template #default >
1417 <div class =" instance-table-wrapper" >
2326 {{ $t("general.refresh") }}
2427 </el-button >
2528 <el-button size =" small" @click =" jumpToLine" >
26- <i class =" el-icon-sort-down" ></i >
27- 跳转行
28- </el-button >
29+ <i class =" el-icon-sort-down" ></i >{{ $t("CommonText.034") }}</el-button
30+ >
2931 <el-dropdown :hide-on-click =" false" >
3032 <el-button type =" default" size =" small" >
31- <i class =" el-icon-setting" ></i >
32- 编辑器设置
33- <i class =" el-icon-arrow-down el-icon--right" ></i >
33+ <i class =" el-icon-setting" ></i >{{ $t("views.FileManagerEditor.001")
34+ }}<i class =" el-icon-arrow-down el-icon--right" ></i >
3435 </el-button >
3536 <template #dropdown >
3637 <el-dropdown-menu >
4041 @change =" setWrapMode($event)"
4142 active-color =" #13ce66"
4243 inactive-color =" #ff4949"
43- active-text =" 自动换行 "
44- / >
44+ : active-text =" $t('CommonText.035') "
45+ ></ el-switch >
4546 </el-dropdown-item >
4647 <el-dropdown-item >
4748 <el-switch
4849 v-model =" editorSettings.behavioursEnabled"
4950 @change =" setBehavioursEnabled($event)"
5051 active-color =" #13ce66"
5152 inactive-color =" #ff4949"
52- active-text =" 自动补全 "
53- / >
53+ : active-text =" $t('CommonText.036') "
54+ ></ el-switch >
5455 </el-dropdown-item >
5556 <el-dropdown-item >
5657 <el-switch
5758 v-model =" editorSettings.highlightActiveLine"
5859 @change =" setHighlightActiveLine($event)"
5960 active-color =" #13ce66"
6061 inactive-color =" #ff4949"
61- active-text =" 高亮当前行 "
62- / >
62+ : active-text =" $t('views.FileManagerEditor.002') "
63+ ></ el-switch >
6364 </el-dropdown-item >
6465 <el-dropdown-item >
6566 <el-switch
6667 v-model =" editorSettings.readOnly"
6768 @change =" setReadOnly($event)"
6869 active-color =" #13ce66"
6970 inactive-color =" #ff4949"
70- active-text =" 只读模式 "
71- / >
71+ : active-text =" $t('CommonText.037') "
72+ ></ el-switch >
7273 </el-dropdown-item >
7374 <el-dropdown-item >
7475 <el-switch
7576 v-model =" editorSettings.showInvisibles"
7677 @change =" setShowInvisibles($event)"
7778 active-color =" #13ce66"
7879 inactive-color =" #ff4949"
79- active-text =" 显示隐藏字符 "
80- / >
80+ : active-text =" $t('views.FileManagerEditor.003') "
81+ ></ el-switch >
8182 </el-dropdown-item >
8283 <el-dropdown-item >
8384 <el-switch
8485 v-model =" editorSettings.enableMultiselect"
8586 @change =" setEnableMultiselect($event)"
8687 active-color =" #13ce66"
8788 inactive-color =" #ff4949"
88- active-text =" 选中多行 "
89- / >
89+ : active-text =" $t('CommonText.038') "
90+ ></ el-switch >
9091 </el-dropdown-item >
9192 <el-dropdown-item >
9293 <el-switch
9394 v-model =" editorSettings.showLineNumbers"
9495 @change =" setShowLineNumbers($event)"
9596 active-color =" #13ce66"
9697 inactive-color =" #ff4949"
97- active-text =" 显示行号 "
98- / >
98+ : active-text =" $t('CommonText.039') "
99+ ></ el-switch >
99100 </el-dropdown-item >
100101 </el-dropdown-menu >
101102 </template >
104105 v-model =" editorSettings.theme"
105106 filterable
106107 size =" small"
107- placeholder =" 编辑器主题"
108108 @change =" changeEditorTheme($event)"
109+ :placeholder =" $t('views.FileManagerEditor.004')"
109110 >
110- <el-option v-for =" item in editorThemes" :key =" item" :label =" item" :value =" item" ></el-option >
111+ <el-option
112+ v-for =" item in editorThemes"
113+ :key =" item"
114+ :label =" item"
115+ :value =" item"
116+ ></el-option >
111117 </el-select >
112- <el-input-number v-model =" editorSettings.fontSize" @change =" changeEditorFontsize($event)" :min =" 1" :max =" 114.514" size =" small" ></el-input-number >
118+ <el-input-number
119+ v-model =" editorSettings.fontSize"
120+ @change =" changeEditorFontsize($event)"
121+ :min =" 1"
122+ :max =" 114.514"
123+ size =" small"
124+ ></el-input-number >
113125 <el-button type =" default" size =" small" @click =" toHotKey" >
114- <i class =" el-icon-sort-down" ></i >
115- 快捷键提示
116- </el-button >
126+ <i class =" el-icon-sort-down" ></i >{{ $t("views.FileManagerEditor.005") }}</el-button
127+ >
117128 <el-button size =" small" @click =" back" v-if =" !backType" >
118129 <i class =" el-icon-pie-chart" ></i >
119130 {{ $t("fileManagerEditor.backToFileManager") }}
127138 type =" primary"
128139 plain
129140 v-if =" backType == 1"
130- >{{ $t("fileManagerEditor.backViaHistory") }}</el-button >
141+ >{{ $t("fileManagerEditor.backViaHistory") }}</el-button
142+ >
131143 </div >
132144 </div >
133145 <div v-show =" !error" style =" overflow : auto " >
149161 </template >
150162 </Panel >
151163</template >
164+
152165<script >
153166import Panel from " ../../components/Panel" ;
154167import { API_FILE_URL } from " ../service/common" ;
155168import path from " path" ;
156169import { request } from " ../service/protocol" ;
157-
158170export default {
159- components: { Panel },
171+ components: {
172+ Panel
173+ },
160174 data () {
161175 return {
162176 serviceUuid: this .$route .params .serviceUuid ,
@@ -224,7 +238,6 @@ export default {
224238 editorHotKey: false
225239 };
226240 },
227-
228241 async mounted () {
229242 await this .render ();
230243 this .editor = window .ace .edit (" editor" );
@@ -244,7 +257,10 @@ export default {
244257 });
245258 this .editor .commands .addCommand ({
246259 name: " saveFile" ,
247- bindKey: { win: " Ctrl-S" , mac: " Command-S" },
260+ bindKey: {
261+ win: " Ctrl-S" ,
262+ mac: " Command-S"
263+ },
248264 exec : () => {
249265 this .saveFile ();
250266 this .editStatus = " success" ;
@@ -276,15 +292,15 @@ export default {
276292 },
277293 jumpToLine () {
278294 this .editor .find ();
279- this .$prompt (" 跳转到指定行 " , " 提示 " , {
280- confirmButtonText: " 确定 " ,
281- cancelButtonText: " 取消 " ,
295+ this .$prompt (window . $t ( " views.FileManagerEditor.006 " ), window . $t ( " CommonText.040 " ) , {
296+ confirmButtonText: window . $t ( " CommonText.041 " ) ,
297+ cancelButtonText: window . $t ( " CommonText.042 " ) ,
282298 inputPattern: / ^ [0-9 ] * $ / ,
283- inputErrorMessage: " 格式不正确 "
299+ inputErrorMessage: window . $t ( " views.FileManagerEditor.007 " )
284300 }).then (({ value }) => {
285301 this .$message ({
286302 type: " success" ,
287- message: " 已跳转到第 " + value + " 行 "
303+ message: window . $t ( " views.FileManagerEditor.008 " ) + value + window . $t ( " CommonText.043 " )
288304 });
289305 this .editor .gotoLine (value);
290306 });
@@ -315,11 +331,14 @@ export default {
315331 localStorage .setItem (" editorTheme" , val);
316332 },
317333 toHotKey () {
318- window .open (' https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts' )
334+ window .open (" https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts" );
319335 },
320336 async refresh () {
321337 await this .render ();
322- this .$message ({ message: this .$t (" general.refreshFinish" ), type: " success" });
338+ this .$message ({
339+ message: this .$t (" general.refreshFinish" ),
340+ type: " success"
341+ });
323342 },
324343 async backTerminal () {
325344 this .$router .push ({
@@ -328,19 +347,18 @@ export default {
328347 },
329348 async back () {
330349 if (this .editStatus === " edit" ) {
331- this .$confirm (" 你还未保存文件, 是否继续返回? " , " 提示 " , {
332- confirmButtonText: " 确定 " ,
333- cancelButtonText: " 取消 " ,
350+ this .$confirm (window . $t ( " views.FileManagerEditor.009 " ), window . $t ( " CommonText.040 " ) , {
351+ confirmButtonText: window . $t ( " CommonText.041 " ) ,
352+ cancelButtonText: window . $t ( " CommonText.042 " ) ,
334353 type: " warning"
335- })
336- .then (() => {
337- this .$router .push ({
338- path: ` /file/${ this .serviceUuid } /${ this .instanceUuid } /` ,
339- query: {
340- path: path .dirname (this .target )
341- }
342- });
343- })
354+ }).then (() => {
355+ this .$router .push ({
356+ path: ` /file/${ this .serviceUuid } /${ this .instanceUuid } /` ,
357+ query: {
358+ path: path .dirname (this .target )
359+ }
360+ });
361+ });
344362 } else {
345363 this .$router .push ({
346364 path: ` /file/${ this .serviceUuid } /${ this .instanceUuid } /` ,
@@ -353,7 +371,6 @@ export default {
353371 backViaHistory () {
354372 this .$router .go (- 1 );
355373 },
356-
357374 async render () {
358375 try {
359376 const text = await request ({
@@ -375,7 +392,6 @@ export default {
375392 this .error = error .message ;
376393 }
377394 },
378-
379395 async saveFile () {
380396 this .edit .text = this .editor .getValue ();
381397 await request ({
@@ -390,7 +406,10 @@ export default {
390406 target: this .target
391407 }
392408 });
393- this .$message ({ message: this .$t (" fileManagerEditor.updateTextSuccess" ), type: " success" });
409+ this .$message ({
410+ message: this .$t (" fileManagerEditor.updateTextSuccess" ),
411+ type: " success"
412+ });
394413 }
395414 }
396415};
0 commit comments