<commit_before>## Selecting plot element for customizaiton
observe({
  v <- input$customizeItem
  isolate({
    if(!isEmpty(v)){
      currentSheet <- (projProperties[['activeSheet']])
      if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']] <<- v
    }
  })
})
observe({
  updateInput[['customizeItem']]
  currentSheet <- projProperties[['activeSheet']]
  s <- if(!isEmpty(currentSheet)){
    isolate(sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']])
  } else ''
  updateTabsetPanel(session, 'customizeItem', selected=null2String(s))
})

## modify plotTitle and other text fields
lapply(c('plotTitle', 'plotXlab', 'plotYlab'),
       function(inputId){
         assign(paste0('observer_', inputId, '_push'),
                observe({
                  v <- input[[inputId]]
                  isolate({
                    currentSheet <- (projProperties[['activeSheet']])
                    if(!isEmpty(currentSheet)){
                      sheetList[[currentSheet]][['dynamicProperties']][[inputId]] <<- v
                    }
                  })

                }),
                sessionEnv)
         assign(paste0('observer_', inputId, '_pull'),
                observe({
                  updateInput[[inputId]]
                  currentSheet <- projProperties[['activeSheet']]
                  s <- if(!isEmpty(currentSheet)){
                    isolate(sheetList[[currentSheet]][['dynamicProperties']][[inputId]])
                  } else ''
                  updateTextInput(session, inputId, value=null2String(s))
                }),
                sessionEnv)
       })


#
#
#
# ## modify xlab
# observe({
#   v <- input$plotXlab
#   isolate({
#     currentSheet <- (projProperties[['activeSheet']])
#     if(!isEmpty(currentSheet)){
#       sheetList[[currentSheet]][['dynamicProperties']][['plotXlab']] <<- v
#     }
#   })
#
# })
# observe({
#   updateInput[['plotXlab']]
#   currentSheet <- projProperties[['activeSheet']]
#   s <- if(!isEmpty(currentSheet)){
#     isolate(sheetList[[currentSheet]][['dynamicProperties']][['plotXlab']])
#   } else ''
#   updateTextInput(session, 'plotXlab', value=null2String(s))
# })
#
# ## modify ylab
# observe({
#   v <- input$plotYlab
#   isolate({
#     currentSheet <- (projProperties[['activeSheet']])
#     if(!isEmpty(currentSheet)){
#       sheetList[[currentSheet]][['dynamicProperties']][['plotYlab']] <<- v
#     }
#   })
#
# })
# observe({
#   updateInput[['plotYlab']]
#   currentSheet <- projProperties[['activeSheet']]
#   s <- if(!isEmpty(currentSheet)){
#     isolate(sheetList[[currentSheet]][['dynamicProperties']][['plotYlab']])
#   } else ''
#   updateTextInput(session, 'plotYlab', value=null2String(s))
# })


###########################
## Text Formatting
#
# ## Selecting font family
# observe({
#   v <- input$textFamily
#   isolate({
#     if(!isEmpty(v)){
#       currentSheet <- (projProperties[['activeSheet']])
#       if(!isEmpty(currentSheet)) {
#         customizeItem <- sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']]
#         if(!isEmpty(customizeItem)){
#           if(is.null(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]])){
#             sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]] <<- list()
#           }
#           sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]][['textFamily']] <<- v
#         }
#       }
#     }
#   })
# })
# observe({
#   updateInput[['textFamily']]
#   currentSheet <- projProperties[['activeSheet']]
#   s <- ''
#   if(!isEmpty(currentSheet)){
#     customizeItem <- (sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']])
#     if(!isEmpty(customizeItem) && !is.null(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]])){
#       s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]][['textFamily']])
#     }
#   }
#
#   updateSelectInput(session, 'textFamily', selected=null2String(s))
# })
#
# ## Selecting font face
# observe({
#   v <- input$textFace
#   isolate({
#     if(!isEmpty(v)){
#       currentSheet <- (projProperties[['activeSheet']])
#       if(!isEmpty(currentSheet)) {
#         customizeItem <- sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']]
#         if(!isEmpty(customizeItem)){
#           if(is.null(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]])){
#             sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]] <<- list()
#           }
#           sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]][['textFace']] <<- v
#         }
#       }
#     }
#   })
# })
# observe({
#   updateInput[['textFace']]
#   currentSheet <- projProperties[['activeSheet']]
#   s <- ''
#   if(!isEmpty(currentSheet)){
#     customizeItem <- (sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']])
#     if(!isEmpty(customizeItem) && !is.null(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]])){
#       s <- isolate(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]][['textFace']])
#     }
#   }
#
#   updateSelectInput(session, 'textFace', selected=null2String(s))
# })

# ## Selecting font color
# observe({
#   v <- input$textColor
#   isolate({
#     currentSheet <- (projProperties[['activeSheet']])
#     if(!isEmpty(currentSheet)) {
#       customizeItem <- sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']]
#       if(!isEmpty(customizeItem)){
#         if(is.null(sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]])){
#           sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]] <<- list()
#         }
#         if(!isEmpty(v)) v <- paste0("#", v)
#         sheetList[[currentSheet]][['dynamicProperties']][[customizeItem]][['textColor']] <<- v
#       }
#     }
#   })
# })

## font size, etc.
lapply(list(list(inputId='textFamily', inputType='select'),
            list(inputId='textFace', inputType='select'),
            list(inputId='textColor', inputType='color'),
            list(inputId='textSize', inputType='numeric'),
            list(inputId='textHjust', inputType='numeric'),
            list(inputId='textVjust', inputType='numeric'),
            list(inputId='textAngle', inputType='numeric'),
            list(inputId='textLineheight', inputType='numeric')),
       function(x){
         assign(paste0('observer_', x$inputId, '_push'),<commit_msg>Delete commented code<commit_after>## Selecting plot element for customizaiton
observe({
  v <- input$customizeItem
  isolate({
    if(!isEmpty(v)){
      currentSheet <- (projProperties[['activeSheet']])
      if(!isEmpty(currentSheet)) sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']] <<- v
    }
  })
})
observe({
  updateInput[['customizeItem']]
  currentSheet <- projProperties[['activeSheet']]
  s <- if(!isEmpty(currentSheet)){
    isolate(sheetList[[currentSheet]][['dynamicProperties']][['customizeItem']])
  } else ''
  updateTabsetPanel(session, 'customizeItem', selected=null2String(s))
})

## modify plotTitle and other text fields
lapply(c('plotTitle', 'plotXlab', 'plotYlab'),
       function(inputId){
         assign(paste0('observer_', inputId, '_push'),
                observe({
                  v <- input[[inputId]]
                  isolate({
                    currentSheet <- (projProperties[['activeSheet']])
                    if(!isEmpty(currentSheet)){
                      sheetList[[currentSheet]][['dynamicProperties']][[inputId]] <<- v
                    }
                  })

                }),
                sessionEnv)
         assign(paste0('observer_', inputId, '_pull'),
                observe({
                  updateInput[[inputId]]
                  currentSheet <- projProperties[['activeSheet']]
                  s <- if(!isEmpty(currentSheet)){
                    isolate(sheetList[[currentSheet]][['dynamicProperties']][[inputId]])
                  } else ''
                  updateTextInput(session, inputId, value=null2String(s))
                }),
                sessionEnv)
       })



###########################
## Text Formatting

lapply(list(list(inputId='textFamily', inputType='select'),
            list(inputId='textFace', inputType='select'),
            list(inputId='textColor', inputType='color'),
            list(inputId='textSize', inputType='numeric'),
            list(inputId='textHjust', inputType='numeric'),
            list(inputId='textVjust', inputType='numeric'),
            list(inputId='textAngle', inputType='numeric'),
            list(inputId='textLineheight', inputType='numeric')),
       function(x){
         assign(paste0('observer_', x$inputId, '_push'),
{'fraction_non_alphanumeric': 0.19376213869530445, 'fraction_numerical': 0.001713698160630641, 'mean_word_length': 3.206631427198462, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2537707', 'n_tokens_mistral': 2627, 'n_tokens_neox': 2528, 'n_words': 312}