@@ -30,17 +30,14 @@ export default class ObsidianSage extends Plugin {
30
30
31
31
this . addSettingTab ( new SettingTab ( this . app , this ) ) ;
32
32
33
- new Notice ( "creating everything" ) ;
34
33
this . createListeners ( )
35
- . then ( ( ) => {
34
+ . then ( ( cell_session_id ) => {
36
35
this . registerMarkdownCodeBlockProcessor ( "sage" , ( src , el , ctx ) => {
37
36
if ( this . ws == null ) {
38
37
console . warn ( "tried to parse sage math before server connection established." ) ;
39
38
this . createListeners ( ) ;
40
39
return ;
41
40
}
42
- console . log ( 'rendering eeeeeeeeeeeeeeeeeeeeeeeeee...' , this . ws ) ;
43
- new Notice ( "renderingggggg" ) ;
44
41
45
42
const req_id = nanoid ( ) ;
46
43
const payload = JSON . stringify ( {
@@ -69,8 +66,7 @@ export default class ObsidianSage extends Plugin {
69
66
code_disp . addClass ( 'sagecell-display-code' )
70
67
code_disp . innerText = src ;
71
68
this . outputWriters [ req_id ] = new OutputWriter ( wrapper , this . settings . displayByDefault ) ;
72
- console . log ( 'just_before_send' , this . ws ) ;
73
- this . ws . send ( `${ session_id } /channels,${ payload } ` ) ;
69
+ this . ws . send ( `${ this . session_id } /channels,${ payload } ` ) ;
74
70
} ) ;
75
71
} )
76
72
. catch ( this . connectFailed ) ;
@@ -86,6 +82,7 @@ export default class ObsidianSage extends Plugin {
86
82
. then ( res => res . json ( ) )
87
83
. then ( ( { ws_url, id } ) => {
88
84
this . ws = new SockJS ( `${ this . settings . serverURL } sockjs?CellSessionID=${ cell_session_id } ` ) ;
85
+ this . session_id = id ;
89
86
90
87
this . ws . onclose = ( ) => { this . ws = null ; }
91
88
this . ws . onerror = this . connectFailed ;
@@ -98,7 +95,6 @@ export default class ObsidianSage extends Plugin {
98
95
const content = data . content ;
99
96
100
97
if ( msgType === 'error' ) {
101
- //new Notice("Obsidian Sage evaluation error occured.")
102
98
this . outputWriters [ msgId ] . appendError ( content ) ;
103
99
}
104
100
@@ -120,7 +116,8 @@ export default class ObsidianSage extends Plugin {
120
116
//}
121
117
}
122
118
123
- return [ ws_url , id ] ;
119
+ //return [ ws_url, id ];
120
+ return cell_session_id ;
124
121
} )
125
122
}
126
123
connectFailed ( e : any ) {
0 commit comments