Selecting default class for the editor

Last post 03-14-2005, 8:16 PM by Bunce. 6 replies.
Sort Posts: Previous Next
  •  03-02-2005, 11:24 PM 4370

    Selecting default class for the editor

    I'm using DNN3.0.11 and therefore the EditorWysiwygModeCss property. The styles are parsed correctly and are displayed in the Class dropdownlist.  I only want the users to use these classes so have removed other toolbars, such as 'Font-Name' and 'Paragraph' etc.

    All is fine when users apply styles to the selected text, however the editor is not relfecting the 'Normal' style which should be applied by default.  It works fine when the page is viewed outside the editor.

    Is there a way to tell the editor to user this (normal) style by default?  I'm thinking perhaps there's a conflict with the 'Normal' paragraph style and the 'Normal' CSS style?

  •  03-03-2005, 1:07 AM 4371 in reply to 4370

    Re: Selecting default class for the editor

    OK, after doing some tests it seems the editor gets its display settings by default from the BODY class element.

    Is there any way to tell the editor to get its default style from somewhere else?

    I guess what I'm trying to accomplish is for the editor to display what will be shown on the page.  If a user explicitly applies no styles then it will pick up the default (containing) style - which in DNN is NORMAL.  Is there a way for the editor to work out the default containing style?

  •  03-03-2005, 12:49 PM 4378 in reply to 4371

    Re: Selecting default class for the editor

    Bunce,
     
    I think we can work it out.
     
    In the CEHtmlEditorProvider.vb file, you can find the following code:
     

    CEHtmlEditorProvider

    Dim s1, s2, s3, s4 As String

    s1 = Common.Globals.HostPath & "default.css"

    s2 = PortalSettings.ActiveTab.SkinPath & "skin.css"

    s3 = (PortalSettings.ActiveTab.SkinSrc).Substring(0, PortalSettings.ActiveTab.SkinSrc.LastIndexOf("/")) & "/skin.css"

    s4 = PortalSettings.HomeDirectory & "portal.css"

    'initialize the control

    cntlCE.EditorWysiwygModeCss = s1 & "," & s2 & "," & s3 & ", " & s4

     

    With the above code, we tell the editor using multiple Style Sheets the for the editable area.

    Solution 1: 

        Find  the location of containing style sheet, and append it to EditorWysiwygModeCss property:

        EditorWysiwygModeCss = s1 & "," & s2 & "," & s3 & ", " & s4 & ", yourscontaining.css"

    Solution 2: 
        
        Create a new style sheet and paste the style sheet you want to use in the editable area, and append the new style sheet to EditorWysiwygModeCss property:

        EditorWysiwygModeCss = s1 & "," & s2 & "," & s3 & ", " & s4 & ", mystyles.css"

    Hope it helps.

    Keep me posted.

     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-03-2005, 5:02 PM 4384 in reply to 4378

    Re: Selecting default class for the editor

    Hi Adam - thanks for your reply.

     

    The 'normal' class that I'd like the editor to use is actually already in one of the existing stylesheets, so I'm not sure how adding a new one will help.

     

    The 'normal' class is parsed correctly and shows up in the dropdown list - so thats not a problem.

     

    The issue is that if users don't explicity set a class using the drop-down list then the editor defaults its display to use the 'BODY' class defined in the stylesheets, whereas I'd like it to default to use the 'Normal' class, as this is what will be displayed in the final output when users don't explicity set any styles on text in the editor..

    As an example, typing this in now - where is it picking up this style from?  It looks as if it matched up with the 'Normal' paragraph style. Where would you over-ride this if you wanted it to match up with say the 'Notification' css class by default?
     
     
  •  03-04-2005, 4:10 PM 4397 in reply to 4370

    Re: Selecting default class for the editor

    Adam,
     
      I tried to do what you outlined but it did not function as expected.  I set multiple CSS files separated by a comma and it the editor itself had the properties in it - but nothing was in the class dropdown.
     
    Also - can you provide someway of disabling the "body" tag is css files that are set to the editor - or make the body tag only applicable to the first CSS file assigned?  I want my users to be able to select the styles in my global sheet - but not have the editor window show the solid color for the page.
     
    regards,
    Dave
  •  03-14-2005, 7:33 PM 4631 in reply to 4384

    Re: Selecting default class for the editor

    Bunce,
     
    What you want to achieve:
     
    When the editor loads, you want the text in the editor pick the style from the "normal" class instead of the default normal paragraph style. Is that correct?

    Try create separate css file:

    body, td
    {
       /* copy the content from your normal csss here */
        font:normal 11px verdana;
    }

    EditorWysiwygModeCss = s1 & "," & s2 & "," & s3 & ", " & s4 & ",mystyles.css"
    Hope it helps.
     
    Please note that the editor doesn't have the ability to automatically apply class whenever the user type.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-14-2005, 8:16 PM 4632 in reply to 4631

    Re: Selecting default class for the editor

    Cool - thanks Adam, I think this workaround will keep the boss happy!

    Cheers,
    A

View as RSS news feed in XML