From 003056ea503d668c0e2d8f09a29b28edeff82251 Mon Sep 17 00:00:00 2001 From: Sebastien Curt <sebastien.curt@tetras-libre.fr> Date: Sat, 6 Aug 2022 13:58:58 +0200 Subject: [PATCH] Remove display of tags on editpopup if capsule is open in preview mode and the annotation doesn't contain tag --- capsule-prototype/js/PopupPanelWidget.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/capsule-prototype/js/PopupPanelWidget.js b/capsule-prototype/js/PopupPanelWidget.js index eceb3ac..cef0a81 100644 --- a/capsule-prototype/js/PopupPanelWidget.js +++ b/capsule-prototype/js/PopupPanelWidget.js @@ -663,6 +663,12 @@ AnnotationTagPanelEdition.prototype = Object.create(PanelEdition.prototype); AnnotationTagPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) { let that = this; + let _labels = getProjectLabels(this.tag); + let tagLabels = that.tag.getLabels(); + + if (!this.canEdit && (!tagLabels || tagLabels.length === 0)){ + return; + } function getProjectLabels(tag) { return tag.document.getLabels(); } @@ -740,8 +746,7 @@ AnnotationTagPanelEdition.prototype.appendInputEditorDiv = function (parentDiv) .addClass('flex-col popupInput popupInputNoHide') .attr('id', 'popupLabelsInput'); - let _labels = getProjectLabels(this.tag); - let tagLabels = that.tag.getLabels(); + for (let currentLabel of _labels) { if (!this.canEdit && !tagLabels.includes(currentLabel)) continue; -- GitLab