A
A
Arseniy Eremeev2018-04-28 18:23:33
JavaScript
Arseniy Eremeev, 2018-04-28 18:23:33

Is it possible to insert the meteor template into the summernote editor?

I have a standard custom button that inserts html code into the editor field:

var HelloButton = function (context) {
        var ui = $.summernote.ui;
        var button = ui.button({
            contents: 'Insert HTML',

            click: function () {
                var node = document.createElement('span');
                node.innerHTML = '{{>myTemplate}}'
                context.invoke('editor.insertNode', node);
                },
            });
        return button.render();  
    }

and the template I want to insert:
<template name="myTemplate">
        <h2>some custom HTML code here</h2>
</template>

Now when the button is clicked, it inserts the string '{{>myTemplate}}' so that the template content is inserted.
Is this possible in principle and, if so, how does it work?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question