JSFiddle - React, Tailwind, and code Playground

by Ronny

JavaScript

var MsgType = function(type) {
    var types = {
        0: {
            name: "text",
            previewHtml: "<div id='preview-text'></div>",
            previewBg: "transparent",
            onEdit: function(code, $editorCodearea) {
                $editorCodearea.val($(code).children("#preview-text").html());
                $editorCodearea.data("cleditor").updateFrame();
            }
        },
        1: {
            name: "image",
            previewHtml: "<img id='preview-img-msg' src='/Images/AccountsV2/Toolbar/examples/32x32.png' /><div id='preview-text'></div>",
            previewBg: "transparent",
            onEdit: function(code, $editorCodearea) {
                $editorCodearea.val($(code).children("#preview-text").html());
                $editorCodearea.data("cleditor").updateFrame();
            }
        },
        2: {
            name: "html",
            previewHtml: "<iframe id='notification-preview-inner-html-content'></iframe>",
            previewBg: "transparent",
            onEdit: function(code, $codearea) {
                $codearea.val(code);
                $("html-preview").click();
            }
        }
    };
   this=types[type];
};

a=new MsgType(0);
for(var prop in a)
    console.log(prop);