mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 15:37:46 +03:00
Inform pane containers directly when adding non-moved pane items
This commit is contained in:
parent
ae8d26a8fe
commit
317428b58d
@ -306,22 +306,16 @@ class PaneContainer {
|
|||||||
const iterable = pane.getItems()
|
const iterable = pane.getItems()
|
||||||
for (let index = 0; index < iterable.length; index++) {
|
for (let index = 0; index < iterable.length; index++) {
|
||||||
const item = iterable[index]
|
const item = iterable[index]
|
||||||
this.addedPaneItem(item, pane, index)
|
this.didAddPaneItem(item, pane, index)
|
||||||
}
|
}
|
||||||
|
|
||||||
pane.onDidAddItem(({item, index, moved}) => {
|
|
||||||
if (!moved) { this.addedPaneItem(item, pane, index) }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
pane.onDidRemoveItem(({item, moved}) => {
|
pane.onDidRemoveItem(({item, moved}) => {
|
||||||
if (!moved) { this.removedPaneItem(item) }
|
if (!moved) { this.removedPaneItem(item) }
|
||||||
}
|
})
|
||||||
)
|
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
addedPaneItem (item, pane, index) {
|
didAddPaneItem (item, pane, index) {
|
||||||
this.itemRegistry.addItem(item)
|
this.itemRegistry.addItem(item)
|
||||||
this.emitter.emit('did-add-pane-item', {item, pane, index})
|
this.emitter.emit('did-add-pane-item', {item, pane, index})
|
||||||
}
|
}
|
||||||
|
@ -500,6 +500,8 @@ class Pane
|
|||||||
@setPendingItem(item) if pending
|
@setPendingItem(item) if pending
|
||||||
|
|
||||||
@emitter.emit 'did-add-item', {item, index, moved}
|
@emitter.emit 'did-add-item', {item, index, moved}
|
||||||
|
@container?.didAddPaneItem(item, this, index) unless moved
|
||||||
|
|
||||||
@destroyItem(lastPendingItem) if replacingPendingItem
|
@destroyItem(lastPendingItem) if replacingPendingItem
|
||||||
@setActiveItem(item) unless @getActiveItem()?
|
@setActiveItem(item) unless @getActiveItem()?
|
||||||
item
|
item
|
||||||
|
Loading…
Reference in New Issue
Block a user