| 603 | // ==== Editor (CodeMirror) path ============================================= |
| 604 | |
| 605 | function getModeForFile(fileName) { |
| 606 | const dot = fileName.lastIndexOf("."); |
| 607 | const ext = dot >= 0 ? fileName.slice(dot + 1).toLowerCase() : ""; |
| 608 | |
| 609 | switch (ext) { |
| 610 | case "html": |
| 611 | case "htm": return "text/html"; |
| 612 | case "xml": return "xml"; |
| 613 | case "md": |
| 614 | case "markdown": return "markdown"; |
| 615 | case "yml": |
| 616 | case "yaml": return "yaml"; |
| 617 | case "css": return "css"; |
| 618 | case "js": return "javascript"; |
| 619 | case "json": return { name: "javascript", json: true }; |
| 620 | case "php": return "application/x-httpd-php"; |
| 621 | case "py": return "python"; |
| 622 | case "sql": return "sql"; |
| 623 | case "sh": |
| 624 | case "bash": |
| 625 | case "zsh": |
| 626 | case "bat": return "shell"; |
| 627 | case "ini": |
| 628 | case "conf": |
| 629 | case "config": |
| 630 | case "properties": return "properties"; |
| 631 | case "c": |
| 632 | case "h": return "text/x-csrc"; |
| 633 | case "cpp": |
| 634 | case "cxx": |
| 635 | case "hpp": |
| 636 | case "hh": |
| 637 | case "hxx": return "text/x-c++src"; |
| 638 | case "java": return "text/x-java"; |
| 639 | case "cs": return "text/x-csharp"; |
| 640 | case "kt": |
| 641 | case "kts": return "text/x-kotlin"; |
| 642 | default: return "text/plain"; |
| 643 | } |
| 644 | } |
| 645 | export { getModeForFile }; |
| 646 | |
| 647 | function adjustEditorSize() { |