Struct CodeEditor

Source
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

Source

pub fn on_context_menu( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>

An event emitted on a “contextmenu”.

Source

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).

Source

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.

Source

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())

Source

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.

Source

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.

Source

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()).

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn on_did_dispose( &self, listener: impl FnMut() + 'static, ) -> DisposableClosure<dyn FnMut()>

An event emitted when the editor has been disposed.

Source

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).

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn on_key_down( &self, listener: impl FnMut(IKeyboardEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>

An event emitted on a “keydown”.

Source

pub fn on_key_up( &self, listener: impl FnMut(IKeyboardEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IKeyboardEvent)>

An event emitted on a “keyup”.

Source

pub fn on_mouse_down( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>

An event emitted on a “mousedown”.

Source

pub fn on_mouse_leave( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>

An event emitted on a “mouseleave”.

Source

pub fn on_mouse_move( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>

An event emitted on a “mousemove”.

Source

pub fn on_mouse_up( &self, listener: impl FnMut(IEditorMouseEvent) + 'static, ) -> DisposableClosure<dyn FnMut(IEditorMouseEvent)>

An event emitted on a “mouseup”.

Source

pub fn create<OPT>(element: &HtmlElement, options: Option<OPT>) -> Self

Create a new editor under element. element should be empty (not contain other dom nodes). The editor will read the size of element.

Source

pub fn create_with_sys_options( element: &HtmlElement, options: Option<IStandaloneEditorConstructionOptions>, ) -> Self

👎Deprecated since 0.3.0: Use create instead

Create a new editor under element. element should be empty (not contain other dom nodes). The editor will read the size of element.

Source

pub fn get_model(&self) -> Option<TextModel>

Gets the current model attached to this editor.

Source

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.

Source

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

Source§

fn as_ref(&self) -> &IStandaloneCodeEditor

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Debug for CodeEditor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for CodeEditor

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl From<IStandaloneCodeEditor> for CodeEditor

Source§

fn from(js_editor: IStandaloneCodeEditor) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoPropValue<Option<T>> for T

Source§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
Source§

impl<T> IntoPropValue<T> for T

Source§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<Token, Builder, How> AllPropsFor<Builder, How> for Token
where Builder: Buildable<Token>, <Builder as Buildable<Token>>::WrappedToken: HasAllProps<<Builder as Buildable<Token>>::Output, How>,

Source§

impl<T> HasAllProps<(), T> for T