Topic
#cjk
4 pieces
この
ページは どう 日本語を 折り返しているか ブラウザは
日本語を ほぼどの 文字境界でも 折り返すので、 単語が 真っ二つに なり句読点が 行頭に 来る。 この サイトが それを 避けている 仕組みを 書く。 ビルド時の 文節分割と、 CSS二行だけ。 How this page breaks Japanese lines
Browsers break Japanese between almost any two characters, so words split in half and punctuation lands at the start of a line. Here is how this site avoids that — phrase segmentation at build time plus two lines of CSS.
まだ
変換中なのに 発火する Enterキー 日本語の
変換を Enterで 確定した 瞬間、 素朴な ハンドラは 単語の 途中で フォームを 送信してしまう。 原因は 確定の キー入力が 普通の Enterに 見える こと(isComposing / keyCode 229)で、 直し方は ガード一行。 The Enter key that fires while you're still typing
Press Enter to confirm a Japanese IME conversion and a naive handler submits the form mid-word. The cause is that the confirming keypress looks like a normal Enter (isComposing / keyCode 229), and the fix is one guard clause.