Textbox of Fabric.js does not wrap a long word

前端 未结 3 989
半阙折子戏
半阙折子戏 2020-12-18 01:26

I am using the Textbox of Fabric.js. I have given a fixed width. But if a user types a long word without any space that exceeds the given width of

3条回答
  •  感情败类
    2020-12-18 01:49

    For Fabric.js 3.0.0+ you can use the splitByGrapheme property.

    On a Textbox, set it to true:

    const letterBreakingTextBox = new fabric.Textbox(yourLongText, {
        width: 200,
        textAlign: 'left', // you can use specify the text align
        splitByGrapheme: true
    });
    

提交回复
热议问题