editor: fix purge problems and store parentNode in widgets to avoid using $.parent()
This commit is contained in:
parent
6f58f9ee41
commit
1d912c08a1
6 changed files with 10 additions and 6 deletions
|
|
@ -32,6 +32,8 @@ It must be of the following form:
|
|||
oscOutFilter:function(data){
|
||||
// Filter outgoing osc messages
|
||||
|
||||
var {address, args, host, port} = data
|
||||
|
||||
// same as oscInFilter
|
||||
|
||||
// return data if you want the message to be and sent
|
||||
|
|
@ -43,7 +45,7 @@ It must be of the following form:
|
|||
|
||||
```
|
||||
|
||||
The module is executed in a restricted context, only a few globals areh available :
|
||||
The module is executed in a restricted context, only a few globals are available :
|
||||
|
||||
- `console`: `object`
|
||||
- `sendOsc`: `function({address, args, host, port})`
|
||||
|
|
|
|||
|
|
@ -24,8 +24,8 @@ var updateDom = function(container,data, remote) {
|
|||
// save state
|
||||
var scroll = $('#sidepanel').scrollTop(),
|
||||
state = actions.stateGet(),
|
||||
parentContainer = container.parent(),
|
||||
purge = container[0].abstract.hashes || container[0].abstract.hash
|
||||
parentContainer = container[0].abstract.parentNode,
|
||||
purge = container[0].abstract.hashes || [container[0].abstract.hash]
|
||||
|
||||
// widget
|
||||
var newContainer = parsewidgets([data], parentContainer, container[0].abstract.parent)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ module.exports.widgets = function(data, parentNode, parentWidget, tab) {
|
|||
`)
|
||||
|
||||
// create widget
|
||||
var widgetInner = new widgets[props.type]({props:props, container:widgetContainer, parent:parentWidget})
|
||||
var widgetInner = new widgets[props.type]({props:props, container:widgetContainer, parent:parentWidget, parentNode:parentNode})
|
||||
|
||||
widgetContainer[0].appendChild(widgetInner.widget[0])
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ var callbacks = {
|
|||
|
||||
if (!containers.length) return
|
||||
for (var i=containers.length-1;i>=0;i--) {
|
||||
var container = containers[i].widget.parent(),
|
||||
var container = containers[i].container,
|
||||
data = containers[i].props
|
||||
|
||||
for (var k in newdata) {
|
||||
|
|
@ -37,7 +37,7 @@ var callbacks = {
|
|||
|
||||
if (!containers.length) return
|
||||
for (var i=containers.length-1;i>=0;i--) {
|
||||
var container = containers[i].widget.parent(),
|
||||
var container = containers[i].container,
|
||||
data = containers[i].props
|
||||
|
||||
$.extend(true,data,newdata)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ module.exports = class _widgets_base {
|
|||
this.widget = $(options.html)
|
||||
this.props = options.props
|
||||
this.parent = options.parent
|
||||
this.parentNode = options.parentNode
|
||||
this.hash = _widgets_base.createHash()
|
||||
|
||||
// Turn preArgs into array
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ module.exports = class Modal extends _widgets_base {
|
|||
|
||||
this.panel = new Panel(options)
|
||||
this.panel.widget.appendTo(this.widget.find('.popup-content'))
|
||||
if (this.panel.hashes) this.hashes = this.panel.hashes.concat(this.hash)
|
||||
|
||||
this.widget.hide()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue