Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: implement saveAs in a browser fashion way using URL.createObjectURL #81

Open
wants to merge 28 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8957cb6
FIX: implement saveAs in a browser fashion way using URL.createObjectURL
guidoschmidt Oct 29, 2022
eaef257
refactor: move to Vite
CodyJasonBennett Oct 29, 2022
6c660be
EDIT/README.md: hint to electron + browser version
guidoschmidt Oct 29, 2022
0e4c2d0
Merge branch 'patriciogonzalezvivo:main' into main
guidoschmidt Oct 29, 2022
00f665a
fix correct error handling
patriciogonzalezvivo Oct 30, 2022
dde4cde
Adding Guido Schmidt fix for save as https://github.com/patriciogonza…
guidoschmidt Nov 2, 2022
ed64c19
no package-lock.json
guidoschmidt Nov 2, 2022
5e01281
hint
patriciogonzalezvivo Oct 31, 2022
9978476
push build
patriciogonzalezvivo Oct 30, 2022
3629a15
adding hints and package-lock back
guidoschmidt Nov 2, 2022
e91e318
updating glslCanvas and autocomplate includes sooner
guidoschmidt Nov 2, 2022
302a82b
FIX: implement saveAs in a browser fashion way using URL.createObjectURL
guidoschmidt Nov 2, 2022
7595316
refactor: move to Vite
guidoschmidt Nov 2, 2022
e05a05a
fix correct error handling
patriciogonzalezvivo Oct 30, 2022
3477fdb
Adding Guido Schmidt fix for save as https://github.com/patriciogonza…
patriciogonzalezvivo Oct 30, 2022
370ff06
no packege-lock.json
patriciogonzalezvivo Oct 30, 2022
8304268
no package-lock.json
patriciogonzalezvivo Oct 30, 2022
926f9ac
hint
patriciogonzalezvivo Oct 31, 2022
5b2dc84
push build
patriciogonzalezvivo Oct 30, 2022
29d649f
adding hints and package-lock back
patriciogonzalezvivo Oct 31, 2022
7703ddc
updating glslCanvas and autocomplate includes sooner
patriciogonzalezvivo Oct 31, 2022
a945359
FIX: implement saveAs in a browser fashion way using URL.createObjectURL
guidoschmidt Oct 29, 2022
3ea9a69
refactor: move to Vite
CodyJasonBennett Oct 29, 2022
fb7b654
hint
patriciogonzalezvivo Oct 31, 2022
5163c4c
push build
patriciogonzalezvivo Oct 30, 2022
495d914
Merge branch 'main' of https://github.com/patriciogonzalezvivo/glslEd…
guidoschmidt Nov 10, 2022
09ddda5
EDIT/.gitignore: get rid of yarn.lock
guidoschmidt Nov 10, 2022
6400f07
Merge branch 'main' of https://github.com/patriciogonzalezvivo/glslEd…
guidoschmidt Nov 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
._.DS_Store
node_modules
node_modules
yarn.lock
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,33 @@ This is a list of all the **options** you can set up:

![](http://patriciogonzalezvivo.com/images/glslEditor/debugger.gif)

## Electron Version

When developing use this to automatically reload Electron on every change
## Browser Version
Runs glslEditor in your favourite Browser™

```bash
npm run dev
npm run browser
```

For use just do:
or

```bash
npm run start
yarn browser
```

## Electron Version
Runs glslEditor in [electron](https://www.electronjs.org/)
When developing use this to automatically reload Electron on every change

```bash
npm run electron
```

or

```bash
yarn electron
```

## TODOs

Expand Down
105 changes: 0 additions & 105 deletions gulpfile.js

This file was deleted.

72 changes: 37 additions & 35 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,47 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>GLSL Editor</title>
<link href="/favicon.gif" rel="shortcut icon"/>
<style>
body {
height: 100%;
margin: 0;
background: #171e22;
}
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>GLSL Editor</title>
<link href="/favicon.gif" rel="shortcut icon" />
<style>
body {
height: 100%;
margin: 0;
background: #171e22;
}

#glsl_editor {
height: 100%;
}
</style>
</head>
<body>
<div id="glsl_editor"></div>
</body>
#glsl_editor {
height: 100%;
}
</style>
<link type="text/css" rel="stylesheet" href="./src/css/ElectronApp.css" />
<link type="text/css" rel="stylesheet" href="./src/css/glslEditor.css" />
</head>
<body>
<div id="glsl_editor"></div>
</body>

<link type="text/css" rel="stylesheet" href="build/glslEditor.css">
<script type="text/javascript" src="build/glslEditor.js"></script>
<script type="text/javascript">
window.glslEditor = new GlslEditor('#glsl_editor', {
canvas_size: 500,
canvas_draggable: true,
canvas_resizable: true,
theme: 'monokai',
watchHash: true,
fileDrops: true,
menu: true
});
<script type="module">
import GlslEditor from './src/js/GlslEditor.js';

document.body.style.backgroundColor = window.getComputedStyle(glslEditor.editor.getWrapperElement(),null).getPropertyValue('background-color');
</script>
<script>
window.glslEditor = new GlslEditor("#glsl_editor", {
canvas_size: 500,
canvas_draggable: true,
canvas_resizable: true,
theme: 'monokai',
watchHash: true,
fileDrops: true,
menu: true
});

document.body.style.backgroundColor = window.getComputedStyle(glslEditor.editor.getWrapperElement(),null).getPropertyValue('background-color');
</script>
<script>
(function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,"script","//www.google-analytics.com/analytics.js","ga");
ga("create", "UA-18824436-2", "auto");
ga("send", "pageview");
</script>
</script>
</html>
45 changes: 45 additions & 0 deletions src/electron.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Module to control application life.
const { app, BrowserWindow } = require('electron');
const path = require('path');

function createWindow() {
// Create the browser window.
const mainWindow = new BrowserWindow({
title: 'GlslEditor',
width: 1000,
minWidth: 700,
height: 700,
minHeight: 700
});
mainWindow.setTitle('GlslEditor');
// and load the index.html of the app.
if (process.env.VITE_DEV_SERVER_URL) {
mainWindow.loadURL(process.env.VITE_DEV_SERVER_URL);
}
else {
mainWindow.loadFile(path.join(__dirname, 'index.html'));
}
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', () => {
createWindow();
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
createWindow();
}
});
});

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
58 changes: 0 additions & 58 deletions src/main.js

This file was deleted.

8 changes: 8 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { defineConfig } from 'vite';
import electron from 'vite-plugin-electron';

export default defineConfig({
plugins: [
electron({ entry: 'src/electron.js' }),
],
});