diff options
author | Vendicated <vendicated@riseup.net> | 2022-12-20 17:43:55 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-12-20 18:04:33 +0100 |
commit | 103c49931007c2aa223b39f25902b2dd1a015301 (patch) | |
tree | bb414c60c4f24094a6fd3f1289c382abc6810742 | |
parent | 9dcafbf4689d36ee790c0a81409e87326798bcf2 (diff) | |
download | Vencord-103c49931007c2aa223b39f25902b2dd1a015301.tar.gz Vencord-103c49931007c2aa223b39f25902b2dd1a015301.tar.bz2 Vencord-103c49931007c2aa223b39f25902b2dd1a015301.zip |
Monaco Popup: Add metadata, store window instance
-rw-r--r-- | src/components/Monaco.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/components/Monaco.ts b/src/components/Monaco.ts index aa98f99..59ed7bb 100644 --- a/src/components/Monaco.ts +++ b/src/components/Monaco.ts @@ -29,7 +29,12 @@ const setCss = debounce((css: string) => { }); export async function launchMonacoEditor() { - const win = open("about:blank", void 0, "popup,width=1000,height=1000")!; + const features = `popup,width=${Math.min(window.innerWidth, 1000)},height=${Math.min(window.innerHeight, 1000)}`; + const win = open("about:blank", "VencordQuickCss", features); + if (!win) { + alert("Failed to open QuickCSS popup. Make sure to allow popups!"); + return; + } win.setCss = setCss; win.getCurrentCss = () => VencordNative.ipc.invoke(IpcEvents.GET_QUICK_CSS); @@ -41,4 +46,6 @@ export async function launchMonacoEditor() { : "vs-dark"; win.document.write(monacoHtml); + + window.__VENCORD_MONACO_WIN__ = new WeakRef(win); } |