CMSms TinyMCE HTML Templates für WYSIWYG Editor

Looks like kindof a dead thread, but I just went through the process of figuring out how this works, so I’ll share my findings for anyone who wants to use the template plugin in TinyMCE.

The trick is to place the configuration code in the „Extra configuration“ box in the advanced tab in the TinyMCE config page.

I put this in as a test:
Code:

template_templates : [
{
title : "simple snippet",
src : "tinytemplates/snippet.html",
description : "add a test snippet"
}
],
template_replace_values : {
test : "TEST CONTENT"
}

And snippet.html:
Code:
<p class=“test“>This is a simple <strong>snippet</strong>. Will be replaced: {$test}.</p>

The path to the template is relative to the web root. There is a suggestion above that you could use Template Externalizer to manage the template, and that would work, but these templates become static once inserted into the content–i.e. you won’t be able to change all instances of the template by editing the source template.

This plugin is really just a way to insert complex snippets and give you some variables that will be applied at the time it’s inserted. You could, (and I haven’t figured this out yet) have a pop-up come in that asked for specific content, then when the snippet was inserted, that content would be placed in the snippet. For instance, if you wanted to add a caption to an image, this plugin would allow you to select the image, type in the caption, and then it would do the job of wrapping the caption and image together.

Gefunden im CMSms Forum: https://forum.cmsmadesimple.org/viewtopic.php?t=12138

Schreibe einen Kommentar

This site uses Akismet to reduce spam. Learn how your comment data is processed.