Adding little format box, new markdown exec syntax

This commit is contained in:
Eston Bond
2010-11-01 18:28:34 -07:00
parent 402eb2edaa
commit ca92b0a8c6
4 changed files with 88 additions and 7 deletions
+29 -2
View File
@@ -6,7 +6,7 @@
#gollum-editor {
border: 1px solid #e4e4e4;
background: #f9f9f9;
margin-bottom: 5em;
margin: 1em 0 5em;
overflow: hidden;
padding: 1em;
@@ -47,7 +47,7 @@
float: left;
height: 25px;
overflow: hidden;
margin: 0 0.5em 0 0;
margin: 0.2em 0.5em 0 0;
/* text-indent: -5000px; */
text-shadow: 0 1px 0 #fff;
width: 25px;
@@ -77,6 +77,33 @@
width: 0.5em;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select {
background-color: #f7f7f7;
border: 1px solid transparent;
float: right;
font-size: 1.1em;
font-weight: bold;
line-height: 1.6em;
padding: 0.5em 0.7em;
margin-bottom: 0;
border-radius: 0.5em;
-moz-border-radius: 0.5em;
-webkit-border-radius: 0.5em;
-moz-outline: none;
}
#gollum-editor #gollum-editor-function-bar
#gollum-editor-format-selector select:hover {
background-color: #fff;
border: 1px solid #ddd;
-moz-outline: none;
}
/* @section form-fields */
+9 -1
View File
@@ -41,12 +41,20 @@
<span class="function-divider">&nbsp;</span>
<a href="#" id="function-link" class="function-button">Link</a>
<a href="#" id="function-image" class="function-button">Image</a>
<div id="gollum-editor-format-selector">
<select name="gollum-editor-format-select"
id="gollum-editor-format-select" disabled>
<option name="Markdown" value="markdown" selected>
Markdown</option>
</select>
</div>
</div>
<fieldset id="gollum-editor-fields">
<textarea id="gollum-editor-body"
data-markup-lang="markdown"></textarea>
<span class="aural"><br></span>
<input type="submit" id="gollum-editor-submit" value="Save">
<input type="submit" id="gollum-editor-submit" value="Save" title="Save current changes">
</fieldset>
</form>
</div>
+2 -2
View File
@@ -60,7 +60,6 @@
// EditorHas.functionBar
}
// EditorHas.baseEditorMarkup
};
@@ -88,7 +87,8 @@
* @return void
*/
var debug = function(m) {
if ( ActiveOptions.Debug && console
if ( ActiveOptions.Debug
&& typeof console != 'undefined'
&& typeof console.log == 'function' ) {
console.log( m );
}
+48 -2
View File
@@ -39,12 +39,58 @@ var MarkDown = {
append: "\n***\n"
},
'function-ul' : {
'function-ul' : {
search: /(.+)([\n]?)/gi,
replace: "* $1$2"
},
/* This looks silly but is completely valid Markdown */
'function-ol' : {
search: /(.+)([\n]?)/gi,
replace: "1. $1$2"
},
'function-blockquote' : {
search: /(.+)([\n]?)/gi,
replace: "> $1$2"
},
'function-link' : {
exec: function( txt, selText, $field ) {
var results = null;
res = $.GollumEditor.Dialog({
title: '',
fields: [
{
id: 'text',
name: 'Link Text',
type: 'text',
help: 'The text to display to the user.'
},
{
id: 'href',
name: 'URL',
type: 'text',
help: 'The URL to link to.'
}
]
});
if ( res['text'] && res['href'] ) {
return '[' + res['text'] + ']('
+ res['href'] + ')';
}
else
return '';
}
},
'function-image' : {
/* Stub */
}
};
// this is necessary for GollumEditor to pick this up
jQuery.GollumEditor.defineLanguage('markdown', MarkDown);