小小的MCE编辑器不适用于https url

时间:2019-01-02 06:32:32

标签: javascript laravel tinymce

我有测试网站(开发站点)可以在http上运行,并且编辑器加载没有任何问题,但是由于我将应用程序移至可以在https上运行的主站点,所以编辑器停止了加载,并且在控制台中收到此错误:

  

ReferenceError:未定义tinymce

屏幕截图

http site

one

https site

two

代码

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

我们将不胜感激!

1 个答案:

答案 0 :(得分:0)

已解决

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