dom: don't polyfill Node forEach, use safer method; editor: fix select/unselect bug with tabs
This commit is contained in:
parent
16d9a66f63
commit
3bf08fd5f0
5 changed files with 8 additions and 22 deletions
|
|
@ -71,7 +71,9 @@ module.exports = {
|
|||
|
||||
var nodes = module.exports.get(context, selector)
|
||||
|
||||
nodes.forEach(callback)
|
||||
for (let i = nodes.length - 1; i !== -1; i--) {
|
||||
callback(nodes[i], i)
|
||||
}
|
||||
|
||||
return nodes
|
||||
|
||||
|
|
|
|||
|
|
@ -331,8 +331,6 @@ var Editor = class Editor {
|
|||
|
||||
select(widget, options={}){
|
||||
|
||||
if (!options.fromLasso) this.unselect()
|
||||
|
||||
if (Array.isArray(widget)) {
|
||||
|
||||
this.selectedWidgets = widget
|
||||
|
|
@ -362,13 +360,15 @@ var Editor = class Editor {
|
|||
|
||||
} else {
|
||||
|
||||
if (!options.refresh && (widget.container.classList.contains('editing'))) return
|
||||
if (widget.container.classList.contains('editing')) return
|
||||
|
||||
this.selectedWidgets = [widget]
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!options.fromLasso) this.unselect()
|
||||
|
||||
if (this.selectedWidgets.length > 0 && !options.fromLasso) {
|
||||
|
||||
this.createEditForm()
|
||||
|
|
@ -442,10 +442,6 @@ var Editor = class Editor {
|
|||
|
||||
createSelectionBlock(){
|
||||
|
||||
DOM.each(document, '.editing', (element)=>{
|
||||
element.classList.remove('editing')
|
||||
})
|
||||
|
||||
for (let widget of this.selectedWidgets) {
|
||||
DOM.each(document, `[data-widget="${widget.hash}"]`, (item)=>{
|
||||
item.classList.add('editing')
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
if (!NodeList.prototype.forEach) {
|
||||
|
||||
NodeList.prototype.forEach = Array.prototype.forEach
|
||||
|
||||
}
|
||||
|
||||
if (!HTMLCollection.prototype.forEach) {
|
||||
|
||||
HTMLCollection.prototype.forEach = Array.prototype.forEach
|
||||
|
||||
}
|
||||
|
|
@ -206,7 +206,7 @@ function sidepanelOpen() {
|
|||
|
||||
sidepaneLock = true
|
||||
|
||||
DOM.get('#open-toggle, #sidepanel').forEach((el)=>{
|
||||
DOM.each(document, '#open-toggle, #sidepanel', (el)=>{
|
||||
el.classList.add('sidepanel-open')
|
||||
})
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ function sidepanelClose() {
|
|||
|
||||
if (sidepaneLock) return
|
||||
|
||||
DOM.get('#open-toggle, #sidepanel, #container').forEach((el)=>{
|
||||
DOM.each(document, '#open-toggle, #sidepanel, #container', (el)=>{
|
||||
el.classList.remove('sidepanel-open')
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
require('./app/stacktrace')
|
||||
require('./app/polyfills')
|
||||
require('./app/globals')
|
||||
|
||||
var {loading} = require('./app/ui/utils'),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue