javascript - 微型 mce 编辑器不适用于 https url
问题描述
我有测试网站(开发网站)在 http 上工作,我的编辑器加载没有任何问题,但是由于我将我的应用程序移动到在 https 上运行的主站点,我的编辑器停止加载,我在控制台中收到此错误:
ReferenceError:未定义tinymce
截图
http site
https site
代码
JavaScript
<script>
var editor_config = {
path_absolute : "/",
selector: "textarea.editor", //get class name "editor"
plugins: [
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
"searchreplace wordcount visualblocks visualchars code fullscreen",
"insertdatetime media nonbreaking save table contextmenu directionality",
"emoticons template paste textcolor colorpicker textpattern codesample",
"fullpage toc tinymcespellchecker imagetools help"
],
toolbar: "insertfile undo redo | styleselect | bold italic strikethrough | alignleft aligncenter alignright alignjustify | ltr rtl | bullist numlist outdent indent removeformat formatselect| link image media | emoticons charmap | code codesample | forecolor backcolor",
external_plugins: { "nanospell": "https://www.mysiteurl.com/js/tinymce/plugins/nanospell/plugin.js" },
nanospell_server:"php",
browser_spellcheck: true,
relative_urls: true,
remove_script_host: false,
branding: false,
file_browser_callback : function(field_name, url, type, win) {
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: '<?= route('elfinder.tinymce4') ?>',// use an absolute path!
title: 'File manager',
width: 900,
height: 450,
resizable: 'yes'
}, {
setUrl: function (url) {
win.document.getElementById(field_name).value = url;
}
});
}
};
tinymce.init(editor_config);
</script>
<script>
{!! \File::get(base_path('vendor/barryvdh/laravel-elfinder/resources/assets/js/standalonepopup.js')) !!}
</script>
注意:错误指的是这一行
tinymce.init(editor_config);
Blade
{{Form::textarea('short_description', null, array('class' => 'form-control editor'))}}
帮助将不胜感激!
解决方案
解决了
我再次下载tinymce并重新上传js文件,现在加载没有问题。
推荐阅读
- python - 当我尝试将包含一些 python 代码 testpy.py 的应用程序发布到应用商店时出现此错误
- python - 我在 ML 算法上应用了 W2V。它为 NB 提供了负值的误差,并为所有其他算法提供了 0.48 的准确度。怎么会?
- mobile - 如何使链接始终悬停在移动设备上或悬停在滚动上
- elasticsearch - kibana 按集群聚合 x 轴
- kotlin - 调用递归 lambda 表达式
- netbeans - 如何将netbeans jar文件转换为无需安装JRE即可运行程序的可执行文件?
- html - 如何将使用 jwt 的登录从弹出窗口转移到 html 页面?
- php - 在 Woocommerce 结帐时禁用自动完成字段(自动填充),某些字段除外
- vue.js - 如何显示 svg 到前端的路径?
- vue.js - 如何使用 v-show 切换隐藏 div 中的第二行跨度?