@@ -162,20 +162,14 @@ public function display(array $classPagesToShow = Controller::VALID_CLASS_PAGES,
162162 $ cell = new \PHPFUI \Cell ();
163163 $ div ->add (' ' );
164164 $ 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 );
170165 $ icon ->setToolTip ('Send Constructor to Clipboard ' );
171- $ div ->add ($ icon );
172166 $ callout = new \PHPFUI \Callout ('success ' );
173167 $ callout ->add ('Copied! ' );
174168 $ 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 );
179173 $ page ->setDebug (1 );
180174 $ div ->add ($ callout );
181175 $ mainColumn ->add ($ div );
0 commit comments