@@ -129,7 +129,7 @@ export const drawCustomLink = function (this: MindElixirInstance, from: Topic, t
129129}
130130
131131export const createLink = function ( this : MindElixirInstance , from : Topic , to : Topic ) {
132- const newLinkObj = {
132+ const linkObj = {
133133 id : generateUUID ( ) ,
134134 label : 'Custom Link' ,
135135 from : from . nodeObj . id ,
@@ -143,7 +143,12 @@ export const createLink = function (this: MindElixirInstance, from: Topic, to: T
143143 y : - 200 ,
144144 } ,
145145 }
146- this . drawCustomLink ( from , to , newLinkObj )
146+ this . drawCustomLink ( from , to , linkObj )
147+
148+ this . bus . fire ( 'operation' , {
149+ name : 'createCustomLink' ,
150+ obj : linkObj ,
151+ } )
147152}
148153
149154export const removeLink = function ( this : MindElixirInstance , linkSvg ?: CustomSvg ) {
@@ -158,6 +163,12 @@ export const removeLink = function (this: MindElixirInstance, linkSvg?: CustomSv
158163 const id = link . linkObj ! . id
159164 delete this . linkData [ id ]
160165 link . remove ( )
166+ this . bus . fire ( 'operation' , {
167+ name : 'removeCustomLink' ,
168+ obj : {
169+ id,
170+ } ,
171+ } )
161172}
162173
163174export const selectLink = function ( this : MindElixirInstance , link : CustomSvg ) {
@@ -307,11 +318,10 @@ export function editCutsomLinkLabel(this: MindElixirInstance, el: CustomSvg) {
307318 if ( text === origin ) return
308319 textEl . innerHTML = node . label
309320 this . linkDiv ( )
310- // this.bus.fire('operation', {
311- // name: 'finishEditSummary',
312- // obj: node,
313- // origin,
314- // })
321+ this . bus . fire ( 'operation' , {
322+ name : 'finishEditCustomLinkLabel' ,
323+ obj : node ,
324+ } )
315325 } )
316326 console . timeEnd ( 'editSummary' )
317327}
0 commit comments