本文介绍了TinyMCE的装载郎/插件/不正确的目录主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有TinyMCE的麻烦。当搜索的郎,主题和插件,它应该在基本的脚本文件所在的目录看。然而,代替这样做,则使用当前加载的页为根用于搜索。我在看在src文件中的loadScripts功能,但改变路径似乎并没有提供任何有意义的影响。

下面是您的评论未修改loadScripts功能:

  //加载脚本
        功能loadScripts(){
            如果(s.language)
                sl.add(tinymce.baseURL +'/ LANGS /+ s.language +'.js文件');            如果(s.theme&放大器;&放大器; s.theme.charAt(0)=' - '和;!&放大器; ThemeManager.urls [s.theme])
                ThemeManager.load(s.theme,'主题/+ s.theme +'/ editor_template'+ tinymce.suffix +'.js文件');            每个(爆炸(s.plugins),功能(P){
                如果(P&放大器;&放大器; p.charAt(0)=' - '和;!&放大器; PluginManager.urls [P]){
                    //跳过其他浏览器Safari浏览器插件
                    如果(isWebKit&安培;!&安培; p =='狩猎')
                        返回;                    PluginManager.load(对,插件/'+ P +'/ editor_plugin'+ tinymce.suffix +的.js');
                }
            });            //初始化时,阙是装
            sl.loadQueue(函数(){
                如果(!t.removed)
                    t.init();
            });
        };        loadScripts();
    }


解决方案

我/我有一个单页应用程序我工作的这个相同的问题。该JS加载JS为TinyMCE的是在其他目录,这是给我你在谈论同样的问题。

有一对夫妇的事情,我在这里学到,可以帮助你。

  window.tinyMCE preINIT = {
      后缀:_1,
      基地:'/静态/ JS /插件/ tiny_mce',//你的路径在TinyMCE
      查询:'东西'
  };

在'基地'的说法是至关重要的,如果你正在运行到这些问题。

此外,我用的jQuery插件。但是,如果您手动包括了jQuery插件和TinyMCE的,那么jQuery插件的script_src似乎被忽略。这是一些未知的原因也很重要。

最后,在我的情况,我使用后缀为我们缓存无效化的一部分。当我们做一个构建,所有的JS和CSS文件的文件扩展名之前的哈希说。不幸的是,我认为,TinyMCE的开发者考虑为后缀设置有不同的想法,因此lang和模板css文件不服从它,造成404。速战速决郎是设置语言参数en_1',其中'_1是cacehbuster后缀。最后,我不得不手动编辑的主题文件,包括tinymce.suffix ARG。

希望这可以帮助你。我花了6个小时到达了这一点。

I am having trouble with TinyMCE. When it is searching for the lang, theme, and plugins, it is supposed to look in the directory where the base script files are located. however, instead of doing that, it is using the current loaded page as the root for searching. I am looking at the "loadScripts" function in the src file, but changing the path doesn't seem to provide any meaningful effect.

Here is the unmodified loadScripts function for your review:

// Load scripts
        function loadScripts() {
            if (s.language)
                sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');

            if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
                ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');

            each(explode(s.plugins), function(p) {
                if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {
                    // Skip safari plugin for other browsers
                    if (!isWebKit && p == 'safari')
                        return;

                    PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
                }
            });

            // Init when que is loaded
            sl.loadQueue(function() {
                if (!t.removed)
                    t.init();
            });
        };

        loadScripts();
    }
解决方案

I was/am having this same issue with a "single page" application I am working on. The JS to load the JS for tinymce is in a some other directory, and this was giving me the same issue you were talking about.

There are a couple things I learned here that might help you.

  window.tinyMCEPreInit = {
      suffix : '_1',
      base : '/static/js/plugins/tiny_mce', // your path to tinyMCE
      query : 'something'
  };

The 'base' argument is crucial if you are running into these issues.

Additionally, I was using the jquery plugin. However, if you manually include both the jquery plugin AND the tinymce, then the jquery plugin's script_src appears to be ignored. This is important too for some unknown reason.

Finally, in my case, I use the suffix as part of our cachebusting. When we do a build, all JS and CSS files have a hash added before the file extension. Unfortunately, I think the tinymce developers had a different idea in mind for the suffix setting and as such the lang and template css files do not obey it, resulting in 404s. The quick fix for lang was to set the language argument to 'en_1' where '_1" is the cacehbuster suffix. Finally, I had to manually edit the theme files to include the tinymce.suffix arg.

Hopefully that helps you. It took me 6 hours to get to this point.

这篇关于TinyMCE的装载郎/插件/不正确的目录主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-30 08:30