How to use a trumbowyg plugin when using AMD module loader and typescript
HeyndrickxKarel opened this issue · 1 comments
Hi
For a project I'm working on, I'm using your plugin. The project is setup with
- CLI’s built bundler and AMD module loader
- Typescript
- RequireJs
I'm trying to use the plugin "mention" which is documented here. In the documentation it tells us to just link the script but how I can use that plugin in my project?
I have created a test repository including a new aurelia setup with the above details and aurelia-trumbowyg-plugin installed right here
in case you would like to try it out :).
Kind regards
Karel
I have just found a simple solution. Instead of trying to import the script, i copied the contents into a function which I declare for a typescript class like so:
export class TrumbowygPlugins { static initMention() { (function ($) { "use strict"; ...... })(jQuery); } }
Then I can simple call this function when constructing the component in which I use the aurelia-trumbowyg-plugin like so:
constructor(){ TrumbowygPlugins.initMention(); }