From 64a108c49143c2a555fc7815786686b4727241bd Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 7 Sep 2016 15:11:39 +0200 Subject: [PATCH] Improved caret click handler --- .../js/3rdParty/redactor2/plugins/WoltLabCaret.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js index 829afbf3bd..dbf48ccb27 100644 --- a/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js +++ b/wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js @@ -14,7 +14,7 @@ $.Redactor.prototype.WoltLabCaret = function() { mpAfter.call(this, node); }).bind(this); - this.$editor[0].addEventListener('mouseup', this.WoltLabCaret._handleEditorClick.bind(this)); + this.$editor[0].addEventListener(WCF_CLICK_EVENT, this.WoltLabCaret._handleEditorClick.bind(this)); this.WoltLabCaret._initInternalRange(); }, @@ -132,9 +132,13 @@ $.Redactor.prototype.WoltLabCaret = function() { var mpHtml = this.insert.html; this.insert.html = (function (html, data) { + var hasMarker = elBySel('.redactor-selection-marker', this.$editor[0]); + mpHtml.call(this, html, data); - saveRange(); + if (hasMarker || elBySel('.redactor-selection-marker', this.$editor[0]) === null) { + saveRange(); + } }).bind(this); require(['Environment'], (function (Environment) { @@ -151,10 +155,6 @@ $.Redactor.prototype.WoltLabCaret = function() { }, _handleEditorClick: function (event) { - if (!this.selection.get().isCollapsed) { - return; - } - var block = this.selection.block(); if (block === false) { // check if the caret is now in a

before a -- 2.20.1