diff --git a/widget/src/text_editor.rs b/widget/src/text_editor.rs index ceddb89a..b0e279a3 100644 --- a/widget/src/text_editor.rs +++ b/widget/src/text_editor.rs @@ -63,6 +63,16 @@ pub use text::editor::{ Action, Cursor, Edit, Line, LineEnding, Motion, Position, Selection, }; +/// The identifier of a [`TextEditor`]. +#[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct Id(widget::Id); + +impl From for Id { + fn from(value: widget::Id) -> Self { + Id(value) + } +} + /// A multi-line text input. /// /// # Example @@ -1096,6 +1106,13 @@ where operation.focusable(self.id.as_ref(), layout.bounds(), state); } + + fn id(&self) -> Option { + self.id.clone() + } + fn set_id(&mut self, id: widget::Id) { + self.id = Some(id); + } } impl<'a, Highlighter, Message, Theme, Renderer>