pub struct Editor {
pub event_bus: EventBus,
pub state: Arc<State>,
pub extension_manager: ExtensionManager,
pub history_manager: HistoryManager<Arc<State>>,
pub options: EditorOptions,
pub middleware_stack: MiddlewareStack,
}
Expand description
Editor 结构体代表编辑器的核心功能实现 负责管理文档状态、事件处理、插件系统和存储等核心功能
Fields§
§event_bus: EventBus
§state: Arc<State>
§extension_manager: ExtensionManager
§history_manager: HistoryManager<Arc<State>>
§options: EditorOptions
§middleware_stack: MiddlewareStack
Implementations§
Source§impl Editor
impl Editor
Sourcepub async fn create(options: EditorOptions) -> EditorResult<Self>
pub async fn create(options: EditorOptions) -> EditorResult<Self>
创建新的编辑器实例 options: 编辑器配置选项
Sourcepub fn add_middleware<M>(&mut self, middleware: M)where
M: Middleware + 'static,
pub fn add_middleware<M>(&mut self, middleware: M)where
M: Middleware + 'static,
Add a middleware to the stack
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>>, ) -> EditorResult<()>
pub async fn command(&mut self, command: Arc<dyn Command>) -> EditorResult<()>
Sourcepub async fn dispatch(&mut self, transaction: Transaction) -> EditorResult<()>
pub async fn dispatch(&mut self, transaction: Transaction) -> 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
pub fn get_tr(&self) -> Transaction
pub fn undo(&mut self)
pub fn redo(&mut self)
pub fn jump(&mut self, n: isize)
Auto Trait Implementations§
impl Freeze for Editor
impl !RefUnwindSafe for Editor
impl Send for Editor
impl Sync 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