Automatically adjust height to contents in Ace Cloud 9 editor

前端 未结 8 1998
孤街浪徒
孤街浪徒 2020-12-04 11:28

I\'m trying to add the Ace editor to a page, but I don\'t know how to get the height to be set automatically based on the length of its contents.

Ideally it would wo

8条回答
  •  长情又很酷
    2020-12-04 11:37

    I agree with the accepted answer, except that I would prefer editor.getSession().getScreenLength().

    The issue is that if you enable wrap mode, a long line may break into multiple lines. Thus you will not be able to get correct line count with editor.getSession().getDocument().getLength().

提交回复
热议问题