Loading js/init.handsontable.csv.js +43 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,49 @@ }, afterCreateCol: function (index,amount) { textarea.value = Papa.unparse(table.getData()); }, beforeKeyDown: function (e) { // On Tab, go to external button if last cell if (e.keyCode === 9 && table) { let selection = table.getSelected(); if (typeof selection !== "undefined" && selection !== null) { let rowIndex = selection[0][0]; let colIndex = selection[0][1]; if (rowIndex === (table.countRows() - 1) && colIndex === (table.countCols() - 1)) { table.deselectCell(); e.stopPropagation(); } } } } }); renderedTableParent.addEventListener('keyup', function (e) { if (e.keyCode === 9 && !e.shiftKey && (e.target.classList.contains("handsontableInput") || e.target.classList.contains("blizz")) && typeof table !== "undefined" && table !== null && typeof table.getSelected() === "undefined" ) { // Select the first not read-only. let rowCount = table.countRows(); let colCount = table.countCols(); for (let row = 0; row < rowCount; row++) { for (let col = 0; col < colCount; col++) { let cellMeta = table.getCellMeta(row, col); if (!cellMeta.readOnly) { table.selectCell(row, col); return; } } } // If no editable cells found, use the very first. table.selectCell(0, 0); } }); } Loading js/init.handsontable.json.js +43 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,49 @@ }, afterCreateCol: function (index, amount) { textarea.value = JSON.stringify(table.getData()); }, beforeKeyDown: function (e) { // On Tab, go to external button if last cell if (e.keyCode === 9 && table) { let selection = table.getSelected(); if (typeof selection !== "undefined" && selection !== null) { let rowIndex = selection[0][0]; let colIndex = selection[0][1]; if (rowIndex === (table.countRows() - 1) && colIndex === (table.countCols() - 1)) { table.deselectCell(); e.stopPropagation(); } } } } }); renderedTableParent.addEventListener('keyup', function (e) { if (e.keyCode === 9 && !e.shiftKey && (e.target.classList.contains("handsontableInput") || e.target.classList.contains("blizz")) && typeof table !== "undefined" && table !== null && typeof table.getSelected() === "undefined" ) { // Select the first not read-only. let rowCount = table.countRows(); let colCount = table.countCols(); for (let row = 0; row < rowCount; row++) { for (let col = 0; col < colCount; col++) { let cellMeta = table.getCellMeta(row, col); if (!cellMeta.readOnly) { table.selectCell(row, col); return; } } } // If no editable cells found, use the very first. table.selectCell(0, 0); } }); } Loading src/Plugin/Field/FieldWidget/TableWidget.php +1 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ class TableWidget extends WidgetBase implements ContainerFactoryPluginInterface $element['table'] = [ '#type' => 'inline_template', '#template' => '<div class="rendered-table blizz format-{{ format }}" data-blizz-config="{{ config }}"></div>', '#template' => '<div class="rendered-table blizz format-{{ format }}" data-blizz-config="{{ config }}" tabIndex="0"></div>', '#context' => [ 'format' => $format, 'config' => json_encode((object) $config), Loading Loading
js/init.handsontable.csv.js +43 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,49 @@ }, afterCreateCol: function (index,amount) { textarea.value = Papa.unparse(table.getData()); }, beforeKeyDown: function (e) { // On Tab, go to external button if last cell if (e.keyCode === 9 && table) { let selection = table.getSelected(); if (typeof selection !== "undefined" && selection !== null) { let rowIndex = selection[0][0]; let colIndex = selection[0][1]; if (rowIndex === (table.countRows() - 1) && colIndex === (table.countCols() - 1)) { table.deselectCell(); e.stopPropagation(); } } } } }); renderedTableParent.addEventListener('keyup', function (e) { if (e.keyCode === 9 && !e.shiftKey && (e.target.classList.contains("handsontableInput") || e.target.classList.contains("blizz")) && typeof table !== "undefined" && table !== null && typeof table.getSelected() === "undefined" ) { // Select the first not read-only. let rowCount = table.countRows(); let colCount = table.countCols(); for (let row = 0; row < rowCount; row++) { for (let col = 0; col < colCount; col++) { let cellMeta = table.getCellMeta(row, col); if (!cellMeta.readOnly) { table.selectCell(row, col); return; } } } // If no editable cells found, use the very first. table.selectCell(0, 0); } }); } Loading
js/init.handsontable.json.js +43 −0 Original line number Diff line number Diff line Loading @@ -79,6 +79,49 @@ }, afterCreateCol: function (index, amount) { textarea.value = JSON.stringify(table.getData()); }, beforeKeyDown: function (e) { // On Tab, go to external button if last cell if (e.keyCode === 9 && table) { let selection = table.getSelected(); if (typeof selection !== "undefined" && selection !== null) { let rowIndex = selection[0][0]; let colIndex = selection[0][1]; if (rowIndex === (table.countRows() - 1) && colIndex === (table.countCols() - 1)) { table.deselectCell(); e.stopPropagation(); } } } } }); renderedTableParent.addEventListener('keyup', function (e) { if (e.keyCode === 9 && !e.shiftKey && (e.target.classList.contains("handsontableInput") || e.target.classList.contains("blizz")) && typeof table !== "undefined" && table !== null && typeof table.getSelected() === "undefined" ) { // Select the first not read-only. let rowCount = table.countRows(); let colCount = table.countCols(); for (let row = 0; row < rowCount; row++) { for (let col = 0; col < colCount; col++) { let cellMeta = table.getCellMeta(row, col); if (!cellMeta.readOnly) { table.selectCell(row, col); return; } } } // If no editable cells found, use the very first. table.selectCell(0, 0); } }); } Loading
src/Plugin/Field/FieldWidget/TableWidget.php +1 −1 Original line number Diff line number Diff line Loading @@ -274,7 +274,7 @@ class TableWidget extends WidgetBase implements ContainerFactoryPluginInterface $element['table'] = [ '#type' => 'inline_template', '#template' => '<div class="rendered-table blizz format-{{ format }}" data-blizz-config="{{ config }}"></div>', '#template' => '<div class="rendered-table blizz format-{{ format }}" data-blizz-config="{{ config }}" tabIndex="0"></div>', '#context' => [ 'format' => $format, 'config' => json_encode((object) $config), Loading