Embedding Ace Editor inside jQuery UI Resizable Component

喜欢而已 提交于 2019-12-03 16:30:21

Use CSS to dictate how much space the resizable container can use.

Change your style line:

#resizable { min-width: 500px; min-height: 500px; max-width: 100%; max-height: 100%; padding: 5px; border: 3px solid red}

Add this to your inline stylesheet:

#editor { position: absolute; top: 40px; padding: 5px; left:0; bottom:0; right: 0; }

This will allow the control to fill the whole container but have a minimum width and height of 500px.

Change the following resizable call to not specify the min/max

$( "#resizable" ).resizable();

If you want a responsive template, check out Bootstrap

you need to make #editor node the same size as #resizable node

  <style>
  #resizable{position: relative}
  #editor{position: absolute; top:0;left:0;right:0;bottom:0;}
  </style>

and when size of container node changes, notify editor about that by calling editor.resize();

    $( "#resizable" ).resizable({
      resize: function( event, ui ) {
        editor.resize();
      }
    });

see http://jsbin.com/ojijeb/645/edit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!