将HTML模板插入tinymce 4编辑器 [英] Inserting HTML template into tinymce 4 editor

查看:384
本文介绍了将HTML模板插入tinymce 4编辑器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一侧有一个HTML模板.另一方面,我有TinyMce Editor 4+版本.我创造了一个HTMl页面,其中包含我将要使用的每个模板的按钮(名称为使用模板").

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.

基本上,我希望用户单击相应的模板按钮,并且应该插入HTML模板插入tinyMCE编辑器.

Basically, I want a user to click a corresponding template button and that should Insert the HTML template into the tinyMCE editor.

任何人都可以给我一些想法,我应该如何开始这样做?我发现大多数人都在搜寻在线了解如何从不需要的"TinyMce"编辑器的内置选项中插入HTML模板.

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.

请提供您的输入.

更多说明

我有一个HTML页面(例如PAGE1),其中有几个名为"USE TEMPLATE"的按钮.因此,基本上,当用户单击使用模板"按钮时,应该将他定向到下一页(例如PAGE2).第2页包含一个电子邮件编辑器,即TinyMCE.用户单击按钮所对应的模板必须插入TinyMCE编辑器中.我想知道在这种情况下应该如何进行?

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?

请不要将其与tinyMce的INSERT-> INSERT TEMPLATE OPTION混淆.我知道该怎么做.

Please don't confuse this with the INSERT --> INSERT TEMPLATE OPTION of the tinyMce. I know how to do this.

推荐答案

如果我没记错,请确保您的tinymce具有/tinymce/plugins/template:

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
    ]
});

阅读: https://www.tinymce.com/docs/plugins/template/

这篇关于将HTML模板插入tinymce 4编辑器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆