如何在 Tinymce 中添加浏览器文件或图像按钮


How to add browser file or image button in Tinymce

我在php文件中写了下面的代码。我有图像选项,但要上传图像,我需要添加URL

tinyMCE.init({
        // General options
        mode : "exact",
        elements : "descp",
        theme : "advanced",
        plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount",
        // Theme options
        theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
        theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
        theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
        theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak",
        theme_advanced_toolbar_location : "top",
        theme_advanced_toolbar_align : "left",
        theme_advanced_statusbar_location : "bottom",
        theme_advanced_resizing : true,
});

我在执行时没有得到浏览文件选项

您可以使用外部插件将图像/媒体上传到 tinymce。 OpenManager是用于图像/媒体上传的工作插件之一。

试试这个https://github.com/rmorse/Open-Manager

将这些参数与其他参数一起添加

    tinymce.init({
    selector: 'textarea',  // change this value according to your HTML
    file_picker_callback: function(callback, value, meta) {
   // Provide image and alt text for the image dialog
   if (meta.filetype == 'image') {
     callback('myimage.jpg', {alt: 'My alt text'});
   }

  }
 });