Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/463.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript UniSharp laravel文件管理器与TinyMCE 5的集成_Javascript_Laravel_Tinymce_File Manager - Fatal编程技术网

Javascript UniSharp laravel文件管理器与TinyMCE 5的集成

Javascript UniSharp laravel文件管理器与TinyMCE 5的集成,javascript,laravel,tinymce,file-manager,Javascript,Laravel,Tinymce,File Manager,要将其与TinyMCE 4集成,请参阅中的文档: <script> var editor_config = { /* replace textarea having class .tinymce with tinymce editor */ selector: "textarea.tinymce", path_absolute : "/", relative_urls: false, height: 129, file_browser_callback : f

要将其与TinyMCE 4集成,请参阅中的文档:

<script>
var editor_config = {
  /* replace textarea having class .tinymce with tinymce editor */
  selector: "textarea.tinymce",
  path_absolute : "/",
  relative_urls: false,
  height: 129,
  file_browser_callback : function(field_name, value, type, meta) {
    var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
    var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;

    var cmsURL = editor_config.path_absolute + 'laravel-filemanager?field_name=' + field_name;
    if (type == 'image') {
        cmsURL = cmsURL + "&type=Images";
    } else {
        cmsURL = cmsURL + "&type=Files";
    }

    tinyMCE.activeEditor.windowManager.open({
      file : cmsURL,
      title : 'Gestionnaire de fichiers',
      width : x * 0.8,
      height : y * 0.8,
      resizable : "yes",
      close_previous : "no"
    });
  },




    /* theme of the editor
    theme: "modern",
    skin: "lightgray", */

    /* width and height of the editor */
    width: "100%",
    height: 500,

    /* display statusbar */
    statubar: true,

    /* plugin */
    plugins: [
        "advlist link image autolink autosave link image lists charmap print preview hr anchor pagebreak",
        "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking",
        "save table directionality emoticons template paste"
    ],

    /* toolbar */
    toolbar: " insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | ltr rtl | insertfile media image link | forecolor backcolor | code preview fullscreen",

    /* style */
    style_formats: [
        {title: "Headers", items: [
            {title: "Header 1", format: "h1"},
            {title: "Header 2", format: "h2"},
            {title: "Header 3", format: "h3"},
            {title: "Header 4", format: "h4"},
            {title: "Header 5", format: "h5"},
            {title: "Header 6", format: "h6"}
        ]},
        {title: "Inline", items: [
            {title: "Bold", icon: "bold", format: "bold"},
            {title: "Italic", icon: "italic", format: "italic"},
            {title: "Underline", icon: "underline", format: "underline"},
            {title: "Strikethrough", icon: "strikethrough", format: "strikethrough"},
            {title: "Superscript", icon: "superscript", format: "superscript"},
            {title: "Subscript", icon: "subscript", format: "subscript"},
            {title: "Code", icon: "code", format: "code"}
        ]},
        {title: "Blocks", items: [
            {title: "Paragraph", format: "p"},
            {title: "Blockquote", format: "blockquote"},
            {title: "Div", format: "div"},
            {title: "Pre", format: "pre"}
        ]},
        {title: "Alignment", items: [
            {title: "Left", icon: "alignleft", format: "alignleft"},
            {title: "Center", icon: "aligncenter", format: "aligncenter"},
            {title: "Right", icon: "alignright", format: "alignright"},
            {title: "Justify", icon: "alignjustify", format: "alignjustify"}
        ]}
    ]
};

tinymce.init(editor_config);

</script>

变量编辑器配置={
/*将具有class.tinymce的textarea替换为tinymce编辑器*/
选择器:“textarea.tinymce”,
绝对路径:“/”,
相对URL:false,
身高:129,
文件\浏览器\回调:函数(字段\名称、值、类型、元){
var x=window.innerWidth | | document.documentElement.clientWidth | | | document.getElementsByTagName('body')[0].clientWidth;
var y=window.innerHeight | | | document.documentElement.clientHeight | | | document.getElementsByTagName('body')[0].clientHeight;
var cmsURL=editor_config.path_absolute+'laravel filemanager?field_name='+field_name;
如果(类型=='image'){
cmsURL=cmsURL+“&type=Images”;
}否则{
cmsURL=cmsURL+“&type=Files”;
}
tinyMCE.activeEditor.windowManager.open({
档案:cmsURL,
标题:“fichiers的设计”,
宽度:x*0.8,
高度:y*0.8,
可调整大小:“是”,
关闭上一个:“否”
});
},
/*编辑的主题
主题:“现代”,
皮肤:“浅灰色”*/
/*编辑器的宽度和高度*/
宽度:“100%”,
身高:500,
/*显示状态栏*/
是的,
/*插件*/
插件:[
“advlist链接图像autolink autosave链接图像列表charmap打印预览hr锚定页面中断”,
“searchreplace wordcount visualblocks visualchars代码全屏插入日期时间媒体非中断”,
“保存表格方向性表情模板粘贴”
],
/*工具栏*/
工具栏:“插入文件撤消重做|样式选择|粗体斜体|对齐左对齐中心对齐右对齐对齐对齐对齐|粗体numlist outdent缩进| ltr rtl |插入文件媒体图像链接|前景色背景色|代码预览全屏”,
/*风格*/
样式和格式:[
{标题:“标题”,项目:[
{标题:“标题1”,格式:“h1”},
{标题:“标题2”,格式:“h2”},
{标题:“标题3”,格式:“h3”},
{标题:“标题4”,格式:“h4”},
{标题:“标题5”,格式:“h5”},
{标题:“标题6”,格式:“h6”}
]},
{标题:“内联”,项目:[
{标题:“粗体”,图标:“粗体”,格式:“粗体”},
{标题:“斜体”,图标:“斜体”,格式:“斜体”},
{标题:“下划线”,图标:“下划线”,格式:“下划线”},
{标题:“删除线”,图标:“删除线”,格式:“删除线”},
{标题:“上标”,图标:“上标”,格式:“上标”},
{标题:“下标”,图标:“下标”,格式:“下标”},
{标题:“代码”,图标:“代码”,格式:“代码”}
]},
{标题:“块”,项目:[
{标题:“段落”,格式:“p”},
{标题:“Blockquote”,格式:“Blockquote”},
{标题:“Div”,格式:“Div”},
{标题:“Pre”,格式:“Pre”}
]},
{标题:“对齐”,项目:[
{标题:“左”,图标:“alignleft”,格式:“alignleft”},
{标题:“中心”,图标:“对齐中心”,格式:“对齐中心”},
{标题:“右”,图标:“右对齐”,格式:“右对齐”},
{标题:“对齐”,图标:“对齐对齐对齐”,格式:“对齐对齐对齐”}
]}
]
};
tinymce.init(编辑器配置);
上的文档说明:

<script>
tinymce.init({
  selector: 'textarea',  // change this value according to your HTML
  file_picker_callback: function(callback, value, meta) {
    // Provide file and text for the link dialog
    if (meta.filetype == 'file') {
      callback('mypage.html', {text: 'My text'});
    }

    // Provide image and alt text for the image dialog
    if (meta.filetype == 'image') {
      callback('myimage.jpg', {alt: 'My alt text'});
    }

    // Provide alternative source and posted for the media dialog
    if (meta.filetype == 'media') {
      callback('movie.mp4', {source2: 'alt.ogg', poster: 'image.jpg'});
    }
  }
});
</script>

tinymce.init({
选择器:“textarea”,//根据HTML更改此值
文件选择器回调:函数(回调、值、元){
//为链接对话框提供文件和文本
如果(meta.filetype=='file'){
回调('mypage.html',{text:'mytext'});
}
//为“图像”对话框提供图像和alt文本
if(meta.filetype=='image'){
回调('myimage.jpg',{alt:'myalttext'});
}
//为“媒体”对话框提供替代源和发布
如果(meta.filetype=='media'){
回调('movie.mp4',{source2:'alt.ogg',poster:'image.jpg'});
}
}
});
因此,我的问题是,是否有任何可能的方法使UniSharp laravel文件管理器使用TinyMCE 5
TinyMCE.activeEditor.windowManager.open({file:cmsURL});}不再受支持?

  • 将Tinymce升级到5.0.6+
  • 如果以前没有执行过,请执行以下命令:

    php artisan供应商:发布--tag=lfm\u视图

  • 在“resources/views/vendor/laravel filemanager/index.php”中,替换

    {!!\File::get(基本路径('vendor/unisharp/laravel filemanager/public/js/script.js'))!!

    {!!\File::get(资源路径('assets/vendor/laravel filemanager/script.js'))!!}

  • 将“vendor/unisharp/laravel filemanager/public/js/script.js”复制到 “resources/assets/vendor/laravel filemanager/script.js”

  • 打开“resources/assets/vendor/laravel filemanager/script.js”并 在功能“useTinymce3”后插入以下代码:

    函数useTinymce5(url){
    parent.postMessage({
    mceAction:“插入”,
    内容:网址
    });
    postMessage({mceAction:'close'});
    }
    然后替换:
    if(window.opener | | | | window.tinyMCEPopup | | | | field | | | | getUrlParam('ckeditorcleanupfunnum')| |是ckeditor)

    if('tinymce5'==getUrlParam('editor')){
    使用名称5(url);
    }else if(window.opener | | | window.tinyMCEPopup | | | |字段| | | getUrlParam('CKEditorCleanUpFuncNum')| |是?ckeditor)

  • 配置Tinymce ():

    var编辑器\u配置={
    // ...
    文件选择器回调:函数(回调、值、元){
    设x=window.innerWidth | | document.documentElement.clientWidth | | | document.getElementsByTagName('body')[0].clientWidth;
    设y=window.innerHeight | | | document.documentElement.clientHeight | | | document.getElementsByTagName('body'))[
    
        let type = 'image' === meta.filetype ? 'Images' : 'Files',
            url  = editor_config.path_absolute + 'laravel-filemanager?editor=tinymce5&type=' + type;
    
        tinymce.activeEditor.windowManager.openUrl({
            url : url,
            title : 'Filemanager',
            width : x * 0.8,
            height : y * 0.8,
            onMessage: (api, message) => {
                callback(message.content);
            }
        });
    }