o-spreadsheet icon indicating copy to clipboard operation
o-spreadsheet copied to clipboard

[IMP] clipboard: preserve cell style and format when copy/pasting cross spreadsheets

Open Rachico opened this issue 10 months ago • 1 comments

[IMP] clipboard: preserve cell style and format when copy/pasting cross spreadsheets

Problem

Before this commit, copying and pasting content cross spreadsheets removes all cell style and format and only keeps cell values. This is because the model clipboard is invalidated from one instance to another.

Solution

This commit solves the issue by adding a new custom type in the os clipboard (application/o-spreadsheet) and using the content saved in this key to re-create the cell style and format in the new spreadsheet.

NOTE: After an assessment of the capabilities and limitations of most modern browsers, here's the bottom line till the date of this commit:

For Google Chrome (and all chromium browsers: Opera, Edge, Brave,...): read/write are supported for custom types; Therefore cross spreadsheet copy/paste works like a charm.

For Safari and Mozilla Firefox: saving custom types in the os clipboard is not supported; Therefore, cross spreadsheet copy/paste does not work.

Task: 3597039

review checklist

  • [ ] feature is organized in plugin, or UI components
  • [ ] support of duplicate sheet (deep copy)
  • [ ] in model/core: ranges are Range object, and can be adapted (adaptRanges)
  • [ ] in model/UI: ranges are strings (to show the user)
  • [ ] undo-able commands (uses this.history.update)
  • [ ] multiuser-able commands (has inverse commands and transformations where needed)
  • [ ] new/updated/removed commands are documented
  • [ ] exportable in excel
  • [ ] translations (_t("qmsdf %s", abc))
  • [ ] unit tested
  • [ ] clean commented code
  • [ ] track breaking changes
  • [ ] doc is rebuild (npm run doc)
  • [ ] status is correct in Odoo

Rachico avatar Apr 11 '24 11:04 Rachico

Merge method set to rebase and fast-forward.

robodoo avatar Aug 05 '24 09:08 robodoo