text
This commit is contained in:
parent
3b6571c008
commit
798aefc0ea
@ -22,7 +22,7 @@
|
|||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field>
|
<mat-form-field>
|
||||||
<input matInput placeholder="{{'submission.title' | i18n}}" formControlName="title" type="text" required>
|
<input matInput placeholder="{{'submission.title' | i18n}}" formControlName="title" type="text" required (focus)="onTitleFocus($event)">
|
||||||
<mat-error>
|
<mat-error>
|
||||||
{{'submission.title.error' | i18n}}
|
{{'submission.title.error' | i18n}}
|
||||||
</mat-error>
|
</mat-error>
|
||||||
|
@ -44,6 +44,18 @@ export class PageSubmission implements OnInit {
|
|||||||
return this.form.controls[ controlName ].errors != null;
|
return this.form.controls[ controlName ].errors != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onTitleFocus(event): void {
|
||||||
|
fetch(this.form.get("url").value)
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((html) => {
|
||||||
|
const doc = new DOMParser().parseFromString(html, "text/html");
|
||||||
|
const title = doc.querySelectorAll('title')[ 0 ];
|
||||||
|
return title.innerText;
|
||||||
|
}).then((title) => {
|
||||||
|
this.form.get("title").setValue(title);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
create(): void {
|
create(): void {
|
||||||
|
|
||||||
if (this.working) {
|
if (this.working) {
|
||||||
|
@ -10,7 +10,6 @@ small a:not(.entry):hover {
|
|||||||
|
|
||||||
.text {
|
.text {
|
||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
word-break: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
span.voted {
|
span.voted {
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
a.title {
|
a.title {
|
||||||
white-space: break-spaces;
|
white-space: break-spaces;
|
||||||
word-wrap: break-word;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
small a {
|
small a {
|
||||||
|
Loading…
Reference in New Issue
Block a user