session: ensure 1/ root is singleton 2/ root has widgetManager as parent
This commit is contained in:
parent
77c564cd2a
commit
4fe55e77d5
2 changed files with 4 additions and 3 deletions
|
|
@ -44,7 +44,8 @@ var SessionManager = class SessionManager {
|
|||
parser.reset()
|
||||
parser.parse({
|
||||
data: this.session.getRoot(),
|
||||
parentNode: DOM.get('#osc-container')[0]
|
||||
parentNode: DOM.get('#osc-container')[0],
|
||||
parent: widgetManager
|
||||
})
|
||||
editor.clearHistory()
|
||||
DOM.get(document, '#osc-greeting-header')[0].classList.add('hidden')
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ class Widget extends EventEmitter {
|
|||
this.widget = options.html
|
||||
this.props = options.props
|
||||
this.errors = {}
|
||||
this.parent = options.root ? widgetManager : options.parent
|
||||
this.parent = options.parent
|
||||
this.parentNode = options.parentNode
|
||||
this.hash = options.hash || nanoid('abcdefghijklmnopqrstuvwxyABCDEFGHIJKLMNOPQRSTUVWXYZ', 10)
|
||||
this.children = []
|
||||
|
|
@ -182,7 +182,7 @@ class Widget extends EventEmitter {
|
|||
|
||||
this.createPropsCache()
|
||||
|
||||
if (this.getProp('id') == 'root' && !options.root) {
|
||||
if (this.getProp('id') == 'root' && this.parent !== widgetManager) {
|
||||
this.cachedProps.id = '_root'
|
||||
this.errors.id = 'There can only be one root'
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue