我找不到任何关于此的文档。 我可以以某种方式在我的模板插件中创建多组模板(例如,首先选择一个模板,然后为所选模板选择配色方案)? 现在在/templates/templates/default.js 中我有一些东西^
CKEDITOR.addTemplates("default",{imagesPath:CKEDITOR.getUrl(CKEDITOR.plugins.getPath("templates")+"templates/images/"),templates:[ /* list of my custom templates */ ]});
第一个“default”
是什么意思?
最佳答案
似乎没有针对 CKEditor 4 的“addTemplates”方法的文档,但有针对 CKEditor 3 的文档。我不确定您当前使用的是哪个版本的 CKEditor?
以下是 CKEditor 3 文档的片段:
// Register a template definition set named "default".
CKEDITOR.addTemplates( 'default',
{
// The name of the subfolder that contains the preview images of the templates.
imagesPath : CKEDITOR.getUrl( CKEDITOR.plugins.getPath( 'templates' ) + 'templates/images/' ),
// Template definitions.
templates :
[
{
title: 'My Template 1',
image: 'template1.gif',
description: 'Description of My Template 1.',
html:
'<h2>Template 1</h2>' +
'<p><img src="/logo.png" style="float:left" />Type your text here.</p>'
},
{
title: 'My Template 2',
html:
'<h3>Template 2</h3>' +
'<p>Type your text here.</p>'
}
]
});
完整文档: https://docs.cksource.com/CKEditor_3.x/Developers_Guide/Templates
关于javascript - CKEDITOR.addTemplates() 的完整语法是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42227501/