diff --git a/lib/gollum/frontend/public/css/editor.css b/lib/gollum/frontend/public/css/editor.css index 6d99045b..df072eef 100644 --- a/lib/gollum/frontend/public/css/editor.css +++ b/lib/gollum/frontend/public/css/editor.css @@ -22,6 +22,46 @@ width: 100%; } +/* @control title */ +#gollum-editor-title-field { + display: none; +} + +#gollum-editor-title-field.active { + border-bottom: 1px solid #ddd; + display: block; + margin: 0 0 0.3em 0; + padding: 0 0 0.5em 0; +} + +#gollum-editor-title-field label { + /* JAWS should see it, but you can't */ + display: block; + height: 1px; + left: -5000px; + overflow: hidden; + position: absolute; + top: -5000px; + width: 1px; +} + +#gollum-editor-title-field input { + background: #fff; + border: 1px solid #ddd; + color: #000; + font-size: 1.3em; + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + font-weight: bold; + line-height: 1.8em; + margin: 0; + padding: 0.5em; + width: 40%; +} + +#gollum-editor-title-field input.ph { + color: #999; +} + /* @control editor-view-tab */ #gollum-editor #gollum-editor-type-switcher { display: none; diff --git a/lib/gollum/frontend/public/javascript/gollum-editor/gollum.editor.js b/lib/gollum/frontend/public/javascript/gollum-editor/gollum.editor.js index 8cfbed60..7b0906db 100644 --- a/lib/gollum/frontend/public/javascript/gollum-editor/gollum.editor.js +++ b/lib/gollum/frontend/public/javascript/gollum-editor/gollum.editor.js @@ -11,6 +11,7 @@ var DefaultOptions = { MarkupType: 'markdown', EditorMode: 'code', + NewFile: false, HasFunctionBar: true, Debug: true }; @@ -24,12 +25,21 @@ */ $.GollumEditor = function( IncomingOptions ) { - ActiveOptions = $.extend( DefaultOptions, IncomingOptions ); + ActiveOptions = $.extend( DefaultOptions, IncomingOptions ); + debug('GollumEditor loading'); - if ( EditorHas.baseEditorMarkup() ) { - // Initialise the function bar by loading proper definitions + if ( EditorHas.baseEditorMarkup() ) { + + if ( ActiveOptions.NewFile ) { + $('#gollum-editor-title-field').addClass('active'); + $('#gollum-editor-title-field input').focus(function() { + $(this)[0].select(); + }); + } + + // Initialize the function bar by loading proper definitions if ( EditorHas.functionBar() ) { var htmlSetMarkupLang = $('#gollum-editor-body').attr('data-markup-lang'); @@ -226,6 +236,10 @@ ff4Environment: function() { var ua = new RegExp(/Firefox\/4.0b/); return ( ua.test( navigator.userAgent ) ); + }, + + titleDisplayed: function() { + return ( ActiveOptions.NewFile ); } }; @@ -597,7 +611,3 @@ } // })(jQuery); - -jQuery(document).ready(function() { - $.GollumEditor(); -}); \ No newline at end of file diff --git a/lib/gollum/frontend/templates/create.mustache b/lib/gollum/frontend/templates/create.mustache index 2f88edfa..4dc7457a 100644 --- a/lib/gollum/frontend/templates/create.mustache +++ b/lib/gollum/frontend/templates/create.mustache @@ -7,4 +7,9 @@ {{>editor}} - \ No newline at end of file + + \ No newline at end of file diff --git a/lib/gollum/frontend/templates/edit.mustache b/lib/gollum/frontend/templates/edit.mustache index d447aeaf..b86a71cd 100644 --- a/lib/gollum/frontend/templates/edit.mustache +++ b/lib/gollum/frontend/templates/edit.mustache @@ -13,4 +13,9 @@ {{>editor}} - \ No newline at end of file + + \ No newline at end of file diff --git a/lib/gollum/frontend/templates/editor.mustache b/lib/gollum/frontend/templates/editor.mustache index 8fb90183..d4fa5321 100644 --- a/lib/gollum/frontend/templates/editor.mustache +++ b/lib/gollum/frontend/templates/editor.mustache @@ -1,5 +1,9 @@