1
0
forked from cgcristi/aCloud
aCloudGaborV77/templates/edit_file.html

39 lines
1.2 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Edit {{ filename }}</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.30.1/min/vs/loader.min.js"></script>
<style>
#editor {
width: 100%;
height: 600px;
border: 1px solid #ccc;
}
</style>
</head>
<body>
<h1>Editing {{ filename }}</h1>
<div id="editor"></div>
<form id="saveForm" method="POST">
<input type="hidden" name="content" id="content">
<button type="submit">Save</button>
</form>
<script>
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.30.1/min/vs' }});
require(['vs/editor/editor.main'], function() {
var editor = monaco.editor.create(document.getElementById('editor'), {
value: {{ content|tojson }},
language: 'plaintext',
theme: 'vs-dark'
});
document.getElementById('saveForm').onsubmit = function() {
document.getElementById('content').value = editor.getValue();
};
});
</script>
</body>
</html>