mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
refactor(editor): 支持doPaste插件 (#299)
* refactor(editor): 粘贴时添加粘贴选项,用于格式化粘贴对象数据。 * refactor(editor): 支持doPaste插件
This commit is contained in:
parent
a7fa9f3a29
commit
56b8ed1d73
@ -71,6 +71,7 @@ class Editor extends BaseService {
|
||||
'sort',
|
||||
'copy',
|
||||
'paste',
|
||||
'doPaste',
|
||||
'duAlignCenter',
|
||||
'alignCenter',
|
||||
'moveLayer',
|
||||
@ -556,11 +557,16 @@ class Editor extends BaseService {
|
||||
|
||||
if (!Array.isArray(config)) return;
|
||||
|
||||
const pasteConfigs = await beforePaste(position, config);
|
||||
const pasteConfigs = await this.doPaste(config, position);
|
||||
|
||||
return this.add(pasteConfigs);
|
||||
}
|
||||
|
||||
public async doPaste(config: MNode[], position: PastePosition = {}): Promise<MNode[]> {
|
||||
const pasteConfigs = await beforePaste(position, cloneDeep(config));
|
||||
return pasteConfigs;
|
||||
}
|
||||
|
||||
public async doAlignCenter(config: MNode): Promise<MNode> {
|
||||
const parent = this.getParentById(config.id);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user