Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Handlebar, MediumEditor not defined reference error #313

Closed
mkmule opened this issue Apr 15, 2016 · 1 comment
Closed

Handlebar, MediumEditor not defined reference error #313

mkmule opened this issue Apr 15, 2016 · 1 comment

Comments

@mkmule
Copy link
Contributor

mkmule commented Apr 15, 2016

Hello, I am really new, so perhaps the error exposed below is my fail. However, here is it:
The modules are managed with RequireJS.

First I got a Handlebars error, same as described here. Solutions like "shim with exports" and "change Handlebars library to handlebars.runtime" did not work for me.

Then if the first one is got solved (adding root["Handlebars"] = factory(); in handlebars.js, inside if (..&& define.amd)", which seems very wrong todo) I've got a similar one with MediumEditor.

After reading about RequireJS, I've come with another solution:

  • Remove modification from handlebar
  • Modify medium-editor-insert-plugin.js by adding Handlebar and MediumEditor dependencies, here is the code:

(function (factory) { if (typeof define === 'function' && define.amd) { define(['jquery', 'handlebars', "medium-editor"], factory); } else if (typeof module === 'object' && module.exports) { module.exports = function( root, jQuery ) { if ( jQuery === undefined ) { if ( typeof window !== 'undefined' ) { jQuery = require('jquery'); } else { jQuery = require('jquery')(root); } } factory(jQuery); return jQuery; }; } else { factory(jQuery); } }(function ($, Handlebars, MediumEditor) { ...

Please give me some feedback and explanation if this is bug or I am doing something wrong.
Your plugin is awesome, that's why I would be very grateful for your help.

@mkmule
Copy link
Contributor Author

mkmule commented Apr 15, 2016

I've added a pull request to solve it.

@mkmule mkmule closed this as completed Apr 15, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant