Insert content

This example shows how to insert a piece of template as html where the cursor is.

Click the button and insert content.

Code

<!DOCTYPE html>
<html>
    <head>
        <title>Revolvapp</title>
        <meta charset="utf-8">

        <!-- css -->
        <link rel="stylesheet" href="/your-folder/revolvapp.css" />
    </head>
    <body>
        <!-- button -->
        <button onclick="insertContent()">Insert content</button>

        <!-- element -->
        <div id="myemail"></div>

        <!-- js -->
        <script src="/your-folder/revolvapp.js"></script>

        <!-- call -->
        <script>
        var app = Revolvapp('#myemail', {
            editor: {
                path: '/your-path-to-revolvapp-folder/',
                template: '/your-path-to-template-file.html'
            },
            image: {
                upload: '/my-backend-upload/'
            }
        });

        // call API method
        function insertContent() {
            var code = `<re-block align="center" padding="20px 40px">
            <re-text>
                My text
            </re-text>
        </re-block>`;

            app.editor.insertContent({ html: code });
        }
        </script>
    </body>
</html>