Skip to content
Simple example of using template with arguments passed to server.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images
js/tinymce
templates
index.html
readme.md

readme.md

TinyMCE advanced template example

alt Advanced template editor

Simple example of using template with arguments passed to server.

Original change made in fork to tinymce: https://github.com/Xesenix/tinymce

If you add options parameter to template configuration setup button will appear for that template.

tinymce.init({
	selector: "textarea",
	plugins: ["template"],
	toolbar: "template",
	templates : [
		{
			title: "Template with params",
			url: "templates/ajax.php",
			description: "Template loaded via ajax with some additional arguments.",
			// if this options exist the button will appear
			options: {
				title: { type: 'textbox', label: 'document name', value: 'Passport' },
				name: { type: 'textbox', label: 'name', value: 'whats your name?' },
				age: { type: 'textbox', label: 'age', value: '21' }
			}
		},
		{
			title: "Template without params",
			url: "templates/static.html",
			description: "Just some static content."
		}
	]
});

Options are objects that are passed to:

tinymce.ui.Factory.create(option)

So anything you working with ui factory will work here also options keys are names of arguments passed to url.

You can’t perform that action at this time.