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 818 forks source link

feat: excel like paste when paste cell range is larger than input range #1681

Closed yhay81 closed 3 months ago

yhay81 commented 3 months ago

Hello,

I've opened a PR same as https://github.com/jspreadsheet/ce/pull/594, targeting a feature I believe is crucial. Eager to contribute more, I welcome any guidance on how I can assist further with this feature or elsewhere in the project.

Your feedback would be greatly appreciated. Thank you for your hard work on this project!

yhay81 commented 3 months ago

Related https://github.com/jspreadsheet/ce/issues/591

yhay81 commented 3 months ago

Hello @hodeware and @giko45,

I've initiated this PR echoing the valuable effort behind @giko45's #594, focusing on a vital feature for me. I'm fully prepared to make any required updates to align with the project's current needs.

@Giko45, your foundational work is deeply appreciated. If you're still passionate about this feature and willing, your support in engaging with @hodeware would mean a lot.

hodeware commented 3 months ago

Hi @yhay81, thanks a lot. I would be happy to review your PR. There is one change required.

The method signature should stay the same. The compatibility with all versions and distributions are very important. obj.paste = function(x, y, data);

Solution: it seems you need the selection range inside the paste, you can use the following property which is already available on the scope of the function. obj.selectedCell

It would be great if you can commit those changes, so we can proceed with the merge.

giko45 commented 3 months ago

Hi @yhay81,

Happy it comes into use :).

I don't have the code readly available but try as @hodeware suggest: just change your extra line to: selectedCell = obj.selectedCell.map((cell) => parseInt(cell)); and rollback all jexcel.current.paste calls.

hodeware commented 3 months ago

Thanks, we are reviewing the PR soon.

yhay81 commented 3 months ago

@hodeware, @giko45 Thank you for the feedback. I've made the changes using obj.selectedCell and committed them!

hodeware commented 3 months ago

Thanks