diff --git a/editor_modules/editor_code_editor/doc_classes/EditorScriptEditor.xml b/editor_modules/editor_code_editor/doc_classes/EditorScriptEditor.xml
index 0b1d32f2d..86c3be4c5 100644
--- a/editor_modules/editor_code_editor/doc_classes/EditorScriptEditor.xml
+++ b/editor_modules/editor_code_editor/doc_classes/EditorScriptEditor.xml
@@ -25,6 +25,12 @@
+
+
+
+ Returns the underlying [Control] used for editing scripts. For text scripts, this is a [TextEdit].
+
+
diff --git a/editor_modules/editor_code_editor/editor_script_editor.cpp b/editor_modules/editor_code_editor/editor_script_editor.cpp
index e356c6046..bf19c8d50 100644
--- a/editor_modules/editor_code_editor/editor_script_editor.cpp
+++ b/editor_modules/editor_code_editor/editor_script_editor.cpp
@@ -285,6 +285,10 @@ EditorScriptEditorBase *EditorScriptEditor::_get_current_editor() const {
return Object::cast_to(tab_container->get_child(selected));
}
+Control *EditorScriptEditor::_get_base_editor() const {
+ return Object::cast_to(_get_current_editor())->get_code_editor_text_edit();
+}
+
void EditorScriptEditor::_update_history_arrows() {
script_back->set_disabled(history_pos <= 0);
script_forward->set_disabled(history_pos >= history.size() - 1);
@@ -3184,6 +3188,7 @@ void EditorScriptEditor::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_open_scripts"), &EditorScriptEditor::_get_open_scripts);
ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &EditorScriptEditor::open_script_create_dialog);
ClassDB::bind_method(D_METHOD("reload_scripts"), &EditorScriptEditor::reload_scripts);
+ ClassDB::bind_method(D_METHOD("get_base_editor"), &EditorScriptEditor::_get_base_editor);
ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script")));
diff --git a/editor_modules/editor_code_editor/editor_script_editor.h b/editor_modules/editor_code_editor/editor_script_editor.h
index 29204225b..c368a53f8 100644
--- a/editor_modules/editor_code_editor/editor_script_editor.h
+++ b/editor_modules/editor_code_editor/editor_script_editor.h
@@ -294,6 +294,7 @@ class EditorScriptEditor : public PanelContainer {
void _script_created(Ref