angular-ui / ui-ace

This directive allows you to add ACE editor elements.
http://angular-ui.github.io/ui-ace
MIT License
578 stars 172 forks source link

Check if the text is a json and prettify it #39

Open slopjong opened 10 years ago

slopjong commented 10 years ago

If something is wrong or bad with the pull request, let me know so that I can improve it. One thing that could you keep from merging is that it's hard-coded instead of making it optional.

douglasduteil commented 10 years ago

I just don't know if it's really necessary in UI.Ace . I think that specific json treatment might be useful in specific project. Is it a fix? Is it blocking something ? For me UI.Ace must be just a minimal ace integration into the Angular environment.

slopjong commented 10 years ago

In my case the json got always minified on model changes even with ace's json mode enabled. After having a closer look at ace's API and googling for this I read in a google group discussion that this is the way how it should be done.

I'll check the discussion again today/tomorrow and maybe ask some ace guys if I'm yet not 100% sure. If they confirm we should add an option to auto-prettify a json. I did it hard-coded which I'm going to change to an opt-in thingie so that users have their full freedom.

douglasduteil commented 10 years ago

@slopjong can't you give me the links you checked ? I'm, me too, curious about it

slopjong commented 10 years ago

Now as I think of it, I'm currently not totally sure if my issue is caused by something else. I'll do some more testing.

Are you somewhere on irc? I'd like fiddle with jasmine and add some test cases for this kind of "issue", if it is one at all.