MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / EditorManager

Function EditorManager

src/lib/editorManager.js:94–3066  ·  view source on GitHub ↗

* Represents an editor manager that handles multiple files and provides various editor configurations and event listeners. * @param {HTMLElement} $header - The header element. * @param {HTMLElement} $body - The body element. * @returns {Promise } A promise that resolves to the editor manag

($header, $body)

Source from the content-addressed store, hash-verified

92 * @returns {Promise<Object>} A promise that resolves to the editor manager object.
93 */
94async function EditorManager($header, $body) {
95 /**
96 * @type {Collapsible & HTMLElement}
97 */
98 let $openFileList;
99 let TIMEOUT_VALUE = 500;
100 let preventScrollbarV = false;
101 let preventScrollbarH = false;
102 let scrollBarVisibilityCount = 0;
103 let timeoutQuicktoolsToggler;
104 let timeoutHeaderToggler;
105 let isScrolling = false;
106 let lastScrollTop = 0;
107 let lastScrollLeft = 0;
108 let suppressCursorRevealUntil = 0;
109 let scrollbarScrollLockUntil = 0;
110 let scrollbarScrollLockTop = null;
111 let scrollbarScrollLockLeft = null;
112 let scrollRestoreFrame = 0;
113 let scrollRestoreNestedFrame = 0;
114 let scrollRestoreTimeout = 0;
115
116 // Debounce timers for CodeMirror change handling
117 let checkTimeout = null;
118 let autosaveTimeout = null;
119 let touchSelectionController = null;
120 let touchSelectionSyncRaf = 0;
121 let nativeContextMenuDisabled = null;
122 const recoverableWarningKeys = new Set();
123
124 function warnRecoverable(message, error, key) {
125 if (key) {
126 if (recoverableWarningKeys.has(key)) return;
127 recoverableWarningKeys.add(key);
128 }
129 console.warn(message, error);
130 }
131
132 function isCoarsePointerDevice() {
133 if (typeof window !== "undefined") {
134 try {
135 if (window.matchMedia?.("(pointer: coarse)").matches) {
136 return true;
137 }
138 } catch (_) {
139 // Ignore matchMedia capability errors and fall through.
140 }
141 }
142 return (
143 typeof navigator !== "undefined" &&
144 Number(navigator.maxTouchPoints || 0) > 0
145 );
146 }
147
148 const setNativeContextMenuDisabled = (disabled) => {
149 const value = !!disabled;
150 if (nativeContextMenuDisabled === value) return;
151 nativeContextMenuDisabled = value;

Callers

nothing calls this directly

Calls 15

searchFunction · 0.90
executeCommandFunction · 0.90
getThemeExtensionsFunction · 0.90
stopManagedServerFunction · 0.90
getModeForPathFunction · 0.90
initModesFunction · 0.90
clearScrollbarScrollLockFunction · 0.85
isCursorRevealSuppressedFunction · 0.85
isCursorVisibleFunction · 0.85

Tested by

no test coverage detected