diff --git a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js index ed22afb17..8f249606e 100644 --- a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js +++ b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js @@ -133,12 +133,19 @@ return } + newLine = "
" if ( this.options.mode === 'textonly' ) { - document.execCommand('insertHTML', false, "\n") + newLine = "\n" + } + if (document.selection) { + var range = document.selection.createRange() + newLine = "
" // ie is not supporting \n :( + range.pasteHTML(newLine) } else { - document.execCommand('insertHTML', false, '
') + document.execCommand('insertHTML', false, newLine) } + // prevent the default behaviour of return key pressed return false } @@ -275,10 +282,14 @@ // e.altKey // e.ctrlKey // e.metaKey - // on mac block e.ctrlKey + i/b/u + // on mac block e.metaKey + i/b/u if ( !e.altKey && e.metaKey && this.options.richTextFormatKey[ e.keyCode ] ) { return true } + // on win block e.ctrlKey + i/b/u + if ( !e.altKey && e.ctrlKey && this.options.richTextFormatKey[ e.keyCode ] ) { + return true + } return false }