translation: stopPropagation on clicks inline on element

This commit is contained in:
Felix Niklas 2015-11-19 16:19:02 +01:00
parent 2c93b1c57d
commit db0b434eb6
3 changed files with 2 additions and 6 deletions

View file

@ -16,14 +16,9 @@ class Widget
enable: -> enable: ->
App.Config.set( 'translation_inline', true ) App.Config.set( 'translation_inline', true )
App.Event.trigger('ui:rerender') App.Event.trigger('ui:rerender')
$(document).bind('click.block', (e) ->
e.preventDefault()
e.stopPropagation()
)
disable: -> disable: ->
App.Config.set( 'translation_inline', false ) App.Config.set( 'translation_inline', false )
App.Event.trigger('ui:rerender') App.Event.trigger('ui:rerender')
$(document).unbind('click.block')
App.Config.set( 'translation_inline', Widget, 'Widgets' ) App.Config.set( 'translation_inline', Widget, 'Widgets' )

View file

@ -224,7 +224,7 @@ class _i18nSingleton extends Spine.Module
translateContent: (string, args) => translateContent: (string, args) =>
if App.Config.get('translation_inline') if App.Config.get('translation_inline')
return '<span class="translation" contenteditable="true" title="' + App.Utils.htmlEscape(string) + '">' + App.Utils.htmlEscape(@translate(string)) + '</span>' return '<span class="translation" onclick="arguments[0].stopPropagation(); return false" contenteditable="true" title="' + App.Utils.htmlEscape(string) + '">' + App.Utils.htmlEscape(@translate(string)) + '</span>'
translated = App.Utils.htmlEscape(@translate(string, args)) translated = App.Utils.htmlEscape(@translate(string, args))

View file

@ -2558,6 +2558,7 @@ footer {
.translation { .translation {
border: 1px dotted #F92; border: 1px dotted #F92;
border-radius: 3px; border-radius: 3px;
cursor: text;
} }
.translation:hover { .translation:hover {
} }