WebClient: add csp nonce to CodeMirror

Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
Nicola Murino 2023-11-18 11:18:31 +01:00
parent 50a9ac0163
commit 6439569f36
No known key found for this signature in database
GPG key ID: 935D2952DEC4EECF
2 changed files with 6 additions and 3 deletions

File diff suppressed because one or more lines are too long

View file

@ -156,8 +156,11 @@ explicit grant from the SFTPGo Team (support@sftpgo.com).
//{{- if .ReadOnly}}
options.readOnly = true;
//{{- end}}
cmView = cm6.createEditorView(undefined, document.getElementById("editor"));
cmView.setState(cm6.createEditorState("{{.Data}}", options));
//{{- if .CSPNonce}}
options.cspNonce = "{{.CSPNonce}}";
//{{- end}}
let editorState = cm6.createEditorState("{{.Data}}", options);
cmView = cm6.createEditorView(editorState, document.getElementById("editor"));
var saveBtn = $('#save_button');
if (saveBtn){