[PHP-WEBMASTER] [web-php] master: Allow "/" when editing code (#1177)

Author: Antoine Bluchet (soyuka)
Committer: GitHub (web-flow)
Pusher: sy-records
Date: 2024-12-04T15:16:25+08:00

Commit: Allow "/" when editing code (#1177) · php/web-php@543eab7 · GitHub
Raw diff: https://github.com/php/web-php/commit/543eab70a4aa940839c238fbcfef35ad288f22bc.diff

Allow "/" when editing code (#1177)

Co-authored-by: Luffy <lufei@php.net>

Changed paths:
  M js/search.js

Diff:

diff --git a/js/search.js b/js/search.js
index ec4ef8fb6c..1cc5447de9 100644
--- a/js/search.js
+++ b/js/search.js
@@ -294,6 +294,10 @@ const initSearchModal = () => {

     // Open when / is pressed
     document.addEventListener("keydown", (event) => {
+ if (event.target.contentEditable === "true") {
+ return;
+ }
+
         if (event.key === "/") {
             show();
             event.preventDefault();