This project is read-only.
1
Vote

Templates for editor

description

Feature
The new ckeditor has an integrated templatesystem. The html template is located in userfiles/editortemplates/mytemplates.js. It should be possible to manage the mytemplates.js with the CMS.

Possible solution:
If a new item pagetyp = "Template" is created, overwrite mytemplates.js.__

Technical:
Create a new public function in App_code
Delete all existing templates from the file userfiles/editortemplates/mytemplates.js
Select all items from database with pagetyp = "Template"
Insert all items into mytemplates.js
db.item.titel = template.title
db.item.metadescription = template.description
db.item.content = template.html

Example content of mytemplates.js
// Register a template definition set named "default".
CKEDITOR.addTemplates('default',

{
    // The name of the subfolder that contains the preview images of the templates.
    imagesPath: CKEDITOR.getUrl(CKEDITOR.plugins.getPath('templates') + 'templates/images/'),

    // Template definitions.
templates:
        [
            {
                title: 'My Template 1',
                description: 'Description of My Template 1.',
                html:
                    '<h2>Template 1</h2>' +
                    '<p><img src="/logo.png" style="float:left" />Type your text here.</p>'
            },
            {
                title: 'My Template 2',
                html:
                    '<h3>Template 2</h3>' +
                    '<p>Type your text here.</p>'
            }
 ]
});

comments

didush72 wrote May 16, 2014 at 5:56 AM

didush72 wrote May 16, 2014 at 5:57 AM

wrote Nov 28 at 3:21 AM