From 798aefc0ea152ec4d73ca00bfdb6b2b0956cc18b Mon Sep 17 00:00:00 2001 From: _Bastler Date: Wed, 6 Oct 2021 07:38:24 +0200 Subject: [PATCH] text --- src/app/pages/submission/submission.page.html | 2 +- src/app/pages/submission/submission.page.ts | 12 ++++++++++++ src/app/ui/comment/comment.ui.scss | 1 - src/app/ui/entry/entry.ui.scss | 1 - 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/app/pages/submission/submission.page.html b/src/app/pages/submission/submission.page.html index 9eb6224..3bdd329 100644 --- a/src/app/pages/submission/submission.page.html +++ b/src/app/pages/submission/submission.page.html @@ -22,7 +22,7 @@ - + {{'submission.title.error' | i18n}} diff --git a/src/app/pages/submission/submission.page.ts b/src/app/pages/submission/submission.page.ts index 0bf3a3d..ac76305 100644 --- a/src/app/pages/submission/submission.page.ts +++ b/src/app/pages/submission/submission.page.ts @@ -44,6 +44,18 @@ export class PageSubmission implements OnInit { 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 { if (this.working) { diff --git a/src/app/ui/comment/comment.ui.scss b/src/app/ui/comment/comment.ui.scss index b19a36e..558a80e 100644 --- a/src/app/ui/comment/comment.ui.scss +++ b/src/app/ui/comment/comment.ui.scss @@ -10,7 +10,6 @@ small a:not(.entry):hover { .text { white-space: break-spaces; - word-break: break-word; } span.voted { diff --git a/src/app/ui/entry/entry.ui.scss b/src/app/ui/entry/entry.ui.scss index dbb969e..d5b0681 100644 --- a/src/app/ui/entry/entry.ui.scss +++ b/src/app/ui/entry/entry.ui.scss @@ -2,7 +2,6 @@ a.title { white-space: break-spaces; - word-wrap: break-word; } small a {