@@ -162,20 +162,14 @@ public function display(array $classPagesToShow = Controller::VALID_CLASS_PAGES,
162
162
$ cell = new \PHPFUI \Cell ();
163
163
$ div ->add (' ' );
164
164
$ icon = new \PHPFUI \FAIcon ('far ' , 'clipboard ' );
165
- $ parameters = $ this ->getConstructorParameters ($ fullClassName );
166
- $ parameters = \str_replace ("\n" , '' , $ parameters );
167
- $ hidden = new \PHPFUI \Input ('text ' , 'clipboard ' , "new \\{$ fullClassName }( {$ parameters }); " );
168
- $ hidden ->addClass ('hide ' );
169
- $ div ->add ($ hidden );
170
165
$ icon ->setToolTip ('Send Constructor to Clipboard ' );
171
- $ div ->add ($ icon );
172
166
$ callout = new \PHPFUI \Callout ('success ' );
173
167
$ callout ->add ('Copied! ' );
174
168
$ callout ->addClass ('small ' );
175
- $ callout -> addClass ( ' hide ' );
176
- $ icon -> setAttribute ( ' onclick ' , ' copyText(" ' . $ hidden -> getId () . ' "," ' . $ callout -> getId () . ' ") ' );
177
- $ js = ' function copyText(id,callout){$("#"+callout).toggleClass("hide");$("#"+id).toggleClass("hide").select();document.execCommand("copy");$("#"+id).toggleClass("hide");setTimeout(function(){$("#"+callout).toggleClass("hide")},2000);} ' ;
178
- $ page ->addJavaScript ( $ js );
169
+ $ parameters = $ this -> getConstructorParameters ( $ fullClassName );
170
+ $ parameters = \str_replace ( "\n" , '' , $ parameters );
171
+ // @phpstan-ignore-next-line hack for now
172
+ $ page ->addCopyToClipboard ( " new \\{ $ fullClassName } ( { $ parameters } ); " , $ icon , $ callout );
179
173
$ page ->setDebug (1 );
180
174
$ div ->add ($ callout );
181
175
$ mainColumn ->add ($ div );
0 commit comments