Skip to content

Commit 817daaf

Browse files
ert78gbmondalaci
authored andcommitted
feat: Set no wrap on Delete Keymap and Delete Macro icons (#371)
close #369
1 parent c17bf0f commit 817daaf

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

shared/src/components/keymap/header/keymap-header.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ <h1 class="col-xs-12 pane-title">
2727
[class.disabled]="!deletable"
2828
data-toggle="tooltip"
2929
data-placement="bottom"
30+
html="true"
3031
(click)="removeKeymap()"
3132
></i>
3233
<i class="fa fa-files-o keymap__duplicate pull-right"

shared/src/components/keymap/header/keymap-header.component.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,16 @@ import { Keymap } from '../../../config-serializer/config-items/keymap';
1818
import { AppState } from '../../../store';
1919
import { KeymapActions } from '../../../store/actions';
2020

21+
const DEFAULT_TRASH_TITLE = '<span class="text-nowrap">Delete keymap</span>';
22+
2123
@Component({
2224
selector: 'keymap-header',
2325
templateUrl: './keymap-header.component.html',
2426
styleUrls: ['./keymap-header.component.scss'],
2527
changeDetection: ChangeDetectionStrategy.OnPush
2628
})
2729
export class KeymapHeaderComponent implements OnChanges {
30+
2831
@Input() keymap: Keymap;
2932
@Input() deletable: boolean;
3033
@Output() downloadClick = new EventEmitter<void>();
@@ -33,7 +36,7 @@ export class KeymapHeaderComponent implements OnChanges {
3336
@ViewChild('abbr') keymapAbbr: ElementRef;
3437

3538
starTitle: string;
36-
trashTitle: string = 'Delete keymap';
39+
trashTitle: string = DEFAULT_TRASH_TITLE;
3740

3841
constructor(private store: Store<AppState>, private renderer: Renderer2) { }
3942

@@ -92,7 +95,9 @@ export class KeymapHeaderComponent implements OnChanges {
9295
}
9396

9497
setTrashTitle(): void {
95-
this.trashTitle = this.deletable ? 'Delete keymap' : 'The last keymap cannot be deleted.';
98+
this.trashTitle = this.deletable
99+
? DEFAULT_TRASH_TITLE
100+
: '<span class="text-nowrap">The last keymap cannot be deleted.</span>';
96101
}
97102

98103
onDownloadIconClick(): void {

shared/src/components/macro/header/macro-header.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ <h1 class="col-xs-12 pane-title">
1111
<i class="glyphicon glyphicon-trash macro__remove pull-right" title=""
1212
data-toggle="tooltip"
1313
data-placement="bottom"
14-
data-original-title="Remove macro"
14+
html="true"
15+
data-original-title="<span class='text-nowrap'>Delete macro</span>"
1516
(click)="removeMacro()"
1617
></i>
1718
<i class="fa fa-files-o macro__duplicate pull-right" title=""

shared/src/directives/tooltip/tooltip.directive.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { AfterContentInit, Directive, ElementRef, HostBinding, Input, OnChanges, Renderer2, SimpleChanges } from '@angular/core';
1+
import { AfterContentInit, Directive, ElementRef, HostBinding, Input, OnChanges, SimpleChanges } from '@angular/core';
2+
import { DomSanitizer } from '@angular/platform-browser';
23

34
@Directive({
45
selector: '[data-toggle="tooltip"]'
@@ -16,7 +17,7 @@ export class TooltipDirective implements AfterContentInit, OnChanges {
1617
</div>
1718
`;
1819

19-
constructor(private elementRef: ElementRef, private renderer: Renderer2) { }
20+
constructor(private elementRef: ElementRef, private sanitizer: DomSanitizer) { }
2021

2122
ngAfterContentInit() {
2223
this.init();
@@ -38,6 +39,13 @@ export class TooltipDirective implements AfterContentInit, OnChanges {
3839
}
3940

4041
private fixTitle() {
42+
jQuery(this.elementRef.nativeElement).tooltip({
43+
placement: this.placement,
44+
html: this.html,
45+
template: this.customTooltipTemplate,
46+
title: this.title
47+
});
48+
4149
jQuery(this.elementRef.nativeElement)
4250
.attr('title', this.title)
4351
.tooltip('fixTitle');

0 commit comments

Comments
 (0)