Selection changes on mobile were recognized as clicks
authorAlexander Ebert <ebert@woltlab.com>
Thu, 16 Dec 2021 18:08:23 +0000 (19:08 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Thu, 16 Dec 2021 18:08:23 +0000 (19:08 +0100)
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabCaret.js

index 4d2f5a6c586e5384e061f37ac701c3cbc843e220..f2bc1347d1fa5e3328a672b6f5d969e34e70e24c 100644 (file)
@@ -54,8 +54,11 @@ $.Redactor.prototype.WoltLabCaret = function() {
                                        }, { passive: true });
                                        
                                        editor.addEventListener('touchend', (function (event) {
-                                               handleEditorClick(event);
-                                               handleEditorMouseUp(event);
+                                               const selection = window.getSelection();
+                                               if (selection.rangeCount === 0 || selection.isCollapsed) {
+                                                       handleEditorClick(event);
+                                                       handleEditorMouseUp(event);
+                                               }
                                        }).bind(this));
                                }
                                else {