From 28dcee225d495f8c0a2210d2126b8c7599ba9270 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 20 Nov 2015 10:53:56 +0100 Subject: [PATCH] Fixed inline translations with &, < and > issues. --- .../app/controllers/widget/translation_inline.coffee | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/app/controllers/widget/translation_inline.coffee b/app/assets/javascripts/app/controllers/widget/translation_inline.coffee index 3ddb65a8e..a6eeaa8d1 100644 --- a/app/assets/javascripts/app/controllers/widget/translation_inline.coffee +++ b/app/assets/javascripts/app/controllers/widget/translation_inline.coffee @@ -34,7 +34,7 @@ class Widget extends App.Controller $('body') .on 'focus.translation', '.translation', (e) -> element = $(e.target) - element.data 'before', element.html() + element.data 'before', element.text() element .on 'blur.translation', '.translation', (e) => console.log('blur') @@ -42,12 +42,7 @@ class Widget extends App.Controller source = element.attr('title') # get new translation - translation_new = element.html() - translation_new = ('' + translation_new) - .replace(/<.+?>/g, '') - - # set new translation - element.html(translation_new) + translation_new = element.text() # update translation return if element.data('before') is translation_new @@ -58,7 +53,7 @@ class Widget extends App.Controller App.i18n.setMap(source, translation_new) # replace rest in page - $(".translation[title='#{source}']").html(translation_new) + $(".translation[title='#{source}']").text(translation_new) # update permanent translation mapString translation = App.Translation.findByAttribute('source', source)