0

I am updating some legacy code to support CKEditor up from FCKEditor, in classic asp. I am not a classic asp designer by trade so I am flying by the seat of my pants here. We previously used Javascriptspellcheck to to the spell checking. The problem I am having relates to this old code:

function doSpellCheck() {
    var oSpell = new JavaScriptSpellCheck();
    oSpell.callBack = function() {
        oEditor.SetHTML($('POST_MESSAGE').value);
    }
    oEditor.UpdateLinkedField();
    oSpell.spellCheckWindow('POST_MESSAGE');
}

oEditor is an instance of FCKEditor defined in a fckeditor_oncomplete() function. The new code I am trying to use is as follows:

    function doSpellCheck() {
    oSpellEditor = CKEDITOR.instances['POST_MESSAGE'].getData();

    var oSpell = new JavaScriptSpellCheck();
    oSpell.callBack = function() {
        CKEDITOR.instances['POST_MESSAGE'].Setdata(oSpellEditor);
    }

    oSpell.spellCheckWindow('POST_MESSAGE');
}

The problem I seem to be facing is that JavaScriptSpellCheck(); needs the textarea id of the ckeditor instance. I attempted to follow the directions in This Post and nemisj's answer but I am having trouble with the code. I am not really understanding the DOM or how to manipulate it in this case. I know that this is not asp, to create the ckeditor instance I am using a custom asp sub to create it, but this is the area that I am having trouble with.

*EDIT: Found the answer. Where I am creating new CKEditor I needed to add text area attributes like so:

Set pageEditorTop = New CKEditor

' Change default textarea attributes
set textareaAttributes = CreateObject("Scripting.Dictionary")
textareaAttributes.Add "id", "POST_MESSAGE"
Set pageEditorTop.textareaAttributes = textareaAttributes
Community
  • 1
  • 1

1 Answers1

0

That code that you are trying to use doesn't make sense.

This is a straight port of the original code to CKEditor:

function doSpellCheck() {
  var oEditor = CKEDITOR.instances['POST_MESSAGE'];
  var oSpell = new JavaScriptSpellCheck();
  oSpell.callBack = function() {
      oEditor.setData($('POST_MESSAGE').value);
  }
  oEditor.updateElement();
  oSpell.spellCheckWindow('POST_MESSAGE');
}
AlfonsoML
  • 12,634
  • 2
  • 46
  • 53