This is a migrated thread and some comments may be shown as answers.

RadSpell sharing Custom Dictionary File suggestions

3 Answers 103 Views
Spell
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 18 May 2011, 05:31 PM
Hi guys,

we have been implementing the RadSpell control within a number of large forms, both from within the RadEditor using the 'abc' spell-check button, and using a client-side 'mass-input' javascript function which combines all the fields on the forms and checks accordingly.

All has been working as expected, with a single tdf master dictionary file and allowing each user to add to a separate custom file with their username as the suffix.

One thing we have noticed though, when a user adds a custom word to their dictionary, it is displayed as a 'suggestion' for anyone else who tries to enter the same word.

I have tried this on your demonstration page of the website, and adding the english "theatre" to en-US-John.txt, when you enter the "theatre" and check using en-US-Sally.txt, although the word had not been added, it is still a suggestion.

If you wish to test, this also happens with other words we have used locally, and yet to add to the demo site ("colour", "analyse" etc)

Is this by design, or is it an issue with the spell-engine caching data? The concern arises by the fact that users could add incorrectly spelt words to their custom file, which would then be shown as a suggestion to all other users and could multiply any mistakes.

Look forward to hearing back about any resolution.

Mike

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 20 May 2011, 02:05 PM
Hi Michael,

The reported behavior occurs in the demo, because there are two instances of RadSpell on the page and when the first one is launched the added misspelled word to the dictionary is cached and used by the second spellchecker.

If you have a single spellchecker on the page which is configured according to the currently logged user, you should not experience this behavior.

Best regards,
Rumen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Michael
Top achievements
Rank 1
answered on 23 May 2011, 10:28 AM
Hi Rumen,

Can you please inform me if I am missing a step with this. I have copied my code and believed this would be all required to get the expected behaviour


ASPX markup
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
     <script type="text/javascript">
          function spellCheck() {
               //Build a list of IDs 
               var sources   = new Array();       
                            
               //for the rad editors        
               var radEditorList = $('.RadEditor');   
   
               for (var i = 0; i < (radEditorList.length) ; i++)
               {
                    var editorSource = $find(radEditorList[i].id).get_contentAreaElement().contentWindow.document.body;
                    Array.add(sources,new Telerik.Web.UI.Spell.HtmlElementTextSource(editorSource));             
               }
   
               var spell = $find('<%= RadSpell1.ClientID %>');
               spell.set_textSource(new MultipleTextSource(sources));
               spell.startSpellCheck();
          }
  
          function onClicking(sender, eventArgs) {
               var item = eventArgs.get_item();
                  
               var sAction  = item.get_text();
               if (sAction=="Spell Check"){
                    spellCheck();
                    eventArgs.set_cancel(true);
               }
        }
     </script>
</telerik:RadCodeBlock>
 
 
<telerik:RadSpell ID="RadSpell1" runat="server" ButtonType="None" AllowAddCustom="true" />
  
<cc1:customControlName id="dummyControl" runat="server">
  
<telerik:RadMenu ID="RadMenu2" runat="server" OnClientItemClicking="onClicking">
    <Items>
        <telerik:RadMenuItem runat="server" Text="Tools">
            <Items>
                <telerik:RadMenuItem runat="server" Text="Spell Check">
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadMenuItem>
    </Items>
</telerik:RadMenu>


ASPX code behind
// _userID - dynamic id based on session once user has logged in
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     ...
     If Not Page.IsPostBack Then
          RadSpell1.CustomDictionarySuffix = "-" & _userID
     End If
     ...
End Sub


ASCX dummy page - markup
<telerik:RadEditor AutoResizeHeight="True" ToolbarMode="PageTop" ID="RadEditor1" runat="server" EditModes="Design">
    <Content>
    </Content>
</telerik:RadEditor>


ASCX dummy page - code behind
// _userID - dynamic id based on session once user has logged in
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
     If Not Page.IsPostBack Then
          ...
          RadEditor1.SpellCheckSettings.CustomDictionarySuffix = "-" & _userID
          ...
     End If
End Sub


Cheers
Mike
0
Rumen
Telerik team
answered on 25 May 2011, 02:58 PM
Hello Michael,

I tried to run the provided markup and code but to no avail, because the page throwed an error that MultipleTextSource is undefined. The problem could be due to that there are two instances of RadSpell again on the page, because RadEditor has its own reference to RadSpell.

When I performed my test before providing my earlier reply, I just removed the second spellchecker from the Different Custom Dictionaries live demo, spell-checked the content in the textarea with the Default(John's) spellchecker and added a new word to the custom dictionary of the John's user. After that I removed the first spellchecker and added the second one. After spell-checked the content of the textarea with the second spellchecker, I verified that the second spellchecker does not use the words saved in the custom dictionary of the first spellchecker (Default(John's)).

Kind regards,
Rumen
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Spell
Asked by
Michael
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Michael
Top achievements
Rank 1
Share this question
or