EditorCore

Trait EditorCore 

Source
pub trait EditorCore {
    type Error;

    // Required methods
    fn doc(&self) -> Arc<NodePool>;
    fn get_options(&self) -> &EditorOptions;
    fn get_state(&self) -> &Arc<State>;
    fn get_schema(&self) -> Arc<Schema>;
    fn get_event_bus(&self) -> &EventBus;
    fn get_tr(&self) -> Transaction;
    fn command<'life0, 'async_trait>(
        &'life0 mut self,
        command: Arc<dyn Command>,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn dispatch<'life0, 'async_trait>(
        &'life0 mut self,
        transaction: Transaction,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn register_plugin<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn unregister_plugin<'life0, 'async_trait>(
        &'life0 mut self,
        plugin_key: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn undo(&mut self);
    fn redo(&mut self);
}
Expand description

定义编辑器核心功能的基础特征

Required Associated Types§

Required Methods§

Source

fn doc(&self) -> Arc<NodePool>

获取当前文档内容

Source

fn get_options(&self) -> &EditorOptions

获取编辑器配置选项

Source

fn get_state(&self) -> &Arc<State>

获取当前状态

Source

fn get_schema(&self) -> Arc<Schema>

获取文档模式定义

Source

fn get_event_bus(&self) -> &EventBus

获取事件总线实例

Source

fn get_tr(&self) -> Transaction

创建新的事务实例

Source

fn command<'life0, 'async_trait>( &'life0 mut self, command: Arc<dyn Command>, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

执行自定义命令

Source

fn dispatch<'life0, 'async_trait>( &'life0 mut self, transaction: Transaction, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

处理事务并更新状态

Source

fn register_plugin<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

注册新插件

Source

fn unregister_plugin<'life0, 'async_trait>( &'life0 mut self, plugin_key: String, ) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

注销插件

Source

fn undo(&mut self)

执行撤销操作

Source

fn redo(&mut self)

执行重做操作

Implementors§

Source§

impl EditorCore for moduforge_runtime::async_runtime::Editor

Source§

type Error = Box<dyn Error>

Source§

impl EditorCore for moduforge_runtime::runtime::Editor