Add focus id to text editor
This commit is contained in:
parent
49b154c048
commit
46c745be2c
1 changed files with 17 additions and 0 deletions
|
|
@ -63,6 +63,16 @@ pub use text::editor::{
|
||||||
Action, Cursor, Edit, Line, LineEnding, Motion, Position, Selection,
|
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<widget::Id> for Id {
|
||||||
|
fn from(value: widget::Id) -> Self {
|
||||||
|
Id(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// A multi-line text input.
|
/// A multi-line text input.
|
||||||
///
|
///
|
||||||
/// # Example
|
/// # Example
|
||||||
|
|
@ -1096,6 +1106,13 @@ where
|
||||||
|
|
||||||
operation.focusable(self.id.as_ref(), layout.bounds(), state);
|
operation.focusable(self.id.as_ref(), layout.bounds(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn id(&self) -> Option<widget::Id> {
|
||||||
|
self.id.clone()
|
||||||
|
}
|
||||||
|
fn set_id(&mut self, id: widget::Id) {
|
||||||
|
self.id = Some(id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a, Highlighter, Message, Theme, Renderer>
|
impl<'a, Highlighter, Message, Theme, Renderer>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue