export default function editorInit() {
  const tablesCells = document.querySelectorAll('.wp-block-table td');
  function filterCells(element, stringToParse) {
    return element.textContent.trim() === stringToParse;
  }
  const checkedCells = Array.from(tablesCells).filter((element) => filterCells(element, '((v))'));
  const crossedCells = Array.from(tablesCells).filter((element) => filterCells(element, '((x))'));

  checkedCells.forEach((cell) => {
    cell.innerHTML = `<div class="table-cell-icon table-cell-icon--checked"><img src="${mainAppJsDynamicDatas.template_directory_uri}/resources/img/graphic-assets/table-cell--check.svg"
      alt="${mainAppJsDynamicDatas.yes}"/></div>`;
  });
  crossedCells.forEach((cell) => {
    cell.innerHTML = `<img class="table-cell-icon table-cell-icon--crossed" src="${mainAppJsDynamicDatas.template_directory_uri}/resources/img/graphic-assets/table-cell--cross.svg"
      alt="${mainAppJsDynamicDatas.no}"/>`;
  });

  // tables.forEach((table) => {
  //   const tableCells = contains('td', '((v))');
  //   console.log(tableRows);
  //   tableRows.forEach((row) => {
  //     console.log(row);
  //   });
  // });
}
