tinymce获取html内容并使用ember.js将其作为电子邮件正文

时间:2016-03-31 10:54:24

标签: javascript ember.js tinymce dynamics-crm

我正在使用tinymce编辑器发送电子邮件。虽然在mscrm活动和ember.js框架中发送实际的电子邮件,但电子邮件正文作为HTML源发送,而不是作为实际的HTML格式。 例如,在收到电子邮件时,我将格式设为'<'strong'> test<'/ strong'>'

不是粗体'测试'。请建议。

下面的

是我使用的初始化函数

RichTextArea = Ember.TextArea.extend({     编辑:null,     _suspendValueChange:false,     didInsertElement:function(){         调试器;         var id =“#”+ this.get(“elementId”);         var view = this;         tinyMCE.init({             宽度:“700”,             身高:“400”,             插件:“table,inlinepopups”,

        // Style formats
        style_formats : [
                {title : 'Bold text', inline : 'b'},
                {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
                {title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
                {title : 'Example 1', inline : 'span', classes : 'example1'},
                {title : 'Example 2', inline : 'span', classes : 'example2'},
                {title : 'Table styles'},
                {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
        ],

        formats : {
            alignleft : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'left'},
            aligncenter : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'center'},
            alignright : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'right'},
            alignfull : {selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img', classes : 'full'},
            bold : {inline : 'span', 'classes' : 'bold'},
            italic : {inline : 'span', 'classes' : 'italic'},
            underline : {inline : 'span', 'classes' : 'underline', exact : true},
            strikethrough : {inline : 'del'},
            customformat : {inline : 'span', styles : {color : '#00ff00', fontSize : '20px'}, attributes : {title : 'My custom format'}}
        },
        mode: "specific_textareas",
                    editor_selector : "mceEditor",
                    theme: "advanced",
                    theme_advanced_resizing: true,
        //// Theme options
        //            theme_advanced_buttons1: "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat,code",
        //            theme_advanced_buttons2: "",
        //            theme_advanced_buttons3: "",
        //            theme_advanced_buttons4: "",
        //            theme_advanced_toolbar_location: "top",
        //            theme_advanced_toolbar_align: "left",
        //            theme_advanced_statusbar_location: "bottom",
        //            theme_advanced_resizing: true,
                   theme_advanced_buttons1: "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect",
                    theme_advanced_toolbar_location: "top",
        selector: id,
        element_format : 'html',
        setup : function(ed) {
            view.set("editor", ed);
            ed.onKeyUp.add(function (ed, e) {
                view.suspendValueChange(function () {
                    view.set("value", ed.getContent());
                });
            });
        },
        valid_styles: {
            '*': 'border,font-size',
            'div': 'width,height'
        }
    });
},
suspendValueChange: function(cb) {
    this._suspendValueChange = true;
    cb();
    this._suspendValueChange = false;
},
valueChanged: function() {
    if (this._suspendValueChange) { return; }
    var content = this.get("value");
    this.get("editor").setContent(content);
}.observes("value"),
willClearRender: function() {
    this.get("editor").remove();
}

});

0 个答案:

没有答案