小程序富文本插入图片默认居中 uniapp editor

插入图片后使用

this.editorCtx.format(\'align\', \'center\')

注:是在插入图片成功后(不是在插入图片的回调中设置,如果在这里使用的话会报错的,因为这里使用的对象是img标签,我们做的是要在img标签外的p标签)

比如:

this.editorCtx.insertImage({
    #Todo...
})
this.editorCtx.format(\'align\', \'center\')//这里其实就是设置格式