我正试图在旅行者中为Tinymce添加一个插件,但是我一直无法从url http://domain/admin/plugins/template/plugin.js net::ERR_ABORTED 404 (未找到)获得加载插件:模板。
我尝试过将插件文件夹放置在公共或供应商tcg公用文件夹中,但是没有任何效果。我也尝试从外部加载插件,仍然没有运气。
有人能帮忙吗谢谢。
function tinymce_init_callback(editor) {
console.log('Init!');
editor.remove();
editor = null;
tinymce.init({
menubar: false,
selector: 'textarea.richTextBox',
skin_url: $('meta[name="assets-path"]').attr('content')+'?path=js/skins/voyager',
min_height: 600,
resize: 'vertical',
plugins: 'link, image, code, table, textcolor, lists, template',
extended_valid_elements : 'input[id|name|value|type|class|style|required|placeholder|autocomplete|onclick]',
file_browser_callback: function(field_name, url, type, win) {
if(type =='image'){
$('#upload_file').trigger('click');
}
},
toolbar: 'styleselect bold italic underline | forecolor backcolor | alignleft aligncenter alignright | bullist numlist outdent indent | link image table | code',
convert_urls: false,
image_caption: true,
image_title: true,
// external_plugins: {
// 'link': '/tinymce/plugins/link/plugin.js',
// 'image': '/tinymce/plugins/image/plugin.js',
// 'code': '/tinymce/plugins/code/plugin.js',
// 'table': '/tinymce/plugins/table/plugin.js',
// 'textcolor': '/tinymce/plugins/textcolor/plugin.js',
// 'lists': '/tinymce/plugins/lists/plugin.js',
// 'template': '/tinymce/plugins/template/plugin.js',
// }
});
}发布于 2022-06-28 19:10:26
我也尝试过,我的解决方案是:
添加到您的composer.json
"tinymce/tinymce": "4.9.11"因为旅行者1.5配备了这个版本的tinymce。
在您的终端中运行composer update以在/vendor中安装此版本
将/供应商/tinymce/tinymce目录复制到/public/js/tinymce
这是我在custom.js中的回调函数,它是从航海家文件中提取的
function tinymce_init_callback(editor) {
editor.remove();
editor = null;
tinymce.init({
menubar: false,
selector: 'textarea.richTextBox',
skin_url: $('meta[name="assets-path"]').attr('content') + '?path=js/skins/voyager',
min_height: 100,
height: 500,
resize: 'vertical',
inline_styles: false,
keep_styles: false,
font_formats: 'Open Sans, sans-serif',
plugins: 'link, image, code, table, textcolor, lists',
file_browser_callback: function (field_name, url, type, win) {
if (type == 'image') {
$('#upload_file').trigger('click');
}
},
toolbar: 'styleselect bold italic underline | forecolor backcolor | alignleft aligncenter alignright | bullist numlist outdent indent | anchor link image table | print | emoticons | code',
convert_urls: false,
image_caption: true,
image_title: true,
valid_elements: 'div[*],p[*],span[*],ul[*],li[*],ol[*],hr,br,img[*],i[*],em,table[*],tr[*],td[*],th[*],sup[*],sub[*],strong[*],b,h1[*],h2[*],h3[*],h4[*],h5[*],h6[*],small[*],a[*], svg,path',
valid_children: '+li[p]',
external_plugins: {
'anchor': '/js/tinymce/plugins/anchor/plugin.min.js',
'print': '/js/tinymce/plugins/print/plugin.min.js',
'preview': '/js/tinymce/plugins/preview/plugin.min.js',
'emoticons': '/js/tinymce/plugins/emoticons/plugin.min.js',
}
});注意外部插件路径前面的"/js“。插件是加载和工作。
检查/public/js/tinymce/plugins,查看随此版本提供的可用插件。
https://stackoverflow.com/questions/69655186
复制相似问题