加载 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
没有 event/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>');
});
}
如果我必须从工具栏中的模板图标插入自定义模板,那么自定义模板在我的 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
没有 event/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>');
});
}