Click here to Skip to main content
15,881,455 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Below is my code which compares the text entered in two ck editors and display the text in third ckeditor by highlighting the error text.that means i will give some text in ckeditor1 and CKEditorControl1 and when i click button compare i will show the highlighted error text in third ckeditor.But now the requirement is exactly revers to this.I wil give text only in one ck editor that is in ckeditor1 and eliminate some text in that ckeditor1 and click compare button then i should show two ckeditors CKEditorControl1 and CKEditorControl2 with actual text in CKEditorControl1 and error text in CKEditorControl2 how can i do this.I am a begineer and very new to this can anyone help me out


<pre><div>
  
         <CKEditor:CKEditorControl ID="CKEditor1" BasePath="/ckeditor/" runat="server" Width="1108px" Height="143px">
    </CKEditor:CKEditorControl>      

        <br />
        <br />

    </div>

        <div>

    <CKEditor:CKEditorControl ID="CKEditorControl1" BasePath="/ckeditor/" runat="server" Width="1105px" Height="163px"></CKEditor:CKEditorControl>      

            <br />
            <asp:Button ID="btn_compare" runat="server" OnClick="btn_compare_Click" Text="Compare" />
            <br />
            <br />

    </div>

         <div>

    <CKEditor:CKEditorControl ID="CKEditorControl2" BasePath="/ckeditor/" runat="server" Width="1117px" Height="331px"></CKEditor:CKEditorControl>  
    </div>

C#
protected void btn_compare_Click(object sender, EventArgs e)
       {

           string s1 = CKEditor1.Text;

           string f1 = Regex.Replace(s1, @"<[^>]+>|&nbsp|&#39;", "").Trim();

           string s2 = CKEditorControl1.Text;

           string f2 = Regex.Replace(s2, @"<[^>]+>|&nbsp|&#39;", "").Trim();

           diff_match_patch dmp = new diff_match_patch();

          // var diffs = dmp.diff_main(f2, f1, false);

           var diffs = dmp.diff_lineMode(f2, f1);

           dmp.diff_cleanupSemanticLossless(diffs);

           var html = dmp.diff_prettyHtml(diffs);

           CKEditorControl2.Text = html;

       }


What I have tried:

I am very new to how to modify my above code
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900