Re: CuteEditor methods are not working when making it visible by code.

  •  03-07-2013, 6:22 AM

    Re: CuteEditor methods are not working when making it visible by code.

    Hi Ken,

    I am adding cuteeditor dynamically to the page, How can i assign Intialized event for cute editor in clientside. Is there any way to make cuteeditor intialize rather than waiting for page to load.

     

    In 6.3 version i am not gettign any error in IE10 though its not working for any other browser. For 6.6 version no browser is supporting.

     

    C# code:

      HTMLBox1.ID = "HTMLBox" + Language;
                HTMLBox1.Height = Unit.Pixel(330);
                HTMLBox1.Width = Unit.Pixel(740);
                HTMLBox1.Attributes.Add("Initialized", "CuteEditor_OnInitialized(this);");
                HTMLBox1.ResizeMode = CuteEditor.EditorResizeMode.None;
                HTMLBox1.EnableStripStyleTagsCodeInjection = false;


                HTMLBox1.EnableAntiSpamEmailEncoder = false;
                HTMLBox1.EnableStripIframeTags = false;
                HTMLBox1.EnableStripLinkTagsCodeInjection = false;
                HTMLBox1.EnableStripScriptTags = false;
                //HTMLBox1.AllowPasteHtml = false;
                HTMLBox1.EditorOnPaste = CuteEditor.PasteBehavior.Default;
                HTMLBox1.EditorWysiwygModeCss = "~/includes/styles/editorStyle.css";
                HTMLBox1.EnableContextMenu = false;
                HTMLBox1.ConfigurationPath = "~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/mailwizard.config";


                //HTMLBox1.ActiveTab = CuteEditor.TabType.Edit;
                //HTMLBox1.ShowBottomBar = false;
                HTMLBox1.ShowDecreaseButton = false;
                HTMLBox1.ShowEnlargeButton = false;
                //HTMLBox1.Initialized += new EventHandler(CuteEditor_OnInitialized);
                PvHTML.Controls.Add(HTMLBox1);
     

     JS code:

       var editor1 = $('HTMLBox' + LanguageID + '_ID');
        var editor2 = $('txtPlainText' + LanguageID + '_ID');

     TextResultID = GetTemplateText(TempID, 'PlainText');
            HTMLResultID = GetTemplateText(TempID, 'HTML');
            EmailSubject = GetTemplateText(TempID, 'Subject');


            if (TextResultID != "" && HTMLResultID != "") {
                selindex.selectedIndex = 0;
               setEmailType();// Making containers visible or invisible
            }
            else if (TextResultID != "") {
                selindex.selectedIndex = 1;
                setEmailType();
            }
            else if (HTMLResultID != "") {
                selindex.selectedIndex = 2;
                setEmailType();
            }




        }
       
        
        //    alert(editor1);
        //    alert(editor2);
        getObject('txtSubjectText' + LanguageID).value = EmailSubject;


        if (editor1 != null && HTMLResultID != '') {
            alert(editor1.Visible);
            alert(editor1.IsReady);
            var control = document.getElementById('CE_ctl00_contentMain_HTMLBox0_ID_ToolBar');
            alert(control);
            control.focus();
            try {
                editor1.FocusDocument();// Cute editor still not renedered at this point
                editor1.setHTML(HTMLResultID);
            }
            catch (e) {
                //editor1.AutoConfigure(Minimal);
                editor1.FocusDocument();
                editor1.setHTML(HTMLResultID);
            }
        }
        if (editor2 != null && TextResultID != '') {
            alert(editor2.Visible);
            alert(editor2.IsReady);
            editor2.FocusDocument();
            editor2.setHTML(TextResultID);
        }
    function CuteEditor_OnInitialized(editor) {
        alert('something');
    }
    error:

    Uncaught TypeError: Object #<HTMLTableElement> has no method 'FocusDocument'
     Let me know if you need anymore info.

     

     

    Edit: var control = document.getElementById('CE_ctl00_contentMain_HTMLBox0_ID_ToolBar');
         
            control.style.display = '';

            var control = document.getElementById('CE_ctl00_contentMain_HTMLBox0_ID_CodeViewToolBar');
            control.style.display = '';
            control.focus();
            var control = $('CE_ctl00_contentMain_HTMLBox0_ID_Frame');
            try {

                control.innerHTML = HTMLResultID;
                control.document = HTMLResultID;
            }
     I tried doing this, With this even though i can see the cuteeditor, I still can not see the data i assigned to iframe within.

View Complete Thread