Skip to main content
Participating Frequently
January 3, 2008
Question

Some spacing dropped w/ Highlight enabled

  • January 3, 2008
  • 14 replies
  • 2012 views
Wondering if anyone else has encountered this. I'm seeing it in output from RH HTML 7. Note: I do not generate Help with a skin.

1. Generate WebHelp w/ any preferred format (I usually use DHTML > Java Applet > Pure HTML).
2. Select Search tab in Help and search for any string with 'Highlight search results' check box selected.
3. View a topic that contains search hits. Spaces are missing around some (not all) hyperlinked or formatted (e.g., bolded) text in the topic.

The only 'fix' for this I can find is to insert hard spaces in the HTML around all hyperlinked and formatted text. Surely there must be a better way....

Thanks in advance for any ideas.
This topic has been closed for replies.

14 replies

Known Participant
June 5, 2008
Thank You!
Peter Grainge
Community Expert
Community Expert
June 5, 2008
You can download a replacement file from my site.

http://www.grainge.org/pages/authoring/rh7/using_rh7.htm

See item 32.

Use the menu (bottom right) to mark the Best Answer or Highlight particularly useful replies. Found the answer elsewhere? Share it here.
Known Participant
June 4, 2008
We're experiencing the same problem.
1. First, we generate WebHelp with the Highlight Search Result option enabled.
2. Perform a Search.
3. Click on a topic.
Look for the highlighted word. The word after the highlighted word will have a missing space. This occurs only if the highlighted word is formatted (italicized or bolded)
3. Go to the TOC and click on a different topic.
4. Click on the same topic (as in Step 3).
Notice that the highlight is removed (since we are not performing a search) and the missing space is back.
We are able to reproduce this with every project, with or without a skin and in IE (not in Firefox. That's a first!)
Participating Frequently
June 5, 2008
This is a bug and we missed fixing it in 7.0.2 patch. I am pasting the fix below, you will have to modify the file "C:\Program Files\Adobe\Adobe RoboHelp 8\RoboHTML\WebHelp5Ext\template_stock\whtopic.js" manually if you wish you take up the fix.

Look for funciton
this.doHighlight = function( a_aRanges, a_nStart )

and replace the entire function body with

this.doHighlight = function( a_aRanges, a_nStart )
{
s_strHlStart = "<font style='color:" + gsTextColor + "; background-color:" + gsBkgndColor + "'>";
s_strHlEnd = "</font>";

if ( a_nStart >= a_aRanges.length )
return a_nStart;

var nEnd = this.getClosedRanges( a_aRanges, a_nStart );
if ( this.aClosedRanges.length == 0 )
return nEnd;
var strText = this.node.data;
var strHTML = "";
var nLastStart = 0;
for ( var i = 0; i < this.aClosedRanges.length; i++ )
{
strHTML += strText.substring( nLastStart, this.aClosedRanges .nStart - this.nFrom );
strHTML += s_strHlStart;
strHTML += strText.substring( this.aClosedRanges
.nStart - this.nFrom,
this.aClosedRanges .nEnd - this.nFrom );
strHTML += s_strHlEnd;

nLastStart = this.aClosedRanges
.nEnd - this.nFrom;
}
strHTML += strText.substr( nLastStart );

var spanElement = document.createElement( "span" );
spanElement.innerHTML = strHTML;
if (gbIE4)
{
//for IE, when assigning string to innerHTML, leading whitespaces are dropped
if ((strHTML.length >0)&&(strHTML.charAt(0) == " "))
spanElement.innerHTML = " " + spanElement.innerHTML ;
}
this.node.parentNode.replaceChild( spanElement, this.node );
if(gnYPos == -1)
{
var elemObj = spanElement;
var curtop = 0;
if (elemObj.offsetParent)
{
while (elemObj.offsetParent)
{
curtop += elemObj.offsetTop
elemObj = elemObj.offsetParent;
}
}
else if (elemObj.y)
curtop += elemObj.y;

gnYPos = curtop;
}
return nEnd;
};

Notice that only following 6 new lines have been added in the modificaiton

if (gbIE4)
{
//for IE, when assigning string to innerHTML, leading whitespaces are dropped
if ((strHTML.length >0)&&(strHTML.charAt(0) == " "))
spanElement.innerHTML = " " + spanElement.innerHTML ;
}

thanks
Vivek
RoboHelp Team.
Adobe Systems.
MergeThis
Inspiring
January 3, 2008
If "Spaces are missing around some (not all) hyperlinked or formatted (e.g., bolded) text in the topic," it's probably because those spaces are included, or not, within the SPAN tags that determine the formatting.


Good luck,
Leon