editor: keybinding clean
vm: global globals
This commit is contained in:
parent
90ae97d412
commit
66c68a734e
2 changed files with 10 additions and 8 deletions
|
|
@ -168,7 +168,8 @@ class Editor {
|
|||
|
||||
handleKeyboard(combo, e){
|
||||
|
||||
if (e.target && e.target.classList.contains('no-keybinding')) return
|
||||
if (e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
|
||||
|
||||
e.preventDefault()
|
||||
|
||||
switch (combo) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,11 @@
|
|||
var loopProtect = require('loop-protect'),
|
||||
{deepCopy} = require('../utils')
|
||||
{deepCopy} = require('../utils'),
|
||||
globals = {
|
||||
screen: {width: screen.width, height: screen.height},
|
||||
env: deepCopy(ENV),
|
||||
url: document.location.host,
|
||||
platform: navigator.platform
|
||||
}
|
||||
|
||||
class Vm {
|
||||
|
||||
|
|
@ -42,12 +48,7 @@ class Vm {
|
|||
this.sandbox.contentWindow.setInterval = ()=>{
|
||||
throw 'setTimeout and setInterval can\'t be used in the JS sandbox'
|
||||
}
|
||||
this.sandbox.contentWindow.globals = {
|
||||
screen: {width: screen.width, height: screen.height},
|
||||
env: deepCopy(ENV),
|
||||
url: document.location.host,
|
||||
platform: navigator.platform
|
||||
}
|
||||
this.sandbox.contentWindow.globals = globals
|
||||
|
||||
// sanitize globals
|
||||
for (var imports of ['__protect', 'console', 'setTimeout', 'setInterval', 'globals']) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue