jQWidgets Forums

jQuery UI Widgets Forums Editors Editor Fonts drop-down in editor

Tagged: , ,

This topic contains 5 replies, has 2 voices, and was last updated by  silvochka 9 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • Fonts drop-down in editor #76509

    silvochka
    Participant

    Hi

    Could you please help me?

    I would like to add some fonts to font drop-down.
    I call function in createCommand if name is ‘font’.

    If I my function has next code:
    return {
    value: [
    { label: “Calibri”, value: “Calibri, sans-serif” }
    ]
    }

    Then I see in drop-down label ‘Calibri, sans-serif’. Yes, may be my system doesn’t contains this font. But WHY?? I set label = Calibri. Why you show value instead of label?

    if my function return next:
    return {
    init: function (widget) {
    widget.jqxDropDownList({
    source: [
    { label: “Calibri”, value: “Calibri, sans-serif” }
    ]
    });
    }
    }

    then your drop-down not works at all! I select text, select font. Font is applied to test, but when I click to text to determine font, this drop-down show wrong value!

    Could you please help me, how I can work with your font drop-down?

    Thanks,
    Evgenia

    Fonts drop-down in editor #76516

    Vladimir
    Participant

    Hello Evgenia,

    Try adding displayMember and valueMember properties of the dropdownList:

    widget.jqxDropDownList({
        source: [
            { label: "Calibri", value: "Calibri, sans-serif" }
        ],
        displayMember: 'label',
        valueMember: 'value'
    });

    Best Regards,
    Vladimir

    jQWidgets Team
    http://www.jqwidgets.com

    Fonts drop-down in editor #76523

    silvochka
    Participant

    Thank you for quick answer. But it still not work 🙁

    I’ve tried

                return {
                    value:  [
                        { label: "Calibri", value: "Calibri, sans-serif" }
                      ],
                    displayMember: 'label',
                    valueMember: 'value'
                }

    font detection works, but I still see ‘Calibri, sans-serif’ instead of ‘Calibri’.

    When I trying to

                return {
                    init: function (widget) {
                        widget.jqxDropDownList({
                            source: [
                                     { label: "Calibri", value: "Calibri, sans-serif" }
                            ],
                            displayMember: 'label',
                            valueMember: 'value'
                        });
                    }
                }

    then I see good labels (but I see good labels also without displayMember and valueMember), but font detecting doesn’t work. I apply one font, then click on text and in font drop-down see another value.

    Thanks,
    Evgenia

    Fonts drop-down in editor #76529

    Vladimir
    Participant

    Hello Evgenia,

    I am a little bit at a loss on what you want to achieve here.
    What do you mean by font detect and how is that connected to the dropDownList?
    When and how do you perform this detection and what exactly is the expected result?

    Best Regards,
    Vladimir

    jQWidgets Team
    http://www.jqwidgets.com

    Fonts drop-down in editor #76535

    Vladimir
    Participant

    Hello Evgenia,

    I figured out what you are trying to do.
    The detection itself is based on the browser, so the editor requests the browser to identify the font. As an example if you try to add
    { label: 'Helvetica', value: '"Helvetica Neue", Helvetica, Arial, sans-serif'}

    The Helvetica font would be recognized as Arial as it fallsback to Arial.
    Unfortunately there is nothing we can do about it.

    Best Regards,
    Vladimir

    jQWidgets Team
    http://www.jqwidgets.com

    Fonts drop-down in editor #76536

    silvochka
    Participant

    Thanks, I solved this issue by myself.

    Root cause: jqeditor search localization of given label (font name). For ‘Calibri’ it couldn’t find localization label.

    And ‘of course’ set it to ‘undefined’ instead of given value.

    Thanks,
    Evgenia

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.