0
我想在CKEditor中加载一些自定义模板,但我无法设法使其工作。CKEditor中的自定义模板
这是处理自定义模板的config.js的一部分:我创建了CKEditor的文件夹的根目录内的文件夹/mytemplates
,把default.js
的mytemplates.js
(精确复制
config.templates = 'default';
config.templates_files = [ '/mytemplates/mytemplates.js' ];
config.templates_replaceContent = false;
内容模板插件附带的文件),但编辑器似乎没有加载它们。我收到以下错误:
Uncaught TypeError: Cannot read property 'imagesPath' of undefined
imagesPath = definition.imagesPath,
行的/plugins/templates/dialogs/templates.js
文件。
任何想法?
在此先感谢
路径模板文件,您使用的是相对的,可能不适用于当前的CKEditor目录,'CKEDITOR.getUrl()'是一个不错的办法。要从CKEditor目录之外加载文件,您可以使用完整的URL(例如'http://yourdomain.com /.../ mytemplates.js')或适当的相对URL(如果文件是正确加载)。 – f1ames
感谢您的洞察! – user1991185