javascript - CKEDITOR.addTemplates() 的完整语法是什么?

标签 javascript plugins ckeditor

我找不到任何关于此的文档。 我可以以某种方式在我的模板插件中创建多组模板(例如,首先选择一个模板,然后为所选模板选择配色方案)? 现在在/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/

相关文章:

eclipse - 由于缺少类而无法调试 Eclipse 应用程序

php - 保护 PHP 中的变量不被窃取

grails - 在 liferay 6 上部署 grails portlet 时出错

javascript - CKEditor React 图像调整大小插件

Django ckeditor 上传图片链接在几个小时后过期

javascript - 在 DOM 集合上使用 `querySelectorAll` 的子选择器

javascript - 在 Ember.js 中访问父路由模型

javascript - 每次保存文档时,换行符和段落都会增加一倍 ckeditor 在每次保存后添加额外的空格段落和换行符

javascript - 正则表达式匹配连续的大括号

javascript - Angular 子组件无法识别输入更改