更新时间:2022-03-15 22:55:40
因为我为此付出了很多努力,并且因为正如迈克尔·弗罗明(Michael Fromin)的回答所述,标准 nbsp
带来了一系列问题对于HTML中的富文本编辑器,我决定完全跳过使用 nbsp
,并使用其他Unicode不间断空格之一,如下所述:
Because I have struggled with this a lot, and because as is described in Michael Fromin's answer the standard nbsp
poses a series of issues for rich text editors in HTML, I decided to skip using nbsp
altogether and use one of the other Unicode non-breaking spaces as described here: https://en.wikipedia.org/wiki/Non-breaking_space#Width_variation
更具体地说,我最终使用了"图空间"字符,它的显示空间比普通的要宽(取决于字体),但在大多数情况下可能比薄的不间断空间要好.我创建了一个自定义按钮,在内容中添加了这个特殊字符.
More specifically, I ended up using the "Figure space" character, which renders as a bit wider space than normal (depending on the font), but is probably better than the thin non-breaking space for most uses. I created a custom button that adds this special character in the content.
只要确保您使用的是哪种字体,特别是如果您正在为其他输出(如PDF)处理生成的HTML时,都支持此字形.
Just make sure that whatever font you're using, especially if you're processing the produced HTML for some other output like PDF, is supporting this glyph.