MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / initFileTabContainer

Function initFileTabContainer

src/lib/editorManager.js:2935–2991  ·  view source on GitHub ↗

* Initializes the file tab container.

()

Source from the content-addressed store, hash-verified

2933 * Initializes the file tab container.
2934 */
2935 function initFileTabContainer() {
2936 let $list;
2937
2938 if ($openFileList) {
2939 if ($openFileList.classList.contains("collapsible")) {
2940 $list = Array.from($openFileList.$ul.children);
2941 } else {
2942 $list = Array.from($openFileList.children);
2943 }
2944 $openFileList.remove();
2945 }
2946
2947 // show open file list in header
2948 const { openFileListPos } = appSettings.value;
2949 if (
2950 openFileListPos === appSettings.OPEN_FILE_LIST_POS_HEADER ||
2951 openFileListPos === appSettings.OPEN_FILE_LIST_POS_BOTTOM
2952 ) {
2953 if (!$openFileList?.classList.contains("open-file-list")) {
2954 $openFileList = <ul className="open-file-list"></ul>;
2955 }
2956 if ($list) $openFileList.append(...$list);
2957
2958 if (openFileListPos === appSettings.OPEN_FILE_LIST_POS_BOTTOM) {
2959 $container.parentElement.insertAdjacentElement(
2960 "afterend",
2961 $openFileList,
2962 );
2963 } else {
2964 $header.insertAdjacentElement("afterend", $openFileList);
2965 }
2966
2967 root.classList.add("top-bar");
2968
2969 const oldAppend = $openFileList.append;
2970 $openFileList.append = (...args) => {
2971 oldAppend.apply($openFileList, args);
2972 };
2973 } else {
2974 $openFileList = list(strings["active files"]);
2975 $openFileList.classList.add("file-list");
2976 if ($list) $openFileList.$ul.append(...$list);
2977 $openFileList.expand();
2978
2979 const oldAppend = $openFileList.$ul.append;
2980 $openFileList.append = (...args) => {
2981 oldAppend.apply($openFileList.$ul, args);
2982 };
2983
2984 const files = sidebarApps.get("files");
2985 files.insertBefore($openFileList, files.firstElementChild);
2986 root.classList.remove("top-bar");
2987 }
2988
2989 root.setAttribute("open-file-list-pos", openFileListPos);
2990 manager.emit("int-open-file-list", openFileListPos);
2991 }
2992

Callers 2

openFileListFunction · 0.85
EditorManagerFunction · 0.85

Calls 5

appendMethod · 0.80
addMethod · 0.80
listFunction · 0.70
removeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected