medium-editor-insert-plugin icon indicating copy to clipboard operation
medium-editor-insert-plugin copied to clipboard

Webpack - Unable to make custom Addons

Open makeitrein opened this issue 8 years ago • 2 comments

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: screen shot 2016-05-10 at 6 02 40 pm

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.

makeitrein avatar May 11 '16 01:05 makeitrein

I had the same problem with webpack. Try this:

     import MediumInsert from 'medium-editor-insert-plugin'
     window.MediumInsert = MediumInsert.MediumInsert

seSze avatar Aug 22 '16 10:08 seSze

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.

the-map avatar Dec 21 '16 17:12 the-map