[QUESTION] How to change the default font family in the Editor?
sigmapie8 opened this issue · 6 comments
I want to remove the font-family drop down and set one default font. How can I do that?
To set the default font I think you can do:
HtmlEditor(
callbacks: Callbacks(
onInit: () {
controller.execCommand('fontName', argument: "font_name_here");
}
)
)
Your font name has to be inserted in the exact same way it would be in HTML, for example sans-serif
or Times New Roman
.
I haven't tested this but I think it should work, and you can use defaultToolbarButtons
to remove the font dropdown. If it doesn't work please post the code you tried and I will try to make a working solution tomorrow. Thanks!
Hope this helped you, let me know if you have further questions.
Thanks for bringing to my attention, that was a mistake on my part. Fixing right now :)
I try to set fontName like you, but I can't change the default font family in the editor. (I don't use defaultToolbarButtons.)
@tneotia
To set the default font I think you can do:
HtmlEditor( callbacks: Callbacks( onInit: () { controller.execCommand('fontName', argument: "font_name_here"); } ) )Your font name has to be inserted in the exact same way it would be in HTML, for example
sans-serif
orTimes New Roman
.I haven't tested this but I think it should work, and you can use
defaultToolbarButtons
to remove the font dropdown. If it doesn't work please post the code you tried and I will try to make a working solution tomorrow. Thanks!
I try to set fontName like you, but I can't change the default font family in the editor. (I don't use defaultToolbarButtons.) @tneotia
To set the default font I think you can do:
HtmlEditor( callbacks: Callbacks( onInit: () { controller.execCommand('fontName', argument: "font_name_here"); } ) )Your font name has to be inserted in the exact same way it would be in HTML, for example
sans-serif
orTimes New Roman
.
I haven't tested this but I think it should work, and you can usedefaultToolbarButtons
to remove the font dropdown. If it doesn't work please post the code you tried and I will try to make a working solution tomorrow. Thanks!
sama for me