* perf(settings): reduce Mac settings window input lag (#1347) Debounce custom CSS commits, memoize heavy tabs, and replace Radix ScrollArea with native scrolling so typing and navigation stay responsive on macOS. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(settings): flush debounced textarea on unmount Avoid losing custom CSS edits when the settings window closes before the debounce timer fires. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
15 lines
503 B
TypeScript
15 lines
503 B
TypeScript
const CUSTOM_CSS_STYLE_ID = 'netcatty-custom-css';
|
|
|
|
/** Inject or update the user custom CSS style block in document.head. */
|
|
export function applyCustomCssToDocument(css: string): void {
|
|
if (typeof document === 'undefined') return;
|
|
|
|
let styleEl = document.getElementById(CUSTOM_CSS_STYLE_ID) as HTMLStyleElement | null;
|
|
if (!styleEl) {
|
|
styleEl = document.createElement('style');
|
|
styleEl.id = CUSTOM_CSS_STYLE_ID;
|
|
document.head.appendChild(styleEl);
|
|
}
|
|
styleEl.textContent = css;
|
|
}
|