diff --git a/scratch/js/gollum-editor/langs/asciidoc.js b/scratch/js/gollum-editor/langs/asciidoc.js index f034c394..4f6fce83 100644 --- a/scratch/js/gollum-editor/langs/asciidoc.js +++ b/scratch/js/gollum-editor/langs/asciidoc.js @@ -58,12 +58,12 @@ var ASCIIDoc = { } ], OK: function( res ) { + var h = ''; if ( res['text'] && res['href'] ) { - return res['href'] + '[' + - res['text'] + ']'; + h = res['href'] + '[' + + res['text'] + ']'; } - else - return ''; + $.GollumEditor.replaceSelection( h ); } }); @@ -89,11 +89,12 @@ var ASCIIDoc = { } ], OK: function( res ) { + var h = ''; if ( res['url'] && res['alt'] ) { - return 'image::' + res['url'] + - '[' + res['alt'] + ']'; - } else - return ''; + h = 'image::' + res['url'] + + '[' + res['alt'] + ']'; + } + $.GollumEditor.replaceSelection( h ); } }); } @@ -101,8 +102,6 @@ var ASCIIDoc = { }; - -// this is necessary for GollumEditor to pick this up jQuery.GollumEditor.defineLanguage('asciidoc', ASCIIDoc); })(); diff --git a/scratch/js/gollum-editor/langs/creole.js b/scratch/js/gollum-editor/langs/creole.js index 3f0e7c57..9241a8a9 100644 --- a/scratch/js/gollum-editor/langs/creole.js +++ b/scratch/js/gollum-editor/langs/creole.js @@ -56,12 +56,9 @@ var Creole = { } ], OK: function( res ) { - if ( res['text'] && res['href'] ) { - return '[[' + res['href'] + '|' + - res['text'] + ']]'; - } - else - return ''; + var h = '[[' + res['href'] + '|' + + res['text'] + ']]'; + $.GollumEditor.replaceSelection( h ); } }); @@ -92,9 +89,8 @@ var Creole = { if ( res['alt'] != '' ) { h += '|' + res['alt'] + '}}'; } - return h; - } else - return ''; + } + $.GollumEditor.replaceSelection( h ); } }); } diff --git a/scratch/js/gollum-editor/langs/markdown.js b/scratch/js/gollum-editor/langs/markdown.js index c035630c..a56f4e54 100644 --- a/scratch/js/gollum-editor/langs/markdown.js +++ b/scratch/js/gollum-editor/langs/markdown.js @@ -76,12 +76,12 @@ var MarkDown = { } ], OK: function( res ) { + var rep = ''; if ( res['text'] && res['href'] ) { - return '[' + res['text'] + '](' + rep = '[' + res['text'] + '](' + res['href'] + ')'; } - else - return ''; + $.GollumEditor.replaceSelection( rep ); } }); } @@ -118,8 +118,6 @@ var MarkDown = { }; - -// this is necessary for GollumEditor to pick this up jQuery.GollumEditor.defineLanguage('markdown', MarkDown); })(); diff --git a/scratch/js/gollum-editor/langs/textile.js b/scratch/js/gollum-editor/langs/textile.js index ae0b958f..18a546a6 100644 --- a/scratch/js/gollum-editor/langs/textile.js +++ b/scratch/js/gollum-editor/langs/textile.js @@ -60,12 +60,12 @@ var Textile = { } ], OK: function( res ) { + var h = ''; if ( res['text'] && res['href'] ) { - return '"' + res['text'] + '":' + - res['href']; - } - else - return ''; + h = '"' + res['text'] + '":' + + res['href']; + } + $.GollumEditor.replaceSelection( h ); } }); @@ -97,7 +97,7 @@ var Textile = { h += '(' + res['alt'] + ')'; } h += '!'; - return h; + %.GollumEditor.replaceSelection( h ); } } });