TinyMCE 路径,如何指定加载 editor_plugin.js 等内容的位置

发布于 2024-10-07 01:37:59 字数 437 浏览 7 评论 0原文

我安装了 TinyMCE,一切运行良好。然后我使用 Google Closure 将我网站的 JavaScript 与 TinyMCE_src 一起打包

我遇到的问题是 TinyMCE 现在正在调用:

plugins/paste/editor_plugin.js
themes/advanced/editor_template.js
langs/en.js

并且正在使用的路径无效,它们是 404'ing

我如何告诉 TinyMCE 去哪里去获取这些文件吗?

我尝试过:

relative_urls : false,
document_base_url : "http://www.site.com/path1/",

但是它们对上面的文件没有影响。

建议?谢谢

I installed TinyMCE, everything was working great. I then used Google Closure to package my site's JavaScript along with TinyMCE_src

The problem I'm having is that TinyMCE is now making calls to:

plugins/paste/editor_plugin.js
themes/advanced/editor_template.js
langs/en.js

And that paths that are being used are invalid, they are 404'ing

How can I tell TinyMCE where to go to get these files?

I tried:

relative_urls : false,
document_base_url : "http://www.site.com/path1/",

But they have no effect on the files above.

Advise? Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

划一舟意中人 2024-10-14 01:37:59

我遇到了同样的问题,如果我们能够使用 document_base_url 指定基本 url,那么这个问题就可以轻松解决。

或者,我可以在初始化tinymce 之前指定基本url。

tinyMCE.baseURL = "URL_TO/tinymce/jscripts/tiny_mce/";// trailing slash important

tinyMCE.init({
        mode : "textareas",
        theme : "simple"
});

TinyMCE 现在工作正常。

I had the same issue, and it could have been solved easily if we were able to specify the base url using the document_base_url.

Alternatively, I was able to specify the base url before initializing tinymce.

tinyMCE.baseURL = "URL_TO/tinymce/jscripts/tiny_mce/";// trailing slash important

tinyMCE.init({
        mode : "textareas",
        theme : "simple"
});

TinyMCE is working fine now.

仅此而已 2024-10-14 01:37:59

您可以通过在初始化tinyMCE之前放置以下代码来覆盖tinyMCE的基本url。

var tinyMCEPreInit = {
    suffix: '',
    base: '/tinymce/',
    query: ''
};

如果您已经从合并源加载了tinyMCE并且未正确找到基本路径,那么这非常有用。

You can override the base url for tinyMCE by placing the following code before initializing tinyMCE.

var tinyMCEPreInit = {
    suffix: '',
    base: '/tinymce/',
    query: ''
};

This is usefull if you already loaded tinyMCE from a merged source and the base path isn't correctly found.

路还长,别太狂 2024-10-14 01:37:59

根据此: http://www.tinymce.com/wiki.php/Configuration:theme_url< /a>

tinymce.init({
   ...
   theme_url: (document.location.pathname + '/js/tinymce/themes/modern/theme.js').replace("\/\/", "\/"),
   skin_url:  (document.location.pathname + '/js/tinymce/skins/lightgray/').replace("\/\/", "\/"),
   ...

但是,需要小心路径。在 document.location.pathname 的帮助下,我得到了项目根目录。替换函数需要将双斜杠替换为单斜杠,因为不同的服务器可以返回“...//server/site”或“...//server/site/”,它可以是:
“...//服务器/站点/js...”或“...//服务器/站点//js...”。

According this: http://www.tinymce.com/wiki.php/Configuration:theme_url

tinymce.init({
   ...
   theme_url: (document.location.pathname + '/js/tinymce/themes/modern/theme.js').replace("\/\/", "\/"),
   skin_url:  (document.location.pathname + '/js/tinymce/skins/lightgray/').replace("\/\/", "\/"),
   ...

But, need to be carefull with paths. With help document.location.pathname I've got project root directory. Replace function need for replacing double slash with single slash, because different server can return "...//server/site" OR "...//server/site/" and it can be:
"...//server/site/js..." OR "...//server/site//js...".

难如初 2024-10-14 01:37:59

如果您使用 TinyMCE jQuery 插件,则可以从远程位置加载所有内容,只需将 script_url 参数添加到初始化代码中即可。它将从那里加载所有内容,包括任何脚本/图像/等。

$('textarea').tinymce({
    script_url: 'http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/tiny_mce.js'
});

看看这个小提琴,它包括从 TinyMCE 网站远程访问的整个内容: http://jsfiddle.net/xgPzS/ 22/

If you're using the TinyMCE jQuery plugin, you can load everything from a remote location, just add the script_url parameter into your init code. It will load everything from there, including any scripts/images/etc.

$('textarea').tinymce({
    script_url: 'http://tinymce.moxiecode.com/js/tinymce/jscripts/tiny_mce/tiny_mce.js'
});

Check out this fiddle, it's including the whole thing remotely from the TinyMCE website: http://jsfiddle.net/xgPzS/22/

调妓 2024-10-14 01:37:59

根据 TinyMCE 4.x 文档,您可以在 init 期间指定文档基 url。

tinymce.init({
        document_base_url: "http://www.example.com/path1/"
});

如果您使用 CodeIgniter,只需使用 base_url()

tinymce.init({
        document_base_url: "<?php echo base_url() ?>"
});

请记住:relative_url 必须为 true 才能完美工作,否则您将获得绝对 URL 。

欲了解更多详情:
http://www.tinymce.com/wiki.php/Configuration:document_base_url

As per TinyMCE 4.x documentation you can specify the document base url during init.

tinymce.init({
        document_base_url: "http://www.example.com/path1/"
});

if you are using CodeIgniter, simply use base_url()

tinymce.init({
        document_base_url: "<?php echo base_url() ?>"
});

Remember: relative_url must be true in order to work it perfectly otherwise you will get absolute URLS.

For more details:
http://www.tinymce.com/wiki.php/Configuration:document_base_url

南七夏 2024-10-14 01:37:59

使用 grunt 捆绑所有内容(github 上的说明),然后您只需配置从哪里开始使用选项 skin_url 加载所有 css

tinymce.init({skin_url: window.location.origin + '/css/tinymce'})

Bundle everything using grunt (instructions on github) then you will just have to configure from where to load all the css using the option skin_url

tinymce.init({skin_url: window.location.origin + '/css/tinymce'})
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文