revolist / revogrid

Powerful virtual data grid smartsheet with advanced customization. Best features from excel plus incredible performance 🔋
https://revolist.github.io/revogrid
MIT License
2.68k stars 167 forks source link

Multiple copy/paste issues: can’t copy/paste on non-qwerty keybords, and can’t copy in some firefox instances #399

Open tobiasBora opened 1 year ago

tobiasBora commented 1 year ago

Describe the issue Copy/paste is really not working nicely on my system for multiple reasons:

  1. if I use a non-azerty or qwerty keybord (e.g. bépo), then I can’t copy/past at all, on any demo, like this one: when I press Ctrl-C, it tries to edit the cell instead of copy/pasting… but weirdly enough, pasting works when run inside codesandbox, like https://codesandbox.io/s/revogrid-react-g3ygo?from-embed (but copying fails, see next error)
  2. even if I move back to azerty, then I can’t copy (but I can paste) on firefox as I get an error (note that on chromium, this works fine, but bug 1 is still present):
    NoModificationAllowedError
    Modifications are not allowed for this document
    ▼ 7 stack frames were expanded.
    $csb$eval/e.prototype.doCopy/</<@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:9689:11
    l@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:209:13
    s/<@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:158:14
    $csb$eval/__awaiter</<@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:136:33
    $csb$eval/__awaiter<@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:118:10
    $csb$eval/e.prototype.doCopy@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/revo-grid_12.entry.js:9687:12
    value/<@https://nrz0f.csb.app/node_modules/
    revolist/revogrid/dist/esm-es5/index-c7c8ae92.js:1338:48
    ▲ 7 stack frames were expanded.

    this error is however not always present: for instance the demo here works, but I get this error when I go to https://codesandbox.io/s/revogrid-react-component-hrgrx?from-embed=&file=/src/App.js or if I locally run the code in the next section:

To Reproduce

This bug is present on all examples I can come up with, for instance:

import React, { useEffect, useState } from "react";
import { defineCustomElements } from "@revolist/revogrid/loader";
import { RevoGrid } from "@revolist/revogrid-react";

const App = () => {
  defineCustomElements();
    const [columns, setColumns] = useState([{ prop: "name" }, { prop: "age" }]);
    const [source, setSource] = useState([{ name: "1", age: 42 }, { name: "2", age: 48 }]);

  const afterEdit = ({ detail }) => {

  };

  useEffect(() => {
    // Votre logique d'effet ici, si nécessaire
  }, []);

  return (
    <div>
      <RevoGrid
        theme="compact"
        columns={columns}
        source={source}
          onAfterEdit={(e) => afterEdit(e)}
          canFocus={true}
          range={true}
          useClipboard={true}
          readonly={false}
          filter={true}
          resize={true}
      />
    </div>
  );
};

export default App;