wangEditor 初始化设置行高、字体和字体大小

wangEditor 设置字体大小16px、字体微软雅黑、行高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 配置完整代码

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'
})

猜你喜欢

转载自blog.csdn.net/weixin_42597632/article/details/129378313
今日推荐