Skip to content

Commit

Permalink
Replace colon emojis (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolson committed Oct 25, 2023
1 parent 87c35ad commit afe34a2
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 11 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"class-validator": "0.14.0",
"commander": "7.2.0",
"dayjs": "1.11.10",
"emoji-js": "^3.7.0",
"fastify": "4.23.2",
"fs-extra": "10.1.0",
"node-cache": "5.1.2",
Expand Down
3 changes: 2 additions & 1 deletion ui/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"xterm",
"xterm-addon-fit",
"xterm-addon-web-links",
"mobile-detect"
"mobile-detect",
"emoji-js"
],
"aot": false,
"stylePreprocessorOptions": {
Expand Down
6 changes: 3 additions & 3 deletions ui/src/app/core/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { SpinnerComponent } from './components/spinner/spinner.component';
import { ConvertTempPipe } from './pipes/convert-temp.pipe';
import { ReplacePipe } from './pipes/replace.pipe';
import { ExternalLinkIconPipe } from './pipes/external-link-icon.pipe';
import { HrefTargetBlankDirective } from './directives/href-target-blank.directive';
import { PluginsMarkdownDirective } from './directives/plugins.markdown.directive';
import { LongClickDirective } from './directives/longclick.directive';
import { BackupRestoreComponent } from './backup-restore/backup-restore.component';
import { ScheduledBackupsComponent } from './backup-restore/scheduled-backups/scheduled-backups.component';
Expand All @@ -24,7 +24,7 @@ import { JsonSchemaFormPatchDirective } from './directives/json-schema-form-patc
ConvertTempPipe,
ReplacePipe,
ExternalLinkIconPipe,
HrefTargetBlankDirective,
PluginsMarkdownDirective,
LongClickDirective,
RtlDirective,
JsonSchemaFormPatchDirective,
Expand All @@ -46,7 +46,7 @@ import { JsonSchemaFormPatchDirective } from './directives/json-schema-form-patc
ConvertTempPipe,
ReplacePipe,
ExternalLinkIconPipe,
HrefTargetBlankDirective,
PluginsMarkdownDirective,
LongClickDirective,
RtlDirective,
JsonSchemaFormPatchDirective,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Directive, ElementRef, OnInit } from '@angular/core';
import { EmojiConvertor } from 'emoji-js';

@Directive({
selector: '[hrefTargetBlank]',
selector: 'markdown',
})
export class HrefTargetBlankDirective implements OnInit {
export class PluginsMarkdownDirective implements OnInit {

constructor(
private el: ElementRef,
Expand All @@ -16,6 +17,10 @@ export class HrefTargetBlankDirective implements OnInit {
a.target = '_blank';
a.rel = 'noopener noreferrer';
});

// replace colon emojis
const emoji = new EmojiConvertor();
this.el.nativeElement.innerHTML = emoji.replace_colons(this.el.nativeElement.innerHTML);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ <h4 class="mt-2">
</div>

<div class="mt-3" *ngIf="gshConfig && gshConfig.token">
<markdown hrefTargetBlank class="plugin-md" [data]="schema.footerDisplay" *ngIf="schema.footerDisplay">
<markdown class="plugin-md" [data]="schema.footerDisplay" *ngIf="schema.footerDisplay">
</markdown>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ <h3 class="text-center primary-text" [translate]="'platform.version.title_servic
</div>
<hr>
</div>
<markdown hrefTargetBlank class="plugin-md" [data]="changeLog"></markdown>
<markdown class="plugin-md" [data]="changeLog"></markdown>
</div>
<div *ngIf="!onlineUpdateOk" class="modal-body">
<h4 class="primary-text text-center" [translate]="'plugins.manage.label_manual_update_required'">
Expand All @@ -41,7 +41,7 @@ <h4 class="primary-text text-center" [translate]="'plugins.manage.label_manual_u
<div *ngIf="showReleaseNotes && !actionComplete" class="modal-body plugin-modal-body">
<h3>Release Notes</h3>
<h5>{{ release.name }}</h5>
<markdown hrefTargetBlank class="plugin-md" [data]="release.changelog"></markdown>
<markdown class="plugin-md" [data]="release.changelog"></markdown>
</div>
<div class="modal-footer" *ngIf="!onlineUpdateOk || actionComplete || showReleaseNotes || actionFailed">
<button type="button" class="btn btn-elegant" data-dismiss="modal" (click)="activeModal.dismiss('Cross click')"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ <h5 class="modal-title">
</div>
<div class="modal-body">
<div>
<markdown hrefTargetBlank class="plugin-md" [data]="schema.headerDisplay | interpolateMd"
<markdown class="plugin-md" [data]="schema.headerDisplay | interpolateMd"
*ngIf="schema.headerDisplay"></markdown>
</div>

Expand Down Expand Up @@ -50,7 +50,7 @@ <h5 class="m-0">{{ block.name }}</h5>
</div>

<div class="mt-3">
<markdown hrefTargetBlank class="plugin-md" [data]="schema.footerDisplay | interpolateMd"
<markdown class="plugin-md" [data]="schema.footerDisplay | interpolateMd"
*ngIf="schema.footerDisplay"></markdown>
</div>
</div>
Expand Down

0 comments on commit afe34a2

Please sign in to comment.