From e4fb5b75931c42a20446f101e8a0f592e4c30b94 Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Tue, 28 Jan 2014 12:12:58 +0530 Subject: [PATCH 1/2] webnotes/erpnext#1348 alphabetically listing of print formats --- public/js/wn/model/meta.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) 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; }, From 12960331d0234394f0c981e542f8820e1722b93d Mon Sep 17 00:00:00 2001 From: Akhilesh Darjee Date: Thu, 30 Jan 2014 12:14:34 +0530 Subject: [PATCH 2/2] ignored image for cleanup html in text editor --- public/js/wn/ui/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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!)