简体   繁体   中英

Browserify + third-party plugin

I am trying to wrap my head around Browserify. Presently I have this file:

window.URI = require('urijs');
window._ = require('underscore');
window.moment = require('moment');
window.Cookies = require('js-cookie');
window.tinymce = require('tinymce/tinymce');

if (window.$ === undefined || window.jQuery === undefined) {
    window.$ = window.jQuery = require('jquery');
}

I have access to jQuery through $ and it works just fine. My main problem is with tinymce.

How can I get it to work with Browserify? As you can imagine, the following doesn't work.

tinymce.init({
    selector : "textarea",
    toolbar : "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages",
});

I ran into a similar problem in React. you have to change

window.tinymce = require('tinymce/tinymce');

to

window.tinymce = require('tinymce/tinymce').tinymce.EditorManager;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM