Skip to content

Commit f744066

Browse files
committed
Fix issue with inability to type 's' character in wysiwyg editor
1 parent fa0e4b5 commit f744066

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/javascript/src/admin/main.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ $(document).on("ready page:load turbolinks:load", function () {
1818
$(window).on("keydown", (evt) => {
1919
// <input>, <textarea>, or the mailer input field
2020
if (
21-
$("input").is(":focus") ||
22-
$("textarea").is(":focus") ||
23-
document.getElementById("editor")?.contains(document.activeElement)
21+
document.activeElement &&
22+
(["input", "textarea"].includes(
23+
document.activeElement.tagName.toLowerCase(),
24+
) ||
25+
document.activeElement.isContentEditable)
2426
) {
2527
// Cancel if any inputs are selected
2628
return;

app/javascript/src/admin/members.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ $(document).on("ready page:load turbolinks:load", function () {
1515
$(window).on("keydown", (evt) => {
1616
// <input>, <textarea>, or the mailer input field
1717
if (
18-
$("input").is(":focus") ||
19-
$("textarea").is(":focus") ||
20-
document.getElementById("editor")?.contains(document.activeElement)
18+
document.activeElement &&
19+
(["input", "textarea"].includes(
20+
document.activeElement.tagName.toLowerCase(),
21+
) ||
22+
document.activeElement.isContentEditable)
2123
) {
2224
// Cancel if any inputs are selected
2325
return;

0 commit comments

Comments
 (0)