From 68828e1a5351a2f2f9cbf8e9d98544b2647af447 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 30 Jul 2018 14:35:40 +1000 Subject: [PATCH] Bug 21131: Remove the TinyMCE.isDirty() check that caused unexpected behaviour When using the WYSIWYG editor for system preferences, the editor only updates the textarea element if the content is different from the original content. This means if you change a system preference and then change it back to the original content, the textarea will have the 2nd last change you made. This patch removes the TinyMCE.isDirty() check, which was responsible for comparing the original and changed content. Every input/keydown/dragend or TinyMCE command will cause the textarea element to be updated and trigger the input event which causes the "modified" class to be added to the element, so that the system preference can be saved. __TEST PLAN__ _Before applying_ 0. Change "UseWYSIWYGinSystemPreferences" to "Show" 1. Change "opaccredits" to "123a" 2. Click "Save all OPAC preferences" 3. Reload the page 4. Change "opaccredits" to "123" 5. Change "opaccredits" to "123a" 6. Click "Save all OPAC preferences" 7. Reload the page 8. Note that "opaccredits" says "123" _Apply the patch_ _After applying_ 1. Change "opaccredits" to "123a" 2. Change "opaccredits" to "123" 3. Click "Save all OPAC preferences" 4. Reload the page 5. Note that "opaccredits" says "123" (and not "123a") 6. Change "opaccredits" to "1234" 7. Click "Save all OPAC preferences" 8. Reload the page 9. Note that "opaccredits" says "1234" Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens (cherry picked from commit f4cf075fbea353a5cbf11aaead37c92eac8179b2) Signed-off-by: Martin Renvoize (cherry picked from commit 1dfa4318262a908b1df9d8d2454c15a39c84416c) Signed-off-by: Fridolin Somers --- .../prog/en/includes/wysiwyg-systempreferences.inc | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc index 89230df00e..a4a1283b8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/wysiwyg-systempreferences.inc @@ -29,17 +29,13 @@ tinyMCE.init({ -%] tinyMCE.dom.Event.bind(editor.getBody(), 'input keyup dragend', function(e){ - if (ed.isDirty()){ - wysiwyg_change(ed); - } + wysiwyg_change(ed); }); }); // Register change when TinyMCE command returns isDirty() ed.onExecCommand.add(function(ed, cmd, ui, val) { - if (ed.isDirty()){ - wysiwyg_change(ed); - } + wysiwyg_change(ed); }); }, -- 2.39.5