1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > 控制富文本中图片宽高_tinyMCE富文本编辑器如何设置默认的图片宽度

控制富文本中图片宽高_tinyMCE富文本编辑器如何设置默认的图片宽度

时间:2021-11-21 11:54:30

相关推荐

控制富文本中图片宽高_tinyMCE富文本编辑器如何设置默认的图片宽度

大佬们 我想在用户上传图片后给编辑器里的图片设置一个默认宽度 这该在哪里进行设置啊

以下是我现在的tinyMCE初始化设置

tinymce.init({

selector: '#' + this.elementId,

height: 400,

plugins: ['link', 'table', 'image'],

skin_url: 'assets/skins/lightgray',

// image_dimensions: false,

init_instance_callback : function(editor) {

setTimeout(function(){

console.log(self.model);

if (self.model.content === undefined) {

editor.setContent("");

} else {

editor.setContent(self.model.content);

}

},1000)

},

setup: editor => {

editor.on('keyup change', () => {

const content = editor.getContent();

self.model.content = editor.getContent()

});

},

// 图片上传功能

images_upload_handler: function(blobInfo, success, failure) {

var formData;

formData = new FormData();

formData.append("file", blobInfo.blob(), blobInfo.filename());

self.uploadFile(`${environment.host}/admin.php/brand/common/upload`, formData).subscribe( response => {

var str = JSON.stringify(response);

var selfimgurl = JSON.parse(str)

console.log(selfimgurl)

success(selfimgurl.link);

});

}

});

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。