jspreadsheet / ce

Jspreadsheet is a lightweight vanilla javascript plugin to create amazing web-based interactive tables and spreadsheets compatible with other spreadsheet software.
https://bossanova.uk/jspreadsheet/v4
MIT License
6.66k stars 820 forks source link

[fix] - Allow multiple cell erase on backspace #1622

Closed mccp closed 2 months ago

mccp commented 1 year ago

Context

I use jspreasheet to edit d3 charts data. I am running the project on a macbook pro.

Problem

I was unable to erase values from multiple cells at once (multiple selection). I tried first on my app :

onKeydown (e) {
  if (!this.spreadsheet) return

  if (e.code === 'Backspace') {
     const highlighted = this.spreadsheet.getHighlighted()
     if (highlighted.length && highlighted.length > 1) {
       highlighted.forEach((cell) => {
        this.spreadsheet.setValue(cell, '')
       })
    }
  }
},

But it resulted on an error cell.children[0] is undefined on the keydownControls function. Because no inputs were available on the table.

Fix

Add backspace key to the delete key condition

mccp commented 2 months ago

Hi there, Any update on this ? It there anything missing to merge the PR ?

hodeware commented 2 months ago

thanks