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

时间:2016-07-11 12:25:25

标签: php tinymce tinymce-4

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

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,

});

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

2 个答案:

答案 0 :(得分:0)

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

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

答案 1 :(得分:-1)

将这些参数添加到其他人

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


  }
 });