magento-lts icon indicating copy to clipboard operation
magento-lts copied to clipboard

[FEAT] Add a feature to make it possible so select and copy text in grid without trigger click event in Admin grid.

Open JesperHerrloff opened this issue 8 months ago • 4 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Description

Would it be of interest to implement said solution? Only one file is affected and will fix the issue in every admin grid.

I can make a pull request if there is interest in the solution? Its only a conditional check in js/mage/adminhtml/grid.js to fix this permanently.

Expected Behavior

Be able to select for example sku in admin grid for products or order incrementId in order grid.

A selection should not trigger click.

Benefits

I think this will benefit all ecommerce users, as they will be able to select for example a sku in backend copy it then search it in frontend to verify it is searchable.

I think it will not do any harm to anyone.

Anything else?

This is a fix I do every release. :) It would be nice to make this into the framework.

JesperHerrloff avatar Mar 06 '25 17:03 JesperHerrloff

See PR #4029

kiatng avatar Mar 06 '25 21:03 kiatng

@kiatng do you have some minutes to write a short docunentation (doc blog-post?)

Not tested, but is it possible to make columns copyable via xml or observer?

(something for https://github.com/OpenMage/magento-lts/pull/3451 ?)

sreichel avatar Mar 09 '25 15:03 sreichel

@sreichel As requested: PR #4678

It is possible to make col copyable in xml (your PR #4225) by adding 'copyable' in this line https://github.com/OpenMage/magento-lts/blob/71f38e9f9e1ec98bdea12d00a8e29622df594455/app/code/core/Mage/Adminhtml/Block/Widget/Grid.php#L392-L392

It is possible also in observer with the event 'adminhtml_block_html_before'.

As for #3451, I think it's better to add the feature as an layout update.

kiatng avatar Mar 11 '25 04:03 kiatng

Its a nice solution. But There will be a lot of work to make it work with Enhanced Admingrids I think. Will check it out later when having more time to check if it will work.

My solution for now is to add this snippet here if(!window.getSelection().isCollapsed){ return; } Before this line and this works https://github.com/OpenMage/magento-lts/blob/ec284ac6234f2c36467c2c6ed61e8ccb8d28015c/js/mage/adminhtml/grid.js#L129

This way my client is free to copy with selection not a button.

JesperHerrloff avatar Mar 11 '25 13:03 JesperHerrloff