pub struct Editor { /* private fields */ }
Expand description
Editor 结构体代表编辑器的核心功能实现 负责管理文档状态、事件处理、插件系统和存储等核心功能
Implementations§
Source§impl Editor
impl Editor
Sourcepub async fn create(options: EditorOptions) -> EditorResult<Self>
pub async fn create(options: EditorOptions) -> EditorResult<Self>
创建新的编辑器实例 options: 编辑器配置选项
Sourcepub async fn destroy(&mut self) -> EditorResult<()>
pub async fn destroy(&mut self) -> EditorResult<()>
销毁编辑器实例
pub async fn emit_event(&mut self, event: Event) -> EditorResult<()>
pub async fn run_before_middleware( &mut self, transaction: &mut Transaction, ) -> EditorResult<()>
pub async fn run_after_middleware( &mut self, state: &mut Option<Arc<State>>, transactions: &mut Vec<Transaction>, ) -> EditorResult<()>
pub async fn command(&mut self, command: Arc<dyn Command>) -> EditorResult<()>
pub async fn command_with_meta( &mut self, command: Arc<dyn Command>, description: String, meta: Value, ) -> EditorResult<()>
Sourcepub async fn dispatch(&mut self, transaction: Transaction) -> EditorResult<()>
pub async fn dispatch(&mut self, transaction: Transaction) -> EditorResult<()>
Sourcepub async fn dispatch_with_meta(
&mut self,
transaction: Transaction,
description: String,
meta: Value,
) -> EditorResult<()>
pub async fn dispatch_with_meta( &mut self, transaction: Transaction, description: String, meta: Value, ) -> EditorResult<()>
更新编辑器状态并记录到历史记录 包含描述和元信息
Sourcepub async fn update_state(&mut self, state: Arc<State>) -> EditorResult<()>
pub async fn update_state(&mut self, state: Arc<State>) -> EditorResult<()>
更新编辑器状态并记录到历史记录 不包含描述和元信息
Sourcepub async fn update_state_with_meta(
&mut self,
state: Arc<State>,
description: String,
meta: Value,
) -> EditorResult<()>
pub async fn update_state_with_meta( &mut self, state: Arc<State>, description: String, meta: Value, ) -> EditorResult<()>
更新编辑器状态并记录到历史记录 包含描述和元信息
pub async fn register_plugin(&mut self) -> EditorResult<()>
pub async fn unregister_plugin( &mut self, plugin_key: String, ) -> EditorResult<()>
pub fn get_options(&self) -> &EditorOptions
pub fn get_state(&self) -> &Arc<State>
pub fn get_schema(&self) -> Arc<Schema>
pub fn get_event_bus(&self) -> &EventBus<Event>
pub fn get_tr(&self) -> Transaction
pub fn undo(&mut self)
pub fn redo(&mut self)
pub fn jump(&mut self, n: isize)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Editor
impl !RefUnwindSafe for Editor
impl !Unpin for Editor
impl !UnwindSafe for Editor
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
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>
Converts
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>
Converts
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 more