better (but still broken) removal from playgrounds

This commit is contained in:
2022-07-05 14:55:49 +00:00
parent efaf0985d8
commit 3015c74e90
2 changed files with 11 additions and 3 deletions

View File

@@ -328,4 +328,10 @@
(defCommand SwitchPlayground [name (Text null)]
(archive.changePlaygrounds ->:Void [:DynamicAccess<Dynamic> p] (dictSet p "default" name))
(when playgroundSystem (playgroundSystem.switchPlaygroundKey name))))
(when playgroundSystem (playgroundSystem.switchPlaygroundKey name)))
(defCommand RemoveFromPlayground [entries (SelectedEntries 1 null)]
(for e entries
(when (hasComponent e Positions)
(withWritableComponents archive e [positions Positions]
(positions.remove (dictGet archive.playgrounds "default")))) e)))

View File

@@ -5,7 +5,8 @@
(defNew [&prop :ArchiveUI ui
:EntryChecker canProcess
&prop :PlaygroundEntryProcessor processor]
&prop :PlaygroundEntryProcessor processor
:EntryProcessor onRemoveEntry]
(super
->[archive e]
@@ -21,7 +22,8 @@
(return null))))
(whenLet [pos (dictGet (readComponent e Positions) _playgroundKey)]
(processor archive e pos ui))
}))
})
(set this.onRemoveEntry onRemoveEntry))
(method switchPlaygroundKey [key]
(when _playgroundKey