From b1936b8fc760a7ed997bd65bfe942b4ba31480e4 Mon Sep 17 00:00:00 2001 From: tundebabzy Date: Mon, 29 May 2017 12:51:44 +0100 Subject: [PATCH] Issue with ToDo WYSIWG area (#3374) (fixes frappe/erpnext#7773) * fixes #7773: Issue with ToDo WYSIWG area --- frappe/public/js/frappe/form/control.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frappe/public/js/frappe/form/control.js b/frappe/public/js/frappe/form/control.js index 52c13aa6d2..a6981d437a 100755 --- a/frappe/public/js/frappe/form/control.js +++ b/frappe/public/js/frappe/form/control.js @@ -1647,6 +1647,15 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({ prettifyHtml: true, dialogsInBody: true, callbacks: { + onInit: function() { + // firefox hack that puts the caret in the wrong position + // when div is empty. To fix, seed with a
. + // See https://bugzilla.mozilla.org/show_bug.cgi?id=550434 + $(".note-editable[contenteditable='true']").on('focus', function(){ + var $this = $(this); + $this.html( $this.html() + '
' ); + }); + }, onChange: function(value) { me.parse_validate_and_set_in_model(value); },