Skip to content

Commit

Permalink
Fixing markdown block's toData, adding Header block
Browse files Browse the repository at this point in the history
  • Loading branch information
andflett committed Oct 16, 2012
1 parent 60e5e3e commit 1444128
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/heading.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
A generic heading block level element
*/

SirTrevor.Blocks.Heading = SirTrevor.Block.extend({

title: "Heading",
className: "heading",
limit: 0,
toolbarEnabled: true,
dropEnabled: false,
formattingEnabled: false,

editorHTML: function() {
return _.template('<h2 class="required text-block <%= className %>" contenteditable="true"></h2>', this);
},

loadData: function(data){
this.$$('.text-block').html(data.text);
}

});
6 changes: 4 additions & 2 deletions src/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ SirTrevor.Blocks.Markdown = SirTrevor.Block.extend({

toData: function() {
var bl = this.$el,
dataStruct = bl.data('block');
dataObj = {}

dataStruct.data.text = this.$$('.markdown').val();
dataObj.text = this.$$('.markdown').val();

this.setData(dataObj)
}
});

0 comments on commit 1444128

Please sign in to comment.