@@ -55,14 +55,6 @@ export default class helpers {
5555
5656 return result ;
5757 }
58- static removeAttachmentListener ( ) {
59- document . getElementById ( 'removeAttachement' ) . addEventListener ( 'click' , ( ) => {
60- document . getElementById ( 'attachedFile' ) . remove ( ) ;
61- document . AI_INTEGRATION . currentInputHasAttachment = false ;
62- document . AI_INTEGRATION . attachmentDetails . attachmentText = "" ;
63- document . AI_INTEGRATION . attachmentDetails . attachmentBlocks = "" ;
64- } ) ;
65- }
6658 static updateAIModels ( geminiKey , openrouterKey ) {
6759 if ( document . getElementById ( 'AI_Selector_select' ) == null ) return ;
6860 for ( var i of document . AI_INTEGRATION . AIModels ) {
@@ -98,14 +90,17 @@ export default class helpers {
9890 return fetchPromise
9991 . finally ( ( ) => clearTimeout ( timeoutId ) ) ;
10092 }
93+ static disableCodeChunkAttachment ( ) {
94+ document . getElementById ( 'Context_Selector_select' ) . value = '0' ;
95+ document . getElementById ( 'Context_Selector_select' ) . style . width = "26px" ;
96+ document . getElementById ( 'Context_Selector_select' ) . children [ 0 ] . disabled = true ;
97+ document . getElementById ( 'Context_Selector_select' ) . children . innerText = "Code Chunk" ;
98+ }
10199 static messageErrorOccured ( messageContents ) {
102100 document . AI_INTEGRATION . chatHistory . push ( { "role" : "user" , "message" : messageContents } ) ;
103101 //document.AI_INTEGRATION.chatHistory.push({ "role": "assistant", "message": "Error reading response" }); //not sure if the AI needs to know that it failed
104102
105- //clean up attachments
106- document . AI_INTEGRATION . currentInputHasAttachment = false ;
107- if ( document . getElementById ( 'attachedFile' ) != null ) document . getElementById ( 'attachedFile' ) . remove ( ) ;
108-
103+ helpers . disableCodeChunkAttachment ( ) ;
109104
110105 document . AI_INTEGRATION . AI_currently_blabbering = false ;
111106 if ( document . getElementById ( 'currentlyBlabberingOnThis' ) != null ) {
@@ -137,7 +132,7 @@ export default class helpers {
137132 ) ,
138133 ] ) ;
139134 }
140- static async returnEntireProjectAsXML ( addon ) {
135+ static returnEntireProjectAsXML ( addon ) {
141136 //create new XML document
142137 const xmlDoc = document . implementation . createDocument ( "" , "" , null ) ;
143138
@@ -148,14 +143,16 @@ export default class helpers {
148143 for ( var x of addon . tab . redux . state . scratchGui . vm . runtime . targets ) {
149144 // Create a child element with text content
150145 const childElement = xmlDoc . createElement ( "sprite" ) ;
146+ //add sprite name as attribute
147+ childElement . setAttribute ( "name" , x . getName ( ) ) ;
151148 childElement . innerHTML = x . blocks . toXML ( ) ;
152149 rootElement . appendChild ( childElement ) ;
153150 }
154151 // Serialize XML to string
155152 const serializer = new XMLSerializer ( ) ;
156153 const xmlString = serializer . serializeToString ( xmlDoc ) ;
157154
158- console . log ( xmlString ) ;
155+ return xmlString ;
159156 }
160157 static APIKeyRequiredModal ( ) {
161158 const div = document . createElement ( 'div' ) ;
0 commit comments