From 5d2dd18ddda96ce91e60affcdf601587cc3b1a8a Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Mon, 27 Mar 2017 16:47:20 +0530 Subject: [PATCH] [summernote] Trigger change event in code view --- frappe/public/js/lib/summernote/summernote.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/frappe/public/js/lib/summernote/summernote.js b/frappe/public/js/lib/summernote/summernote.js index b5f1c67963..894a361584 100755 --- a/frappe/public/js/lib/summernote/summernote.js +++ b/frappe/public/js/lib/summernote/summernote.js @@ -4771,6 +4771,15 @@ $editor.addClass('codeview'); $codable.focus(); + $codable.on('keyup', function () { + var value = $codable.val(); + var isChange = $editable.html() !== value; + + if (isChange) { + context.triggerEvent('change', value, $editable); + } + }); + // activate CodeMirror as codable if (agent.hasCodeMirror) { var cmEditor = CodeMirror.fromTextArea($codable[0], options.codemirror);