Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS error after clicking on edit button #13

Open
alberskib opened this issue Jan 30, 2015 · 4 comments
Open

JS error after clicking on edit button #13

alberskib opened this issue Jan 30, 2015 · 4 comments

Comments

@alberskib
Copy link
Contributor

Hey!

First of all, thanks for great lib!

When you open JS console and click on edit button toy will notice error:
Uncaught ReferenceError: define is not defined which comes from mode-json.js.
You are able to notice it even in demo.
Just download repo, bower install and try out.

If you need more info how to reproduce the problem, please let me know.
Thanks!

@darul75
Copy link
Owner

darul75 commented Jan 30, 2015

yes indeed, it is relative to "ace" library, I did not check it well until now, you can see code here

https://github.com/darul75/ng-prettyjson/blob/gh-pages/javascripts/ng-prettyjson.js#L78

editor.getSession().setMode("ace/mode/json");  

Then I guess they use requirejs to load all stuff but I can not check it now.

Let me know if you find, ace solution must be there http://ace.c9.io/#nav=embedding

@alberskib
Copy link
Contributor Author

There are two ways to solve this issue:

  1. Add require.js to your project - you will not receive error but json will not be colored during edition
  2. Replace file mode-json.js with next file mode-json.js (from non conflict directorory) - as a result you will not recieve any error and json will be colored during edition.

@darul75
Copy link
Owner

darul75 commented Feb 5, 2015

Thx @alberskib for providing such details, I will apply and document it when back home.

@pynej
Copy link
Contributor

pynej commented Sep 15, 2016

Also worth noting, you can include just the core ace.js in the src folder, and then comment out the following line in ng-prettyjson.js and you will get editing capabilities without needing to load the entire ace solution. We do this and lose color hilighting and other functions, but have a working editable region.

editor.getSession().setMode("ace/mode/json");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants