public HtmlEditorControlDamageServices(HtmlEditorControl editorControl, MshtmlEditor mshtmlControl, DamageCommitStrategy commitStrategy)
        {
            _editorControl = editorControl;
            _mshtmlControl = mshtmlControl;
            wordRangeDamager = new WordRangeDamager(editorControl, mshtmlControl);

            _commitStrategy = commitStrategy;
            _commitStrategy.CommitDamage += new EventHandler(damageCommitStrategy_CommitDamage);
        }
 private void UpdateCommitStrategyForCurrentWord()
 {
     //if the current word is misspelled, switch commit to realtime.
     if (ShouldUseRealtimeDamageCommitStrategy())
     {
         CurrentCommitStrategy = _realtimeCommitStrategy;
     }
     else
     {
         CurrentCommitStrategy = _wordBasedCommitStrategy;
     }
 }
 public override void OnKeyPress(HtmlEventArgs e)
 {
     CurrentCommitStrategy.OnKeyPress(e);
     char ch = (char)e.htmlEvt.keyCode;
     if (CurrentCommitStrategy == _realtimeCommitStrategy)
     {
         if (!Char.IsLetterOrDigit(ch) || !ShouldUseRealtimeDamageCommitStrategy())
         {
             //the caret position moved onto a new word, so revoke realtime spelling strategy
             CurrentCommitStrategy = _wordBasedCommitStrategy;
         }
     }
 }