Skip to content

Commit 3eb639c

Browse files
committed
Include Monaco Editor files
1 parent a9c268c commit 3eb639c

File tree

10 files changed

+892
-7
lines changed

10 files changed

+892
-7
lines changed

.github/workflows/main.yml

-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,4 @@ jobs:
6666
- name: Publish Release on GitHub
6767
run: |
6868
VERSION=$(cat ./output/version.txt)
69-
echo "GITHUB_TOKEN"
70-
echo $GITHUB_TOKEN
7169
gh release create $VERSION ./output/ShaderToy-Chrome-Plugin-$VERSION.zip --title "$VERSION" --notes "Release of version $VERSION"

app/add-ons/monaco/LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2016 - present Microsoft Corporation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

app/add-ons/monaco/README.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This directory contains Monaco Editor
2+
3+
https://github.com/microsoft/monaco-editor

app/add-ons/monaco/loader.min.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/add-ons/monaco/min/vs/base/worker/workerMain.js

+31
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/add-ons/monaco/min/vs/editor/editor.main.css

+8
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/add-ons/monaco/min/vs/editor/editor.main.js

+798
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/contentscript.js

+10
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,16 @@
196196
*/
197197
function init() {
198198
loadScript(MAIN_EXTENSION_FILENAME);
199+
setTimeout(() => {
200+
window.postMessage({
201+
type: "MonacoAssetsData", cfg: {
202+
monacoLoader: chrome.runtime.getURL('add-ons/monaco/loader.min.js'),
203+
monacoEditor: chrome.runtime.getURL('add-ons/monaco/min/vs/editor.main.js'),
204+
monacoEditorVSPath: chrome.runtime.getURL('add-ons/monaco/min/vs/editor.min.css').replace("/editor.min.css", "")
205+
}
206+
});
207+
console.log("post message sent")
208+
}, 1000);
199209

200210
loadScript('scripts/node-sanitize-filename.js');
201211
loadScript('scripts/jszip-3.1.5.js');

app/manifest.json

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 3,
33
"name": "Shadertoy unofficial plugin.",
4-
"version": "0.14.268",
4+
"version": "0.14.270",
55
"description": "Shadertoy.com unofficial plugin.",
66
"homepage_url": "https://github.com/patuwwy/ShaderToy-Chrome-Plugin",
77
"background": {
@@ -34,6 +34,10 @@
3434
"add-ons/shadertoy-plugin-codemirror.js",
3535
"add-ons/shadertoy-plugin-parameters.js",
3636
"add-ons/shadertoy-plugin-bbcode.js",
37+
"add-ons/monaco/loader.min.js",
38+
"add-ons/monaco/min/vs/editor/editor.main.js",
39+
"add-ons/monaco/min/vs/editor/editor.main.css",
40+
"add-ons/monaco/min/vs/base/worker/workerMain.js",
3741
"shadertoy-plugin-profile.js",
3842
"shadertoy-plugin-home.js",
3943
"scripts/jszip-3.1.5.js",

app/shadertoy-plugin.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,15 @@
186186
constructor() {
187187
this.init();
188188
let ok = false;
189+
console.log("waiting for message");
190+
const monacoAssetsListener = (event) => {
191+
if (event.source !== window) return;
192+
if (event.data.type && event.data.type === "MonacoAssetsData") {
193+
this.loadMonacoEditor(event.data.cfg);
194+
}
195+
}
189196

190-
this.loadMonacoEditor();
197+
window.addEventListener("message", monacoAssetsListener);
191198
}
192199

193200
/**
@@ -709,7 +716,7 @@
709716
}
710717
}
711718

712-
loadMonacoEditor() {
719+
loadMonacoEditor(monacoAssetsData) {
713720
this.state = JSON.parse(window.localStorage.getItem(STATE_STORAGE_KEY) || "{}");
714721

715722
var f_add_glsl_language_to_monaco_editor = function(monaco){
@@ -795,7 +802,8 @@
795802
var o_script = document.createElement('script');
796803

797804
o_script.type = 'text/javascript';
798-
o_script.src = 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.26.1/min/vs/loader.min.js';
805+
o_script.src = monacoAssetsData.monacoLoader;
806+
799807
document.head.appendChild(o_script);
800808

801809
var o_editor_monaco = null;
@@ -853,7 +861,7 @@
853861
}
854862

855863
o_script.onload = function() {
856-
require.config({ paths: { 'vs': 'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.26.1/min/vs' }});
864+
require.config({ paths: { 'vs': monacoAssetsData.monacoEditorVSPath }});
857865
require(["vs/editor/editor.main"], registerEditorEvents);
858866
}
859867

0 commit comments

Comments
 (0)