pub struct TextInputManager {
pub pending_changeset: Option<PendingTextEdit>,
pub input_source: Option<TextInputSource>,
}Expand description
Text Input Manager
Centralizes all text editing logic. This is the single source of truth for text input state.
Fields§
§pending_changeset: Option<PendingTextEdit>The pending text changeset that hasn’t been applied yet. This is set during the “record” phase and cleared after the “apply” phase.
input_source: Option<TextInputSource>Source of the current text input
Implementations§
Source§impl TextInputManager
impl TextInputManager
Sourcepub fn record_input(
&mut self,
node: DomNodeId,
inserted_text: String,
old_text: String,
source: TextInputSource,
) -> DomNodeId
pub fn record_input( &mut self, node: DomNodeId, inserted_text: String, old_text: String, source: TextInputSource, ) -> DomNodeId
Record a text input event (Phase 1)
This ONLY records what text was inserted. It does NOT apply the changes yet.
The changes are applied later in apply_changeset() if preventDefault is not set.
§Arguments
node- The DOM node being editedinserted_text- The text being insertedold_text- The current text before the editsource- Where the input came from (keyboard, IME, A11y, etc.)
Returns the affected node for event generation.
Sourcepub fn get_pending_changeset(&self) -> Option<&PendingTextEdit>
pub fn get_pending_changeset(&self) -> Option<&PendingTextEdit>
Get the pending changeset (if any)
Sourcepub fn clear_changeset(&mut self)
pub fn clear_changeset(&mut self)
Clear the pending changeset
This is called after applying the changeset or if preventDefault was set.
Sourcepub fn has_pending_changeset(&self) -> bool
pub fn has_pending_changeset(&self) -> bool
Check if there’s a pending changeset that needs to be applied
Trait Implementations§
Source§impl Default for TextInputManager
impl Default for TextInputManager
Source§impl EventProvider for TextInputManager
impl EventProvider for TextInputManager
Source§fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
fn get_pending_events(&self, timestamp: Instant) -> Vec<SyntheticEvent>
Get pending text input events.
If there’s a pending changeset, returns an Input event for the affected node. The event data includes the old text and inserted text so callbacks can query the changeset.
Auto Trait Implementations§
impl Freeze for TextInputManager
impl RefUnwindSafe for TextInputManager
impl Send for TextInputManager
impl Sync for TextInputManager
impl Unpin for TextInputManager
impl UnwindSafe for TextInputManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more