11import  '../style/index.css' ; 
22
33import  {  codeSnippetIcon  }  from  '@elyra/ui-components' ; 
4+ import  checkSVGstr  from  '../style/check.svg' ; 
5+ // import { LabIcon } from '@jupyterlab/ui-components'; 
46
57import  { 
68 JupyterFrontEnd , 
@@ -13,11 +15,11 @@ import { ICommandPalette } from '@jupyterlab/apputils';
1315
1416import  {  CodeSnippetWidget  }  from  './CodeSnippetWidget' ; 
1517
18+ import  {  showMessage  }  from  './ConfirmMessage' ; 
1619
1720import  {  RequestHandler  }  from  '@elyra/application' ; 
1821// import { URLExt } from '@jupyterlab/coreutils'; 
1922
20- 
2123///////////////////////////////////////////////////////////////////////////////////////////////////////////// 
2224import  {  Dialog ,  showDialog }  from  '@jupyterlab/apputils' ; 
2325
@@ -58,11 +60,11 @@ export interface IFileContainer extends JSONObject {
5860 * Rename a file with a dialog. This is what actually displays everything.  
5961 * Result.value is the value retrieved from .getValue(). ---> .getValue() returns an array of inputs. 
6062 */ 
61- export  function  renameDialog ( 
63+ export  async   function  renameDialog ( 
6264 url : string , 
6365 inputCode : string 
6466) : Promise < Contents . IModel  |  null >  { 
65-  return  showDialog ( { 
67+  return  await   showDialog ( { 
6668 title : 'Save Code Snippet' , 
6769 body : new  RenameHandler ( ) , 
6870 focusNodeSelector : 'input' , 
@@ -90,6 +92,14 @@ export function renameDialog(
9092 } ) , 
9193 false 
9294 ) ; 
95+  showMessage ( { 
96+  body : /*"Saved as Snippet"*/ new  MessageHandler ( ) 
97+  } ) ; 
98+  // showDialog({ 
99+  // body: new ConfirmHandler(), 
100+  // buttons: [] 
101+  // }); 
102+  // new ConfirmHandler(); 
93103 } 
94104 // if (!isValidFileName(result.value)) { 
95105 // void showErrorMessage( 
@@ -174,6 +184,11 @@ class RenameHandler extends Widget {
174184 } 
175185} 
176186
187+ class  MessageHandler  extends  Widget  { 
188+  constructor ( )  { 
189+  super ( {  node : Private . createConfirmMessageNode ( )  } ) ; 
190+  } 
191+ } 
177192/** 
178193 * A namespace for private data. 
179194 */ 
@@ -211,6 +226,19 @@ namespace Private {
211226 body . appendChild ( name3 ) ; 
212227 return  body ; 
213228 } 
229+ 
230+  export  function  createConfirmMessageNode ( ) : HTMLElement  { 
231+  const  body  =  document . createElement ( 'div' ) ; 
232+  body . innerHTML  =  checkSVGstr ; 
233+ 
234+  const  messageContainer  =  document . createElement ( 'div' ) ; 
235+  messageContainer . className  =  'jp-confirm-text' ; 
236+  const  message  =  document . createElement ( 'text' ) ; 
237+  message . textContent  =  'Saved as Snippet!' ; 
238+  messageContainer . appendChild ( message ) 
239+  body . append ( messageContainer ) ; 
240+  return  body ; 
241+  } 
214242} 
215243
216244////////////////////////////////////////////////////////////////////////////////////////////////////////////// 
@@ -284,8 +312,8 @@ const code_snippet_extension: JupyterFrontEndPlugin<void> = {
284312 // }), 
285313 // false 
286314 // ); 
287- 
288-    renameDialog ( url , temp ) ; 
315+   renameDialog ( url , temp ) 
316+  
289317 console . log ( `Highlight trial: ${ temp }  ` ) ; 
290318 } } ) ; 
291319
0 commit comments