@@ -175,7 +175,9 @@ class InlineEditorHandler {
175175
176176  // Handler for the changeInput event. 
177177  private  changeInput  =  async  ( input : boolean ,  initialValue ?: string ,  cursorMode ?: CursorMode )  =>  { 
178-     if  ( ! input  &&  ! this . open )  return ; 
178+     if  ( ! input  &&  ! this . open )  { 
179+       return ; 
180+     } 
179181
180182    if  ( initialValue )  { 
181183      this . initialValue  +=  initialValue ; 
@@ -185,8 +187,9 @@ class InlineEditorHandler {
185187    } 
186188
187189    if  ( ! this . div )  { 
188-       throw   new   Error ( 'Expected div and editor to be defined in InlineEditorHandler' ) ; 
190+       return ; 
189191    } 
192+ 
190193    if  ( input )  { 
191194      const  sheet  =  sheets . sheet ; 
192195      const  cursor  =  sheet . cursor . position ; 
@@ -195,23 +198,42 @@ class InlineEditorHandler {
195198        x : cursor . x , 
196199        y : cursor . y , 
197200      } ; 
198-        this . codeCell   =   pixiApp . cellsSheet ( ) . tables . getCodeCellIntersects ( this . location ) ; 
201+ 
199202      let  value : string ; 
200203      let  changeToFormula  =  false ; 
204+ 
201205      if  ( initialValue )  { 
206+         changeToFormula  =  initialValue [ 0 ]  ===  '=' ; 
207+ 
202208        value  =  initialValue ; 
203-         changeToFormula  =  value [ 0 ]  ===  '=' ; 
204209      }  else  { 
205210        const  formula  =  await  quadraticCore . getCodeCell ( this . location . sheetId ,  this . location . x ,  this . location . y ) ; 
211+ 
206212        if  ( formula ?. language  ===  'Formula' )  { 
207-           value  =  '='  +  formula . code_string ; 
208213          changeToFormula  =  true ; 
214+ 
215+           value  =  '='  +  formula . code_string ; 
209216        }  else  { 
210-           value  =  ( await  quadraticCore . getEditCell ( this . location . sheetId ,  this . location . x ,  this . location . y ) )  ||  '' ; 
211217          changeToFormula  =  false ; 
218+ 
219+           const  jsCellValue  =  await  quadraticCore . getCellValue ( this . location . sheetId ,  this . location . x ,  this . location . y ) ; 
220+           if  ( jsCellValue )  { 
221+             value  =  jsCellValue . kind  ===  'number'  ? parseFloat ( jsCellValue . value ) . toString ( )  : jsCellValue . value ; 
222+ 
223+             // open the calendar pick if the cell is a date 
224+             if  ( [ 'date' ,  'date time' ] . includes ( jsCellValue . kind ) )  { 
225+               pixiAppSettings . setEditorInteractionState ?.( { 
226+                 ...pixiAppSettings . editorInteractionState , 
227+                 annotationState : `calendar${ jsCellValue . kind  ===  'date time'  ? '-time'  : '' }  , 
228+               } ) ; 
229+             } 
230+           }  else  { 
231+             value  =  '' ; 
232+           } 
212233        } 
213234      } 
214235
236+       this . codeCell  =  pixiApp . cellsSheet ( ) . tables . getCodeCellIntersects ( this . location ) ; 
215237      if  ( this . codeCell ?. language  ===  'Import'  &&  changeToFormula )  { 
216238        pixiAppSettings . snackbar ( 'Cannot create formula inside table' ,  {  severity : 'error'  } ) ; 
217239        this . closeIfOpen ( ) ; 
@@ -225,6 +247,7 @@ class InlineEditorHandler {
225247          cursorMode  =  value  ? CursorMode . Edit  : CursorMode . Enter ; 
226248        } 
227249      } 
250+ 
228251      pixiAppSettings . setInlineEditorState ?.( ( prev )  =>  ( { 
229252        ...prev , 
230253        editMode : cursorMode  ===  CursorMode . Edit , 
@@ -249,6 +272,7 @@ class InlineEditorHandler {
249272      this . showDiv ( ) ; 
250273      this . changeToFormula ( changeToFormula ) ; 
251274      this . updateMonacoCursorPosition ( ) ; 
275+ 
252276      inlineEditorEvents . emit ( 'status' ,  true ,  value ) ; 
253277
254278      // this needs to be at the end to avoid a race condition where the cursor 
0 commit comments