From 115f3ce847293ea36f8baafdc12f00859122e814 Mon Sep 17 00:00:00 2001
From: scgm0 <2682963017@qq.com>
Date: Tue, 28 Oct 2025 06:44:28 +0800
Subject: [PATCH] Expose the `TextEdit::get_text_canvas_item` binding
---
doc/classes/TextEdit.xml | 6 ++++++
scene/gui/text_edit.cpp | 1 +
2 files changed, 7 insertions(+)
diff --git a/doc/classes/TextEdit.xml b/doc/classes/TextEdit.xml
index 3cf96b01449d..c2adfa0fd4e0 100644
--- a/doc/classes/TextEdit.xml
+++ b/doc/classes/TextEdit.xml
@@ -678,6 +678,12 @@
Returns the [TextEdit]'s' tab size.
+
+
+
+ Returns the canvas item [RID] for internal drawn text, available for use by [RenderingServer].
+
+
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp
index 16ff66d5687f..0fac24dd2425 100644
--- a/scene/gui/text_edit.cpp
+++ b/scene/gui/text_edit.cpp
@@ -7095,6 +7095,7 @@ Color TextEdit::get_font_color() const {
void TextEdit::_bind_methods() {
/* Text */
// Text properties
+ ClassDB::bind_method(D_METHOD("get_text_canvas_item"), &TextEdit::get_text_canvas_item);
ClassDB::bind_method(D_METHOD("has_ime_text"), &TextEdit::has_ime_text);
ClassDB::bind_method(D_METHOD("cancel_ime"), &TextEdit::cancel_ime);
ClassDB::bind_method(D_METHOD("apply_ime"), &TextEdit::apply_ime);