Inserting HTML template into tinymce 4 editor [closed]

不羁岁月 提交于 2019-12-24 04:15:06

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!