From 402d4be9f9f6ba42417f26aa9fca18339dd4514c Mon Sep 17 00:00:00 2001 From: Jared Hancock <jared@osticket.com> Date: Thu, 28 Aug 2014 14:03:41 -0500 Subject: [PATCH] html: Fix dropped text after inserted image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On some setups, IE v10 on Windows 7 at least, text added to the Redactor editor after an image is inserted (via the image popup dialog for instance), will not be retrieved via the ::get() method and so will not be submitted with the form submit button. This patch introduces a workaround by manually calling ::sync() for the Redactor when the submit button is pressed — just before the form is submitted. --- include/staff/ticket-view.inc.php | 2 +- js/redactor-osticket.js | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index bfef5605e..cf059b279 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -720,9 +720,9 @@ $tcount+= $ticket->getNumNotes(); }?> </select> <span class='error'>* <?php echo $errors['state']; ?></span> + </div> </td> </tr> - </div> </table> <p style="padding-left:165px;"> diff --git a/js/redactor-osticket.js b/js/redactor-osticket.js index 48d6a4597..b181aeca4 100644 --- a/js/redactor-osticket.js +++ b/js/redactor-osticket.js @@ -255,6 +255,13 @@ $(function() { el.redactor('set', '', false, false); }); } + $('input[type=submit]', el.closest('form')).on('click', function() { + // Some setups (IE v10 on Windows 7 at least) seem to have a bug + // where Redactor does not sync properly after adding an image. + // Therefore, the ::get() call will not include text added after + // the image was inserted. + el.redactor('sync'); + }); if (el.hasClass('draft')) { el.closest('form').append($('<input type="hidden" name="draft_id"/>')); options['plugins'].push('draft'); -- GitLab