From 8e5d17c9077a3cb11cdc949bcc61d7338889d255 Mon Sep 17 00:00:00 2001 From: Mark Rickert Date: Thu, 10 May 2012 13:16:52 -0400 Subject: [PATCH] Grab selected text and use it as the default text when creating links. --- .../frontend/public/gollum/javascript/editor/langs/asciidoc.js | 3 ++- .../frontend/public/gollum/javascript/editor/langs/creole.js | 3 ++- .../frontend/public/gollum/javascript/editor/langs/markdown.js | 3 ++- .../frontend/public/gollum/javascript/editor/langs/org.js | 3 ++- .../frontend/public/gollum/javascript/editor/langs/pod.js | 3 ++- .../frontend/public/gollum/javascript/editor/langs/textile.js | 3 ++- lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js | 3 +++ 7 files changed, 15 insertions(+), 6 deletions(-) diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js index 4b690198..31322c06 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js @@ -47,7 +47,8 @@ var ASCIIDoc = { id: 'text', name: 'Link Text', type: 'text', - help: 'The text to display to the user.' + help: 'The text to display to the user.', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js index c0651d52..b32e95b6 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js @@ -46,7 +46,8 @@ var Creole = { id: 'text', name: 'Link Text', type: 'text', - help: 'The text to display to the user.' + help: 'The text to display to the user.', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js index a3b54f4d..923a5458 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js @@ -80,7 +80,8 @@ var MarkDown = { { id: 'text', name: 'Link Text', - type: 'text' + type: 'text', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js index 7c67c896..072cf388 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js @@ -60,7 +60,8 @@ var OrgMode = { { id: 'text', name: 'Link Text', - type: 'text' + type: 'text', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js index 94ddc87f..1cb7957c 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js @@ -44,7 +44,8 @@ var Pod = { { id: 'text', name: 'Link Text', - type: 'text' + type: 'text', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js b/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js index a9793d3d..4e27433d 100644 --- a/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +++ b/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js @@ -49,7 +49,8 @@ var Textile = { id: 'text', name: 'Link Text', type: 'text', - help: 'The text to display to the user.' + help: 'The text to display to the user.', + defaultValue: selText }, { id: 'href', diff --git a/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js b/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js index b5402420..84ddb8e7 100755 --- a/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +++ b/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js @@ -72,6 +72,9 @@ if ( fieldAttributes.type == 'code' ) { html+= ' class="code"'; } + if ( fieldAttributes.defaultValue ) { + html+= ' value="' + fieldAttributes.defaultValue.split('"').join('"') + '"'; + } html += ' id="gollum-dialog-dialog-generated-field-' + fieldAttributes.id + '">'; }