You can achieve what you want in two ways. I created a jsfiddle showing css and javascript used to resize the ace editor in its container.
Css is used to make the editor take up the width and height of the container, so editor.resize() can correctly calculate the size that should be in the editor.
I recommend the following to make editor.resize() work.
<style type="text/css" media="screen"> #editor { width: 100%; height: 100%; } </style>
However, if you want to support the use of current css for #editor , the following will work.
<style type="text/css" media="screen"> #editor { position: absolute; top: 0; right: 0; bottom: 0; left: 0; } </style>
and add position: relative; into the container so that the absolutely positioned editor is correctly located inside the container. Regarding this, I refer you to Absolute positioning within relative positioning.
scain
source share