add markdown support for text widgets
This commit is contained in:
@@ -47,6 +47,7 @@ import { CustomizableGridComponent } from './customizable-grid/customizable-grid
|
||||
import {DragDropModule} from '@angular/cdk/drag-drop';
|
||||
import { ConfirmationDialogComponent } from './confirmation-dialog/confirmation-dialog.component';
|
||||
import { FocusDirective } from './focus.directive';
|
||||
import { MarkdownModule } from 'ngx-markdown';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
@@ -77,6 +78,7 @@ import { FocusDirective } from './focus.directive';
|
||||
FocusDirective
|
||||
],
|
||||
imports: [
|
||||
MarkdownModule.forRoot(),
|
||||
BrowserModule,
|
||||
AppRoutingModule,
|
||||
FormsModule,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<style>
|
||||
mat-form-field textarea {
|
||||
height: 7em;
|
||||
height: 20em;
|
||||
}
|
||||
</style>
|
||||
<h1 mat-dialog-title>Add Text</h1>
|
||||
@@ -9,6 +9,7 @@
|
||||
<mat-label>Text</mat-label>
|
||||
<textarea matInput [(ngModel)]="text" #textElement focus></textarea>
|
||||
</mat-form-field>
|
||||
<div>Text field supports <a href="https://spec.commonmark.org/" target="_blank" rel="noopener">Markdown</a>.</div>
|
||||
</div>
|
||||
<div mat-dialog-actions align="end">
|
||||
<button mat-button mat-dialog-close (click)="close()">Cancel</button>
|
||||
|
||||
@@ -29,5 +29,5 @@
|
||||
<button mat-icon-button (click)="edit()"><img src="/assets/img/edit-outline.svg"/></button>
|
||||
<button mat-icon-button (click)="delete()"><img src="/assets/img/recycle-bin-line.svg"/></button>
|
||||
</div>
|
||||
<p *ngFor="let line of lines()">{{line}}</p>
|
||||
<markdown [data]="this.data.text"></markdown>
|
||||
</div>
|
||||
|
||||
@@ -190,7 +190,8 @@ mat-form-field.pdb-form-mid {
|
||||
mat-form-field.pdb-form-wide {
|
||||
width: 10em;
|
||||
}
|
||||
pdb-visualization-page .mat-mdc-form-field-subscript-wrapper {
|
||||
pdb-visualization-page .mat-mdc-form-field-subscript-wrapper,
|
||||
app-add-text-dialog .mat-mdc-form-field-subscript-wrapper {
|
||||
display: none;/**/
|
||||
}
|
||||
|
||||
@@ -207,3 +208,23 @@ pdb-visualization-page .mat-mdc-form-field-subscript-wrapper {
|
||||
top: 0.2em;
|
||||
line-height: 1em;
|
||||
}
|
||||
|
||||
a[target="_blank"]:after {
|
||||
content: "";
|
||||
display: inline-block;
|
||||
background: url("assets/img/external-link.svg") no-repeat;
|
||||
background-size: 1em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
margin-left: 0.3em;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
|
||||
|
||||
/* styles for markdown*/
|
||||
markdown blockquote {
|
||||
border-left: 4px grey solid;
|
||||
display: block;
|
||||
margin-left: 2em;
|
||||
padding-left: 0.5em;
|
||||
}
|
||||
Reference in New Issue
Block a user