feat: monaco editor toegevoegd voor py bestanden
This commit is contained in:
Binary file not shown.
@@ -18,6 +18,7 @@ TEXT_CONTENT_TYPES = {
|
|||||||
".yaml": "text/yaml",
|
".yaml": "text/yaml",
|
||||||
".json": "application/json",
|
".json": "application/json",
|
||||||
".js": "text/javascript",
|
".js": "text/javascript",
|
||||||
|
".py": "text/x-python",
|
||||||
".css": "text/css",
|
".css": "text/css",
|
||||||
".html": "text/html",
|
".html": "text/html",
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -67,6 +67,19 @@ class EditApiGoldenTest(unittest.TestCase):
|
|||||||
self.assertFalse(body["truncated"])
|
self.assertFalse(body["truncated"])
|
||||||
self.assertIn("modified", body)
|
self.assertIn("modified", body)
|
||||||
|
|
||||||
|
def test_edit_view_python_success(self) -> None:
|
||||||
|
file_path = self.root / "script.py"
|
||||||
|
file_path.write_text("print('hello')\n", encoding="utf-8")
|
||||||
|
|
||||||
|
response = self._request("GET", "/api/files/view", params={"path": "storage1/script.py", "for_edit": "true"})
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
body = response.json()
|
||||||
|
self.assertEqual(body["path"], "storage1/script.py")
|
||||||
|
self.assertEqual(body["name"], "script.py")
|
||||||
|
self.assertEqual(body["content_type"], "text/x-python")
|
||||||
|
self.assertEqual(body["content"], "print('hello')\n")
|
||||||
|
|
||||||
def test_save_success(self) -> None:
|
def test_save_success(self) -> None:
|
||||||
file_path = self.root / "notes.txt"
|
file_path = self.root / "notes.txt"
|
||||||
file_path.write_text("hello", encoding="utf-8")
|
file_path.write_text("hello", encoding="utf-8")
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ class UiSmokeGoldenTest(unittest.TestCase):
|
|||||||
self.assertIn('function openRenamePopup()', app_js)
|
self.assertIn('function openRenamePopup()', app_js)
|
||||||
self.assertIn('document.getElementById("rename-btn").onclick = openRenamePopup;', app_js)
|
self.assertIn('document.getElementById("rename-btn").onclick = openRenamePopup;', app_js)
|
||||||
self.assertIn('return triggerActionButton("rename-btn");', app_js)
|
self.assertIn('return triggerActionButton("rename-btn");', app_js)
|
||||||
|
self.assertIn('".py"', app_js)
|
||||||
self.assertIn('function openVideoViewer()', app_js)
|
self.assertIn('function openVideoViewer()', app_js)
|
||||||
self.assertIn('function openPdfViewer()', app_js)
|
self.assertIn('function openPdfViewer()', app_js)
|
||||||
self.assertIn('async function loadMonacoModule()', app_js)
|
self.assertIn('async function loadMonacoModule()', app_js)
|
||||||
|
|||||||
+1
-1
@@ -562,7 +562,7 @@ function isEditableSelection(item) {
|
|||||||
if (lower === "dockerfile" || lower === "containerfile") {
|
if (lower === "dockerfile" || lower === "containerfile") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return [".txt", ".log", ".md", ".yml", ".yaml", ".json", ".js", ".css", ".html"].some((suffix) => lower.endsWith(suffix));
|
return [".txt", ".log", ".md", ".yml", ".yaml", ".json", ".js", ".py", ".css", ".html"].some((suffix) => lower.endsWith(suffix));
|
||||||
}
|
}
|
||||||
|
|
||||||
function monacoLanguageForName(name) {
|
function monacoLanguageForName(name) {
|
||||||
|
|||||||
Reference in New Issue
Block a user