diff --git a/public/js/wn/model/meta.js b/public/js/wn/model/meta.js index b98d7ffa71..355b3d6b5a 100644 --- a/public/js/wn/model/meta.js +++ b/public/js/wn/model/meta.js @@ -93,13 +93,8 @@ $.extend(wn.meta, { }, get_print_formats: function(doctype) { - // if default print format is given, use it - var print_format_list = []; - if(locals.DocType[doctype].default_print_format) - print_format_list.push(locals.DocType[doctype].default_print_format) - - if(!in_list(print_format_list, "Standard")) - print_format_list.push("Standard"); + var print_format_list = ["Standard"]; + var default_print_format = locals.DocType[doctype].default_print_format; var print_formats = wn.model.get("Print Format", {doc_type: doctype}) .sort(function(a, b) { return (a > b) ? 1 : -1; }); @@ -107,6 +102,12 @@ $.extend(wn.meta, { if(!in_list(print_format_list, d.name)) print_format_list.push(d.name); }); + + if(default_print_format && default_print_format != "Standard") { + var index = print_format_list.indexOf(default_print_format) - 1; + print_format_list.sort().splice(index, 1); + print_format_list.unshift(default_print_format); + } return print_format_list; }, diff --git a/public/js/wn/ui/editor.js b/public/js/wn/ui/editor.js index c1d6d705b5..e2574f125b 100644 --- a/public/js/wn/ui/editor.js +++ b/public/js/wn/ui/editor.js @@ -125,7 +125,7 @@ bsEditor = Class.extend({ clean_html: function() { var html = this.editor.html() || ""; - if(!strip(this.editor.text())) html = ""; + if(!strip(this.editor.text()) && !(this.editor.find("img"))) html = ""; // html = html.replace(/(
|\s|

<\/div>| )*$/, ''); // remove custom typography (use CSS!)