pub struct CodeEditor { /* private fields */ }
Expand description
Monaco code editor.
This struct should be the sole owner of the underlying
IStandaloneCodeEditor
because it will call
dispose
when dropped.
This is only an issue when using the From
trait.
Implementations§
Source§impl CodeEditor
impl CodeEditor
An event emitted on a “contextmenu”.
Sourcepub fn on_did_blur_editor_text(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_did_blur_editor_text( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted when the text inside this editor lost focus (i.e. cursor stops blinking).
Sourcepub fn on_did_blur_editor_widget(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_did_blur_editor_widget( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted when the text inside this editor or an editor widget lost focus.
Sourcepub fn on_did_change_configuration(
&self,
listener: impl FnMut(ConfigurationChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(ConfigurationChangedEvent)>
pub fn on_did_change_configuration( &self, listener: impl FnMut(ConfigurationChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(ConfigurationChangedEvent)>
An event emitted when the configuration of the editor has changed. (e.g. editor.updateOptions())
Sourcepub fn on_did_change_cursor_position(
&self,
listener: impl FnMut(ICursorPositionChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(ICursorPositionChangedEvent)>
pub fn on_did_change_cursor_position( &self, listener: impl FnMut(ICursorPositionChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(ICursorPositionChangedEvent)>
An event emitted when the cursor position has changed.
Sourcepub fn on_did_change_cursor_selection(
&self,
listener: impl FnMut(ICursorSelectionChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(ICursorSelectionChangedEvent)>
pub fn on_did_change_cursor_selection( &self, listener: impl FnMut(ICursorSelectionChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(ICursorSelectionChangedEvent)>
An event emitted when the cursor selection has changed.
Sourcepub fn on_did_change_model(
&self,
listener: impl FnMut(IModelChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelChangedEvent)>
pub fn on_did_change_model( &self, listener: impl FnMut(IModelChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelChangedEvent)>
An event emitted when the model of this editor has changed (e.g. editor.setModel()).
Sourcepub fn on_did_change_model_content(
&self,
listener: impl FnMut(IModelContentChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelContentChangedEvent)>
pub fn on_did_change_model_content( &self, listener: impl FnMut(IModelContentChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelContentChangedEvent)>
An event emitted when the content of the current model has changed.
Sourcepub fn on_did_change_model_decorations(
&self,
listener: impl FnMut(JsValue) + 'static,
) -> DisposableClosure<dyn FnMut(JsValue)>
pub fn on_did_change_model_decorations( &self, listener: impl FnMut(JsValue) + 'static, ) -> DisposableClosure<dyn FnMut(JsValue)>
An event emitted when the decorations of the current model have changed.
Sourcepub fn on_did_change_model_language(
&self,
listener: impl FnMut(IModelLanguageChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelLanguageChangedEvent)>
pub fn on_did_change_model_language( &self, listener: impl FnMut(IModelLanguageChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelLanguageChangedEvent)>
An event emitted when the language of the current model has changed.
Sourcepub fn on_did_change_model_language_configuration(
&self,
listener: impl FnMut(JsValue) + 'static,
) -> DisposableClosure<dyn FnMut(JsValue)>
pub fn on_did_change_model_language_configuration( &self, listener: impl FnMut(JsValue) + 'static, ) -> DisposableClosure<dyn FnMut(JsValue)>
An event emitted when the language configuration of the current model has changed.
Sourcepub fn on_did_change_model_options(
&self,
listener: impl FnMut(IModelOptionsChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IModelOptionsChangedEvent)>
pub fn on_did_change_model_options( &self, listener: impl FnMut(IModelOptionsChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IModelOptionsChangedEvent)>
An event emitted when the options of the current model has changed.
Sourcepub fn on_did_content_size_change(
&self,
listener: impl FnMut(IContentSizeChangedEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IContentSizeChangedEvent)>
pub fn on_did_content_size_change( &self, listener: impl FnMut(IContentSizeChangedEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IContentSizeChangedEvent)>
An event emitted when the content width or content height in the editor has changed.
Sourcepub fn on_did_dispose(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_did_dispose( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted when the editor has been disposed.
Sourcepub fn on_did_focus_editor_text(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_did_focus_editor_text( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted when the text inside this editor gained focus (i.e. cursor starts blinking).
Sourcepub fn on_did_focus_editor_widget(
&self,
listener: impl FnMut() + 'static,
) -> DisposableClosure<dyn FnMut()>
pub fn on_did_focus_editor_widget( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>
An event emitted when the text inside this editor or an editor widget gained focus.
Sourcepub fn on_did_layout_change(
&self,
listener: impl FnMut(EditorLayoutInfo) + 'static,
) -> DisposableClosure<dyn FnMut(EditorLayoutInfo)>
pub fn on_did_layout_change( &self, listener: impl FnMut(EditorLayoutInfo) + 'static, ) -> DisposableClosure<dyn FnMut(EditorLayoutInfo)>
An event emitted when the layout of the editor has changed.
Sourcepub fn on_did_paste(
&self,
listener: impl FnMut(IPasteEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IPasteEvent)>
pub fn on_did_paste( &self, listener: impl FnMut(IPasteEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IPasteEvent)>
An event emitted when users paste text in the editor.
Sourcepub fn on_did_scroll_change(
&self,
listener: impl FnMut(IScrollEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IScrollEvent)>
pub fn on_did_scroll_change( &self, listener: impl FnMut(IScrollEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IScrollEvent)>
An event emitted when the scroll in the editor has changed.
Sourcepub fn on_key_down(
&self,
listener: impl FnMut(IKeyboardEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>
pub fn on_key_down( &self, listener: impl FnMut(IKeyboardEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>
An event emitted on a “keydown”.
Sourcepub fn on_key_up(
&self,
listener: impl FnMut(IKeyboardEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>
pub fn on_key_up( &self, listener: impl FnMut(IKeyboardEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>
An event emitted on a “keyup”.
Sourcepub fn on_mouse_down(
&self,
listener: impl FnMut(IEditorMouseEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
pub fn on_mouse_down( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
An event emitted on a “mousedown”.
Sourcepub fn on_mouse_leave(
&self,
listener: impl FnMut(IEditorMouseEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
pub fn on_mouse_leave( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
An event emitted on a “mouseleave”.
Sourcepub fn on_mouse_move(
&self,
listener: impl FnMut(IEditorMouseEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
pub fn on_mouse_move( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
An event emitted on a “mousemove”.
Sourcepub fn on_mouse_up(
&self,
listener: impl FnMut(IEditorMouseEvent) + 'static,
) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
pub fn on_mouse_up( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>
An event emitted on a “mouseup”.
Sourcepub fn create<OPT>(element: &HtmlElement, options: Option<OPT>) -> Selfwhere
OPT: Into<IStandaloneEditorConstructionOptions>,
pub fn create<OPT>(element: &HtmlElement, options: Option<OPT>) -> Selfwhere
OPT: Into<IStandaloneEditorConstructionOptions>,
Create a new editor under element
.
element
should be empty (not contain other dom nodes).
The editor will read the size of element
.
Sourcepub fn create_with_sys_options(
element: &HtmlElement,
options: Option<IStandaloneEditorConstructionOptions>,
) -> Self
👎Deprecated since 0.3.0: Use create
instead
pub fn create_with_sys_options( element: &HtmlElement, options: Option<IStandaloneEditorConstructionOptions>, ) -> Self
create
insteadCreate a new editor under element
.
element
should be empty (not contain other dom nodes).
The editor will read the size of element
.
Sourcepub fn set_model(&self, model: &TextModel)
pub fn set_model(&self, model: &TextModel)
Sets the current model attached to this editor.
If the previous model was created by the editor via the value
key in
the options, it will be destroyed. Otherwise, if the previous model was
set via this method, or the model
key in the options, the
previous model will not be destroyed.
Sourcepub fn detach_model(&self) -> Option<TextModel>
pub fn detach_model(&self) -> Option<TextModel>
Detaches the current model from the editor and returns it.
The handling of the model is the same as described in
set_model
. This operation acts like
setModel(null)
in the Javascript API.
Trait Implementations§
Source§impl AsRef<IStandaloneCodeEditor> for CodeEditor
impl AsRef<IStandaloneCodeEditor> for CodeEditor
Source§fn as_ref(&self) -> &IStandaloneCodeEditor
fn as_ref(&self) -> &IStandaloneCodeEditor
Source§impl Debug for CodeEditor
impl Debug for CodeEditor
Source§impl Drop for CodeEditor
impl Drop for CodeEditor
Source§impl From<IStandaloneCodeEditor> for CodeEditor
impl From<IStandaloneCodeEditor> for CodeEditor
Source§fn from(js_editor: IStandaloneCodeEditor) -> Self
fn from(js_editor: IStandaloneCodeEditor) -> Self
Auto Trait Implementations§
impl Freeze for CodeEditor
impl RefUnwindSafe for CodeEditor
impl !Send for CodeEditor
impl !Sync for CodeEditor
impl Unpin for CodeEditor
impl UnwindSafe for CodeEditor
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> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
Source§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
self
to a value of a Properties
struct.Source§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
Source§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
self
to a value of a Properties
struct.