setPadding prop
See original GitHub issueProblem
Looking to be able to set padding through props. Currently have to do editor.renderer.setPadding(value)
to set editor padding.
Sample code to reproduce your issue
For example, trying to set padding through style props doesn’t work
import React from 'react';
import { render } from 'react-dom';
import brace from 'brace';
import AceEditor from 'react-ace';
import 'brace/mode/java';
import 'brace/theme/github';
function onChange(newValue) {
console.log('change',newValue);
}
// Render editor
render(
<AceEditor
mode="java"
theme="github"
onChange={onChange}
name="UNIQUE_ID_OF_DIV"
editorProps={{$blockScrolling: true}}
style={{padding: 8}}
/>,
document.getElementById('example')
);
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
CSS Padding - W3Schools
The padding property is a shorthand property for the following individual padding properties: padding-top; padding-right; padding-bottom; padding-left. So, here ...
Read more >padding - CSS: Cascading Style Sheets - MDN Web Docs
The padding property may be specified using one, two, three, or four values. Each value is a <length> or a <percentage> .
Read more >Control.Padding Property (System.Windows.Forms)
A Padding representing the control's internal spacing characteristics. Remarks. For containers such as GroupBox and TabControl, the Padding property gets or ...
Read more >padding | CSS-Tricks
The padding property in CSS defines the innermost portion of the box model, creating space around an element's content, inside of any ...
Read more >Spacing - MUI System
The props are named using the format {property}{sides} . Where property is one of: m - for classes that set margin; p -...
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
I’ve tried to use
This added padding, but it also broke mouse selection. With this css the mouse selection is mispositioned. At last I’ve removed this css and used
This is not perfect, when you scroll the code in the editor the top “padding” disappears, but for my case it is ok.
But for posterity’s sake, the above Codesandbox example only provides side padding, not top or bottom padding.
I’ve been targeting the .ace_content classname in CSS, but if anyone else has a better way for top/bottom padding, would love to hear it.