'wcf.editor.quote.title': '{lang __literal=true}wcf.editor.quote.title{/lang}',
'wcf.editor.quote.url': '{lang}wcf.editor.quote.url{/lang}',
'wcf.editor.quote.url.description': '{lang}wcf.editor.quote.url.description{/lang}',
+ 'wcf.editor.quote.url.error.invalid': '{lang}wcf.editor.quote.url.error.invalid{/lang}',
'wcf.editor.spoiler.label': '{lang}wcf.editor.spoiler.label{/lang}',
'wcf.editor.spoiler.label.description': '{lang}wcf.editor.spoiler.label.description{/lang}',
event.preventDefault();
var id = 'redactor-quote-' + this._elementId;
+ var urlInput = elById(id + '-url');
+ var innerError = elBySel('.innerError', urlInput.parentNode);
+ if (innerError !== null) elRemove(innerError);
- ['author', 'url'].forEach((function (attr) {
- elData(this._blockquote, attr, elById(id + '-' + attr).value);
- }).bind(this));
+ var url = urlInput.value.replace(/\u200B/g, '').trim();
+ // simple test to check if it at least looks like it could be a valid url
+ if (url.length && !/^https?:\/\/[^\/]+/.test(url)) {
+ innerError = elCreate('small');
+ innerError.className = 'innerError';
+ innerError.textContent = Language.get('wcf.editor.quote.url.error.invalid');
+ urlInput.parentNode.insertBefore(innerError, urlInput.nextElementSibling);
+ return;
+ }
+
+ // set author
+ elData(this._blockquote, 'author', elById(id + '-author').value);
+
+ // set url
+ elData(this._blockquote, 'url', url);
this._setTitle(this._blockquote);
this._editor.caret.after(this._blockquote);
<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.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>
<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[You have entered an invalid link.]]></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>