question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ACE set the initial value, there is no wrap effect, can not format

See original GitHub issue

Problem

ACE set the initial value, there is no wrap effect, can not format Version: “react-ace”: “^5.8.0”

Sample code to reproduce your issue

this.state.SimBody = {"id":123456,"name":"ACE","age":111};
<AceEditor
                    readOnly={fale}
                    onChange={this.handleGetBody}
                    width="100%"
                    height="500px"
                    mode="json"
                    theme="github"
                    name="aceCodeEditor"
                    onLoad={this.onLoad}
                    fontSize={14}
                    showPrintMargin={true}
                    showGutter={true}
                    highlightActiveLine={true}
                    value={this.state.modelBody}
                    editorProps={{
                      $blockScrolling: true,
                      enableBasicAutocompletion: true,
                      enableLiveAutocompletion: true,
                      enableSnippets: true
                    }}
                    setOptions={{
                      showLineNumbers: true,
                      tabSize: 2
                    }}/>

References

React-ace Progress on: # It will show like this image I expect like this image

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
securingsincitycommented, Dec 28, 2017

@Bobcui001 the editor doesn’t auto format json as you describe. However to get it into that format JSON.stringify(this.state.modelBody, null, '\t'); This should pretty print the json as you describe.

0reactions
oqxcommented, Jul 15, 2019

I’m running into this issue as well. I’ll see if I can look into it when I have some extra time.

EDIT So this will happen if you’re running JSON.stringify twice on the same string. You need to run JSON.parse for each JSON.stringify, otherwise you risk adding additional slashes.

In my case, I was stringifying in both useEffect and in state management.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set Value for ace editor without selecting the whole editor
setValue(str, -1) // moves cursor to the start editor. ... This will NOT select the text, so there's no need to do any...
Read more >
ACE Software Development Guidelines
Be very careful with ACE_ASSERT . It must only be used to check values; it may never be used to wrap a function...
Read more >
Format Specific Options — ASE documentation
If 'initial', the values from get_initial_magnetic_moments() are used. If 'calculated', the values from get_magnetic_moments() are used.
Read more >
Configuring the editor - Ace Editor
This means you can grab the session, store it in a var, and set the editor ... setValue("text2", -1); // set value and...
Read more >
AMBA AXI and ACE Protocol Specification
This specification does not recommend a default ARREADY value of LOW, because it forces ... it can have a significantly reduced set of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found