ACE set the initial value, there is no wrap effect, can not format
See original GitHub issueProblem
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 I expect like this
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.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 runJSON.parse
for eachJSON.stringify
, otherwise you risk adding additional slashes.In my case, I was stringifying in both
useEffect
and in state management.