-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New column clipboard #5453
base: main
Are you sure you want to change the base?
New column clipboard #5453
Conversation
It is much nicer than the workaround I have used 😅
and then created a
and added it to the CRUD with
Update |
Hey @adriallongarriu Thanks for coming up with this cool little useful feature. I appreciate your effort & the idea. |
Thanks @adriallongarriu for the PR 🙏 I like the copy feature. I've need it myself, and as @o15a3d4l11s2 showed, he also probably needed it in other contexts. I am just not sure about the implementation. Should we add this as a new column, or add the copy ability to existing columns ? I think the later is the most appropriate, as for example you can have a I am postponing this decision to v7. Cheers |
Hi, I think this copy feature should be an option for all columns and fields. Cheers! |
Sure it is, all the columns have a "display value" and the "original value". For example a dropdown, the value would be "1" (the key), but the display value would be "My Article With Id 1". But this raises many questions, for example, what would you copy in a text column where the text is truncated ? "My Article Wi..." Copy the truncated text, or the original? We didn't get out of the text column, and we have already so many questions and some of them are tricky. This seems like a "simple" thing, but to make it general there are some use cases and caveats in specific fields that require a lot of thought. I think after we decide on how we are going to tackle all the problems we can foresee, the implementation will be rather "easy" I think. I like this idea, I think it will not be very difficult to implement, the difficulty is in "writting the feature spec", that's why I keep this open as I think we should work on something like this... in the next version. 🙏 |
If the text is truncated, copy the original. For the first version of this feature i think is ok to build something that will cover the simple use cases and then build from there. |
Sure, I can review a PR for CRUD columns if you are willing to work on this now. // no copy
CRUD::column('title');
// copy with our defaults
CRUD::column('title')->copy(true);
// copy what developer wants
CRUD::column('title')
->copy(fn($entry, $column, $columnProcessedValue, $columnOriginalValue) => strtoupper($columnProcessedValue)); Probably create a I am sure even in crud some columns will be tricky by the way they are built but if you are willing to give it a shot, go ahead 🙏 Cheers |
WHY
I need a be able to copy the content of the column to the clipboard. Basically is a text column with an icon and on click the span copy the content to the clipboard.
Maybe this can be and optional parameter on the basic column text buy for now i created a separated column.
Using a column this can be used in lists and in show view.
On click show a Noty to the user to report whether it was able to be copied or not
HOW
How did you achieve that, in technical terms?
Use javascript to copy text to clipboard using
await navigator.clipboard.writeText(text);
Is it a breaking change?
No
How can we test the before & after?
Note: on localhost only show the error message. To work need https otherwise the browser will block the action.