Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-36611

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

    XMLWordPrintable

Details

    • 1
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      NOTE: This suggestion is for Confluence Cloud. Using Confluence Server? 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:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: