[BUGFIX] Fix HTML in modal of OnlineMedia.ts 20/59120/10
authorGeorg Ringer <georg.ringer@gmail.com>
Tue, 11 Dec 2018 19:33:18 +0000 (20:33 +0100)
committerBenni Mack <benni@typo3.org>
Thu, 13 Dec 2018 21:10:24 +0000 (22:10 +0100)
Allows to call the OnlineMedia modal box again.

This change also adapts the buttons within
a Modal to be text-only.
Resolves: #87144
Releases: master, 8.7
Change-Id: Id08356aad3eb319c59af1411a14131715c8159d0
Reviewed-on: https://review.typo3.org/59120
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Oliver Hader <oliver.hader@typo3.org>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Resources/Private/TypeScript/Modal.ts
typo3/sysext/backend/Resources/Private/TypeScript/OnlineMedia.ts
typo3/sysext/backend/Resources/Public/JavaScript/Modal.js
typo3/sysext/backend/Resources/Public/JavaScript/OnlineMedia.js

index 991b2dc..2039a27 100644 (file)
@@ -391,7 +391,7 @@ class Modal {
       for (let i = 0; i < configuration.buttons.length; i++) {
         const button = configuration.buttons[i];
         const $button = $('<button />', {'class': 'btn'});
-        $button.html('<span>' + button.text + '</span>');
+        $button.html('<span>' + this.securityUtility.encodeHtml(button.text, false) + '</span>');
         if (button.active) {
           $button.addClass('t3js-active');
         }
index 1991710..4b8808b 100644 (file)
@@ -16,6 +16,7 @@ import * as $ from 'jquery';
 import NProgress = require('nprogress');
 import Modal = require('./Modal');
 import Severity = require('./Severity');
+import SecurityUtility = require('TYPO3/CMS/Core/SecurityUtility');
 
 interface Response {
   file?: number;
@@ -27,7 +28,9 @@ interface Response {
  * Javascript for show the online media dialog
  */
 class OnlineMedia {
+  private readonly securityUtility: SecurityUtility;
   constructor() {
+    this.securityUtility = new SecurityUtility();
     $((): void => {
       this.registerEvents();
     });
@@ -87,14 +90,24 @@ class OnlineMedia {
     const btnSubmit = $currentTarget.data('btn-submit') || 'Add';
     const placeholder = $currentTarget.data('placeholder') || 'Paste media url here...';
     const allowedExtMarkup = $.map($currentTarget.data('online-media-allowed').split(','), (ext: string): string => {
-      return '<span class="label label-success">' + ext.toUpperCase() + '</span>';
+      return '<span class="label label-success">' + this.securityUtility.encodeHtml(ext.toUpperCase(), false) + '</span>';
     });
     const allowedHelpText = $currentTarget.data('online-media-allowed-help-text') || 'Allow to embed from sources:';
+
+    const $markup = $('<div>')
+        .attr('class', 'form-control-wrap')
+        .append([
+          $('<input>')
+            .attr('type', 'text')
+            .attr('class', 'form-control online-media-url')
+            .attr('placeholder', placeholder),
+          $('<div>')
+            .attr('class', 'help-block')
+            .html(this.securityUtility.encodeHtml(allowedHelpText, false) + '<br>' + allowedExtMarkup.join(' '))
+        ]);
     const $modal = Modal.show(
       $currentTarget.attr('title'),
-      '<div class="form-control-wrap">' +
-      '<input type="text" class="form-control online-media-url" placeholder="' + placeholder + '" />' +
-      '</div><div class="help-block">' + allowedHelpText + '<br>' + allowedExtMarkup.join(' ') + '</div>',
+      $markup,
       Severity.notice,
       [{
         text: btnSubmit,
index ff18f8a..effcaf3 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-var __values=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],a=0;return e?e.call(t):{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}}};define(["require","exports","./Enum/Severity","jquery","./Icons","./Severity","TYPO3/CMS/Core/SecurityUtility","bootstrap"],function(t,e,a,n,i,o,l){"use strict";var s,r,d,c,u,f,m,g;(r=s||(s={})).modal=".t3js-modal",r.content=".t3js-modal-content",r.title=".t3js-modal-title",r.close=".t3js-modal-close",r.body=".t3js-modal-body",r.footer=".t3js-modal-footer",r.iframe=".t3js-modal-iframe",r.iconPlaceholder=".t3js-modal-icon-placeholder",(c=d||(d={})).small="small",c.default="default",c.medium="medium",c.large="large",c.full="full",(f=u||(u={})).default="default",f.light="light",f.dark="dark",(g=m||(m={})).default="default",g.ajax="ajax",g.iframe="iframe";var p=function(){function t(t){this.sizes=d,this.styles=u,this.types=m,this.currentModal=null,this.instances=[],this.$template=n('<div class="t3js-modal modal fade"><div class="modal-dialog"><div class="t3js-modal-content modal-content"><div class="modal-header"><button class="t3js-modal-close close"><span aria-hidden="true"><span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span></span><span class="sr-only"></span></button><h4 class="t3js-modal-title modal-title"></h4></div><div class="t3js-modal-body modal-body"></div><div class="t3js-modal-footer modal-footer"></div></div></div></div>'),this.defaultConfiguration={type:m.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:a.SeverityEnum.notice,buttons:[],style:u.default,size:d.default,additionalCssClasses:[],callback:n.noop(),ajaxCallback:n.noop(),ajaxTarget:null},this.securityUtility=t,n(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}return t.prototype.dismiss=function(){this.currentModal&&this.currentModal.modal("hide")},t.prototype.confirm=function(t,e,i,l,s){return void 0===i&&(i=a.SeverityEnum.warning),void 0===l&&(l=[]),0===l.length&&l.push({text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(i),name:"ok"}),this.advanced({title:t,content:e,severity:i,buttons:l,additionalCssClasses:s,callback:function(t){t.on("button.clicked",function(t){"cancel"===t.target.getAttribute("name")?n(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&n(t.currentTarget).trigger("confirm.button.ok")})}})},t.prototype.loadUrl=function(t,e,n,i,o,l){return void 0===e&&(e=a.SeverityEnum.info),this.advanced({type:m.ajax,title:t,severity:e,buttons:n,ajaxCallback:o,ajaxTarget:l})},t.prototype.show=function(t,e,n,i,o){return void 0===n&&(n=a.SeverityEnum.info),this.advanced({type:m.default,title:t,content:e,severity:n,buttons:i,additionalCssClasses:o})},t.prototype.advanced=function(t){return t.type="string"==typeof t.type&&t.type in m?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in d?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in u?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)},t.prototype.initializeMarkupTrigger=function(t){var e=this;n(t).on("click",".t3js-modal-trigger",function(t){t.preventDefault();var i=n(t.currentTarget),l=i.data("content")||"Are you sure?",s=void 0!==a.SeverityEnum[i.data("severity")]?a.SeverityEnum[i.data("severity")]:a.SeverityEnum.info,r=i.data("url")||null;null!==r&&(r=r+(r.indexOf("?")>-1?"&":"?")+n.param({data:i.data()}));e.advanced({type:null!==r?m.ajax:m.default,title:i.data("title")||"Alert",content:null!==r?r:l,severity:s,buttons:[{text:i.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:function(){e.currentModal.trigger("modal-dismiss")}},{text:i.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(s),trigger:function(){e.currentModal.trigger("modal-dismiss"),t.target.ownerDocument.location.href=i.data("href")||i.attr("href")}}]})})},t.prototype.generate=function(t){var e,a,l=this,r=this.$template.clone();if(t.additionalCssClasses.length>0)try{for(var d=__values(t.additionalCssClasses),c=d.next();!c.done;c=d.next()){var u=c.value;r.addClass(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(a=d.return)&&a.call(d)}finally{if(e)throw e.error}}if(r.addClass("modal-type-"+t.type),r.addClass("modal-severity-"+o.getCssClass(t.severity)),r.addClass("modal-style-"+t.style),r.addClass("modal-size-"+t.size),r.attr("tabindex","-1"),r.find(s.title).text(t.title),r.find(s.close).on("click",function(){r.modal("hide")}),"ajax"===t.type){var f=t.ajaxTarget?t.ajaxTarget:s.body,m=r.find(f);i.getIcon("spinner-circle",i.sizes.default,null,null,i.markupIdentifiers.inline).done(function(e){m.html('<div class="modal-loading">'+e+"</div>"),n.get(t.content,function(e){l.currentModal.find(f).empty().append(e),t.ajaxCallback&&t.ajaxCallback(),l.currentModal.trigger("modal-loaded")},"html")})}else"iframe"===t.type?(r.find(s.body).append(n("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),r.find(s.iframe).on("load",function(){r.find(s.title).text(r.find(s.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=n("<p />").html(this.securityUtility.encodeHtml(t.content))),r.find(s.body).append(t.content));if(t.buttons.length>0){for(var g=function(e){var a=t.buttons[e],i=n("<button />",{class:"btn"});i.html("<span>"+a.text+"</span>"),a.active&&i.addClass("t3js-active"),""!==a.btnClass&&i.addClass(a.btnClass),""!==a.name&&i.attr("name",a.name),a.trigger&&i.on("click",a.trigger),a.dataAttributes&&Object.keys(a.dataAttributes).length>0&&Object.keys(a.dataAttributes).map(function(t){i.attr("data-"+t,a.dataAttributes[t])}),a.icon&&i.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+a.icon+'"></span>'),r.find(s.footer).append(i)},p=0;p<t.buttons.length;p++)g(p);r.find(s.footer).find("button").on("click",function(t){n(t.currentTarget).trigger("button.clicked")})}else r.find(s.footer).remove();return r.on("shown.bs.modal",function(t){var e=n(t.currentTarget);e.find(s.footer).find(".t3js-active").first().focus(),e.find(s.iconPlaceholder).each(function(t,e){i.getIcon(n(e).data("icon"),i.sizes.small,null,null,i.markupIdentifiers.inline).done(function(t){l.currentModal.find(s.iconPlaceholder+"[data-icon="+n(t).data("identifier")+"]").replaceWith(t)})})}),r.on("hidden.bs.modal",function(t){if(l.instances.length>0){var e=l.instances.length-1;l.instances.splice(e,1),l.currentModal=l.instances[e-1]}r.trigger("modal-destroyed"),n(t.currentTarget).remove(),l.instances.length>0&&n("body").addClass("modal-open")}),r.on("show.bs.modal",function(t){l.currentModal=n(t.currentTarget),l.instances.push(l.currentModal)}),r.on("modal-dismiss",function(t){n(t.currentTarget).modal("hide")}),t.callback&&t.callback(r),r.modal()},t}(),y=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),y=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),y=top.TYPO3.Modal)}catch(t){}return y||(y=new p(new l),TYPO3.Modal=y),y});
\ No newline at end of file
+var __values=this&&this.__values||function(t){var e="function"==typeof Symbol&&t[Symbol.iterator],a=0;return e?e.call(t):{next:function(){return t&&a>=t.length&&(t=void 0),{value:t&&t[a++],done:!t}}}};define(["require","exports","./Enum/Severity","jquery","./Icons","./Severity","TYPO3/CMS/Core/SecurityUtility","bootstrap"],function(t,e,a,n,i,o,l){"use strict";var s,r,d,c,u,f,m,g;(r=s||(s={})).modal=".t3js-modal",r.content=".t3js-modal-content",r.title=".t3js-modal-title",r.close=".t3js-modal-close",r.body=".t3js-modal-body",r.footer=".t3js-modal-footer",r.iframe=".t3js-modal-iframe",r.iconPlaceholder=".t3js-modal-icon-placeholder",(c=d||(d={})).small="small",c.default="default",c.medium="medium",c.large="large",c.full="full",(f=u||(u={})).default="default",f.light="light",f.dark="dark",(g=m||(m={})).default="default",g.ajax="ajax",g.iframe="iframe";var p=function(){function t(t){this.sizes=d,this.styles=u,this.types=m,this.currentModal=null,this.instances=[],this.$template=n('<div class="t3js-modal modal fade"><div class="modal-dialog"><div class="t3js-modal-content modal-content"><div class="modal-header"><button class="t3js-modal-close close"><span aria-hidden="true"><span class="t3js-modal-icon-placeholder" data-icon="actions-close"></span></span><span class="sr-only"></span></button><h4 class="t3js-modal-title modal-title"></h4></div><div class="t3js-modal-body modal-body"></div><div class="t3js-modal-footer modal-footer"></div></div></div></div>'),this.defaultConfiguration={type:m.default,title:"Information",content:"No content provided, please check your <code>Modal</code> configuration.",severity:a.SeverityEnum.notice,buttons:[],style:u.default,size:d.default,additionalCssClasses:[],callback:n.noop(),ajaxCallback:n.noop(),ajaxTarget:null},this.securityUtility=t,n(document).on("modal-dismiss",this.dismiss),this.initializeMarkupTrigger(document)}return t.prototype.dismiss=function(){this.currentModal&&this.currentModal.modal("hide")},t.prototype.confirm=function(t,e,i,l,s){return void 0===i&&(i=a.SeverityEnum.warning),void 0===l&&(l=[]),0===l.length&&l.push({text:n(this).data("button-close-text")||TYPO3.lang["button.cancel"]||"Cancel",active:!0,btnClass:"btn-default",name:"cancel"},{text:n(this).data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(i),name:"ok"}),this.advanced({title:t,content:e,severity:i,buttons:l,additionalCssClasses:s,callback:function(t){t.on("button.clicked",function(t){"cancel"===t.target.getAttribute("name")?n(t.currentTarget).trigger("confirm.button.cancel"):"ok"===t.target.getAttribute("name")&&n(t.currentTarget).trigger("confirm.button.ok")})}})},t.prototype.loadUrl=function(t,e,n,i,o,l){return void 0===e&&(e=a.SeverityEnum.info),this.advanced({type:m.ajax,title:t,severity:e,buttons:n,ajaxCallback:o,ajaxTarget:l})},t.prototype.show=function(t,e,n,i,o){return void 0===n&&(n=a.SeverityEnum.info),this.advanced({type:m.default,title:t,content:e,severity:n,buttons:i,additionalCssClasses:o})},t.prototype.advanced=function(t){return t.type="string"==typeof t.type&&t.type in m?t.type:this.defaultConfiguration.type,t.title="string"==typeof t.title?t.title:this.defaultConfiguration.title,t.content="string"==typeof t.content||"object"==typeof t.content?t.content:this.defaultConfiguration.content,t.severity=void 0!==t.severity?t.severity:this.defaultConfiguration.severity,t.buttons=t.buttons||this.defaultConfiguration.buttons,t.size="string"==typeof t.size&&t.size in d?t.size:this.defaultConfiguration.size,t.style="string"==typeof t.style&&t.style in u?t.style:this.defaultConfiguration.style,t.additionalCssClasses=t.additionalCssClasses||this.defaultConfiguration.additionalCssClasses,t.callback="function"==typeof t.callback?t.callback:this.defaultConfiguration.callback,t.ajaxCallback="function"==typeof t.ajaxCallback?t.ajaxCallback:this.defaultConfiguration.ajaxCallback,t.ajaxTarget="string"==typeof t.ajaxTarget?t.ajaxTarget:this.defaultConfiguration.ajaxTarget,this.generate(t)},t.prototype.initializeMarkupTrigger=function(t){var e=this;n(t).on("click",".t3js-modal-trigger",function(t){t.preventDefault();var i=n(t.currentTarget),l=i.data("content")||"Are you sure?",s=void 0!==a.SeverityEnum[i.data("severity")]?a.SeverityEnum[i.data("severity")]:a.SeverityEnum.info,r=i.data("url")||null;null!==r&&(r=r+(r.indexOf("?")>-1?"&":"?")+n.param({data:i.data()}));e.advanced({type:null!==r?m.ajax:m.default,title:i.data("title")||"Alert",content:null!==r?r:l,severity:s,buttons:[{text:i.data("button-close-text")||TYPO3.lang["button.close"]||"Close",active:!0,btnClass:"btn-default",trigger:function(){e.currentModal.trigger("modal-dismiss")}},{text:i.data("button-ok-text")||TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+o.getCssClass(s),trigger:function(){e.currentModal.trigger("modal-dismiss"),t.target.ownerDocument.location.href=i.data("href")||i.attr("href")}}]})})},t.prototype.generate=function(t){var e,a,l=this,r=this.$template.clone();if(t.additionalCssClasses.length>0)try{for(var d=__values(t.additionalCssClasses),c=d.next();!c.done;c=d.next()){var u=c.value;r.addClass(u)}}catch(t){e={error:t}}finally{try{c&&!c.done&&(a=d.return)&&a.call(d)}finally{if(e)throw e.error}}if(r.addClass("modal-type-"+t.type),r.addClass("modal-severity-"+o.getCssClass(t.severity)),r.addClass("modal-style-"+t.style),r.addClass("modal-size-"+t.size),r.attr("tabindex","-1"),r.find(s.title).text(t.title),r.find(s.close).on("click",function(){r.modal("hide")}),"ajax"===t.type){var f=t.ajaxTarget?t.ajaxTarget:s.body,m=r.find(f);i.getIcon("spinner-circle",i.sizes.default,null,null,i.markupIdentifiers.inline).done(function(e){m.html('<div class="modal-loading">'+e+"</div>"),n.get(t.content,function(e){l.currentModal.find(f).empty().append(e),t.ajaxCallback&&t.ajaxCallback(),l.currentModal.trigger("modal-loaded")},"html")})}else"iframe"===t.type?(r.find(s.body).append(n("<iframe />",{src:t.content,name:"modal_frame",class:"modal-iframe t3js-modal-iframe"})),r.find(s.iframe).on("load",function(){r.find(s.title).text(r.find(s.iframe).get(0).contentDocument.title)})):("string"==typeof t.content&&(t.content=n("<p />").html(this.securityUtility.encodeHtml(t.content))),r.find(s.body).append(t.content));if(t.buttons.length>0){for(var g=function(e){var a=t.buttons[e],i=n("<button />",{class:"btn"});i.html("<span>"+p.securityUtility.encodeHtml(a.text,!1)+"</span>"),a.active&&i.addClass("t3js-active"),""!==a.btnClass&&i.addClass(a.btnClass),""!==a.name&&i.attr("name",a.name),a.trigger&&i.on("click",a.trigger),a.dataAttributes&&Object.keys(a.dataAttributes).length>0&&Object.keys(a.dataAttributes).map(function(t){i.attr("data-"+t,a.dataAttributes[t])}),a.icon&&i.prepend('<span class="t3js-modal-icon-placeholder" data-icon="'+a.icon+'"></span>'),r.find(s.footer).append(i)},p=this,y=0;y<t.buttons.length;y++)g(y);r.find(s.footer).find("button").on("click",function(t){n(t.currentTarget).trigger("button.clicked")})}else r.find(s.footer).remove();return r.on("shown.bs.modal",function(t){var e=n(t.currentTarget);e.find(s.footer).find(".t3js-active").first().focus(),e.find(s.iconPlaceholder).each(function(t,e){i.getIcon(n(e).data("icon"),i.sizes.small,null,null,i.markupIdentifiers.inline).done(function(t){l.currentModal.find(s.iconPlaceholder+"[data-icon="+n(t).data("identifier")+"]").replaceWith(t)})})}),r.on("hidden.bs.modal",function(t){if(l.instances.length>0){var e=l.instances.length-1;l.instances.splice(e,1),l.currentModal=l.instances[e-1]}r.trigger("modal-destroyed"),n(t.currentTarget).remove(),l.instances.length>0&&n("body").addClass("modal-open")}),r.on("show.bs.modal",function(t){l.currentModal=n(t.currentTarget),l.instances.push(l.currentModal)}),r.on("modal-dismiss",function(t){n(t.currentTarget).modal("hide")}),t.callback&&t.callback(r),r.modal()},t}(),y=null;try{parent&&parent.window.TYPO3&&parent.window.TYPO3.Modal?(parent.window.TYPO3.Modal.initializeMarkupTrigger(document),y=parent.window.TYPO3.Modal):top&&top.TYPO3.Modal&&(top.TYPO3.Modal.initializeMarkupTrigger(document),y=top.TYPO3.Modal)}catch(t){}return y||(y=new p(new l),TYPO3.Modal=y),y});
\ No newline at end of file
index 1315f69..ff7867e 100644 (file)
@@ -10,4 +10,4 @@
  *
  * The TYPO3 project - inspiring people to share!
  */
-define(["require","exports","./Enum/KeyTypes","jquery","nprogress","./Modal","./Severity"],function(e,t,n,o,i,r,a){"use strict";return new(function(){function e(){var e=this;o(function(){e.registerEvents()})}return e.prototype.registerEvents=function(){var e=this;o(document).on("click",".t3js-online-media-add-btn",function(t){e.triggerModal(o(t.currentTarget))})},e.prototype.addOnlineMedia=function(e,t){var n=e.data("target-folder"),l=e.data("online-media-allowed"),d=e.data("file-irre-object");i.start(),o.post(TYPO3.settings.ajaxUrls.online_media_create,{url:t,targetFolder:n,allowed:l},function(e){if(e.file)window.inline.delayedImportElement(d,"sys_file",e.file,"file");else var t=r.confirm("ERROR",e.error,a.error,[{text:TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+a.getCssClass(a.error),name:"ok",active:!0}]).on("confirm.button.ok",function(){t.modal("hide")});i.done()})},e.prototype.triggerModal=function(e){var t=this,i=e.data("btn-submit")||"Add",l=e.data("placeholder")||"Paste media url here...",d=o.map(e.data("online-media-allowed").split(","),function(e){return'<span class="label label-success">'+e.toUpperCase()+"</span>"}),s=e.data("online-media-allowed-help-text")||"Allow to embed from sources:",c=r.show(e.attr("title"),'<div class="form-control-wrap"><input type="text" class="form-control online-media-url" placeholder="'+l+'" /></div><div class="help-block">'+s+"<br>"+d.join(" ")+"</div>",a.notice,[{text:i,btnClass:"btn btn-primary",name:"ok",trigger:function(){var n=c.find("input.online-media-url").val();n&&(c.modal("hide"),t.addOnlineMedia(e,n))}}]);c.on("shown.bs.modal",function(e){o(e.currentTarget).find("input.online-media-url").first().focus().on("keydown",function(e){e.keyCode===n.KeyTypesEnum.ENTER&&c.find('button[name="ok"]').trigger("click")})})},e}())});
\ No newline at end of file
+define(["require","exports","./Enum/KeyTypes","jquery","nprogress","./Modal","./Severity","TYPO3/CMS/Core/SecurityUtility"],function(e,t,n,i,r,o,a,l){"use strict";return new(function(){function e(){var e=this;this.securityUtility=new l,i(function(){e.registerEvents()})}return e.prototype.registerEvents=function(){var e=this;i(document).on("click",".t3js-online-media-add-btn",function(t){e.triggerModal(i(t.currentTarget))})},e.prototype.addOnlineMedia=function(e,t){var n=e.data("target-folder"),l=e.data("online-media-allowed"),s=e.data("file-irre-object");r.start(),i.post(TYPO3.settings.ajaxUrls.online_media_create,{url:t,targetFolder:n,allowed:l},function(e){if(e.file)window.inline.delayedImportElement(s,"sys_file",e.file,"file");else var t=o.confirm("ERROR",e.error,a.error,[{text:TYPO3.lang["button.ok"]||"OK",btnClass:"btn-"+a.getCssClass(a.error),name:"ok",active:!0}]).on("confirm.button.ok",function(){t.modal("hide")});r.done()})},e.prototype.triggerModal=function(e){var t=this,r=e.data("btn-submit")||"Add",l=e.data("placeholder")||"Paste media url here...",s=i.map(e.data("online-media-allowed").split(","),function(e){return'<span class="label label-success">'+t.securityUtility.encodeHtml(e.toUpperCase(),!1)+"</span>"}),d=e.data("online-media-allowed-help-text")||"Allow to embed from sources:",c=i("<div>").attr("class","form-control-wrap").append([i("<input>").attr("type","text").attr("class","form-control online-media-url").attr("placeholder",l),i("<div>").attr("class","help-block").html(this.securityUtility.encodeHtml(d,!1)+"<br>"+s.join(" "))]),u=o.show(e.attr("title"),c,a.notice,[{text:r,btnClass:"btn btn-primary",name:"ok",trigger:function(){var n=u.find("input.online-media-url").val();n&&(u.modal("hide"),t.addOnlineMedia(e,n))}}]);u.on("shown.bs.modal",function(e){i(e.currentTarget).find("input.online-media-url").first().focus().on("keydown",function(e){e.keyCode===n.KeyTypesEnum.ENTER&&u.find('button[name="ok"]').trigger("click")})})},e}())});
\ No newline at end of file