pub struct RichTextEditor { /* private fields */ }Expand description
Rich text editor widget
Implementations§
Source§impl RichTextEditor
impl RichTextEditor
Sourcepub fn from_markdown(self, markdown: impl Into<String>) -> Self
pub fn from_markdown(self, markdown: impl Into<String>) -> Self
Set content from markdown
Sourcepub fn set_content(&mut self, text: &str)
pub fn set_content(&mut self, text: &str)
Set content (mutable)
Sourcepub fn get_content(&self) -> String
pub fn get_content(&self) -> String
Get plain text content
Sourcepub fn to_markdown(&self) -> String
pub fn to_markdown(&self) -> String
Export as markdown
Sourcepub fn view_mode(self, mode: EditorViewMode) -> Self
pub fn view_mode(self, mode: EditorViewMode) -> Self
Set view mode
Sourcepub fn cursor_position(&self) -> (usize, usize)
pub fn cursor_position(&self) -> (usize, usize)
Get cursor position
Sourcepub fn set_cursor(&mut self, block: usize, col: usize)
pub fn set_cursor(&mut self, block: usize, col: usize)
Set cursor position
Sourcepub fn block_count(&self) -> usize
pub fn block_count(&self) -> usize
Get block count
Sourcepub fn move_right(&mut self)
pub fn move_right(&mut self)
Move cursor right
Sourcepub fn move_document_start(&mut self)
pub fn move_document_start(&mut self)
Move to document start
Sourcepub fn move_document_end(&mut self)
pub fn move_document_end(&mut self)
Move to document end
Sourcepub fn start_selection(&mut self)
pub fn start_selection(&mut self)
Start selection
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear selection
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if there’s a selection
Sourcepub fn get_selection(&self) -> Option<String>
pub fn get_selection(&self) -> Option<String>
Get selected text
Sourcepub fn delete_selection(&mut self)
pub fn delete_selection(&mut self)
Delete selection
Sourcepub fn insert_char(&mut self, ch: char)
pub fn insert_char(&mut self, ch: char)
Insert character at cursor
Sourcepub fn insert_str(&mut self, s: &str)
pub fn insert_str(&mut self, s: &str)
Insert string at cursor
Sourcepub fn delete_char_before(&mut self)
pub fn delete_char_before(&mut self)
Delete character before cursor
Sourcepub fn delete_char_at(&mut self)
pub fn delete_char_at(&mut self)
Delete character at cursor
Sourcepub fn delete_block(&mut self)
pub fn delete_block(&mut self)
Delete current block
Sourcepub fn toggle_bold(&mut self)
pub fn toggle_bold(&mut self)
Toggle bold format
Sourcepub fn toggle_italic(&mut self)
pub fn toggle_italic(&mut self)
Toggle italic format
Sourcepub fn toggle_underline(&mut self)
pub fn toggle_underline(&mut self)
Toggle underline format
Sourcepub fn toggle_strikethrough(&mut self)
pub fn toggle_strikethrough(&mut self)
Toggle strikethrough format
Sourcepub fn toggle_code(&mut self)
pub fn toggle_code(&mut self)
Toggle code format
Sourcepub fn current_format(&self) -> TextFormat
pub fn current_format(&self) -> TextFormat
Get current format
Sourcepub fn set_block_type(&mut self, block_type: BlockType)
pub fn set_block_type(&mut self, block_type: BlockType)
Set block type for current block
Sourcepub fn current_block_type(&self) -> BlockType
pub fn current_block_type(&self) -> BlockType
Get current block type
Sourcepub fn open_link_dialog(&mut self)
pub fn open_link_dialog(&mut self)
Open link dialog
Sourcepub fn open_image_dialog(&mut self)
pub fn open_image_dialog(&mut self)
Open image dialog
Sourcepub fn is_dialog_open(&self) -> bool
pub fn is_dialog_open(&self) -> bool
Check if dialog is open
Sourcepub fn close_dialog(&mut self)
pub fn close_dialog(&mut self)
Close dialog
Sourcepub fn insert_link(&mut self, text: &str, url: &str)
pub fn insert_link(&mut self, text: &str, url: &str)
Insert link at cursor
Sourcepub fn insert_image(&mut self, alt: &str, src: &str)
pub fn insert_image(&mut self, alt: &str, src: &str)
Insert image at cursor
Sourcepub fn toolbar_action(&mut self, action: ToolbarAction)
pub fn toolbar_action(&mut self, action: ToolbarAction)
Execute toolbar action
Sourcepub fn process_markdown_shortcuts(&mut self)
pub fn process_markdown_shortcuts(&mut self)
Process markdown shortcuts (called after typing space)
Sourcepub fn handle_key(&mut self, key: &Key) -> bool
pub fn handle_key(&mut self, key: &Key) -> bool
Handle keyboard input
Trait Implementations§
Source§impl Default for RichTextEditor
impl Default for RichTextEditor
Source§impl StyledView for RichTextEditor
impl StyledView for RichTextEditor
Source§fn remove_class(&mut self, class: &str)
fn remove_class(&mut self, class: &str)
Source§fn toggle_class(&mut self, class: &str)
fn toggle_class(&mut self, class: &str)
Source§impl View for RichTextEditor
impl View for RichTextEditor
Source§fn meta(&self) -> WidgetMeta
fn meta(&self) -> WidgetMeta
Source§fn render(&self, ctx: &mut RenderContext<'_>)
fn render(&self, ctx: &mut RenderContext<'_>)
Source§fn widget_type(&self) -> &'static str
fn widget_type(&self) -> &'static str
Auto Trait Implementations§
impl Freeze for RichTextEditor
impl RefUnwindSafe for RichTextEditor
impl Send for RichTextEditor
impl Sync for RichTextEditor
impl Unpin for RichTextEditor
impl UnwindSafe for RichTextEditor
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> 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<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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().