updating showdown library, adding support for tables and strikethrough,

fixing issue with double escaping HTML entities that was causing
blockquotes to be ignored, fixes #75
This commit is contained in:
El RIDO 2016-05-22 16:18:57 +02:00
parent 7f2fd4d980
commit 1625aac798
9 changed files with 19 additions and 1313 deletions

1
js/showdown-1.4.1.js Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -560,17 +560,23 @@ $(function() {
* use given format on paste, defaults to plain text * use given format on paste, defaults to plain text
* *
* @param string format * @param string format
* @param string text
*/ */
formatPaste: function(format) formatPaste: function(format, text)
{ {
helper.setElementText(this.clearText, text);
helper.setElementText(this.prettyPrint, text);
switch (format || 'plaintext') switch (format || 'plaintext')
{ {
case 'markdown': case 'markdown':
if (typeof Showdown == 'object') if (typeof showdown == 'object')
{ {
var converter = new Showdown.converter(); showdown.setOption('strikethrough', true);
showdown.setOption('tables', true);
showdown.setOption('tablesHeaderId', true);
var converter = new showdown.Converter();
this.clearText.html( this.clearText.html(
converter.makeHtml(this.clearText.html()) converter.makeHtml(text)
); );
this.clearText.removeClass('hidden'); this.clearText.removeClass('hidden');
} }
@ -647,9 +653,7 @@ $(function() {
this.passwordInput.val(password); this.passwordInput.val(password);
if (cleartext.length > 0) if (cleartext.length > 0)
{ {
helper.setElementText(this.clearText, cleartext); this.formatPaste(paste.meta.formatter, cleartext);
helper.setElementText(this.prettyPrint, cleartext);
this.formatPaste(paste.meta.formatter);
} }
} }
catch(err) catch(err)
@ -990,10 +994,7 @@ $(function() {
// We pre-select the link so that the user only has to [Ctrl]+[c] the link. // We pre-select the link so that the user only has to [Ctrl]+[c] the link.
helper.selectText('pasteurl'); helper.selectText('pasteurl');
zerobin.showStatus('', false); zerobin.showStatus('', false);
zerobin.formatPaste(data_to_send.formatter, zerobin.message.val());
helper.setElementText(zerobin.clearText, zerobin.message.val());
helper.setElementText(zerobin.prettyPrint, zerobin.message.val());
zerobin.formatPaste(data_to_send.formatter);
} }
else if (data.status==1) else if (data.status==1)
{ {

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="js/rawinflate-0.3.js"></script> <script type="text/javascript" src="js/rawinflate-0.3.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style> <style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style>

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="js/rawinflate-0.3.js"></script> <script type="text/javascript" src="js/rawinflate-0.3.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style> <style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style>

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="js/rawinflate-0.3.js"></script> <script type="text/javascript" src="js/rawinflate-0.3.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style> <style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style>

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="js/rawinflate-0.3.js"></script> <script type="text/javascript" src="js/rawinflate-0.3.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style> <style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style>

View File

@ -18,7 +18,7 @@
<script type="text/javascript" src="js/rawinflate-0.3.js"></script> <script type="text/javascript" src="js/rawinflate-0.3.js"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/bootstrap-3.3.5.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style> <style type="text/css">#ienotice {display:block !important;} #oldienotice {display:block !important;}</style>

View File

@ -13,7 +13,7 @@
<script type="text/javascript" src="js/rawdeflate-0.5.js"></script> <script type="text/javascript" src="js/rawdeflate-0.5.js"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js"></script>{if="$SYNTAXHIGHLIGHTING"} <script type="text/javascript" src="js/rawinflate-0.3.js"></script>{if="$SYNTAXHIGHLIGHTING"}
<script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"} <script type="text/javascript" src="js/prettify.js?{$VERSION|rawurlencode}"></script>{/if}{if="$MARKDOWN"}
<script type="text/javascript" src="js/showdown.js?{$VERSION|rawurlencode}"></script>{/if} <script type="text/javascript" src="js/showdown-1.4.1.js"></script>{/if}
<script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script> <script type="text/javascript" src="js/zerobin.js?{$VERSION|rawurlencode}"></script>
<!--[if lt IE 10]> <!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style> <style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>