Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-36611

Highlight actions uses $('.wiki-content').first() which makes it incompatible with custom themes

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Won't Do
    • None
    • None
    • 1
    • We collect Confluence feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      NOTE: This suggestion is for Confluence Server. Using Confluence Cloud? See the corresponding suggestion.

      From the highlight-panel.js file:

      // Usable area for the plugin. #main-content was another candidate, but does not appear on all pages
      // We only support on main content
      var $wikiContent = $('.wiki-content').first();
      

      Using an id like the developer mentioned would be a much more solid solution. We had a similar issue with the new inline comment functionality: https://jira.atlassian.com/browse/CONF-35750

      They changed it to use $('#content .wiki-content').first() instead. Which is working for us. They also mentioned that they would talk to the core team about adding IDs to the main wiki-content area so every one can select on ids instead.

      To make our theme(RefinedWiki) compatible with the highlight function we've added the following code:

      // FIX: .wiki-content:first is hardcoded in the confluence-highlight-actions projects
      // We need to change $root to the correct wiki-content area.
      var originalComputeSearchTextObject = Confluence.HighlightAction.RangeHelper.computeSearchTextObject;
      		
      Confluence.HighlightAction.RangeHelper.computeSearchTextObject = function ($root, selected)
                  {
      		        // Check if the $root container is one of out custom sections
      		        // If yes, get the correct $mainContent object
      		        if ($root.hasClass('rw_custom_section') || $root.parent().hasClass('rw_custom_section'))
      		            return originalComputeSearchTextObject($mainContent, selected);
      		        else 
      		            return originalComputeSearchTextObject($root, selected);
                  }
      

      Cheers,
      Emil

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              899018603b05 Emil Sjödin [Refined]
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: