Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    RichTextEditor Set Default Font

    Is there a way to set the default font and font size in the RickTextEditor?

    #2
    There are two possibilities here:

    You can specify a css style to apply to the edit area of the RichTextEditor.

    For example if you had this CSS class definition in your HTML file:

    Code:
    <style>
        .rteStyle {
            font-family:Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
            font-size: 20pt;
            color: blue;
        }
    </style>
    you could use the "editAreaProperties" attribute to apply it to the editArea auto-child of the RTE:
    Code:
            isc.RichTextEditor.create({
                editAreaProperties:{
                    styleName:"rteStyle"
                },
                ... // other properties
            });
    This would cause the styling to be applied to the edit area by default, but it wouldn't be present in the generated HTML when you call 'getValue()' on the RTE.
    To copy that HTML to a new component and apply the same styling you'd have to also set the same styleName on that new component.

    Alternatively, when populating the RTE with an HTML value, you could just specify css styling inline and it will be displayed *and* picked up as part of the value

    Code:
      var HTML = "<span style='font-family:Impact'>Some crazy text</span>";
      myRichTextEditor.setValue(HTML);

    Comment


      #3
      Perfect, thank you!

      Comment

      Working...
      X