PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.13.0
Code Block Pro – Beautiful Syntax Highlighting v1.13.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / src / front / CopyButton.tsx

CopyButton.tsx in Code Block Pro – Beautiful Syntax Highlighting 1.13.0, at src/front/CopyButton.tsx

36 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n';
2 import stripAnsi from 'strip-ansi';
3 import { Attributes } from '../types';
4
5 export const CopyButton = ({ attributes }: { attributes: Attributes }) => (
6 <span
7 // Using a span to prevent aggressive button styling from themes
8 role="button"
9 tabIndex={0}
10 data-code={stripAnsi(attributes.code ?? '')}
11 style={{ color: attributes?.textColor ?? 'inherit', display: 'none' }}
12 aria-label={__('Copy', 'code-block-pro')}
13 className="code-block-pro-copy-button">
14 <svg
15 xmlns="http://www.w3.org/2000/svg"
16 style={{ width: 24, height: 24 }}
17 fill="none"
18 viewBox="0 0 24 24"
19 stroke="currentColor"
20 strokeWidth="2">
21 <path
22 className="with-check"
23 strokeLinecap="round"
24 strokeLinejoin="round"
25 d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4"
26 />
27 <path
28 className="without-check"
29 strokeLinecap="round"
30 strokeLinejoin="round"
31 d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
32 />
33 </svg>
34 </span>
35 );
36