Preview doesn't have same format/style as Normal when EditCompleteDocument="false"

Last post 01-31-2012, 11:24 AM by qsun. 2 replies.
Sort Posts: Previous Next
  •  01-30-2012, 7:22 PM 72875

    Preview doesn't have same format/style as Normal when EditCompleteDocument="false"

    This happens on CuteEditor.net 6.6.
     
    When I  set EditCompleteDocument ="false" and set my default style to a customized style.  I have following problems:
     
    1) The "HTML" and  "PREVIEW" don't have the custom style.
    2) When I click "HTML" or "PREVIEW" tab then back to "NORMAL" tab, the custom style in "NORMAL" disappeared as well.
     
    I need to hide the default style in the "HTML" tab so that user cannot change it.  Please advice on this issue.
     
    Below is the code: 
     
     
            <CE:Editor ID="editor1" runat="server"  allowpastehtml="true" visible="true" editorbodyclass="CE_Body" usestandarddialog="true" 
    EditCompleteDocument ="false" EnableStripStyleTagsCodeInjection= "false" EnableStripScriptTags="false"
    showcodeviewtoolbar="true" resizemode="None" FullPage="false" >
            </CE:Editor>
    and
    function CuteEditor_OnInitialized(editor)
     {
         var editwin = editor.GetWindow();
         var editdoc = editor.GetDocument();
         editdoc.body.style.cssText="color:blue;font-family:Comic Sans MS;font-size:24px;";
         editdoc.ToggleBorder=false;
     }
     
    Thanks, Qian 
  •  01-31-2012, 6:39 AM 72882 in reply to 72875

    Re: Preview doesn't have same format/style as Normal when EditCompleteDocument="false"

    Hi qsun,
     
    Please try the example below, it will hide the body style setting in html view.
     
    <%@ Page Language="C#" AutoEventWireup="True" %>
    <%@ Register Namespace="CuteEditor" Assembly="CuteEditor" TagPrefix="CE" %>
    <html>
    <body>
        <form id="Form1" runat="server">
            <CE:Editor ID="editor1" runat="server" EditorBodyStyle="color:red">
            </CE:Editor>
            <input type="button" value="get html" onclick="getContent()" />
        </form>
    </body>
    </html>
    <script>
    function getContent()
    {
        var editor1=document.getElementById("<%= editor1.ClientID %>");
         var editwin = editor1.GetWindow();
         var editdoc = editor1.GetDocument();
        alert(editdoc.documentElement.innerHTML);
    }
    </script>
     
    Regards,
     
    Ken 
  •  01-31-2012, 11:24 AM 72887 in reply to 72882

    Re: Preview doesn't have same format/style as Normal when EditCompleteDocument="false"

    It works, Thanks Ken! I have to create EditorBodyStyle dynamically. So can I call EditorBodyStyle instead of set it statically?
     
    Regards, Qian 
View as RSS news feed in XML