From 3f330a258892ebb14f21c4fdb1573cdf9b7bf499 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 10 Oct 2014 12:00:26 +0200 Subject: [PATCH] IE workarounds, insertHTML is not possible. --- .../app/lib/base/jquery.textmodule.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index 25e4bd663..04ebdc467 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -166,7 +166,13 @@ // get cursor position Plugin.prototype.getCaretPosition = function() { - document.execCommand('insertHTML', false, ''); + // not needed on IE + if (document.selection) { + return + } + else { + document.execCommand('insertHTML', false, '') + } var hiddenNode = document.getElementById('hidden'); if (!hiddenNode) { return 0; @@ -226,7 +232,13 @@ if ( item.id == id ) { var content = item.content + "\n" this.cutInput() - document.execCommand('insertHTML', false, content) + if (document.selection) { + var range = document.selection.createRange() + range.pasteHTML(content) + } + else { + document.execCommand('insertHTML', false, content) + } this.close() return }