mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
commit
fa44d22058
@ -351,7 +351,7 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$fromWeb = new CompositeField(
|
$fromWeb = new CompositeField(
|
||||||
new LiteralField('headerURL',
|
new LiteralField('headerURL',
|
||||||
'<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'),
|
'<h4>' . sprintf($numericLabelTmpl, '1', _t('HtmlEditorField.ADDURL', 'Add URL')) . '</h4>'),
|
||||||
$remoteURL = new TextField('RemoteURL', 'http://'),
|
$remoteURL = new TextField('RemoteURL', ''),
|
||||||
new LiteralField('addURLImage',
|
new LiteralField('addURLImage',
|
||||||
'<button type="button" class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">' .
|
'<button type="button" class="action ui-action-constructive ui-button field add-url" data-icon="addMedia">' .
|
||||||
_t('HtmlEditorField.BUTTONADDURL', 'Add url').'</button>')
|
_t('HtmlEditorField.BUTTONADDURL', 'Add url').'</button>')
|
||||||
|
@ -1142,7 +1142,6 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
var val = this.val(), orig = val;
|
var val = this.val(), orig = val;
|
||||||
|
|
||||||
val = $.trim(val);
|
val = $.trim(val);
|
||||||
val = val.replace(/^https?:\/\//i, '');
|
|
||||||
if (orig !== val) this.val(val);
|
if (orig !== val) this.val(val);
|
||||||
|
|
||||||
this.getAddButton().button(!!val ? 'enable' : 'disable');
|
this.getAddButton().button(!!val ? 'enable' : 'disable');
|
||||||
@ -1160,10 +1159,17 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
|
|
||||||
onclick: function(e) {
|
onclick: function(e) {
|
||||||
var urlField = this.getURLField(), container = this.closest('.CompositeField'), form = this.closest('form');
|
var urlField = this.getURLField(), container = this.closest('.CompositeField'), form = this.closest('form');
|
||||||
|
var val = urlField.val();
|
||||||
|
|
||||||
if (urlField.validate()) {
|
if (urlField.validate()) {
|
||||||
container.addClass('loading');
|
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');
|
container.removeClass('loading');
|
||||||
});
|
});
|
||||||
form.redraw();
|
form.redraw();
|
||||||
|
Loading…
Reference in New Issue
Block a user