-
Notifications
You must be signed in to change notification settings - Fork 89
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
Improved JSON viewing/editing with Ace editor #214
Conversation
I did not remove js\lib\highlight-8.3.min.js (even though it is not used), thoughts? |
The new code editor looks and works great :) As far as the PR goes, I think most of those ace files are not needed. For example, we're only editing json files (not all file types). |
@bsvensson I agree, and only found 4 files used in my testing:
I left the rest of them in there in case somewhere down the line, other ace options are utilized. I went back and forth about the proper approach for this scenario, but don't feel strongly one way or the other. For now, the full ace library source code is in there... I'm open for thoughts on which approach to take. The current approach is safe, and while it increases the repo and deployment size, it has no impact on the client network traffic. I was afraid some other ace call might break things down the line if I removed a file that didn't come up in my testing. |
Case and point, Find/Replace (Ctrl-F) triggers an additional file (thanks @bsvensson , i didn't know you could do that):
|
… tooltips on buttons when viewing/editing JSON. (squashed appId)
Another note on which Ace files to include. Pressing I'm open to feedback if anyone feels strongly one way or another. |
@hogpilot seeing a few strange characters on one item - highlighted in red: |
@slibby interesting. Ace is telling you that there is an invalid or invisible character there. It turns out, this is because the JSON contains Since this is not printable (other than as a space), Ace is differentiating it for you. I agree that red is not ideal, so I can override the CSS. How does this look? |
…or invisible ` ` character, and enabled theme change when in edit mode.
@slibby @bsvensson thanks for the feedback. The latest commit includes the changes you mentioned:
I think this is ready once testing is complete (@slibby? @rwmajor2? @ecaldwell?), let me know if you have questions. |
Can someone else test https://hogpilot.github.io/ago-assistant/build/ in IE to see if they get weird cursor/text-selection behavior? If so, anybody have an idea of what CSS is the culprit? Thanks. |
Yes, the cursor becomes the Double-clicking to select text does the right thing (functionally), but displays a selection box of sorts in the wrong place. Weird. I don't see the same issue in IE11 for neither the JSAPI sandbox, nor the Ace kitchen sink.
Nope :( |
…tenteditable` property of dom element). Fixed a few errors in html templates and removed unused css file from lib.
@bsvensson Thanks for checking. I found the culprit and fixed it in the latest commit. It had to do with our use of |
Note: In my latest commit, I also snuck a few changes into |
Nice find! Maybe this could be addressed with better linting. |
Without reading through all this: are we saying #212 and #213 are fixed (since both threads are closed)? E.g. the pasting of JSON back from notepad can now deal with the window's requirement for numbered lines? If so, that's great. However, there is still another related issue. Simply hitting the pencil, so that I can click in the box, CTRL A, CTRL C and CTRL V into Notepad ++ takes wayyyyyyyyy longer than it used to. It used to take maybe 30 seconds to give me access to the text - now, it takes 15 browser waits and maybe 30 minutes. |
@setldsolutions yes, both of those should be fixed in the latest code here on github, which has not yet been deployed to https://ago-assistant.esri.com. In the interim, you can try this build of the app first and see if you still have that delay: https://hogpilot.github.io/ago-assistant/build/ -- we are working on getting the latest build deployed. |
Thanks Sam. |
Confirmed working - no hitting the pencil to start editing necessary. Simply click in the box, wait a sec, CTRL A, CTRL C, CTRL V to Notepad ++ --- 91k+ lines of JSON in 2 seconds. Thanks again! |
This PR includes a new integration of Ace Editor for viewing and editing JSON. Highlight.js was not meant for editing, and the previous line number integration didn't work very well when adding/deleting lines. Here are things to test:
update
requests were being sent when the same item was saved multiple timesCtrl+F
)For now, a build of this PR is available at hogpilot/ago-assistant