pub struct WebEditor<XMSG> {
pub editor: Editor<XMSG>,
pub is_focused: bool,
/* private fields */
}
Expand description
rename this to WebEditor
Fields§
§editor: Editor<XMSG>
§is_focused: bool
Implementations§
Source§impl<XMSG> WebEditor<XMSG>
impl<XMSG> WebEditor<XMSG>
pub fn from_str(options: Options, content: &str) -> Self
pub fn set_syntax_token(&mut self, syntax_token: &str)
pub fn set_theme(&mut self, theme_name: &str)
pub fn add_on_change_listener<F>(&mut self, f: F)
pub fn add_on_change_notify<F>(&mut self, f: F)
pub fn get_content(&self) -> String
Source§impl<XMSG> WebEditor<XMSG>
impl<XMSG> WebEditor<XMSG>
pub fn set_mouse_cursor(&mut self, mouse_cursor: MouseCursor)
pub fn get_char(&self, loc: Point2<usize>) -> Option<char>
pub fn get_position(&self) -> Point2<usize>
Sourcepub fn rehighlight_visible_lines(&mut self)
pub fn rehighlight_visible_lines(&mut self)
rehighlight from 0 to the end of the visible lines
Sourcepub fn rehighlight_non_visible_lines_in_background(&mut self)
pub fn rehighlight_non_visible_lines_in_background(&mut self)
rehighlight the rest of the lines that are not visible
pub fn keyevent_to_command(ke: &KeyboardEvent) -> Option<Command>
Sourcepub fn process_keypress(&mut self, ke: &KeyboardEvent) -> Effects<Msg, XMSG>
pub fn process_keypress(&mut self, ke: &KeyboardEvent) -> Effects<Msg, XMSG>
make this into keypress to command
pub fn process_commands( &mut self, commands: impl IntoIterator<Item = Command>, ) -> Vec<XMSG>
pub fn highlight_lines( text_edit: &TextEdit, text_highlighter: &mut TextHighlighter, ) -> Vec<Vec<(Style, Vec<Ch>)>>
pub fn process_command(&mut self, command: Command) -> bool
pub fn selected_text(&self) -> Option<String>
pub fn is_selected(&self, loc: Point2<i32>) -> bool
pub fn cut_selected_text(&mut self) -> Option<String>
pub fn clear(&mut self)
pub fn set_selection(&mut self, start: Point2<i32>, end: Point2<i32>)
pub fn copy_selected_text_to_clipboard(&self) -> bool
pub fn cut_selected_text_to_clipboard(&mut self) -> bool
Sourcepub fn bounding_rect(&self) -> Option<(Point2<f32>, Point2<f32>)>
pub fn bounding_rect(&self) -> Option<(Point2<f32>, Point2<f32>)>
calculate the bounding rect of the editor using a DOM call getBoundingClientRect
Sourcepub fn in_bounds(&self, client_x: f32, client_y: f32) -> bool
pub fn in_bounds(&self, client_x: f32, client_y: f32) -> bool
check if this mouse client x and y is inside the editor bounds
pub fn editor_offset(&self) -> Option<Point2<f32>>
Sourcepub fn relative_client(&self, client_x: i32, client_y: i32) -> Point2<i32>
pub fn relative_client(&self, client_x: i32, client_y: i32) -> Point2<i32>
calculate the points relative to the editor bounding box
pub fn total_lines(&self) -> usize
Sourcepub fn client_to_grid(&self, client_x: i32, client_y: i32) -> Point2<i32>
pub fn client_to_grid(&self, client_x: i32, client_y: i32) -> Point2<i32>
convert screen coordinate to grid coordinate taking into account the editor element
Sourcepub fn client_to_grid_clamped(
&self,
client_x: i32,
client_y: i32,
) -> Point2<i32>
pub fn client_to_grid_clamped( &self, client_x: i32, client_y: i32, ) -> Point2<i32>
convert screen coordinate to grid coordinate clamped negative values due to padding in the line number
Sourcepub fn cursor_to_client(&self) -> Point2<f32>
pub fn cursor_to_client(&self) -> Point2<f32>
convert current cursor position to client coordinate relative to the editor div
Sourcepub fn view_status_line<MSG>(&self) -> Node<MSG>
pub fn view_status_line<MSG>(&self) -> Node<MSG>
the view for the status line
pub fn view_highlighted_lines<MSG>(&self) -> Node<MSG>
pub fn plain_view<MSG>(&self) -> Node<MSG>
Sourcepub fn status_line_height(&self) -> i32
pub fn status_line_height(&self) -> i32
height of the status line which displays editor infor such as cursor location
pub fn view_text_edit<MSG>(&self) -> Node<MSG>
Trait Implementations§
Source§impl<XMSG> Component<Msg, XMSG> for WebEditor<XMSG>
impl<XMSG> Component<Msg, XMSG> for WebEditor<XMSG>
Source§impl<XMSG> CustomElement<Msg> for WebEditor<XMSG>where
XMSG: 'static,
impl<XMSG> CustomElement<Msg> for WebEditor<XMSG>where
XMSG: 'static,
Source§fn attribute_changed<APP>(
program: &Program<APP, Msg>,
attr_name: &str,
_old_value: JsValue,
new_value: JsValue,
)where
APP: Application<Msg> + 'static,
fn attribute_changed<APP>(
program: &Program<APP, Msg>,
attr_name: &str,
_old_value: JsValue,
new_value: JsValue,
)where
APP: Application<Msg> + 'static,
this is called when the attributes in the mount is changed
Source§fn custom_tag() -> &'static str
fn custom_tag() -> &'static str
Source§fn observed_attributes() -> Vec<&'static str>
fn observed_attributes() -> Vec<&'static str>
Source§fn connected_callback(&mut self)
fn connected_callback(&mut self)
Source§fn disconnected_callback(&mut self)
fn disconnected_callback(&mut self)
Source§fn adopted_callback(&mut self)
fn adopted_callback(&mut self)
Auto Trait Implementations§
impl<XMSG> Freeze for WebEditor<XMSG>
impl<XMSG> !RefUnwindSafe for WebEditor<XMSG>
impl<XMSG> !Send for WebEditor<XMSG>
impl<XMSG> !Sync for WebEditor<XMSG>
impl<XMSG> Unpin for WebEditor<XMSG>where
XMSG: Unpin,
impl<XMSG> !UnwindSafe for WebEditor<XMSG>
Blanket Implementations§
Source§impl<COMP, MSG> Application<MSG> for COMP
impl<COMP, MSG> Application<MSG> for COMP
Source§fn update(&mut self, msg: MSG) -> Cmd<COMP, MSG>
fn update(&mut self, msg: MSG) -> Cmd<COMP, MSG>
Source§fn view(
&self,
) -> Node<&'static str, &'static str, Leaf<MSG>, &'static str, AttributeValue<MSG>>
fn view( &self, ) -> Node<&'static str, &'static str, Leaf<MSG>, &'static str, AttributeValue<MSG>>
Source§fn init(&mut self) -> Cmd<Self, MSG>where
Self: Sized + 'static,
fn init(&mut self) -> Cmd<Self, MSG>where
Self: Sized + 'static,
Source§fn measurements(&self, measurements: Measurements) -> Cmd<Self, MSG>where
Self: Sized + 'static,
fn measurements(&self, measurements: Measurements) -> Cmd<Self, MSG>where
Self: Sized + 'static,
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.