From c1ac944508d06444082b577f7bff5c85a214ed0e Mon Sep 17 00:00:00 2001 From: Tom Preston-Werner Date: Wed, 14 Jul 2010 14:30:11 -0700 Subject: [PATCH] Basic link and image insertion from editbar. --- lib/gollum/frontend/public/javascript/gollum.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/gollum/frontend/public/javascript/gollum.js b/lib/gollum/frontend/public/javascript/gollum.js index 585270c6..7703e843 100644 --- a/lib/gollum/frontend/public/javascript/gollum.js +++ b/lib/gollum/frontend/public/javascript/gollum.js @@ -29,6 +29,10 @@ Gollum.Formats = { bold: Gollum.encloseStrategy('**', 'bold text', '**'), italic: Gollum.encloseStrategy('//', 'italic text', '//') }, + gollum: { + link: Gollum.encloseStrategy('[[', 'Page Name', ']]'), + image: Gollum.encloseStrategy('[[', '/path/to/image.png', ']]'), + }, markdown: { bold: Gollum.encloseStrategy('**', 'bold text', '**'), italic: Gollum.encloseStrategy('*', 'italic text', '*') @@ -79,4 +83,16 @@ $(function(){ var format = $('#guides .write select[name=format] option:selected').attr('value') Gollum.enclose(el, format, 'italic') }) + + $('#editbar .link').click(function() { + var el = $('#guides .write textarea') + var format = $('#guides .write select[name=format] option:selected').attr('value') + Gollum.enclose(el, 'gollum', 'link') + }) + + $('#editbar .image').click(function() { + var el = $('#guides .write textarea') + var format = $('#guides .write select[name=format] option:selected').attr('value') + Gollum.enclose(el, 'gollum', 'image') + }) })