Handling of non breaking space:

 

vs.

前端 未结 3 1366
夕颜
夕颜 2021-01-30 12:40

  is a non breaking space, which represents an empty space where no line break occurs.

If I use

 

3条回答
  •  余生分开走
    2021-01-30 12:55

    How about a workaround? In my case I took the value of the textarea in a jQuery variable, and changed all "

     " to

    and clear class to have certain height and margin, as the following example:

    jQuery

    tinyMCE.triggerSave();
    var val = $('textarea').val();
    val = val.replace(/

     /g, '

    ');

    the val is then saved to the database with the new val.

    CSS

    p.clear{height: 2px; margin-bottom: 3px;}
    

    You can adjust the height & margin as you wish. And since 'p' is a display: block element. it should give you the expected output.

    Hope that helps!

提交回复
热议问题