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 const fn get_pending_changeset(&self) -> Option<&PendingTextEdit>
pub const 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.
Trait Implementations§
Source§impl Debug for TextInputManager
impl Debug for TextInputManager
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.
Source§impl NodeIdRemap for TextInputManager
impl NodeIdRemap for TextInputManager
Source§fn remap_node_ids(&mut self, dom: DomId, map: &NodeIdMap)
fn remap_node_ids(&mut self, dom: DomId, map: &NodeIdMap)
Remap the pending (recorded, not-yet-applied) text edit.
If the target node was unmounted between “record” and “apply”, the changeset is dropped: applying it would insert the text into whichever node inherited the index.
Auto Trait Implementations§
impl Freeze for TextInputManager
impl RefUnwindSafe for TextInputManager
impl Send for TextInputManager
impl Sync for TextInputManager
impl Unpin for TextInputManager
impl UnsafeUnpin 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