Merge pull request #6744 from d-rivera-c/dev/pharmac-fork

fixing val reference to url in https hotlink and allowes https hotlinking on TinyMCE
This commit is contained in:
Damian Mooyman 2018-02-05 14:22:08 +13:00 committed by GitHub
commit fa44d22058
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -351,7 +351,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

@ -1142,7 +1142,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,10 +1159,17 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
onclick: function(e) {
var urlField = this.getURLField(), container = this.closest('.CompositeField'), form = this.closest('form');
var val = urlField.val();
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();