]> _ Git - fluidbook-html5.git/commitdiff
done #1775 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Nov 2017 16:33:42 +0000 (17:33 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 2 Nov 2017 16:33:42 +0000 (17:33 +0100)
js/libs/fluidbook/fluidbook.share.js

index 2d9352c5438c1e068b7f68dd173ad4c679501805..6f8f76aa1bb7f12b91b29865a6407768097eca24 100644 (file)
@@ -1,7 +1,7 @@
 function FluidbookShare(fluidbook) {
     this.fluidbook = fluidbook;
-    if(this.isEnabled()){
-        var $this=this;
+    if (this.isEnabled()) {
+        var $this = this;
         $(document).on('click', '.share', function () {
             var f = 'send' + ucfirst($(this).data('service'));
             $this[f]();
@@ -30,7 +30,7 @@ FluidbookShare.prototype = {
         return res;
     },
 
-    getShareLinks: function(hideLabels) {
+    getShareLinks: function (hideLabels) {
         var shareLinks = {},
             shareHTML = '';
 
@@ -72,13 +72,14 @@ FluidbookShare.prototype = {
     },
 
     openShare: function (p1, p2, callback) {
-        
+
         var view;
 
         view = '<div class="caption">' + this.fluidbook.menu.closeButton() + '<h2>' + this.fluidbook.l10n.__('share') + '</h2></div>';
         view += '<div class="content">';
         view += this.getShareLinks();
-        view += '</div>';;
+        view += '</div>';
+        ;
 
         $("#view").append('<div class="mview" data-menu="share">' + view + '</div>');
         if (callback != undefined) {
@@ -93,6 +94,11 @@ FluidbookShare.prototype = {
             body = this.fluidbook.datas.title + ' : ' + this.getShareURL();
         }
 
+        // Normalize new lines
+        body = body.replace(/\r\n/g, "\n");
+        body = body.replace(/\r/g, "\n");
+        body = body.replace(/\n/g, "\r\n");
+
         if (this.fluidbook.datas.phonegap == 'android') {
             var extras = {};
             extras[window.plugins.webintent.EXTRA_SUBJECT] = subject;