Browse Source

New option: nl2br

Dante 11 years ago
parent
commit
221e4343b8
2 changed files with 7 additions and 5 deletions
  1. 1 4
      examples/index.html
  2. 6 1
      js/bootstrap-dialog.js

+ 1 - 4
examples/index.html

@@ -75,10 +75,7 @@
             }, {
                 label: 'Title 2',
                 action: function(dialog) {
-                    dialog.setButtons([{
-                        label: 'Something',
-                        cssClass: 'btn-warning'
-                    }]);
+                    dialog.setTitle('Title 2');
                 }
             }]
         });

+ 6 - 1
js/bootstrap-dialog.js

@@ -21,6 +21,7 @@
             cssClass: '',
             title: null,
             message: null,
+            nl2br: true,
             buttons: [],
             closable: true,
             spinicon: BootstrapDialog.ICON_SPINNER,
@@ -198,7 +199,11 @@
             return content;
         },
         formatStringContent: function(content) {
-            return content.replace(/\r\n/g, '<br />').replace(/[\r\n]/g, '<br />');
+            if (this.options.nl2br) {
+                return content.replace(/\r\n/g, '<br />').replace(/[\r\n]/g, '<br />');
+            }
+
+            return content;
         },
         setData: function(key, value) {
             this.options.data[key] = value;