How to hide custom section for Note style panel

Product: Web viewer

Product Version: 11.7.1

Please give a brief summary of your issue: I want to show Tag drop down only for count annotation.

Please describe your issue and provide steps to reproduce it: I want to show Tag drop down only for count annotation. But now the issue is when user click on the note style panel is show Tag drop down.
Here is my code:

   const observer2 = new MutationObserver(() => {
       const selectedAnnotations = annotationManager.getSelectedAnnotations();
       var icon = selectedAnnotations[0]?.Icon;
       var selectedAnnotId = selectedAnnotations[0]?.Id;
       if (icon === 'Check') {
           const annotationStyleButton = iframeDoc.querySelector('[data-element="annotationStyleEditButton"]');
           if (annotationStyleButton) {
               annotationStyleButton.addEventListener('click', () => {
                   setTimeout(() => { Apryse.AddTagSectionToStylePanel(iframeDoc, selectedAnnotId) }, 300);
               });
           }
       }
   });
   observer2.observe(iframeDoc.body, { childList: true, subtree: true });

    annotationManager.addEventListener('annotationSelected', (annots) => {
        if (annots.length === 1 && annots[0].ToolName.includes('AnnotationCreateCountMeasurement')) {
            Apryse.AddTagSectionToStylePanel(iframeDoc, annots[0].Id);
        }
    });

 AddTagSectionToStylePanel: function (iframeDoc, selectedAnnotId) {
     const stylePanel = iframeDoc.querySelector('[data-element="stylePanel"]');
     if (!stylePanel) return;

     const header = stylePanel.querySelector('[data-element="stylePanelHeaderContainer"] h2');
     if (!header || (header.textContent.trim() !== 'Count measurement Annotation' && header.textContent.trim() !== 'Note Annotation')) return;

     const stylePicker = stylePanel.querySelector('.StylePicker');
     if (!stylePicker) return;

     if (stylePicker.querySelector('[data-element="tagSelector"]')) return;
     const tagSection = document.createElement('div');
     tagSection.setAttribute('data-element', 'stylePanel-tagContainer');
     tagSection.className = 'PanelSection';
     tagSection.innerHTML = `
       <div class="panel-section-wrapper Tag">
         <div class="menu-items">
           <div data-element="tagSelector" class="Dropdown__wrapper">
           <div id="slider-Tag" class="slider-property">Tag</div>
             <div class="Dropdown" role="combobox" aria-haspopup="listbox" aria-expanded="false" tabindex="0">
               <div class="picked-option">
                 <div class="picked-option-text">Select Tag</div>
                 <div class="Icon arrow" aria-hidden="true">
                   <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12">
                     <path fill="#abb0c4" d="M9,3.5l-3,3-3-3-1,1,4,4,4-4Z"></path>
                   </svg>
                 </div>
               </div>
               <div class="Dropdown__items hide" role="listbox"></div>
             </div>
           </div>
         </div>
       </div>
     `;

     stylePicker.appendChild(tagSection);

     const dropdownItemsContainer = tagSection.querySelector('.Dropdown__items');

     caseTags.forEach(tag => {
         if (tag && tag.key && tag.value) {
             const item = document.createElement('div');
             item.className = 'Dropdown__item';
             item.setAttribute('role', 'option');
             item.dataset.value = tag.key;
             item.textContent = tag.value;

             item.addEventListener('click', () => {
                 const picked = tagSection.querySelector('.picked-option-text');
                 picked.textContent = tag.value;
                 tagSection.querySelector('.Dropdown').setAttribute('aria-expanded', 'false');
                 dropdownItemsContainer.classList.add('hide');
                 const selectedTag = {
                     id: tag.key,
                     name: tag.value
                 };
                 Apryse.UpdateDocumentStateModel(selectedAnnotId, tag.value);
             });

             dropdownItemsContainer.appendChild(item);
         }
     });

     const dropdown = tagSection.querySelector('.Dropdown');
     const pickedOption = dropdown.querySelector('.picked-option');

     pickedOption.addEventListener('click', () => {
         const expanded = dropdown.getAttribute('aria-expanded') === 'true';
         dropdown.setAttribute('aria-expanded', expanded ? 'false' : 'true');
         dropdownItemsContainer.classList.toggle('hide', expanded);
     });
 },

Please provide a link to a minimal sample where the issue is reproducible:

Hello, I’m AiRon, an automated tech support bot :robot:
While you wait for one of our customer support representatives, I can help you with your question.


It seems you want to customize the visibility of a tag dropdown in the Note Style Panel, specifically to show it only for count annotations. This involves modifying how the panel’s elements are managed based on annotation types.

Some things you can try:

  • Ensure that your logic for detecting the annotation type is correct. You should check that the ToolName or Icon property accurately distinguishes count annotations from others.

  • Modify the AddTagSectionToStylePanel function to include a check for the annotation type right at its start. This will prevent the tag section from being added if the annotation is not of the desired type.

  • Instead of using timeouts, which can be unreliable, consider using event listeners or promises that trigger when the UI is fully ready.

  • Ensure that the annotationSelected event properly filters annotations to only proceed with count annotations.



Here are some resources that might help you:


Hopefully, this helps you solve your problem while you wait for a human to get back to you.

Hello @rishumishra2001,

Thank you for posting on our forum.

To get a better understanding of your desired workflow, please provide the following:

  1. Demo video reproducing the issue, highlighting expected vs. actual behavior
  2. An exact step-by-step of your desired workflow, along with any screenshots necessary
  3. The use case for this desired workflow
  4. JavaScript console output showing all warnings and errors.

Best Regards,
Jacob Romano Carlsen
Web Development Support Engineer
Apryse Software Inc.