allowes hhtps hotlinking on TinyMCE

This commit is contained in:
Denise Rivera 2016-03-16 08:33:44 +13:00
parent de044e591b
commit 5612b498b9
2 changed files with 8 additions and 3 deletions

View File

@ -350,7 +350,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
$fromWeb = new CompositeField(
new LiteralField('headerURL',
'<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'),
$remoteURL = new TextField('RemoteURL', 'http://'),
$remoteURL = new TextField('RemoteURL', ''),
new LiteralField('addURLImage',
'<button type="button" class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">' .
_t('HtmlEditorField.BUTTONADDURL', 'Add url').'</button>')

View File

@ -1139,7 +1139,6 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
var val = this.val(), orig = val;
val = $.trim(val);
val = val.replace(/^https?:\/\//i, '');
if (orig !== val) this.val(val);
this.getAddButton().button(!!val ? 'enable' : 'disable');
@ -1160,7 +1159,13 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
if (urlField.validate()) {
container.addClass('loading');
form.showFileView('http://' + urlField.val()).done(function() {
// add "http://" if a protocol is missing from the url
if (val.match(/^https?:\/\//i) == void 0) {
val = 'http://' + val;
}
form.showFileView(val).done(function() {
container.removeClass('loading');
});
form.redraw();