File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1010 </div >
1111 <div each =" { style in Object .keys (props .styleProps ) }" >
1212 <template if =" { props .styleProps [style] }" >
13- { style }: <code >{ props .styleProps [style] }</code >
13+ { style }: <code onclick = " { copyToClipboard } " >{ props .styleProps [style] }</code >
1414 <span if =" { style .indexOf (' color' ) > - 1 }" class =" popover-color" color =" { props .styleProps [style] }" ></span >
1515 </template >
1616 </div >
3232 onUpdated (props , state ) {
3333 this .updateColors (props, state);
3434 },
35+ copyToClipboard (e ) {
36+ navigator .clipboard .writeText (e .target .innerHTML );
37+ e .target .style [' background-color' ] = ' #8bc34a' ;
38+ setTimeout (() => {
39+ e .target .style [' background-color' ] = null ;
40+ }, 4000 );
41+ },
3542 };
3643 </script >
3744 <style >
93100 height : 0.8rem ;
94101 background-color : #fff ;
95102 }
103+ code {
104+ cursor : pointer ;
105+ transition : background-color 0.5s ease-out ;
106+ }
96107 </style >
97108</popover >
You can’t perform that action at this time.
0 commit comments