Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to remove image from cell? #1634

Open
flatsiedatsie opened this issue Jul 24, 2023 · 1 comment
Open

How to remove image from cell? #1634

flatsiedatsie opened this issue Jul 24, 2023 · 1 comment

Comments

@flatsiedatsie
Copy link

flatsiedatsie commented Jul 24, 2023

I found it surprisingly difficult to remove an image from a cell.

For example, in the demo you can see that pressing backspace shows the image in a popup instead of removing it.

I resorted to hacking a "Clear cell" option into the context menu, but it would be better if backspace removed the image.

if (x) {
                        
                        
                        items.push({
                            title: 'Clear cell',
                            onclick:function() {
                                obj.updateCell(x, y, '', true);
                            }
                        });
@flatsiedatsie
Copy link
Author

flatsiedatsie commented Jul 24, 2023

This modification makes the backspace work:

                                    } else if ((e.keyCode == 8) ||
                                               (e.keyCode >= 48 && e.keyCode <= 57) ||
                                               (e.keyCode >= 96 && e.keyCode <= 111) ||
                                               (e.keyCode >= 187 && e.keyCode <= 190) ||
                                               ((String.fromCharCode(e.keyCode) == e.key || String.fromCharCode(e.keyCode).toLowerCase() == e.key.toLowerCase()) && jexcel.validLetter(String.fromCharCode(e.keyCode)))) {
                                        
                                        
                                        if ((e.keyCode == 8) && jexcel.current.options.columns[columnId].type == 'image'){
                                            jexcel.current.updateCell(columnId, rowId, '', true);
                                        }
                                        
                                        // Start edition
                                        jexcel.current.openEditor(jexcel.current.records[rowId][columnId], true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant