pub struct Content { /* private fields */ }Available on crate feature
rich-text-editor only.Expand description
A rich text document with its selection and undo history.
The app keeps a Content in its state, shows it with
rich_text_editor and applies each
Action the editor sends with perform, as with
iced’s own text editor.
Implementations§
Source§impl Content
impl Content
pub fn new() -> Self
Sourcepub fn with_html(html: &str) -> Self
pub fn with_html(html: &str) -> Self
HTML, such as a saved draft, read with html::from_html.
pub fn with_document(document: Document) -> Self
pub fn document(&self) -> &Document
pub fn selection(&self) -> Selection
Sourcepub fn revision(&self) -> u64
pub fn revision(&self) -> u64
Counts every change to the document, so views can tell when to lay it out again.
Sourcepub fn link_requests(&self) -> u64
pub fn link_requests(&self) -> u64
How many times the link shortcut has been pressed, so a toolbar can open its address field on a new request.
Sourcepub fn html(&self) -> String
pub fn html(&self) -> String
The document as an HTML fragment, see html::to_html.
Sourcepub fn plain_text(&self) -> String
pub fn plain_text(&self) -> String
The plain-text alternative, see plain::to_plain.
pub fn is_empty(&self) -> bool
Sourcepub fn has_formatting(&self) -> bool
pub fn has_formatting(&self) -> bool
Whether the document has any formatting, see
Document::has_formatting.
Sourcepub fn selected_text(&self) -> String
pub fn selected_text(&self) -> String
The selected text without formatting.
Sourcepub fn typing_style(&self) -> Style
pub fn typing_style(&self) -> Style
The style text typed at the caret takes.
pub fn formatting(&self) -> Formatting
Trait Implementations§
Auto Trait Implementations§
impl Forget for Content
impl Freeze for Contentwhere
*const u8 is !null: Freeze,
PhantomData<Block>: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
PhantomData<Change>: Freeze,
PhantomData<u8>: Freeze,
impl Move for Content
impl RefUnwindSafe for Content
impl Send for Content
impl Sync for Content
impl Unpin for Content
impl UnsafeUnpin for Contentwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Block>: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
PhantomData<Change>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
impl UnwindSafe for Content
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Turns some type into the initial state of some
Application.