function changeLogText(element) {
  const newLogText = element.innerText;
  let logId = '';
  if (element.classList[0] === 'card_card_sentence') {
    logId = element.parentNode.parentNode.parentNode.getAttribute('log_id');
    currentLogs.find(log=>log.id===logId).text = newLogText;
  }
  if (element.classList[0] === 'logText') {
    const logItemElement = element.parentNode.parentNode;
    logId = logItemElement.id.split('logItem-')[1];
    currentLogs.find(log=>log.id===logId).text = newLogText;
    refreshCardContent(logId);
  }
  if (logId) {
    updateLogFileById(logId);
    // update main window text if updating latest log
    const latestLog = currentLogs[currentLogs.length-1];
    if (logId === latestLog.id) {
      eel.update_main_window_text(newLogText)();
    }
    // TODO: update matching card options after updating log text
  }
}
// Handle user change of log text from log or inside card
Handle user change of log text from log or inside card
Handle user change of log text from log or inside card
function changeLogText(element) {
  const newLogText = element.innerText;
  let logId = '';
  if (element.classList[0] === 'card_card_sentence') {
    logId = element.parentNode.parentNode.parentNode.getAttribute('log_id');
    currentLogs.find(log=>log.id===logId).text = newLogText;
  }
  if (element.classList[0] === 'logText') {
    const logItemElement = element.parentNode.parentNode;
    logId = logItemElement.id.split('logItem-')[1];
    currentLogs.find(log=>log.id===logId).text = newLogText;
    refreshCardContent(logId);
  }
  if (logId) {
    updateLogFileById(logId);
    const latestLog = currentLogs[currentLogs.length-1];
    if (logId === latestLog.id) {
      eel.update_main_window_text(newLogText)();
    }
  }
}
function changeLogText ( element ) { const newLogText = element . innerText ; let logId = '' ; if ( element . classList [ 0 ] === 'card_card_sentence' ) { logId = element . parentNode . parentNode . parentNode . getAttribute ( 'log_id' ) ; currentLogs . find ( log => log . id === logId ) . text = newLogText ; } if ( element . classList [ 0 ] === 'logText' ) { const logItemElement = element . parentNode . parentNode ; logId = logItemElement . id . split ( 'logItem-' ) [ 1 ] ; currentLogs . find ( log => log . id === logId ) . text = newLogText ; refreshCardContent ( logId ) ; } if ( logId ) { updateLogFileById ( logId ) ; const latestLog = currentLogs [ currentLogs . length - 1 ] ; if ( logId === latestLog . id ) { eel . update_main_window_text ( newLogText ) ( ) ; } } }
Handle user change of log text from log or inside card
Handle user change of log text from log or inside card
// update main window text if updating latest log // TODO: update matching card options after updating log text