Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ckeditor: Add a new event that is triggered when the template is clicked. #283

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions plugins/templates/dialogs/templates.js
Expand Up @@ -51,12 +51,18 @@
item.getFirst().setHtml( html );

item.on( 'click', function() {
hookTemplate( template );
insertTemplate( template.html );
} );

return item;
}

// Add an event that provides the whole template with all of its properties.
function hookTemplate( template ) {
editor.fire('clickTemplate', { templateData: template });
}

// Insert the specified template content into editor.
// @param {Number} index
function insertTemplate( html ) {
Expand Down