-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Markdown and OrderedList blocks. Remove old heading block.
- Loading branch information
Showing
4 changed files
with
96 additions
and
127 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
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,48 @@ | ||
/* | ||
Text Block | ||
Markdown Block | ||
*/ | ||
|
||
var md_template = '<div class="expanding-textarea"><pre><span></span><br></pre><textarea class="required <%= className %>"></textarea></div>'; | ||
|
||
SirTrevor.Blocks.Markdown = SirTrevor.Block.extend({ | ||
|
||
title: "Markdown", | ||
className: "markdown", | ||
|
||
editorHTML: function() { | ||
return _.template(md_template, this); | ||
}, | ||
|
||
loadData: function(data){ | ||
this.$$('.markdown').html(data.text); | ||
}, | ||
|
||
onBlockRender: function(){ | ||
/* Make our expanding text area */ | ||
|
||
var cont = this.$$('.expanding-textarea'), | ||
area = cont.find('textarea'), | ||
span = cont.find('span'); | ||
|
||
area.bind('input', function(){ | ||
span.text(area.val()); | ||
}); | ||
|
||
cont.addClass('active'); | ||
}, | ||
|
||
toData: function() { | ||
var bl = this.$el, | ||
dataObj = {} | ||
|
||
dataObj.text = this.$$('.markdown').val(); | ||
|
||
this.setData(dataObj) | ||
} | ||
}); | ||
SirTrevor.Blocks.Markdown = (function(){ | ||
|
||
var md_template = _.template([ | ||
'<div class="expanding-textarea">', | ||
'<pre><span></span><br></pre>', | ||
'<textarea class="st-markdown st-required"></textarea>', | ||
'</div>' | ||
].join("\n")); | ||
|
||
return SirTrevor.Block.extend({ | ||
|
||
type: "Markdown", | ||
|
||
editorHTML: function() { | ||
return md_template(this); | ||
}, | ||
|
||
loadData: function(data){ | ||
this.$('.st-markdown').html(data.text); | ||
}, | ||
|
||
onBlockRender: function() { | ||
/* Make our expanding text area */ | ||
var cont = this.$('.expanding-textarea'), | ||
area = cont.find('textarea'), | ||
span = cont.find('span'); | ||
|
||
area.bind('input', function(){ | ||
span.text(area.val()); | ||
}); | ||
|
||
cont.addClass('active'); | ||
}, | ||
|
||
toData: function() { | ||
var dataObj = {}; | ||
|
||
dataObj.text = this.$('.st-markdown').val(); | ||
this.setData(dataObj); | ||
} | ||
|
||
}); | ||
|
||
})(); |
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