问题
I have a HTML templates on one side. On the other hand, I have TinyMce Editor 4+ version. I have created a HTMl page with buttons(with name "Use Template") for each of the template I will be using.
Basically, I want a user to click a corresponding template button and that should Insert the HTML template into the tinyMCE editor.
Could anyone give me some ideas how should I start doing this ? I found most of the people are searching online for how to insert HTML templates from the inbuilt option of "TinyMce" editor which I don't want.
Please provide your inputs.
MORE CLARIFICATIONS
I have a HTML page (say PAGE1) with several buttons named "USE TEMPLATE". So, basically, when a user clicks on "Use Template" button, he should be directed to next page(say PAGE2). Page 2 contains an email editor namely TinyMCE. The corresponding template for which the user has clicked the button must be inserted into the TinyMCE editor. I would like to know how should I proceed in this case?
Please don't confuse this with the INSERT --> INSERT TEMPLATE OPTION of the tinyMce. I know how to do this.
回答1:
If I am not wrong, make sure you tinymce has /tinymce/plugins/template:
tinymce.init({
plugins: "xx,xxx,xxx,....,template",//<-- please add template as a plugin, also make sure you have [template] plugin in your tinymce/plugins
templates: [
{title: 'Some title 2', description: 'Some desc 2', url: 'development.html'} //remember put full path to url, and also the url can be a server side script file, such as: my_template.php?t=1
]
});
Reading: https://www.tinymce.com/docs/plugins/template/
来源:https://stackoverflow.com/questions/20647629/inserting-html-template-into-tinymce-4-editor