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

[Solved] copy content updates another control

1 Answer 68 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Grayson Mitchell
Top achievements
Rank 1
Grayson Mitchell asked on 14 Jul 2009, 03:58 AM
Hello,

I have two issues I would like to handle within the editor (I have done these in win form applications, but am new to web development)

1\ Any change in the main editor I want to make a coresponding change to a copy of the editor (with a few exeptions)
I want to have a second editor on my page with a slightly different view from my main editor window (Similar to the Silverlight editor example).

2\ I want to insert "chunks" that can't be edited, and if any of the 'chunk' is deleted, the whole text is deleted.  (I did this in a Richtextbox with the onchange event)





1 Answer, 1 is accepted

Sort by
0
Grayson Mitchell
Top achievements
Rank 1
answered on 14 Jul 2009, 11:41 PM
I have got a solution to problem 1\ through lots of reading of the forums.  The code snippit below makes two editor controls look like one (allowing the preview to be different).

       
 
        function OnClientLoad(editor, args) { 
 
            editor.add_modeChange(function(sender, args) { 
                var mode = sender.get_mode(); 
                var main = document.getElementById("RadEditor1"); 
                var print = document.getElementById("RadEditor2"); 
 
                if ((mode == 1) && ($find("RadEditor1").get_mode() != 1)) { //Editor 
                    print.style.display = 'none'
                    main.style.display = ''
                    $find("RadEditor1").setSize("790""560"); 
                    $find("RadEditor1").set_mode(1); 
                } 
                else if ((mode == 4) && ($find("RadEditor2").get_mode() != 4)) { //Preview 
                    main.style.display = 'none'
                    print.style.display = ''
                    $find("RadEditor2").set_mode(4); 
                    $find("RadEditor2").setSize("790""560"); 
                    var mainHtml = $find("RadEditor1").get_html(); 
                    mainHtml = mainHtml.replace(/###Address###/g, "Some Address"); 
                    mainHtml = mainHtml.replace(/###Name###/g, "A name"); 
                    $find("RadEditor2").set_html(mainHtml); 
                } 
 
 
            }); 
 
        } 

Tags
Editor
Asked by
Grayson Mitchell
Top achievements
Rank 1
Answers by
Grayson Mitchell
Top achievements
Rank 1
Share this question
or