Added html2text convert for desktop notifications.
This commit is contained in:
parent
320fdc1679
commit
84894944a7
2 changed files with 6 additions and 1 deletions
|
@ -154,7 +154,7 @@ class App.OnlineNotificationWidget extends App.Controller
|
||||||
title = item.objectNative.activityMessage(item)
|
title = item.objectNative.activityMessage(item)
|
||||||
else
|
else
|
||||||
title = "Need objectNative in item #{item.object}.find(#{item.o_id})"
|
title = "Need objectNative in item #{item.object}.find(#{item.o_id})"
|
||||||
title = title.replace(/<.+?>/g, '"')
|
title = App.Utils.html2text(title.replace(/<.+?>/g, '"'))
|
||||||
@notifyDesktop(
|
@notifyDesktop(
|
||||||
url: item.link
|
url: item.link
|
||||||
title: title
|
title: title
|
||||||
|
|
|
@ -84,6 +84,11 @@ test("html2text", function() {
|
||||||
result = App.Utils.html2text(source)
|
result = App.Utils.html2text(source)
|
||||||
equal(result, should, source)
|
equal(result, should, source)
|
||||||
|
|
||||||
|
source = "<div>Some & <Value></div>"
|
||||||
|
should = "Some & <Value>"
|
||||||
|
result = App.Utils.html2text(source)
|
||||||
|
equal(result, should, source)
|
||||||
|
|
||||||
source = "<div>Some</div><div><b>Value</b></div>"
|
source = "<div>Some</div><div><b>Value</b></div>"
|
||||||
should = "Some\n<b>Value</b>"
|
should = "Some\n<b>Value</b>"
|
||||||
result = App.Utils.html2text(source)
|
result = App.Utils.html2text(source)
|
||||||
|
|
Loading…
Reference in a new issue