mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-10 14:13:01 +08:00
parent
45eaea6f68
commit
828681e960
@ -352,6 +352,9 @@ class Editor extends BaseService {
|
|||||||
|
|
||||||
const newNodes = await Promise.all(
|
const newNodes = await Promise.all(
|
||||||
addNodes.map((node) => {
|
addNodes.map((node) => {
|
||||||
|
if (isPage(node)) {
|
||||||
|
return this.doAdd(node, this.get('root'));
|
||||||
|
}
|
||||||
const parentNode = parent && typeof parent !== 'function' ? parent : getAddParent(node);
|
const parentNode = parent && typeof parent !== 'function' ? parent : getAddParent(node);
|
||||||
if (!parentNode) throw new Error('未找到父元素');
|
if (!parentNode) throw new Error('未找到父元素');
|
||||||
return this.doAdd(node, parentNode);
|
return this.doAdd(node, parentNode);
|
||||||
@ -579,7 +582,7 @@ class Editor extends BaseService {
|
|||||||
|
|
||||||
const pasteConfigs = await this.doPaste(config, position);
|
const pasteConfigs = await this.doPaste(config, position);
|
||||||
|
|
||||||
return this.add(pasteConfigs);
|
return this.add(pasteConfigs, this.get('parent'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async doPaste(config: MNode[], position: PastePosition = {}): Promise<MNode[]> {
|
public async doPaste(config: MNode[], position: PastePosition = {}): Promise<MNode[]> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user