Adding little format box, new markdown exec syntax
This commit is contained in:
+29
-2
@@ -6,7 +6,7 @@
|
|||||||
#gollum-editor {
|
#gollum-editor {
|
||||||
border: 1px solid #e4e4e4;
|
border: 1px solid #e4e4e4;
|
||||||
background: #f9f9f9;
|
background: #f9f9f9;
|
||||||
margin-bottom: 5em;
|
margin: 1em 0 5em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
float: left;
|
float: left;
|
||||||
height: 25px;
|
height: 25px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
margin: 0 0.5em 0 0;
|
margin: 0.2em 0.5em 0 0;
|
||||||
/* text-indent: -5000px; */
|
/* text-indent: -5000px; */
|
||||||
text-shadow: 0 1px 0 #fff;
|
text-shadow: 0 1px 0 #fff;
|
||||||
width: 25px;
|
width: 25px;
|
||||||
@@ -77,6 +77,33 @@
|
|||||||
width: 0.5em;
|
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 */
|
/* @section form-fields */
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -41,12 +41,20 @@
|
|||||||
<span class="function-divider"> </span>
|
<span class="function-divider"> </span>
|
||||||
<a href="#" id="function-link" class="function-button">Link</a>
|
<a href="#" id="function-link" class="function-button">Link</a>
|
||||||
<a href="#" id="function-image" class="function-button">Image</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>
|
</div>
|
||||||
<fieldset id="gollum-editor-fields">
|
<fieldset id="gollum-editor-fields">
|
||||||
<textarea id="gollum-editor-body"
|
<textarea id="gollum-editor-body"
|
||||||
data-markup-lang="markdown"></textarea>
|
data-markup-lang="markdown"></textarea>
|
||||||
<span class="aural"><br></span>
|
<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>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
// EditorHas.functionBar
|
// EditorHas.functionBar
|
||||||
}
|
}
|
||||||
// EditorHas.baseEditorMarkup
|
// EditorHas.baseEditorMarkup
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -88,7 +87,8 @@
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
var debug = function(m) {
|
var debug = function(m) {
|
||||||
if ( ActiveOptions.Debug && console
|
if ( ActiveOptions.Debug
|
||||||
|
&& typeof console != 'undefined'
|
||||||
&& typeof console.log == 'function' ) {
|
&& typeof console.log == 'function' ) {
|
||||||
console.log( m );
|
console.log( m );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,9 +42,55 @@ var MarkDown = {
|
|||||||
'function-ul' : {
|
'function-ul' : {
|
||||||
search: /(.+)([\n]?)/gi,
|
search: /(.+)([\n]?)/gi,
|
||||||
replace: "* $1$2"
|
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
|
// this is necessary for GollumEditor to pick this up
|
||||||
jQuery.GollumEditor.defineLanguage('markdown', MarkDown);
|
jQuery.GollumEditor.defineLanguage('markdown', MarkDown);
|
||||||
Reference in New Issue
Block a user