wangEditor initializes line height, font and font size

wangEditor set the font size to 16px, the font to Microsoft Yahei, and the line height to 1.5

const editor = createEditor({
    
    
    selector: '#editor-container',
    html: '<p></p>',
    content: [
        {
    
    
            type: 'paragraph',
            children: [
                {
    
     text: '', fontFamily: '微软雅黑', fontSize: '16px'}
            ],
            lineHeight: 1.5
        },
    ],
    config: editorConfig,
    mode: 'default', // or 'simple'
})

wangEditor configuration complete code

const {
    
     createEditor, createToolbar } = window.wangEditor

const editorConfig = {
    
    
    placeholder: '请输入正文...',
    onChange(editor) {
    
    
        const html = editor.getHtml()
        //console.log(html)
        _v_this.dataFrom.infor_content = html
        // 也可以同步到 <textarea>
    }
}
const editor = createEditor({
    
    
    selector: '#editor-container',
    html: '<p></p>',
    content: [
        {
    
    
            type: 'paragraph',
            children: [
                {
    
     text: '', fontFamily: '微软雅黑', fontSize: '16px'}
            ],
            lineHeight: 1.5
        },
    ],
    config: editorConfig,
    mode: 'default', // or 'simple'
})
const toolbarConfig = {
    
    }
const toolbar = createToolbar({
    
    
    editor,
    selector: '#toolbar-container',
    config: toolbarConfig,
    mode: 'default', // or 'simple'
})

Guess you like

Origin blog.csdn.net/weixin_42597632/article/details/129378313