diff options
author | V <vendicated@riseup.net> | 2023-09-19 04:07:24 +0200 |
---|---|---|
committer | V <vendicated@riseup.net> | 2023-09-19 04:11:27 +0200 |
commit | 41f5d71e38f785786656e111cf2ea1200e45886d (patch) | |
tree | 564a0300485de18a0b8d396118f09c6f756105ed /src/main | |
parent | efb88a4df8037fc1394a9e2053c49e75d340f401 (diff) | |
download | Vencord-41f5d71e38f785786656e111cf2ea1200e45886d.tar.gz Vencord-41f5d71e38f785786656e111cf2ea1200e45886d.tar.bz2 Vencord-41f5d71e38f785786656e111cf2ea1200e45886d.zip |
Bundle dependencies with extensions for webstore rule compliance (#1740)
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/ipcMain.ts | 2 | ||||
-rw-r--r-- | src/main/monacoWin.html | 66 |
2 files changed, 67 insertions, 1 deletions
diff --git a/src/main/ipcMain.ts b/src/main/ipcMain.ts index c8e4567..61cbe7a 100644 --- a/src/main/ipcMain.ts +++ b/src/main/ipcMain.ts @@ -27,7 +27,7 @@ import { mkdirSync, readFileSync, watch } from "fs"; import { open, readdir, readFile, writeFile } from "fs/promises"; import { join, normalize } from "path"; -import monacoHtml from "~fileContent/../components/monacoWin.html;base64"; +import monacoHtml from "~fileContent/monacoWin.html;base64"; import { getThemeInfo, stripBOM, UserThemeHeader } from "./themes"; import { ALLOWED_PROTOCOLS, QUICKCSS_PATH, SETTINGS_DIR, SETTINGS_FILE, THEMES_DIR } from "./utils/constants"; diff --git a/src/main/monacoWin.html b/src/main/monacoWin.html new file mode 100644 index 0000000..61d075f --- /dev/null +++ b/src/main/monacoWin.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<html lang="en"> + <head> + <meta charset="utf-8" /> + <title>Vencord QuickCSS Editor</title> + <link + rel="stylesheet" + href="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs/editor/editor.main.min.css" + integrity="sha512-MOoQ02h80hklccfLrXFYkCzG+WVjORflOp9Zp8dltiaRP+35LYnO4LKOklR64oMGfGgJDLO8WJpkM1o5gZXYZQ==" + crossorigin="anonymous" + referrerpolicy="no-referrer" + /> + <style> + html, + body, + #container { + position: absolute; + left: 0; + top: 0; + width: 100%; + height: 100%; + margin: 0; + padding: 0; + overflow: hidden; + } + </style> + </head> + + <body> + <div id="container"></div> + <script + src="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs/loader.min.js" + integrity="sha512-QzMpXeCPciAHP4wbYlV2PYgrQcaEkDQUjzkPU4xnjyVSD9T36/udamxtNBqb4qK4/bMQMPZ8ayrBe9hrGdBFjQ==" + crossorigin="anonymous" + referrerpolicy="no-referrer" + ></script> + + <script> + require.config({ + paths: { + vs: "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.40.0/min/vs", + }, + }); + + require(["vs/editor/editor.main"], () => { + getCurrentCss().then((css) => { + var editor = monaco.editor.create( + document.getElementById("container"), + { + value: css, + language: "css", + theme: getTheme(), + } + ); + editor.onDidChangeModelContent(() => + setCss(editor.getValue()) + ); + window.addEventListener("resize", () => { + // make monaco re-layout + editor.layout(); + }); + }); + }); + </script> + </body> +</html> |