mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-06-20 12:49:19 +08:00
feat(editor): editorService.add 的addNode参数对象中加上inputEvent
This commit is contained in:
parent
0450de481f
commit
c1fc6b8f94
@ -264,6 +264,8 @@ export default defineComponent({
|
||||
left,
|
||||
};
|
||||
|
||||
config.inputEvent = e;
|
||||
|
||||
services?.editorService.add(config, parent);
|
||||
}
|
||||
},
|
||||
|
@ -271,7 +271,8 @@ class Editor extends BaseService {
|
||||
* @returns 添加后的节点
|
||||
*/
|
||||
public async add(addNode: AddMNode, parent?: MContainer | null): Promise<MNode> {
|
||||
const { type, ...config } = addNode;
|
||||
// 加入inputEvent是为给业务扩展时可以获取到更多的信息,只有在使用拖拽添加组件时才有改对象
|
||||
const { type, inputEvent, ...config } = addNode;
|
||||
const curNode = this.get<MContainer>('node');
|
||||
|
||||
let parentNode: MContainer | undefined;
|
||||
|
@ -88,7 +88,7 @@ class Props extends BaseService {
|
||||
* @param type 组件类型
|
||||
* @returns 组件初始值
|
||||
*/
|
||||
public async getPropsValue(type: string, defaultValue: Record<string, any> = {}) {
|
||||
public async getPropsValue(type: string, { inputEvent, ...defaultValue }: Record<string, any> = {}) {
|
||||
if (type === 'area') {
|
||||
const value = (await this.getPropsValue('button')) as MComponent;
|
||||
value.className = 'action-area';
|
||||
|
@ -125,6 +125,7 @@ export interface EditorNodeInfo {
|
||||
export interface AddMNode {
|
||||
type: string;
|
||||
name?: string;
|
||||
inputEvent?: DragEvent;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user