From 62855667ce8348bbe03b0c42160ac395e87cd6f8 Mon Sep 17 00:00:00 2001
From: memdmp <memdmp@estrogen.zone>
Date: Mon, 24 Feb 2025 01:21:58 +0100
Subject: feat: pop out

---
 src/routes/Monaco.svelte | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

(limited to 'src/routes/Monaco.svelte')

diff --git a/src/routes/Monaco.svelte b/src/routes/Monaco.svelte
index 03663d0..409ab39 100644
--- a/src/routes/Monaco.svelte
+++ b/src/routes/Monaco.svelte
@@ -106,6 +106,22 @@ declare global {
       theme: 'redirext',
       autoDetectHighContrast: false,
     });
+    editor.addCommand(Monaco.KeyMod.Alt | Monaco.KeyCode.Backslash, () => {
+      const win = window.open(location.href);
+      if (win) {
+        const el = document.createElement('div');
+        el.setAttribute(
+          'style',
+          'display:flex;width:100vw;height:100vh;position:fixed;left:0;top:0;align-items:center;justify-content:center;text-align:center;z-index:9999;background:#23222B;'
+        );
+        el.textContent = 'Popped out';
+        document.body.appendChild(el);
+        win.addEventListener('close', () => {
+          el.textContent = 'Popping In...';
+          location.reload();
+        });
+      }
+    });
     editor.getModel()?.onDidChangeContent((e) => {
       writeDebounce = true;
       const upd = () => {
-- 
cgit v1.2.3

