Set className and textContent in the dynamic style element 'monaco-colors' before appended

This commit is contained in:
csu-feizao
2023-03-10 17:44:03 +08:00
committed by 洪兴华
parent 83fe8e03fb
commit d80c5b274e
2 changed files with 10 additions and 7 deletions

View File

@@ -691,10 +691,11 @@ export function getActiveElement(): Element | null {
return result;
}
export function createStyleSheet(container: HTMLElement = document.getElementsByTagName('head')[0]): HTMLStyleElement {
export function createStyleSheet(container: HTMLElement = document.getElementsByTagName('head')[0], beforeAppend?: (style: HTMLStyleElement) => void): HTMLStyleElement {
const style = document.createElement('style');
style.type = 'text/css';
style.media = 'screen';
beforeAppend?.(style);
container.appendChild(style);
return style;
}