Exclude the macOS emoji keyboard from keypresses
authorAlexander Ebert <ebert@woltlab.com>
Fri, 22 Apr 2022 15:16:55 +0000 (17:16 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 22 Apr 2022 15:16:55 +0000 (17:16 +0200)
See https://www.woltlab.com/community/thread/295207-hotkey-f%C3%BCr-emoji-men%C3%BC-funktioniert-im-editor-nicht/

wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabKeydown.js

index 6d1ecb9cfd09641d74dcaed3d7606368566de5b4..41bb6d9c2bde559888c28a7a05355fb208885a00 100644 (file)
@@ -15,6 +15,12 @@ $.Redactor.prototype.WoltLabKeydown = function() {
                        var mpInit = this.keydown.init;
                        this.keydown.init = (function (e) {
                                var node;
+
+                               // `Ctrl + Cmd + Space` triggers macOS‘s emoji keyboard
+                               if (e.metaKey && e.ctrlKey && e.key === " ") {
+                                       e.stopImmediatePropagation();
+                                       return;
+                               }
                                
                                // remove empty whitespaces in front of an <img> when backspacing in Firefox
                                if (this.detect.isFirefox() && selection.isCollapsed && e.which === this.keyCode.BACKSPACE) {