nova-text-copy-field icon indicating copy to clipboard operation
nova-text-copy-field copied to clipboard

Nova 4 support

Open ewawiktor opened this issue 2 years ago • 6 comments

Preflight

  • [ ] I have searched the repo for this duplicates

Description

Possible implementation ideas

ewawiktor avatar May 13 '22 15:05 ewawiktor

Nova 4 has a copyable() function, see https://nova.laravel.com/docs/4.0/resources/fields.html#copying-text-field-values-to-the-clipboard

flowan avatar Jun 09 '22 08:06 flowan

@flowan This does not solve the problem of wanting to be able to mask the text that you want to copy, so I don't think this is a valuable substitution for this package.

@sixlive Do you think you could upgrade the package to be compatible with Nova 4?

niels-bosman avatar Jul 29 '22 09:07 niels-bosman

Hey!

I haven't worked in Nova for awhile and don't currently have a license. I'd be happy to accept a PR to update support!

sixlive avatar Jul 29 '22 22:07 sixlive

@niels-bosman: Why do you think, that you can't use the build in function? Just use a computed field, something like this:

 Text::make("copyTag", function ($model) {
    return $model->first_name.' '.$model->last_name;
})->copyable();

bernhardh avatar Oct 12 '22 14:10 bernhardh

@niels-bosman: Why do you think, that you can't use the build in function? Just use a computed field, something like this:

 Text::make("copyTag", function ($model) {
    return $model->first_name.' '.$model->last_name;
})->copyable();

@bernhardh This will make the text visible to the end user, which I don't want.

niels-bosman avatar Oct 13 '22 08:10 niels-bosman

@niels-bosman In case you still need a Nova 4 compatible replacement to the mask() method, you could use the displayedAs meta attribute :

Text::make('copyTag')->withMeta(['displayedAs' => '******'])->copyable();

Seedockh avatar Feb 07 '23 23:02 Seedockh