Skip to content

Pipes in cell value are not copied #2425

@pcadec

Description

@pcadec

Describe the bug

When a cell contains the pipe character | it disapear in the copied value when value is copied through right click context menu + Copy

I fixed it locally by removing unnecessary pipes in the regex in the function copyCellToClipboard of formatterUtilities extension. Pipes are not recognized as OR operator inside squared brackets, but as actual pipe character.

diff --git a/node_modules/@slickgrid-universal/common/dist/formatters/formatterUtilities.js b/node_modules/@slickgrid-universal/common/dist/formatters/formatterUtilities.js
index c50f5a0..f60c0d9 100644
--- a/node_modules/@slickgrid-universal/common/dist/formatters/formatterUtilities.js
+++ b/node_modules/@slickgrid-universal/common/dist/formatters/formatterUtilities.js
@@ -57,9 +57,9 @@ export async function copyCellToClipboard(args) {
         finalTextToCopy = textToCopy;
         if (typeof textToCopy === 'string') {
             finalTextToCopy = textToCopy
-                .replace(/^([·|⮞|⮟]\s*)|([·|⮞|⮟])\s*/gi, '')
+                .replace(/^([·⮞⮟]\s*)|([·⮞⮟])\s*/gi, '')
                 // eslint-disable-next-line
-                .replace(/[\u00b7|\u034f]/gi, '')
+                .replace(/[·◌͏]/gi, '')
                 .trim();
         }

Reproduction

Go to this demo :
https://ghiscoding.github.io/angular-slickgrid-demos/#/example35

Change a value to something that contains a pipe |

Image

Then, when editor is hidden, right click on the cell and click on "Copy" button of the context menu :

Image

Then, test pasting anywhere else, the pipe has disapeared

Image

Which Framework are you using?

Angular

Environment Info

| Executable          | Version |
| ------------------- | ------- |
| (framework used)    | Angular |
| Slickgrid-Universal | 9.10.0  |
| TypeScript          | 5.5.4   |
| Browser(s)          | Chrome 145 |
| System OS           | Windows 11 |

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions