-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
37408e4
commit dc20224
Showing
325 changed files
with
965 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Created by nivankafonseka on 4/18/15. | ||
*/ | ||
(function($){ | ||
|
||
$.entwine('MarkdownField', function(){ | ||
|
||
function showPreview(dom){ | ||
var holder = $(dom).closest('.field.markdowneditor'); | ||
holder.find('.editor-holder').hide(); | ||
holder.find('.preview-pane').show().html('').addClass('loading'); | ||
holder.find('.markdown-tabs').find('a').removeClass('active'); | ||
$(dom).addClass('active'); | ||
|
||
$.ajax({ | ||
method : "POST", | ||
url : holder.data('preview'), | ||
dataType : "html", | ||
data : { | ||
markdown : holder.find('textarea.markdowneditor').val() | ||
}, | ||
success : function(data){ | ||
holder.find('.preview-pane').html(data).removeClass('loading'); | ||
} | ||
}); | ||
|
||
} | ||
|
||
function showEditor(dom){ | ||
var holder = $(dom).closest('.field.markdowneditor'); | ||
holder.find('.markdown-tabs').find('a').removeClass('active'); | ||
$(dom).addClass('active'); | ||
holder.find('.editor-holder').show(); | ||
holder.find('.preview-pane').hide(); | ||
} | ||
|
||
|
||
$('.field.markdowneditor').entwine({ | ||
|
||
onmatch: function() { | ||
|
||
var textarea = $(this).find('textarea'); | ||
var div = $(this).find('.editor-div'); | ||
var editor = ace.edit(div.attr('id')); | ||
editor.setTheme("ace/theme/github"); | ||
editor.getSession().setMode("ace/mode/markdown"); | ||
|
||
editor.getSession().on('change', function(){ | ||
textarea.val(editor.getSession().getValue()); | ||
}); | ||
|
||
$(this).data('ace', editor); | ||
|
||
} | ||
|
||
}); | ||
|
||
|
||
$('.markdown-tabs').entwine({ | ||
|
||
onmatch: function(){ | ||
$(this).find('a.edit').click(function(){ | ||
showEditor(this); | ||
return false; | ||
}); | ||
|
||
|
||
$(this).find('a.preview').click(function(){ | ||
showPreview(this); | ||
return false; | ||
}); | ||
} | ||
|
||
}); | ||
|
||
|
||
|
||
}); | ||
|
||
|
||
|
||
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,13 @@ | ||
<textarea $AttributesHTML>$Value</textarea> | ||
<div class='markdown-tabs'> | ||
<a href="#edit" class="edit active">Edit</a> | ||
<a href="#preview" class="preview">Preview</a> | ||
|
||
</div> | ||
|
||
<div class="editor-holder"> | ||
<pre id='{$Name}' class="editor-div">{$Value}</pre> | ||
<textarea $AttributesHTML>$Value</textarea> | ||
</div> | ||
<div class="preview-pane"> | ||
|
||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<div id="{$Name}-holder" class="field<% if $extraClass %> $extraClass<% end_if %>" data-preview="{$Link('preview')}"> | ||
<% if $Title %><label class="left" for="$ID">$Title</label><% end_if %> | ||
<div class="middleColumn"> | ||
$Field | ||
</div> | ||
<% if $RightTitle %><label class="right" for="$ID">$RightTitle</label><% end_if %> | ||
<% if $Message %><span class="message $MessageType">$Message</span><% end_if %> | ||
<% if $Description %><span class="description">$Description</span><% end_if %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
language: node_js |
Oops, something went wrong.