From 610fad4657efd35f06014e4cee9016696c84b3e6 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Mon, 8 Sep 2014 13:08:52 +0530 Subject: [PATCH] [minor] fixed firefox NS Unexpected Error --- frappe/public/js/frappe/ui/editor.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frappe/public/js/frappe/ui/editor.js b/frappe/public/js/frappe/ui/editor.js index f4d934ca4d..18e61e3605 100644 --- a/frappe/public/js/frappe/ui/editor.js +++ b/frappe/public/js/frappe/ui/editor.js @@ -384,7 +384,15 @@ bsEditorToolbar = Class.extend({ if (this.toolbar) { $(this.toolbar).find('.btn[data-' + this.options.command_role + ']').each(function () { var command = $(this).data(me.options.command_role); - if (document.queryCommandState(command)) { + + // try catch for buggy firefox! + try { + var query_command_state = document.queryCommandState(command); + } catch(e) { + var query_command_state = false; + } + + if (query_command_state) { $(this).addClass(me.options.active_toolbar_class); } else { $(this).removeClass(me.options.active_toolbar_class);