-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add raw code toggle to highlight component and update highlight…
… theme (#2044)
- Loading branch information
Anders Juengst
authored
Aug 14, 2023
1 parent
7148e8e
commit 8bfb682
Showing
14 changed files
with
333 additions
and
77 deletions.
There are no files selected for viewing
4 changes: 3 additions & 1 deletion
4
...app/content/components/component-demos/flavored-markdown/flavored-markdown.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
<td-flavored-markdown>{{ basicFlavoredMarkdown }}</td-flavored-markdown> | ||
<td-flavored-markdown [copyCodeToClipboard]="true" [toggleRawCode]="true">{{ | ||
basicFlavoredMarkdown | ||
}}</td-flavored-markdown> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...nt-demos/highlight/demos/highlight-demo-copy-code/highlight-demo-copy-code.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,20 @@ | ||
<td-highlight | ||
class="push-bottom-md" | ||
codeLang="css" | ||
[copyCodeToClipboard]="true" | ||
[copyCodeTooltips]="tooltipsConfig" | ||
[toggleRawButton]="true" | ||
> | ||
{{ css }} | ||
</td-highlight> | ||
|
||
<div class="dark-theme"> | ||
<td-highlight | ||
codeLang="css" | ||
[copyCodeToClipboard]="true" | ||
[copyCodeTooltips]="tooltipsConfig" | ||
[toggleRawButton]="true" | ||
> | ||
{{ css }} | ||
</td-highlight> | ||
</div> |
6 changes: 5 additions & 1 deletion
6
...onents/component-demos/highlight/demos/highlight-demo-ts/highlight-demo-ts.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<td-highlight codeLang="typescript"> | ||
<td-highlight | ||
codeLang="typescript" | ||
[copyCodeToClipboard]="true" | ||
[toggleRawButton]="true" | ||
> | ||
{{ code }} | ||
</td-highlight> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 31 additions & 9 deletions
40
libs/angular-highlight/src/lib/copy-code-button/copy-code-button.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,32 @@ | ||
<button | ||
mat-icon-button | ||
[cdkCopyToClipboard]="copiedContent" | ||
class="copy-button" | ||
[matTooltip]="copyTooltip" | ||
#tooltip="matTooltip" | ||
(cdkCopyToClipboardCopied)="textCopied($event)" | ||
<mat-button-toggle-group | ||
multiple | ||
class="raw-and-copy-buttons" | ||
*ngIf="toggleRawButton; else button" | ||
> | ||
<mat-icon role="img">content_copy</mat-icon> | ||
</button> | ||
<mat-button-toggle (click)="toggleRawClicked()" #rawButton>{{ | ||
rawToggleText | ||
}}</mat-button-toggle> | ||
<mat-button-toggle | ||
[cdkCopyToClipboard]="copiedContent" | ||
[matTooltip]="copyTooltip" | ||
#tooltip="matTooltip" | ||
#copyButton | ||
(click)="copyClicked()" | ||
(cdkCopyToClipboardCopied)="textCopied($event)" | ||
> | ||
<mat-icon width>content_copy</mat-icon> | ||
</mat-button-toggle> | ||
</mat-button-toggle-group> | ||
|
||
<ng-template #button> | ||
<button | ||
mat-icon-button | ||
[cdkCopyToClipboard]="copiedContent" | ||
class="copy-button" | ||
[matTooltip]="copyTooltip" | ||
#tooltip="matTooltip" | ||
(cdkCopyToClipboardCopied)="textCopied($event)" | ||
> | ||
<mat-icon role="img">content_copy</mat-icon> | ||
</button> | ||
</ng-template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
mat-button-toggle-group.raw-and-copy-buttons { | ||
margin-top: -8px; | ||
margin-right: -8px; | ||
margin-left: 8px; | ||
|
||
::ng-deep .mat-button-toggle-label-content { | ||
font-size: 12px; | ||
line-height: 28px; | ||
|
||
mat-icon { | ||
width: 16px; | ||
height: 16px; | ||
font-size: 16px; | ||
} | ||
} | ||
} |
Oops, something went wrong.