Set default text or html when CuteEditor is first loaded

Last post 06-20-2010, 11:57 PM by Kenneth. 3 replies.
Sort Posts: Previous Next
  •  06-16-2010, 9:16 PM 61830

    Set default text or html when CuteEditor is first loaded

    Hi,
     
    I am using CuteEditor within DotNetNuke 5.4.2 and am wonder if it possible to set some initial default text or html to be loaded into the Rich Text Editor on first load.
     
    I would like to force  <p></p> to be in the html of the editor when it is first loaded. The reason I am doing this is because I am finding my users often do not press enter before starting to type (which is required for CuteEditor to start breaking up paragraphs with <p> tags), it just puts in <br /> tags.
     
    The result is...
     
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. <br />
    Sed gravida erat eget turpis posuere a feugiat ante mollis. <br />
    Aenean condimentum velit tincidunt urna porttitor pellentesque. <br />


    ...When the desired (and more semantic html) I am after is...
     
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. </p>
    <p>Sed gravida erat eget turpis posuere a feugiat ante mollis.</p>
    <p>Aenean condimentum velit tincidunt urna porttitor pellentesque.</p>
     
    Any help on setting the default text to be in the Rich Text Editor on first load would be very much appreicated
     
    Kind Regards
     
    TJ
     
     
     
  •  06-16-2010, 10:34 PM 61832 in reply to 61830

    Re: Set default text or html when CuteEditor is first loaded

    Hi mediaworks,
     
    Try set BreakElement="p" of the editor setting in web.config.
     
    With Cute Editor, you can defines what happens when the "enter" key is pressed in the editor in the BreakElement enumeration.This enumeration has three values: Div, Br and P.
     
    Regards,
     
    ken
  •  06-20-2010, 6:03 PM 61881 in reply to 61832

    Re: Set default text or html when CuteEditor is first loaded

    Hi Ken
     
    Thank you for your reply. We have already done this and unfortunately it does not work for P tags properly.
     
    When one of our content editors starts writing in an empty CuteEditor instance the editor only puts in <br /> tags not <p> tags.
     
    This does not happen if the editor presses "Enter" first then starts typing, in this case
     
    However, despite our many attempts to get these users to press Enter first, they do not.
     
    So the solution I suggested in my first post was to have an initial  base <p> tag when the editor is initialised. Is there any way to do this?
    (FCKEditor has this option,but we'd prefer to use CuteEditor)
     
    Thank you 
    T.J.
     
  •  06-20-2010, 11:57 PM 61886 in reply to 61881

    Re: Set default text or html when CuteEditor is first loaded

    Hi mediaworks,
     
    1. Open project "Provider.sln"(\Providers\HtmlEditorProviders\CEHtmlEditorProvider\Provider.sln)
     
    2. Find section below
    1. Protected Sub cntlCE_Load(ByVal sender As ObjectByVal e As EventArgs) Handles cntlCE.Load   
    2.            Try  
    3.                AddDNNLinks()   
    4.            Catch ex As Exception   
    5.                Throw New Exception("Check your provider configuration for errors!" & Environment.NewLine & ex.Message)   
    6.            End Try  
    7.        End Sub  
    3. Change to
    1. Protected Sub cntlCE_Load(ByVal sender As ObjectByVal e As EventArgs) Handles cntlCE.Load   
    2.          Try  
    3.              AddDNNLinks()   
    4.   
    5.              If cntlCE.Text = "" Then  
    6.                  'here is the text you want to show in editor by default   
    7.                  cntlCE.Text = "<p>this is a test</p>"  
    8.              End If  
    9.          Catch ex As Exception   
    10.              Throw New Exception("Check your provider configuration for errors!" & Environment.NewLine & ex.Message)   
    11.          End Try  
    12.      End Sub  
    4. Bulid the project and use "DotNetNuke.CEHtmlEditorProvider.dll" to replace the old file in bin folder of your dnn site.
     
    Note: CuteEditor does not support empty <p></p> target, so i use<p>this is a test</p> in the above code.
     
    Note: project "Provider.sln" maybe needs some dll files. You can find them in bin foder of your dnn site.
     
    Regards,
     
    ken
View as RSS news feed in XML