From 14441289dc6f48f696f9799c4e8f85e545f0af84 Mon Sep 17 00:00:00 2001 From: Andrew Sprinz Date: Tue, 16 Oct 2012 22:54:31 +0100 Subject: [PATCH] Fixing markdown block's toData, adding Header block --- src/heading.js | 22 ++++++++++++++++++++++ src/markdown.js | 6 ++++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/heading.js diff --git a/src/heading.js b/src/heading.js new file mode 100644 index 0000000..b600119 --- /dev/null +++ b/src/heading.js @@ -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('

', this); + }, + + loadData: function(data){ + this.$$('.text-block').html(data.text); + } + +}); \ No newline at end of file diff --git a/src/markdown.js b/src/markdown.js index e2eecd4..ca6272c 100644 --- a/src/markdown.js +++ b/src/markdown.js @@ -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) } }); \ No newline at end of file