@HUMMEL

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

summer noteで最初に表示されるフォント名を変更したい

解決したいこと

Summernote v0.8.18

summer noteでフォントのボタンに最初に表示されるフォント名を変更したいのですが、
summernote(https://summernote.org/)を見ても解決策がないようです。

現時点ではデフォルトの「sans-serif」が選択中として最初に表示されています。
この部分を変更する方法を教えて下さい。

fontNames: ["Yu Gothic","Yu Mincho","Meiryo","sans-serif", "Arial","Arial Black","Comic Sans MS","Courier New","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],
上記のようにフォントを指定していますが、最初にある「Yu Gothic」を選択状態(最初に表示)にしたいのです。

どうかよろしくお願い致します。

自分で試したこと

https://summernote.org/deep-dive/#font-style-api
上記ページなどを参考にしましたが、解決に至りませんでした。

0 likes

1Answer

Summernote automatically populates the font dropdown with the available fonts that are given on fontNames option. This includes the font set on the current dom element.

現在のdom要素上のフォントセットが追加されると書いてあったので

<style>
	body {
		font-family: Yu Gothic;
	}
</style>
<head>

適当にcssを追加してあげれば Yu Gothic がデフォルト状態になりました
bodyだといい加減すぎるので、適切なclassにfont-familyを追加すれば大丈夫なんじゃないかな

See the Pen Untitled by amate (@amate-the-vuer) on CodePen.

0Like

Your answer might help someone💌