百度编辑器精简版

曹え 5811 发布于:2019-08-12 22:29:40

只有一个图片上传

<script id="ue3" type="text/plain" style="width:100%;height:300px;"> <img src="<?php echo $img; ?>" /> </script>

	  var ue3 = UE.getEditor('ue3',{

	      toolbars: [[

	          

	          'simpleupload'

	      ]],

	  autoHeightEnabled: true,

	  autoFloatEnabled: true

	});


上传多个图片并遍历出来


var ue2 = UE.getEditor('ue2',{
        toolbars: [[
           // 'fullscreen', 'source', '|', 
             'insertimage'
        ]],
    autoHeightEnabled: false,
    autoFloatEnabled: false,
    elementPathEnabled:false,
    wordCount:false
  }); 

 ue2.addListener( 'contentChange', function( editor ) {
	  var html = ue2.getContent();
	  $('#pic').val(html);
	  $('#imglist').html(html);
	  $('#imglist p').each(function(index, el) {
	  	img = $(this).find('img').attr('src');
	  	if(img) $(this).append('<input type="text" value="'+ img +'">');
	  });
 })


 ue.addListener("simpleuploadbtnready", _beforeInsertImage);

 function _beforeInsertImage(t,result){
    console.log(result);
 }


  ue.addListener( 'contentChange', function( editor ) {
	  var html = ue.getContent();
	  $('#body').val(html);
 })


觉得有用请点个赞吧!
0 499