git: ugly reset to remove 3000 commits that don't exist
--- relevant commits ---
commit fa63c7ec3596c9afb4f07f75583b2357f4ef6c85 (HEAD -> master, origin/master, origin/HEAD)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 19:53:00 2020 +0100
console: don't submit onBlur
commit b653c2edd3be4991dfcd6ed82c76dd3ed2526edb
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 19:48:24 2020 +0100
ui: restore left & right panel minWidth
commit 3a1af3f9ec70857548d412ce2971992650fa2899
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 19:45:42 2020 +0100
console: seamless input
commit ec2d49379431a5a6b54968f4dc15bc28286e3741
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 15:08:22 2020 +0100
console: css tweaks
commit 5248fbe4241134ddf56697180a62f8f89c5f382c
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 14:58:03 2020 +0100
console: history tweak
commit 8c49baf8d7f9546ab3ab19f9296e5acbf60a364f
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 14:57:47 2020 +0100
server: allow console osc out
commit 152c6f7276055492bf4a637d5a7a678164d6513b
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 12:32:14 2020 +0100
lint
commit 1158118db89bb3b14fb2972d020371aac3d8f198
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 12:30:18 2020 +0100
ipc: set samesite attr on client_id cookie
commit 25fd79474da4ecba8e80e8d00ac63d4dfb62ca66
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 12:24:55 2020 +0100
console: tweaks
commit 3d39ea9c0a3a28a7344abb023acb76df75f59ba9
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 11:57:45 2020 +0100
console: add interpreter
commit 961ebe7518
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Thu Nov 12 08:16:22 2020 +0100
widget: lazy load uiConsole
commit 96f0d3c00f (tag: v1.7.0-beta2)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 22:46:38 2020 +0100
ios: clone widget not laid out properly in horizontal panels
commit a8e0ac344a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 19:56:35 2020 +0100
console: unified widget error, with quick edit link from the console
commit 6000d1a67a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 17:31:33 2020 +0100
package: beta 2
commit d8b1fc298f
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 17:30:06 2020 +0100
ui: overflow hidden on workspaces introduces some overflow scroll with the console panel
commit 35374a7c1c
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 17:24:22 2020 +0100
session: compat: increment toolbar() usages (new console item)
commit ff78df42b6
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 17:17:33 2020 +0100
console: tweaks
commit 33581804ac
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Wed Nov 11 16:28:18 2020 +0100
ui: move console to full bottom panel
commit dd6b85f6ff
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 16:09:31 2020 +0100
session: v0 label compat tweak
commit 42c4b0f6cd
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 15:50:56 2020 +0100
session: v0 label conversion fix on tabs
commit 9431fd722e (tag: v1.7.0-beta1)
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 13:05:06 2020 +0100
docs, log & restore user rpi build
commit c9e3641332
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 11:13:56 2020 +0100
python: resolve bin path
commit 8030744325
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 11:13:45 2020 +0100
docs: add link
commit 4ce960139a
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 10:18:31 2020 +0100
package: wrong path on osx
commit 2bc507a17b
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 09:48:14 2020 +0100
package: 1.7.0 beta 1
commit 16579241ce
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 09:45:32 2020 +0100
package: document midi support and install process
commit b8173294aa
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 09:24:54 2020 +0100
package: reduce number of prebuilt binaries (keep 64bit linux/windows/osx + node)
commit df215612c5
Author: bordun <jean-emmanuel.doucet@groolot.net>
Date: Tue Nov 10 08:39:27 2020 +0100
midi: bump version
This commit is contained in:
parent
43b0ab9fea
commit
82361e2f60
30 changed files with 480 additions and 205 deletions
|
|
@ -52,7 +52,7 @@ class Editor {
|
|||
w.props[propName] = previousValue
|
||||
updateWidget(w, {changedProps: [propName], preventSelect: this.selectedWidgets.length > 1})
|
||||
|
||||
if (uiConsole.minimized || rightUiSidePanel.minimized) notifications.add({
|
||||
if (uiConsole.minimized) notifications.add({
|
||||
class: 'error',
|
||||
message: locales('inspector_error'),
|
||||
duration: 7000
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Ipc extends EventEmitter {
|
|||
this.socket.send('["pong"]')
|
||||
})
|
||||
|
||||
document.cookie = 'client_id=' + uuid
|
||||
document.cookie = 'client_id=' + uuid + ';samesite=strict'
|
||||
|
||||
try {
|
||||
this.open()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
module.exports = {
|
||||
|
||||
// console
|
||||
console_title: 'Console',
|
||||
console: 'Console',
|
||||
console_enabled: 'Enabled',
|
||||
console_clear: 'Clear console',
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
module.exports = {
|
||||
|
||||
// console
|
||||
console_title: 'Console',
|
||||
console: 'Console',
|
||||
console_enabled: 'Activée',
|
||||
console_clear: 'Vider la console',
|
||||
|
||||
// editor
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ var converters = [
|
|||
}
|
||||
|
||||
var label = data.label === undefined ? 'auto' : data.label
|
||||
if (label !== false && data.type && !data.type.match(/button|menu|modal|clone|html/)) {
|
||||
if (label !== false && data.type && data.type && !data.type.match(/button|menu|modal|clone|html|tab/)) {
|
||||
label = label === 'auto' ? '@{this.id}' : label
|
||||
data.html = label
|
||||
}
|
||||
|
|
@ -239,6 +239,17 @@ var converters = [
|
|||
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
{
|
||||
version: '1.6.2',
|
||||
widget: (data)=>{
|
||||
|
||||
if (data.script && String(data.script).includes('toolbar(')) {
|
||||
// new "console" submenu in toolbar at index 3
|
||||
data.script = String(data.script).replace('toolbar(4)', 'toolbar(5)').replace('toolbar(3)', 'toolbar(4)')
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -159,11 +159,6 @@ var menuEntries = [
|
|||
action: ()=>{return rightUiSidePanel.minimized ? rightUiSidePanel.restore() : rightUiSidePanel.minimize()},
|
||||
shortcut: 'mod + i'
|
||||
},
|
||||
{
|
||||
label: locales('console_title'),
|
||||
class: ()=>{return 'toggle ' + (uiConsole.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return uiConsole.minimized ? uiConsole.restore() : uiConsole.minimize()}
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
|
|
@ -174,6 +169,24 @@ var menuEntries = [
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
label: locales('console'),
|
||||
action: [
|
||||
{
|
||||
label: locales('console_enabled'),
|
||||
class: ()=>{return 'toggle ' + (uiConsole.minimized ? 'off' : 'on')},
|
||||
action: ()=>{return uiConsole.minimized ? uiConsole.restore() : uiConsole.minimize()},
|
||||
shortcut: 'mod + k'
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
{
|
||||
label: locales('console_clear'),
|
||||
action: uiConsole.clear.bind(uiConsole),
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
separator: true
|
||||
},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ var UiSidePanel = require('./ui-sidepanel'),
|
|||
html = require('nanohtml'),
|
||||
raw = require('nanohtml/raw'),
|
||||
locales = require('../locales'),
|
||||
{icon} = require('./utils')
|
||||
{icon} = require('./utils'),
|
||||
Script = require('../widgets/scripts/script'),
|
||||
widgetManager = require('../managers/widgets')
|
||||
|
||||
class UiConsole extends UiSidePanel {
|
||||
|
||||
|
|
@ -12,10 +14,11 @@ class UiConsole extends UiSidePanel {
|
|||
|
||||
this.header = DOM.get(this.container, 'osc-panel-header')[0]
|
||||
|
||||
this.header.appendChild(html`<label>${locales('console_title')}</label>`)
|
||||
this.header.appendChild(html`<label>${locales('console')}</label>`)
|
||||
this.messages = this.content.appendChild(html`<osc-console></osc-console>`)
|
||||
// this.inputWrapper = this.container.appendChild(html`<osc-console-input></osc-console-inpu>`)
|
||||
// this.input = this.inputWrapper.appendChild(html`<textarea></textarea>`)
|
||||
|
||||
this.inputWrapper = this.content.appendChild(html`<osc-console-input></osc-console-inpu>`)
|
||||
this.input = this.inputWrapper.appendChild(html`<textarea rows="1"></textarea>`)
|
||||
|
||||
this.actions = this.header.appendChild(html`<div class="actions"></div>`)
|
||||
this.clearBtn = this.actions.appendChild(html`<div class="clear" title="${locales('console_clear')}">${raw(icon('trash'))}</div>`)
|
||||
|
|
@ -26,44 +29,102 @@ class UiConsole extends UiSidePanel {
|
|||
this.length = 0
|
||||
this.maxLength = 200
|
||||
|
||||
var _this = this,
|
||||
log = console.log,
|
||||
error = console.error
|
||||
this.history = ['']
|
||||
this.cursor = 0
|
||||
|
||||
|
||||
var _this = this
|
||||
|
||||
console._log = console.log
|
||||
console.log = function(message){
|
||||
_this.log('log', message)
|
||||
log(...arguments)
|
||||
console._log(...arguments)
|
||||
}
|
||||
|
||||
console._error = console.error
|
||||
console.error = function(message){
|
||||
_this.log('error', message)
|
||||
error(...arguments)
|
||||
console._error(...arguments)
|
||||
}
|
||||
|
||||
// this.input.addEventListener('keydown', (event)=>{
|
||||
// if (event.keyCode === 13 && !event.shiftKey) {
|
||||
//
|
||||
// event.preventDefault()
|
||||
// DOM.dispatchEvent(event.target, 'change')
|
||||
//
|
||||
// }
|
||||
// })
|
||||
//
|
||||
// this.input.addEventListener('change', (event)=>{
|
||||
// try {
|
||||
// console.log(eval(this.input.value))
|
||||
// } catch (err) {
|
||||
// console.error(err)
|
||||
// }
|
||||
// this.input.value = ''
|
||||
// })
|
||||
|
||||
this.script = new Script({props:{
|
||||
id: 'CONSOLE',
|
||||
script: 'return eval(value)',
|
||||
event: 'value'
|
||||
}, parent: widgetManager})
|
||||
this.script._not_editable = true
|
||||
this.script.hash = 'CONSOLE'
|
||||
|
||||
this.input.addEventListener('keydown', (event)=>{
|
||||
if (event.keyCode === 13 && !event.shiftKey) {
|
||||
event.preventDefault()
|
||||
this.inputValidate()
|
||||
} else if (event.keyCode === 38) {
|
||||
if (this.cursor < this.history.length - 1) {
|
||||
|
||||
if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== 1) return
|
||||
|
||||
this.cursor += 1
|
||||
this.input.value = this.history[this.cursor]
|
||||
event.preventDefault()
|
||||
}
|
||||
} else if (event.keyCode === 40) {
|
||||
if (this.cursor > 0) {
|
||||
var nLines = this.input.value.split('\n').length
|
||||
if (this.input.value.substr(0, this.input.selectionStart).split('\n').length !== nLines) return
|
||||
|
||||
this.cursor -= 1
|
||||
this.input.value = this.history[this.cursor]
|
||||
event.preventDefault()
|
||||
}
|
||||
} else if (event.keyCode === 9) {
|
||||
var cur = this.input.selectionStart,
|
||||
val = this.input.value
|
||||
this.input.value = val.slice(0, cur) + ' ' + val.slice(cur)
|
||||
event.preventDefault()
|
||||
}
|
||||
|
||||
this.inputSize()
|
||||
|
||||
})
|
||||
|
||||
this.input.addEventListener('input', (event)=>{
|
||||
this.inputSize()
|
||||
})
|
||||
|
||||
this.enable()
|
||||
|
||||
}
|
||||
|
||||
log(type, message) {
|
||||
inputSize() {
|
||||
this.input.setAttribute('rows',0)
|
||||
this.input.setAttribute('rows', this.input.value.split('\n').length)
|
||||
}
|
||||
|
||||
inputValidate() {
|
||||
|
||||
if (this.input.value == '') return
|
||||
|
||||
this.log('input', `${this.input.value}`)
|
||||
var returnValue = this.script.setValue(this.input.value, {sync: true, send: true})
|
||||
if (returnValue === undefined) {
|
||||
this.log('output undefined', 'undefined')
|
||||
} else {
|
||||
this.log('output value', returnValue)
|
||||
}
|
||||
|
||||
if (this.input.value !== this.history[this.cursor] && this.input.value !== this.history[1]) {
|
||||
this.history.splice(1, 0, this.input.value)
|
||||
if (this.history.length > 10) this.history.pop()
|
||||
}
|
||||
|
||||
this.input.value = ''
|
||||
this.cursor = 0
|
||||
|
||||
}
|
||||
|
||||
log(type, message, html) {
|
||||
|
||||
var node = this.messages.appendChild(html`
|
||||
<osc-console-message class="${type}">
|
||||
|
|
@ -81,7 +142,12 @@ class UiConsole extends UiSidePanel {
|
|||
}
|
||||
}
|
||||
|
||||
node.textContent = message
|
||||
if (html) {
|
||||
node.innerHTML = message
|
||||
} else {
|
||||
node.textContent = message
|
||||
}
|
||||
|
||||
if (type !== 'error' && node.textContent.match(/error/i)) node.classList.add('error')
|
||||
|
||||
node.scrollIntoView()
|
||||
|
|
@ -105,9 +171,10 @@ class UiConsole extends UiSidePanel {
|
|||
|
||||
this.messages.innerHTML = ''
|
||||
this.length = 0
|
||||
this.script.onRemove()
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new UiConsole({selector: '#osc-console', size: 40})
|
||||
module.exports = new UiConsole({selector: '#osc-console', minSize: 40, size: 200, minimized: true})
|
||||
|
|
|
|||
|
|
@ -17,11 +17,13 @@ class UiSidePanel extends UiWidget {
|
|||
|
||||
this.cacheKey = 'ui.' + options.selector
|
||||
|
||||
this.minWidth = options.size === undefined ? 250 : options.size
|
||||
this.width = cache.get(this.cacheKey + '.width') || options.size || 250
|
||||
var size = cache.get(this.cacheKey + '.width') || 250
|
||||
this.minWidth = options.minSize !== undefined ? options.minSize : (options.size !== undefined ? options.size : 250)
|
||||
this.width = size !== undefined ? size : (options.size !== undefined ? options.size : 250)
|
||||
|
||||
this.disabled = false
|
||||
this.minimized = cache.get(this.cacheKey + '.minimized') || false
|
||||
var minimized = cache.get(this.cacheKey + '.minimized')
|
||||
this.minimized = minimized !== null ? minimized : (options.minimized || false)
|
||||
this.init = false
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ var EventEmitter = require('../../events/event-emitter'),
|
|||
morph = require('nanomorph'),
|
||||
sanitizeHtml = require('sanitize-html'),
|
||||
updateWidget = ()=>{},
|
||||
Script
|
||||
Script, uiConsole
|
||||
|
||||
|
||||
var oscReceiverState = {}
|
||||
|
|
@ -35,6 +35,7 @@ DOM.ready(()=>{
|
|||
|
||||
setTimeout(()=>{
|
||||
updateWidget = require('../../editor/data-workers').updateWidget
|
||||
uiConsole = require('../../ui/ui-console')
|
||||
})
|
||||
|
||||
class Widget extends EventEmitter {
|
||||
|
|
@ -215,6 +216,7 @@ class Widget extends EventEmitter {
|
|||
script: this.getProp('script'),
|
||||
event: 'value'
|
||||
}, builtIn: true, parent: this})
|
||||
this.script._not_editable = true
|
||||
this.on('change', (e)=>{
|
||||
if (e.widget === this && this.mounted && !e.options.fromEdit) {
|
||||
this.script.setValue(e.options.widget ? e.options.widget.value : this.value, {...e.options, id: e.options.id || e.id})
|
||||
|
|
@ -659,9 +661,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
})
|
||||
} catch (err) {
|
||||
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
|
||||
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
|
||||
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': JS{{}} error:\n' + err + line)
|
||||
this.errorProp(propName, 'JS{{}}', err)
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -680,9 +680,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
})
|
||||
} catch (err) {
|
||||
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
|
||||
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
|
||||
console.error((this.getProp('id') || this.props.id) + '.' + propName + ': #{} error:\n' + err + line)
|
||||
this.errorProp(propName, '#{}', err)
|
||||
}
|
||||
|
||||
for (let k in variables) {
|
||||
|
|
@ -878,6 +876,25 @@ class Widget extends EventEmitter {
|
|||
|
||||
}
|
||||
|
||||
errorProp(name, type, error) {
|
||||
|
||||
let stackline = error.stack ? (error.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
|
||||
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - (type.includes('{}') ? 1 : 0)) : '',
|
||||
id = this.getProp('id') || this.props.id,
|
||||
widget = this // used for edit link in console
|
||||
|
||||
while (widget._not_editable && widget.parent !== widgetManager) {
|
||||
// ignore non editable
|
||||
widget = widget.parent
|
||||
}
|
||||
|
||||
// ignore clone wrapper
|
||||
if (widget.parent !== widgetManager && widget.parent.getProp('type') === 'clone') widget = widget.parent
|
||||
|
||||
console._error(`${id}.${name} ${type} error${line}: ${error}`)
|
||||
uiConsole.log('error', `<span class="edit-widget" data-widget="${widget.hash}">${id}</span>.${name} ${type} error${line}: ${error}`, true)
|
||||
}
|
||||
|
||||
setContainerStyles(styles = ['geometry', 'css', 'visibility']) {
|
||||
|
||||
if (styles.includes('geometry')) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ class Clone extends Container() {
|
|||
value: null,
|
||||
osc: null
|
||||
})
|
||||
|
||||
|
||||
defaults.style = {css: defaults.style.css}
|
||||
|
||||
return defaults
|
||||
|
|
@ -98,6 +98,7 @@ class Clone extends Container() {
|
|||
|
||||
if (e.widget !== this) {
|
||||
e.widget.container.classList.add('not-editable')
|
||||
e.widget._not_editable = true
|
||||
}
|
||||
|
||||
})
|
||||
|
|
|
|||
|
|
@ -133,6 +133,7 @@ class Keyboard extends Panel {
|
|||
|
||||
key._index = i - start
|
||||
key.container.classList.add('not-editable')
|
||||
key._not_editable = true
|
||||
key.container.classList.add('key')
|
||||
|
||||
if (pattern[i % 12] == 'w') {
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ class Matrix extends Panel {
|
|||
|
||||
widget._index = i
|
||||
widget.container.classList.add('not-editable')
|
||||
widget._not_editable = true
|
||||
|
||||
this.value[i] = widget.getValue()
|
||||
|
||||
|
|
@ -152,6 +153,7 @@ class Matrix extends Panel {
|
|||
this.children[i].updateProps(Object.keys(data), this, options)
|
||||
// this.children[i] might have been recreated
|
||||
this.children[i].container.classList.add('not-editable')
|
||||
this.children[i]._not_editable = true
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -150,6 +150,7 @@ class PatchBay extends Container(Canvas) {
|
|||
parent: this
|
||||
})
|
||||
w.container.classList.add('not-editable')
|
||||
w._not_editable = true
|
||||
this.inputsWidgets.push(w)
|
||||
this.inputNodes.push(w.container)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -271,7 +271,7 @@ class ScriptVm extends Vm {
|
|||
try {
|
||||
callback()
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
this.errorProp('script', 'setTimeout', e)
|
||||
}
|
||||
this.setWidget()
|
||||
this.setValueOptions()
|
||||
|
|
@ -309,7 +309,7 @@ class ScriptVm extends Vm {
|
|||
try {
|
||||
callback()
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
this.errorProp('script', 'setInterval', e)
|
||||
}
|
||||
this.setWidget()
|
||||
this.setValueOptions()
|
||||
|
|
|
|||
|
|
@ -89,9 +89,7 @@ class Script extends Widget {
|
|||
|
||||
} catch(err) {
|
||||
|
||||
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
|
||||
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
|
||||
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
|
||||
this.errorProp('script', 'javascript', err)
|
||||
this.script = ()=>{}
|
||||
|
||||
}
|
||||
|
|
@ -105,17 +103,17 @@ class Script extends Widget {
|
|||
scriptVm.setWidget(this)
|
||||
|
||||
this.scriptLock = true
|
||||
var returnValue
|
||||
try {
|
||||
this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
|
||||
returnValue = this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
|
||||
} catch(err) {
|
||||
let stackline = err.stack ? (err.stack.match(/>:([0-9]+):[0-9]+/) || '') : '',
|
||||
line = stackline.length > 1 ? ' at line ' + (parseInt(stackline[1]) - 2) : ''
|
||||
console.error((this.getProp('id') || this.props.id) + '.script error:\n' + err + line)
|
||||
this.errorProp('script', 'javascript', err)
|
||||
}
|
||||
this.scriptLock = false
|
||||
|
||||
scriptVm.setWidget()
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -125,7 +123,7 @@ class Script extends Widget {
|
|||
|
||||
scriptVm.setValueOptions(options)
|
||||
|
||||
this.run({
|
||||
var returnValue = this.run({
|
||||
value: v,
|
||||
id: options.id,
|
||||
touch: options.touch
|
||||
|
|
@ -133,6 +131,8 @@ class Script extends Widget {
|
|||
|
||||
scriptVm.setValueOptions(options)
|
||||
|
||||
return returnValue
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue