diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md index abeb4de7..d76979a9 100644 --- a/resources/docs/docs/user-interface/editor.md +++ b/resources/docs/docs/user-interface/editor.md @@ -43,7 +43,9 @@ Selected widget's properties are displayed and can be modified in the inspector. ## Project tree -The project tree displays the whole widget structure of the session. Widgets can be reordered within a container with drag-and-drop. +The project tree displays the whole widget structure of the session. Widgets can be reordered or moved to another container with drag-and-drop. + +The "Filter" input allows filtering displayed widgets by their `id`. It's also possible to only display a single type of widget by typing `type:fader` for example. ## Widget resizing / dragging diff --git a/src/client/ui/ui-tree.js b/src/client/ui/ui-tree.js index 2cce2c36..4dbb90d2 100644 --- a/src/client/ui/ui-tree.js +++ b/src/client/ui/ui-tree.js @@ -248,7 +248,7 @@ class UiTree extends UiWidget { var selected = selectedWidgets.includes(widget), id = widget.getProp('id'), node = html`
  • + data-widget="${widget.hash}" data-type="${widget.getProp('type')}"> ${raw(icon(widgetIcons[widget.getProp('type')] || 'root'))}${id}
  • ` if (widget instanceof Panel && !(widget instanceof Matrix || widget instanceof Keyboard)) { @@ -277,9 +277,12 @@ class UiTree extends UiWidget { applyFilter() { - var filter = this.filter.value + var filter = this.filter.value.replace(/type\:[^\s]+/, ''), + type = this.filter.value.match(/type\:([^\s]+)/) - if (!filter) { + if (type !== null) type = type[1] + + if (!filter && !type) { this.list.classList.remove('filter-active') } else { this.list.classList.add('filter-active') @@ -287,6 +290,7 @@ class UiTree extends UiWidget { var show = [] DOM.each(this.list, 'li', (element)=>{ var match = element.innerText.includes(filter) + if (type && element.dataset.type !== type) match = false element.classList.toggle('filter-hide', !match) if (match) show.push(element) })