IonicaBizau/medium-editor-markdown

Uncaught ReferenceError: merge is not defined

antonagestam opened this issue ยท 23 comments

Using the standalone version i get "Uncaught ReferenceError: merge is not defined" when running the script. It looks like it's the code from he.js that hasn't been properly included.

On this line merge is called in the standalone file, but it's not defined anywhere inside that file:
https://github.com/IonicaBizau/medium-editor-markdown/blob/master/dist/me-markdown.standalone.js#L7

Here merge is defined in he.js:
https://github.com/mathiasbynens/he/blob/master/src/he.js#L89

Good point!

However, I cannot reproduce it in the demo, using the standalone version too: http://ionicabizau.github.io/medium-editor-markdown/

What do you do just before of error throwing?

@IonicaBizau The error throws on page load as far as I can tell. That is very strange, could it be because I am using "use strict"; and you're not?

I cannot reproduce it even using "use strict";, but definitely the merge function should be added.

@IonicaBizau Cool, just to be clear, my "use strict"; statement is in the script that calls new MeMarkdown();, don't know if that makes any difference. :)

This is the line which produce error

image

This is from my console

image

And this is my code

image

Thanks

I'm on it! Will make the changes in another branch.

Wow .. very fast response ...

Thanks ๐Ÿ‘

Yep! Shouldn't be complicated I guess. ๐Ÿ˜„

BTW, are there anything special steps to make this error appear? Also, what browser/OS are you using?

I use latest chrome + win 7 ..

I think its because options that being passed to MediumEditor when initialized like this

contentEditor   = new MediumEditor('.content-editable', {
            buttons: ['bold', 'anchor', 'header2', 'pre'],
            buttonLabels: 'fontawesome',
});

๐Ÿ’ƒ

I used stable Chrome on OSX Yosemite if that helps.

See #3 for the rebuilt scripts. You can get the standalone version using:

$ wget https://raw.githubusercontent.com/IonicaBizau/medium-editor-markdown/8d41c8fb4e04f94e15a65dfd11ab827fc5a1c0fe/dist/me-markdown.standalone.min.js

(or clicking here)

Got error using minified script above ..

image

@ghprod Can you please switch on the non-minified version and send me the line number where the error appears?

decode is not supposed to be called. Instead, it should be he.decode.

here they are

image

@ghprod Good point! Check now.

I'm sorry Ionica .. still error

image

image

Since I can't reproduce this error, it's a little bit difficult to commit these changes. Could you provide a JSFiddle reproducing the error?

Thanks!

@IonicaBizau I'm sorry, but I've moved away from using markdown in my project.

@IonicaBizau I'm really sorry too, finally i must use codemirror + marked js ..

cheers for you ๐Ÿบ

No problem for me. Getting this issue fixed is weird since I don't have any reproduction page.

However, using the *.no-deps.* version should be fine:

<script src="he.js"></script>
<script src="to-markdown.js"></script>
<script src="medium-editor.js"></script>
<script src="me-markdown.no-deps.js"></script>

Yes,

thats what i did when last time i try to make it works ๐Ÿ‘

using no-deps should fine for now ..

Thanks

Could anyone create an online demo to reproduce the error?
I know these functions are not defined, but I don't know if the problem is fixed or not if a demo is missing.