feat(aio): support hiding the copy button on code-examole components
In the API docs there are occasions where we do not wish the code snippet to have a copy button. This commit supports that by providing a new `hideCopy` attribute.
This commit is contained in:
committed by
Matias Niemelä
parent
cb5bc76766
commit
a0b9c23100
@@ -31,7 +31,7 @@ const defaultLineNumsCount = 10; // by default, show linenums over this number
|
||||
selector: 'aio-code',
|
||||
template: `
|
||||
<pre class="prettyprint lang-{{language}}">
|
||||
<button *ngIf="code" class="material-icons copy-button" (click)="doCopy()">content_copy</button>
|
||||
<button *ngIf="!hideCopy" class="material-icons copy-button" (click)="doCopy()">content_copy</button>
|
||||
<code class="animated fadeIn" #codeContainer></code>
|
||||
</pre>
|
||||
`
|
||||
@@ -72,6 +72,12 @@ export class CodeComponent implements OnChanges {
|
||||
@Input()
|
||||
region: string;
|
||||
|
||||
/**
|
||||
* set to true if the copy button is not to be shown
|
||||
*/
|
||||
@Input()
|
||||
hideCopy: boolean;
|
||||
|
||||
/**
|
||||
* The element in the template that will display the formatted code
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user