使用经典ASP在CKEditor 3中添加自定义模板

时间:2012-10-05 07:11:28

标签: asp-classic ckeditor

我有一个网站,它使用经典的ASP渲染CKEditor 3的设置。

在服务器端,我有:

 <%
 Dim Editor

 Set Editor = New CKEditor
 Editor.basePath = "/ckeditor/"
 Editor.Config("contentsCss") = "/Styles/Editor.css"
 Editor.Config("templates_files") = "/templates/news.js"
 Editor.Config("width") = 570;
 Editor.editor "Html", Html
 Set Editor = Nothing
 %>

在news.js中我有:

CKEDITOR.addTemplates('news',
{
   imagesPath: CKEDITOR.getUrl('/JavaScripts/ckeditor_3.6.3/templates/images/'),
   templates:
    [
        {
        title: 'News Template',
        //image: 'template1.gif',
        html:
            '<h3>Template 2</h3>' +
            '<p>Type your text here.</p>'
    }
    ]
});

它呈现:

<script type="text/javascript" src="/ckeditor/ckeditor.js?t=C3HA5RM"></script> 
<script type="text/javascript">//<![CDATA[ 
    CKEDITOR.replace('Html', {"contentsCss": "\u002FStyles\u002FEditor.css","templates_files": "\u002Ftemplates\u002Fnews.js","width": 570}); 
//]]></script> 

好像它需要提供的路径(/ templates)...并且每个字母都有一个404 ....即/ t / e / m ......

可能缺少什么?

1 个答案:

答案 0 :(得分:1)

根据documentation,templates_files应该是一个字符串数组,即使你只使用一个文件,所以正确的配置是

Editor.Config("templates_files") = Array("/templates/news.js")