Ace editor doesn't work with bootstrap

前端 未结 2 1779
醉话见心
醉话见心 2021-01-22 01:09

I use boostrap default example theme: http://getbootstrap.com/examples/jumbotron-narrow/

and i\'d like to past ace editor instead central block, but ace editor doesn\'t

相关标签:
2条回答
  • 2021-01-22 01:29

    Ace should work fine with Bootstrap. Make sure you've included the appropriate ACE js scripts and set an specific height for it's container.

    Ace Bootstrap Example

    http://www.bootply.com/5wt39zvswV

    0 讨论(0)
  • 2021-01-22 01:32

    To test what goes wrong:

    1. check if Ace have added other divs into <div id="editor">, if no, there must be some js error in console.
    2. If Ace is there but isn't visible, remove all text from <div id="editor"> and comment out ace.edit line to see what size ace will get (ace tries to match height of that div)
    3. if the issue is indeed that Ace gets height=0, either add explicit height to the editor div,
    4. or if you want it to fit to text, set maxLines and minLines options as shown in https://github.com/ajaxorg/ace-builds/blob/v1.1.6/demo/autoresize.html#L41-L43, however setting maxLines very large isn't recomended since it disables optimization of drawing only visible text, and can make editor slow for large documents.
    0 讨论(0)
提交回复
热议问题