繁体   English   中英

加载 Tinymce 时,无法在 Tinymce 编辑器中自动加载模板

[英]Unable to auto load a template in Tinymce Editor when Tinymce loads

如果我必须从工具栏中的模板图标插入自定义模板,它在我的 TinyMce 编辑器中工作正常。 但是如何在 TinyMce 加载时直接自动加载自定义模板

            templates: [
            { title: 'Test22', description: 'A cure for writers block', content: 'Once upon a time...' }
            ],
            template : 'Test22', // this line does not load the template on Tinymce onload

没有事件/API 可以在页面加载时插入模板。 您可以使用setContent() API 在编辑器首次加载时加载内容。

你可以在你的 TinyMCE 配置中加入这样的东西:

setup: function (editor) {
    editor.on('init', function (e) {
       // You can load whatever content you want - this is just a hardcoded example...
       editor.setContent('<p>This is the content in TinyMCE!</p>');
    });
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM