Skip to content

Commit

Permalink
Rebase patch from gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
toopay committed Jul 13, 2013
1 parent 46ac996 commit 6d72857
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bootstrap-markdown",
"version": "1.1.1",
"version": "1.1.2",
"main": ["./js/bootstrap-markdown.js", "./css/bootstrap-markdown.min.css"],
"dependencies": {
"bootstrap": "~2.3.0"
Expand Down
20 changes: 3 additions & 17 deletions js/bootstrap-markdown.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* ===================================================
* bootstrap-markdown.js v1.1.1
* bootstrap-markdown.js v1.1.2
* http://github.com/toopay/bootstrap-markdown
* ===================================================
* Copyright 2013 Taufan Aditya
Expand Down Expand Up @@ -30,7 +30,6 @@
this.$ns = 'bootstrap-markdown'
this.$element = $(element)
this.$editable = {el:null, type:null,attrKeys:[], attrValues:[], content:null}
this.$cloneEditor = {el:null, type:null,attrKeys:[], attrValues:[], content:null}
this.$options = $.extend(true, {}, $.fn.markdown.defaults, options)
this.$oldContent = null
this.$isPreview = false
Expand Down Expand Up @@ -298,26 +297,13 @@
container = this.$textarea,
afterContainer = container.next(),
replacementContainer = $('<div/>',{'class':'md-preview','data-provider':'markdown-preview'}),
cloneEditor = this.$cloneEditor,
content

// Give flag that tell the editor enter preview mode
this.$isPreview = true
// Disable all buttons
this.disableButtons('all').enableButtons('cmdPreview')

// Save the editor
cloneEditor.el = container
cloneEditor.type = container.prop('tagName').toLowerCase()
cloneEditor.content = container.val()

$(container[0].attributes).each(function(){
cloneEditor.attrKeys.push(this.nodeName)
cloneEditor.attrValues.push(this.nodeValue)
})

this.$cloneEditor = cloneEditor

if (typeof callbackContent == 'string') {
// Set the content based by callback content
content = callbackContent
Expand All @@ -331,7 +317,7 @@

if (afterContainer && afterContainer.attr('class') == 'md-footer') {
// If there is footer element, insert the preview container before it
replacementContainer.insertBefore('.md-footer')
replacementContainer.insertBefore(afterContainer)
} else {
// Otherwise, just append it after textarea
container.parent().append(replacementContainer)
Expand Down Expand Up @@ -371,7 +357,7 @@
}

, getContent: function() {
return (this.$isPreview) ? this.$cloneEditor.content : this.$textarea.val()
return this.$textarea.val()
}

, setContent: function(content) {
Expand Down

0 comments on commit 6d72857

Please sign in to comment.