Javascript :: Ace Editor Positioning with Bootstrap3
Ace editor is a fantastic option for live source code editor on the web. One problem you come across when using Ace Editor is with the default absolute positioning. Also it doesn’t fit inside a container div by default. Here is how I overcame these issues.
The example from ace website uses absolute positioning by default, as show below. But luckily, ace can work perfectly with relative positioning
|
|
In order to put ace-editor inside a container div, we can give relative
positioning to the editor
and remove the positioning attribs, like
top, right, bottom and left.
|
|
We also need to give height, otherwise editor won’t show up.
|
|
That said, when using Twitter Bootstrap, you can absolutely forget about relative positioning of ace. But we still need to set height, as ace does not fill. In the following jsfiddle, I have used Bootstrap’s panel component for showing the editor.
Full Screen Result is available here. https://jsfiddle.net/deepumohanp/U5JtP/embedded/result/
Fiddle here: https://jsfiddle.net/deepumohanp/U5JtP/