Explorar o código

wrap long lines in plaintext format but force horizontal scroll on
syntaxhighlighting, resolves #45

El RIDO %!s(int64=10) %!d(string=hai) anos
pai
achega
40019624fd
Modificáronse 1 ficheiros con 7 adicións e 1 borrados
  1. 7 1
      js/zerobin.js

+ 7 - 1
js/zerobin.js

@@ -578,14 +578,20 @@ $(function() {
                     break;
                     break;
                 case 'syntaxhighlighting':
                 case 'syntaxhighlighting':
                     if (typeof prettyPrint == 'function') prettyPrint();
                     if (typeof prettyPrint == 'function') prettyPrint();
+                    this.prettyMessage.css('overflow', 'auto');
                 default:
                 default:
                     // Convert URLs to clickable links.
                     // Convert URLs to clickable links.
                     helper.urls2links(this.clearText);
                     helper.urls2links(this.clearText);
                     helper.urls2links(this.prettyPrint);
                     helper.urls2links(this.prettyPrint);
                     this.clearText.addClass('hidden');
                     this.clearText.addClass('hidden');
+                    if (format == 'plaintext') 
+                    {
+                        this.prettyPrint.css('white-space', 'pre-wrap');
+                        this.prettyPrint.css('word-break', 'normal');
+                        this.prettyPrint.removeClass('prettyprint');
+                    }
                     this.prettyMessage.removeClass('hidden');
                     this.prettyMessage.removeClass('hidden');
             }
             }
-            if (format == 'plaintext') this.prettyPrint.removeClass('prettyprint');
         },
         },
 
 
         /**
         /**