Split string in JavaScript and detect line break

前端 未结 7 1178
情书的邮戳
情书的邮戳 2020-12-24 04:55

I have a small function I found that takes a string from a textarea and then puts it into a canvas element and wraps the text when the line gets to

7条回答
  •  清歌不尽
    2020-12-24 05:24

    You should try detect the first line.

    Then the:

    if(n == 0){
      line = words[n]+"\n";
    }
    

    I'm not sure, but maybe it helps.

提交回复
热议问题