medium-editor-insert-plugin
medium-editor-insert-plugin copied to clipboard
Webpack - Unable to make custom Addons
Uncaught TypeError: Cannot read property 'src/js/templates/core-empty-line.hbs' of undefined
The error occurs in Core.prototype.clean function, specifically this line:
this.$el.html(this.templates'src/js/templates/core-empty-line.hbs'.trim());
Here's a snapshot of the "this" value:
Background:
- Webpack setup follows this guide: https://github.com/orthes/medium-editor-insert-plugin/wiki/v2.x-Using-with-webpack
- Only modification I made was to bind window.MediumInsert to the require('medium-editor-insert-plugin')($); statement
- This was an attempt to get access to window.MediumInsert.Templates, as shown in the CustomAddon function https://github.com/orthes/medium-editor-insert-plugin/wiki/v2.x-Custom-addons
Any help would be very appreciated! This is an awesome plugin, just having some difficulty creating a custom addon to add an iframe to a page.
I had the same problem with webpack. Try this:
import MediumInsert from 'medium-editor-insert-plugin'
window.MediumInsert = MediumInsert.MediumInsert
This one worked for me ...
import * as MediumInsert from 'medium-editor-insert-plugin/dist/js/medium-editor-insert-plugin';
window["MediumInsert"] = MediumInsert.MediumInsert;
Although, using this plugin in webpack is nightmare. Please include some documentation on how to add this in webpack.