Преглед изворни кода

WebClient: remove inline onclick from file edit page

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
Nicola Murino пре 1 година
родитељ
комит
3c522961af
1 измењених фајлова са 8 додато и 1 уклоњено
  1. 8 1
      templates/webclient/editfile.html

+ 8 - 1
templates/webclient/editfile.html

@@ -52,7 +52,7 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
         <div class="card-toolbar">
             <a class="btn btn-light-primary px-10 me-5" href='{{.FilesURL}}?path={{.CurrentDir}}' role="button">Back</a>
             {{- if not .ReadOnly}}
-            <a id="save_button" type="button" class="btn btn-primary px-10" href="#" role="button" onclick="saveFile();">
+            <a id="save_button" type="button" class="btn btn-primary px-10" href="#" role="button">
                 <span class="indicator-label">Save</span>
 			    <span class="indicator-progress">Please wait...
 					<span class="spinner-border spinner-border-sm align-middle ms-2"></span>
@@ -159,6 +159,13 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
         cmView = cm6.createEditorView(undefined, document.getElementById("editor"));
         cmView.setState(cm6.createEditorState("{{.Data}}", options));
 
+        var saveBtn = $('#save_button');
+        if (saveBtn){
+            saveBtn.on("click", function(){
+                saveFile();
+            });
+        }
+
         setInterval(keepAlive, 300000);
     });
 </script>