From 6ee3a6a6eb5141626e3bfc63a3323fbf525145e0 Mon Sep 17 00:00:00 2001
From: Snater <git@snater.com>
Date: Mon, 1 Jan 2024 15:41:20 +0100
Subject: [PATCH] Issue #3402009 by Snater: Can't Insert images into textareas
 after Drupal 10 upgrade

---
 js/FocusManager.js     | 4 ++++
 js/editors/CKEditor.js | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/js/FocusManager.js b/js/FocusManager.js
index bd9e362..c62709f 100644
--- a/js/FocusManager.js
+++ b/js/FocusManager.js
@@ -183,6 +183,10 @@
           return currentEditorInstance;
         }
 
+        if (this._$textareas.length) {
+          return this._$textareas.get(0);
+        }
+
         return null;
       }
 
diff --git a/js/editors/CKEditor.js b/js/editors/CKEditor.js
index acd14bc..066ed4b 100644
--- a/js/editors/CKEditor.js
+++ b/js/editors/CKEditor.js
@@ -62,7 +62,7 @@
        * @inheritDoc
        */
       getCurrentInstance: function() {
-        return CKEDITOR.currentInstance;
+        return CKEDITOR?.currentInstance;
       },
 
       /**
-- 
GitLab