Knowledgebase Home Page  >  RapidSpell Web ASP.NET  >  Troubleshooting
Search the Knowledge Base
When pasting from MS Word into RapidSpellInlineTextBox in Firefox words sometimes run together
https://keyoti.com/kb/Default.aspx?ToDo=view&questId=166&catId=58

Options

Print this page
Email this to a friend

This issue only affects people pasting text from Word into FireFox.

 

Because of the incompatibility between FireFox and Word, when you paste text from Word into an editable IFRAME, FireFox is using a newline character (\n) where the text wraps from one line to the next.

 

E.g.

If your text was ‘here is a long enough sentence for word wrapping’ and FireFox needed to wrap it at ‘for’ it would put the text in the text editor as

 

here is a long enough sentence\n for word wrapping’

 

So the space between ‘sentence’ and ‘for’ became \n.

 

Because there are times when you may get a \n in a text box but it shouldn’t be a space, we can’t automatically convert \n to a space. Another issue is that FireFox has no ability to paste from the clipboard (unless you make client specific configuration changes) and no paste events (so we don't know when something has been pasted).

 

Solutions


1. Using CTRL-SHIFT-V to paste will make FireFox paste without interpreting the formatting, this will prevent the problem.

 

2. Otherwise as a solution to this we suggest adding a button to your page, that when clicked cleans up Word content in FireFox.

 

(Note: This will only work when not using as you type spelling)

 

1.           Add this to your header

 

  <script>

  function cleanWord(textBox){

   var dirtyContent = textBox._getTBS().getContent();

   //content has leading and trailing \n\n, clean first

   var doubleNLExp = new RegExp("\n\n", "g");

   dirtyContent = dirtyContent.replace(doubleNLExp, "");

   //line wraps come out as \n, so convert to space

   var singleNLExp = new RegExp("\n", "g");

   dirtyContent = dirtyContent.replace(singleNLExp, " ");

 

   textBox._getTBS().setContent(dirtyContent);

  }

  </script>

 

2. Add this button (and Javascript to hide the button if the browser isn't Firefox)

 

  <input type=button id="cleanBT" onclick="cleanWord(<%=

RapidSpellWInlineTextBox1.ClientSideObject %>)" value="Clean Word" />

   <script>

    if(navigator.userAgent.indexOf("Mozilla")==-1){

     document.getElementById("cleanBT").style.display = "none";

    }

   </script>

 

 

Change RapidSpellWInlineTextBox1 in the code above to the ID of your RapidSpellWInlineTextBox.

 

The user should click this button after pasting from Word, and before the spell check.


Related Questions:

Attachments:

No attachments were found.