removes a second and useless definition for 'markdownize'
This commit is contained in:
parent
a347637a8e
commit
25bfd478cf
1 changed files with 6 additions and 17 deletions
|
|
@ -1,26 +1,15 @@
|
||||||
var markdownize = function(content) {
|
var markdownize = function(content) {
|
||||||
if (!content) return '';
|
if (!content) return '';
|
||||||
var html = content.split("\n").map($.trim).filter(function(line) {
|
var html = content.split("\n").map($.trim).filter(function(line) {
|
||||||
return line != "";
|
return line != "" ;
|
||||||
}).join("\n");
|
}).join("\n");
|
||||||
return toMarkdown(html);
|
return toMarkdown(html);
|
||||||
};
|
};
|
||||||
|
|
||||||
var converter = new showdown.Converter();
|
var htmlize = function(content) {
|
||||||
var markdownize = function(content) {
|
|
||||||
if (!content) return '';
|
|
||||||
var html = content.split("\n").map($.trim).filter(function(line) {
|
|
||||||
return line != "";
|
|
||||||
}).join("\n");
|
|
||||||
var md = toMarkdown(html);
|
|
||||||
console.log(md);
|
|
||||||
return md;
|
|
||||||
};
|
|
||||||
var htmlize = function(content) {
|
|
||||||
return converter.makeHtml(content);
|
return converter.makeHtml(content);
|
||||||
};
|
};
|
||||||
var updateHtml = function(id,content) {
|
var updateHtml = function(jView,content) {
|
||||||
var jView = jQuery('*[for="'+id+'"]');
|
|
||||||
if (markdownize(jView.html()) === content) {
|
if (markdownize(jView.html()) === content) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -28,7 +17,7 @@ var markdownize = function(content) {
|
||||||
jView.html(html);
|
jView.html(html);
|
||||||
};
|
};
|
||||||
|
|
||||||
var updateMD = function(id,content) {
|
var updateMD = function(id,content) {
|
||||||
if (!content) return jQuery('#'+id).val('') ;
|
if (!content) return jQuery('#'+id).val('') ;
|
||||||
var markdown = markdownize(content);
|
var markdown = markdownize(content);
|
||||||
if (jQuery('#'+id).val() === markdown) {
|
if (jQuery('#'+id).val() === markdown) {
|
||||||
|
|
@ -36,7 +25,7 @@ var markdownize = function(content) {
|
||||||
}
|
}
|
||||||
jQuery('#'+id).val( markdown );
|
jQuery('#'+id).val( markdown );
|
||||||
};
|
};
|
||||||
var onMDModified = ( function (event, data) {
|
var onMDModified = ( function (event, data) {
|
||||||
$('#Submit').addClass('dirty');
|
$('#Submit').addClass('success');
|
||||||
updateMD(this.attributes["for"].value, data.content);
|
updateMD(this.attributes["for"].value, data.content);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue