@@ -17,11 +17,13 @@ class CoreGraph {
1717
1818 projectName ;
1919
20+ authorName ;
21+
2022 cy ;
2123
2224 bendNode ;
2325
24- constructor ( id , element , dispatcher , superState , projectName ) {
26+ constructor ( id , element , dispatcher , superState , projectName , nodeValidator , edgeValidator , authorName ) {
2527 if ( dispatcher ) this . dispatcher = dispatcher ;
2628 if ( superState ) this . superState = superState ;
2729 if ( typeof cytoscape ( 'core' , 'edgehandles' ) !== 'function' ) {
@@ -37,6 +39,7 @@ class CoreGraph {
3739 this . cy = cytoscape ( { ...cyOptions , container : element } ) ;
3840 this . id = id ;
3941 this . projectName = projectName ;
42+ this . authorName = authorName ;
4043 this . cy . emit ( 'graph-modified' ) ;
4144 this . bendNode = this . cy . add (
4245 { group : 'nodes' , data : { type : 'bend' } , classes : [ 'hidden' ] } ,
@@ -83,12 +86,13 @@ class CoreGraph {
8386 }
8487
8588 set ( {
86- cy, dispatcher, superState, projectName,
89+ cy, dispatcher, superState, projectName, authorName ,
8790 } ) {
8891 if ( dispatcher ) this . dispatcher = dispatcher ;
8992 if ( superState ) this . superState = superState ;
9093 if ( cy ) this . cy = cy ;
9194 if ( projectName ) this . projectName = projectName ;
95+ if ( authorName ) this . authorName = authorName ;
9296 }
9397
9498 setProjectName ( projectName , shouldEmit = true ) {
@@ -106,6 +110,21 @@ class CoreGraph {
106110 this . cy . emit ( 'graph-modified' ) ;
107111 }
108112
113+ setProjectAuthor ( authorName , shouldEmit = true ) {
114+ this . authorName = authorName ;
115+ if ( shouldEmit ) {
116+ this . dispatcher ( {
117+ type : T . SET_AUTHOR ,
118+ payload : {
119+ value : authorName ,
120+ graphID : this . id ,
121+ type : 'authorName' ,
122+ } ,
123+ } ) ;
124+ }
125+ this . cy . emit ( 'graph-modified' ) ;
126+ }
127+
109128 setServerID ( serverID , shouldEmit = true ) {
110129 this . serverID = serverID ;
111130 if ( shouldEmit ) {
0 commit comments