diff options
Diffstat (limited to 'app/assets/javascripts/lib/utils/text_utility.js')
-rw-r--r-- | app/assets/javascripts/lib/utils/text_utility.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/app/assets/javascripts/lib/utils/text_utility.js b/app/assets/javascripts/lib/utils/text_utility.js index b6636de5767..d761a844be9 100644 --- a/app/assets/javascripts/lib/utils/text_utility.js +++ b/app/assets/javascripts/lib/utils/text_utility.js @@ -29,6 +29,7 @@ lineBefore = this.lineBefore(text, textArea); lineAfter = this.lineAfter(text, textArea); if (lineBefore === blockTag && lineAfter === blockTag) { + // To remove the block tag we have to select the line before & after if (blockTag != null) { textArea.selectionStart = textArea.selectionStart - (blockTag.length + 1); textArea.selectionEnd = textArea.selectionEnd + (blockTag.length + 1); @@ -63,11 +64,11 @@ if (!inserted) { try { document.execCommand("ms-beginUndoUnit"); - } catch (undefined) {} + } catch (error) {} textArea.value = this.replaceRange(text, textArea.selectionStart, textArea.selectionEnd, insertText); try { document.execCommand("ms-endUndoUnit"); - } catch (undefined) {} + } catch (error) {} } return this.moveCursor(textArea, tag, wrap); }; |