MCPcopy Create free account
hub / github.com/error311/FileRise / canEditFile

Function canEditFile

public/js/fileListView.js:8723–8755  ·  view source on GitHub ↗
(fileName)

Source from the content-addressed store, hash-verified

8721}
8722
8723export function canEditFile(fileName) {
8724 if (!fileName || typeof fileName !== "string") return false;
8725 const dot = fileName.lastIndexOf(".");
8726 if (dot < 0) return false;
8727 const ext = fileName.slice(dot + 1).toLowerCase();
8728
8729 // Your CodeMirror text-based types
8730 const textEditExts = new Set([
8731 "txt", "text", "md", "markdown", "rst",
8732 "html", "htm", "xhtml", "shtml",
8733 "css", "scss", "sass", "less",
8734 "js", "mjs", "cjs", "jsx",
8735 "ts", "tsx",
8736 "json", "jsonc", "ndjson",
8737 "yml", "yaml", "toml", "xml", "plist",
8738 "ini", "conf", "config", "cfg", "cnf", "properties", "props", "rc",
8739 "env", "dotenv",
8740 "csv", "tsv", "tab",
8741 "log",
8742 "sh", "bash", "zsh", "ksh", "fish",
8743 "bat", "cmd",
8744 "ps1", "psm1", "psd1",
8745 "py", "pyw", "rb", "pl", "pm", "go", "rs", "java", "kt", "kts",
8746 "scala", "sc", "groovy", "gradle",
8747 "c", "h", "cpp", "cxx", "cc", "hpp", "hh", "hxx",
8748 "m", "mm", "swift", "cs", "fs", "fsx", "dart", "lua", "r", "rmd",
8749 "sql", "vue", "svelte", "twig", "mustache", "hbs", "handlebars", "ejs", "pug", "jade"
8750 ]);
8751
8752 if (textEditExts.has(ext)) return true; // CodeMirror
8753 if (OO_ENABLED && OO_EXTS.has(ext)) return true; // ONLYOFFICE types if enabled
8754 return false;
8755}
8756
8757// Expose global functions for pagination and preview.
8758window.changePage = function (newPage) {

Callers 6

fillFileSnippetFunction · 0.85
fileListView.jsFile · 0.85
fillHoverPreviewForRowFunction · 0.85
loadFileListFunction · 0.85
openDefaultFileFromHoverFunction · 0.85
currentSelectionFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected