mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 11:55:03 +03:00
🐛 Fixed slash not working in Koenig link editor (#19198)
fixes ADM-43 https://github.com/TryGhost/Product/issues/4213 - The slash '/' search was firing when it wasn't suppose to, eg via the URL editor inside the minimal koenig editors. - this fix makes sure that if any input field has focus, that the slash search function doesn't get fired.
This commit is contained in:
parent
c07218dff4
commit
6983699e1a
@ -40,6 +40,11 @@ const Sidebar: React.FC = () => {
|
||||
// Focus in on search field when pressing "/"
|
||||
useEffect(() => {
|
||||
const handleKeyPress = (e: KeyboardEvent) => {
|
||||
// ensures it doesn't fire when typing in a text field, particularly useful for the Koenig Editor.
|
||||
if (e.target instanceof HTMLElement &&
|
||||
(e.target.nodeName === 'INPUT' || e.target.nodeName === 'TEXTAREA' || e.target.isContentEditable)) {
|
||||
return;
|
||||
}
|
||||
if (e.key === '/' && !isAnyTextFieldFocused) {
|
||||
e?.preventDefault();
|
||||
if (searchInputRef.current) {
|
||||
|
Loading…
Reference in New Issue
Block a user