Results 1 to 3 of 3

Thread: Default font of html editor

  1. #1
    Sencha User
    Join Date
    May 2011

    Default Default font of html editor


    my problem is the following:
    I have a htmleditor and i want to make it possible to set a custom default font with a setting in my application. So i am asking me how to do that.
    My approach was to set the defaultFont: "a font value". The result was, that if the htmledtor loads, the correct font of my setting is selected. But when I start writing some text into the editor it is always the same font. But if I select another font of the font combobox manuylly and start writing, the correct font is selected and shown in editor.
    But I don`t want to manually select the font before typing.
    Can anyone help me with this?

    here is my code for htmleditor:

    var myEditor = new Ext.form.HtmlEditor({
            cls: "fixed",
            layout: "fit",
            border: false,
            defaultFont: settings.getDefaultFont(),
            fieldLabel: ""

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    It looks like the fontname is set too early and doesn't do it again when the editor is initialized. Here is how I got it to work:

        var form = new Ext.form.FormPanel({
            renderTo   : Ext.getBody(),
            width      : 600,
            height     : 400,
            title      : 'Test',
            labelAlign : 'top',
            items      : [
                    xtype       : 'htmleditor',
                    fieldLabel  : 'Test',
                    anchor      : '100%',
                    height      : 200,
                    listeners   : {
                        initialize: function(field) {
                            field.relayCmd('fontname', 'courier new');
    Notice the font name passed is actually all lowercase.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

  3. #3
    Sencha User
    Join Date
    May 2011


    I just included your code to my editor and now it works great. Thank you very much!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts