2014-12-26 03:05:07 +00:00
|
|
|
(function(fp, $, ng, undefined) {
|
|
|
|
|
|
|
|
fp.app.factory("fpMarked", function() {
|
2014-12-31 15:17:57 +00:00
|
|
|
marked.setOptions({
|
|
|
|
breaks: true,
|
|
|
|
sanitize: true
|
|
|
|
});
|
|
|
|
|
|
|
|
return {
|
2016-10-11 22:36:27 +00:00
|
|
|
block: function(string, options) {
|
|
|
|
var ret = $("<div/>").html(marked(string, options));
|
|
|
|
$("a[href]", ret).attr("target", "_blank");
|
|
|
|
return ret.html();
|
|
|
|
},
|
2014-12-31 15:17:57 +00:00
|
|
|
inline: function(string, options) {
|
|
|
|
var ret = $("<div/>").html(marked(string, options));
|
|
|
|
$("p", ret).replaceWith(function() { return $(this).contents(); });
|
2016-10-11 22:36:27 +00:00
|
|
|
$("a[href]", ret).attr("target", "_blank");
|
2014-12-31 15:17:57 +00:00
|
|
|
return ret.html();
|
|
|
|
}
|
|
|
|
};
|
2014-12-26 03:05:07 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
})(FacilPad, jQuery, angular);
|