私は ckeditor を使用してメールを作成しています。それによって生成された html を使用して html メール広告を送信しています。テキスト バージョンも必要です。したがって、メールに HTML とプレーン テキスト バージョンの両方を含めると、スパムを回避できます。
Javaでckeditor htmlコードからテキストを取得する方法は何ですか?
私は ckeditor を使用してメールを作成しています。それによって生成された html を使用して html メール広告を送信しています。テキスト バージョンも必要です。したがって、メールに HTML とプレーン テキスト バージョンの両方を含めると、スパムを回避できます。
Javaでckeditor htmlコードからテキストを取得する方法は何ですか?
これは非常に単純な JavaScript 呼び出しです。
CKEDITOR.instances.yourEditorInstance.getData()
戻り値:
<h1>Apollo 11</h1>
<p><b>Apollo 11</b> was the spaceflight that landed the first humans, Americans <a href="http://en.wikipedia.org/wiki/Neil_Armstrong" title="Neil Armstrong">Neil Armstrong</a> and <a href="http://en.wikipedia.org/wiki/Buzz_Aldrin" title="Buzz Aldrin">Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p>
でも:
CKEDITOR.instances.yourEditorInstance.editable().getText()
戻り値:
Apollo 11
Apollo 11 was the spaceflight that landed the first humans, Americans Neil Armstrong and Buzz Aldrin, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.