Skip to content

Commit

Permalink
[editor] Fix electron url open problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pissang committed Nov 15, 2017
1 parent d330b6c commit 9effd4b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions editor/bundle.js

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions editor/src/browser/open.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function (url) {
window.open(url);
}
5 changes: 5 additions & 0 deletions editor/src/electron/open.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var shell = require('electron').shell;

export default function (url) {
shell.openExternal(url);
}
7 changes: 6 additions & 1 deletion editor/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import TextureUI from './ui/Texture';
import * as timeline from './timeline';
import renderOutline from './debug/renderOutline';
import { updateAnimationUI } from './timeline';
import open from 'vendor/open';

var config = getDefaultSceneConfig();
var materialConfig = getDefaultMaterialConfig();
Expand All @@ -18,7 +19,6 @@ var viewer;
var controlKit = new ControlKit({
loadAndSave: true,
useExternalStyle: true
// history: true
});

function updateLight() {
Expand Down Expand Up @@ -540,3 +540,8 @@ window.addEventListener('dragover', function (e) {
window.addEventListener('drop', function (e) {
e.preventDefault();
});

$(document).on('click', 'a[href^="http"]', function(event) {
event.preventDefault();
open(this.href);
});

0 comments on commit 9effd4b

Please sign in to comment.