次の単純なhtmlがあります。
<h1><i>This is a test</i> <span class="wysiwyg-color-red">Hello world</span></h1>
基本的なスタイルのセットとstrokeText html5 キャンバス API メソッドを使用して、テキスト html からキャンバスへのコンバーターを作成したいと考えています。
ノード値の「ツリー」と html html 要素のリストを取得すると便利です。
{
"This is a test": ["i", "h1"],
"Hello world": ["span class="wysiwyg-color-red", "h1"]
}
そこから、適切なキャンバス テキスト スタイルを生成できます。
答え: