diff --git a/src/mixins/Visibility.js b/src/mixins/Visibility.js index 450079a184..8ed4ac417d 100644 --- a/src/mixins/Visibility.js +++ b/src/mixins/Visibility.js @@ -55,6 +55,10 @@ const VisibilityMixin = types 'no-region-selected': () => !self.annotation.highlightedNode, 'choice-unselected': params => !fns['choice-selected'](params), + 'tag-selected': ({ tagName }) => { + const tag = self.annotation.names.get(tagName); + return tag.isSelected; + }, }; if (Object.keys(fns).includes(self.visiblewhen)) { diff --git a/src/tags/visual/View.js b/src/tags/visual/View.js index 52cbd32c6e..90c2b13087 100644 --- a/src/tags/visual/View.js +++ b/src/tags/visual/View.js @@ -28,8 +28,8 @@ import { AnnotationMixin } from '../../mixins/AnnotationMixin'; * @param {block|inline} display * @param {string} [style] CSS style string * @param {string} [className] - Class name of the CSS style to apply. Use with the Style tag - * @param {region-selected|choice-selected|no-region-selected|choice-unselected} [visibleWhen] Control visibility of the content. Can also be used with `when*` attributes below to narrow down visibility - * @param {string} [whenTagName] Use with visibleWhen. Narrow down visibility by tag name. For regions, use the name of the object tag, for choices, use the name of the choices tag + * @param {region-selected|choice-selected|no-region-selected|choice-unselected|tag-selected} [visibleWhen] Control visibility of the content. Can also be used with `when*` attributes below to narrow down visibility + * @param {string} [whenTagName] Use with visibleWhen. Narrow down visibility by tag name. For regions, use the name of the object tag, for choices, use the name of the choices tag, for tag use the name of the tag * @param {string} [whenLabelValue] Use with visibleWhen="region-selected". Narrow down visibility by label value * @param {string} [whenChoiceValue] Use with visibleWhen ("choice-selected" or "choice-unselected") and whenTagName, both are required. Narrow down visibility by choice value */