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§
Sourcefn get_options(&self) -> &EditorOptions
fn get_options(&self) -> &EditorOptions
获取编辑器配置选项
Sourcefn get_schema(&self) -> Arc<Schema>
fn get_schema(&self) -> Arc<Schema>
获取文档模式定义
Sourcefn get_event_bus(&self) -> &EventBus
fn get_event_bus(&self) -> &EventBus
获取事件总线实例
Sourcefn get_tr(&self) -> Transaction
fn get_tr(&self) -> Transaction
创建新的事务实例
Sourcefn 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 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,
执行自定义命令
Sourcefn 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 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,
处理事务并更新状态
Sourcefn 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 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,
注册新插件