mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-20 21:19:29 +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',
|
'sort',
|
||||||
'copy',
|
'copy',
|
||||||
'paste',
|
'paste',
|
||||||
|
'doPaste',
|
||||||
'duAlignCenter',
|
'duAlignCenter',
|
||||||
'alignCenter',
|
'alignCenter',
|
||||||
'moveLayer',
|
'moveLayer',
|
||||||
@ -556,11 +557,16 @@ class Editor extends BaseService {
|
|||||||
|
|
||||||
if (!Array.isArray(config)) return;
|
if (!Array.isArray(config)) return;
|
||||||
|
|
||||||
const pasteConfigs = await beforePaste(position, config);
|
const pasteConfigs = await this.doPaste(config, position);
|
||||||
|
|
||||||
return this.add(pasteConfigs);
|
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> {
|
public async doAlignCenter(config: MNode): Promise<MNode> {
|
||||||
const parent = this.getParentById(config.id);
|
const parent = this.getParentById(config.id);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user