hifarer / vueditor

A wysiwyg editor written in Vue.js and Vuex.js
http://hifarer.github.io/vueditor/
MIT License
645 stars 112 forks source link

Default font #66

Open Yoduh opened 4 years ago

Yoduh commented 4 years ago

Is there any way to set the default font face and size? It seems that Times New Roman is always the default, even if it's not included in the fontName config. For example

fontName: [
    {val: 'arial black'},
    {val: 'Courier New'}
]

I would expect arial black, or whatever font is listed first, to be the default font before the user picks any alternative. Same with font size.

pierreandreline commented 1 year ago

I had the same problem today. Found this solution that worked for me :

    var editeur = createEditor('#saisie', {uploadUrl: '', id: '', classList: ["editeurnote"], fontName: [{val: 'Arial'}]});
    editeur.$store.dispatch('execCommand', {name: 'fontName', value: 'Arial, sans-serif'})
    editeur.$store.dispatch('execCommand', {name: 'fontSize', value: 12})