首页 > 解决方案 > 微型 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'))}}

帮助将不胜感激!

标签: javascriptlaraveltinymce

解决方案


解决了

我再次下载tinymce并重新上传js文件,现在加载没有问题。


推荐阅读