From: Alexander Ebert Date: Wed, 7 Sep 2016 13:11:39 +0000 (+0200) Subject: Improved caret click handler X-Git-Tag: 3.0.0_Beta_1~269 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=64a108c49143c2a555fc7815786686b4727241bd;p=GitHub%2FWoltLab%2FWCF.git Improved caret click handler --- 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