" tinymce.init不是一个功能"当试图浏览tinymce时

时间:2015-09-17 08:02:42

标签: jquery npm tinymce browserify

我无法获得在browserify中工作的基本调用,即使它只是从CDN加载tinymce也能完美运行。这是我尝试做的最简单的例子。

protected void btnKaydet_Click(object sender, EventArgs e)
{
    Response.Clear();
    Response.Buffer = true;
    Response.ContentType = "application/vnd.openxmlformatsofficedocument.wordprocessingml.documet";
    Response.AddHeader("Content-Disposition", "attachment; filename=XXXX.doc");
    Response.ContentEncoding = Encoding.GetEncoding("ISO-8859-9");
    Response.Charset = "ISO-8859-9";
    EnableViewState = false;


    StringWriter writer = new StringWriter();
    HtmlTextWriter html = new HtmlTextWriter(writer);
    form1.RenderControl(html);


    byte[] bytesInStream = Encoding.GetEncoding("iso-8859-9").GetBytes(writer.ToString());
    MemoryStream memoryStream = new MemoryStream(bytesInStream);


    string msgBody = "";
    string Email = "mail@xxxxxx.org";
    SmtpClient client = new SmtpClient("mail.xxxxx.org");
    MailMessage message = new MailMessage(Email, "mail@someone.com", "ONLINE APP FORM WITH WORD DOC", msgBody);
    Attachment att = new Attachment(memoryStream, "XXXX.doc", "application/vnd.openxmlformatsofficedocument.wordprocessingml.documet");
    message.Attachments.Add(att);
    message.BodyEncoding = System.Text.Encoding.UTF8;
    message.IsBodyHtml = true;
    client.Send(message);}

但是,我从js控制台收到// main.js var tinymceConverter = require('./modules/tinymce-converter'); document.addEventListener('DOMContentLoaded', function () { tinymceConverter.init(); } // tinymce-converter.js 'use strict'; var tinymce = require('tinymce/tinymce'); module.exports = { init: function () { tinymce.init({ // some params }); } }; 错误。

我尝试了其他Uncaught TypeError: tinymce.init is not a function调用的各种组合,其中一些与jQuery结合使用,jQuery在这个项目中经常使用。 (因此,jQuery的解决方案将受到欢迎,虽然我的首要任务是让它工作。)我错过了一些明显的东西吗?

1 个答案:

答案 0 :(得分:1)

我通过添加设置属性来解决它,然后控制台警告我没有一些插件代码和图像,一旦添加了这些代码和图像,它们便停止提供控制台错误,并且我可以取出设置属性。

tinymce.init({ selector: '#tiny', plugins: ['paste', 'link', 'code', 'image'], setup: function(ed) { ed.on("init", function (ed) { alert(7); }) } });