Quote links now imply the `https` protocol if not set
authorAlexander Ebert <ebert@woltlab.com>
Fri, 10 Jun 2022 13:35:54 +0000 (15:35 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 10 Jun 2022 13:35:54 +0000 (15:35 +0200)
com.woltlab.wcf/templates/wysiwyg.tpl
ts/WoltLabSuite/Core/Ui/Redactor/Quote.ts
wcfsetup/install/files/acp/templates/wysiwyg.tpl
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Redactor/Quote.js
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index 653cb29d5bbe2b29b4c0b002f8320f9f46b20726..32a2725a1fbfd85f33594e60b487c7fefd384518 100644 (file)
                                'wcf.editor.quote.title': '{jslang __literal=true}wcf.editor.quote.title{/jslang}',
                                'wcf.editor.quote.url': '{jslang}wcf.editor.quote.url{/jslang}',
                                'wcf.editor.quote.url.description': '{jslang}wcf.editor.quote.url.description{/jslang}',
-                               'wcf.editor.quote.url.error.invalid': '{jslang}wcf.editor.quote.url.error.invalid{/jslang}',
                                
                                'wcf.editor.table.cols': '{jslang}wcf.editor.table.cols{/jslang}',
                                'wcf.editor.table.insertTable': '{jslang}wcf.editor.table.insertTable{/jslang}',
index 747b1aaab660191797a31b0825a8a35bbfa15152..da7dcb2abe08276eeee26b3a59c978a0b47d086a 100644 (file)
@@ -180,14 +180,9 @@ class UiRedactorQuote {
     const id = `redactor-quote-${this._elementId}`;
     const urlInput = document.getElementById(`${id}-url`) as HTMLInputElement;
 
-    const url = urlInput.value.replace(/\u200B/g, "").trim();
-    // simple test to check if it at least looks like it could be a valid url
+    let url = urlInput.value.replace(/\u200B/g, "").trim();
     if (url.length && !/^https?:\/\/[^/]+/.test(url)) {
-      DomUtil.innerError(urlInput, Language.get("wcf.editor.quote.url.error.invalid"));
-
-      return;
-    } else {
-      DomUtil.innerError(urlInput, false);
+      url = `https://${url}`
     }
 
     const quote = this._quote!;
index 653cb29d5bbe2b29b4c0b002f8320f9f46b20726..32a2725a1fbfd85f33594e60b487c7fefd384518 100644 (file)
                                'wcf.editor.quote.title': '{jslang __literal=true}wcf.editor.quote.title{/jslang}',
                                'wcf.editor.quote.url': '{jslang}wcf.editor.quote.url{/jslang}',
                                'wcf.editor.quote.url.description': '{jslang}wcf.editor.quote.url.description{/jslang}',
-                               'wcf.editor.quote.url.error.invalid': '{jslang}wcf.editor.quote.url.error.invalid{/jslang}',
                                
                                'wcf.editor.table.cols': '{jslang}wcf.editor.table.cols{/jslang}',
                                'wcf.editor.table.insertTable': '{jslang}wcf.editor.table.insertTable{/jslang}',
index 682621eb6f830b82a4efe0c3991a9a6e0da85a70..fa4f656772c77664c04191449a1ade1df5684376 100644 (file)
@@ -137,14 +137,9 @@ define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../../Ev
         _dialogSubmit() {
             const id = `redactor-quote-${this._elementId}`;
             const urlInput = document.getElementById(`${id}-url`);
-            const url = urlInput.value.replace(/\u200B/g, "").trim();
-            // simple test to check if it at least looks like it could be a valid url
+            let url = urlInput.value.replace(/\u200B/g, "").trim();
             if (url.length && !/^https?:\/\/[^/]+/.test(url)) {
-                Util_1.default.innerError(urlInput, Language.get("wcf.editor.quote.url.error.invalid"));
-                return;
-            }
-            else {
-                Util_1.default.innerError(urlInput, false);
+                url = `https://${url}`;
             }
             const quote = this._quote;
             // set author
index 0ad70cf25210b39714753a3e469464db16a15aa3..712760cda55309e798d6906e1f08d56e57fb3cad 100644 (file)
@@ -3871,7 +3871,6 @@ Dateianhänge:
                <item name="wcf.editor.quote.title"><![CDATA[{if $author}Zitat von {@$author}{else}Zitat{/if}]]></item>
                <item name="wcf.editor.quote.url"><![CDATA[Link]]></item>
                <item name="wcf.editor.quote.url.description"><![CDATA[Optional: {if LANGUAGE_USE_INFORMAL_VARIANT}Gib{else}Geben Sie{/if} einen Link zu der Quelle an.]]></item>
-               <item name="wcf.editor.quote.url.error.invalid"><![CDATA[Der eingegebene Link ist ungültig.]]></item>
                <item name="wcf.editor.source.error.active"><![CDATA[Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}kehre{else}kehren Sie{/if} zum Absenden in die normale Ansicht zurück.]]></item>
                <item name="wcf.editor.spoiler.label"><![CDATA[Beschriftung]]></item>
                <item name="wcf.editor.spoiler.label.description"><![CDATA[Optional: {if LANGUAGE_USE_INFORMAL_VARIANT}Gib{else}Geben Sie{/if} eine Beschriftung für den Spoiler-Button ein.]]></item>
@@ -5628,5 +5627,6 @@ Benachrichtigungen auf <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phra
        <item name="wcf.article.search.categories" />
        <item name="wcf.global.button.showSidebarRight" />
        <item name="wcf.style.colorPicker.alpha" />
+       <item name="wcf.editor.quote.url.error.invalid" />
 </delete>
 </language>
index afd49915e870912a26941b4497a89fb2cd71ba20..5474f3510c77d23cec30c9efeab1f1fb22f0929b 100644 (file)
@@ -3819,7 +3819,6 @@ Attachments:
                <item name="wcf.editor.quote.title"><![CDATA[{if $author}Quote from {@$author}{else}Quote{/if}]]></item>
                <item name="wcf.editor.quote.url"><![CDATA[Link]]></item>
                <item name="wcf.editor.quote.url.description"><![CDATA[Optional: Specify the link to the source.]]></item>
-               <item name="wcf.editor.quote.url.error.invalid"><![CDATA[The entered link is invalid.]]></item>
                <item name="wcf.editor.source.error.active"><![CDATA[Please return to the normal view before submitting.]]></item>
                <item name="wcf.editor.spoiler.label"><![CDATA[Label]]></item>
                <item name="wcf.editor.spoiler.label.description"><![CDATA[Optional: Specify the label for the spoiler toggle button.]]></item>
@@ -5630,5 +5629,6 @@ your notifications on <a href="{link isHtmlEmail=true}{/link}">{PAGE_TITLE|phras
        <item name="wcf.article.search.categories" />
        <item name="wcf.global.button.showSidebarRight" />
        <item name="wcf.style.colorPicker.alpha" />
+       <item name="wcf.editor.quote.url.error.invalid" />
 </delete>
 </language>