diff --git a/client/dist/js/TinyMCE_ssembed.js b/client/dist/js/TinyMCE_ssembed.js index 8bebcc18f..72eff7953 100644 --- a/client/dist/js/TinyMCE_ssembed.js +++ b/client/dist/js/TinyMCE_ssembed.js @@ -1 +1 @@ -!function(){"use strict";var e={961:function(e,t,r){Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.Component=void 0;var n=p(r(4754)),i=u(r(7363)),o=r(2827),s=r(1624),a=p(r(4912)),d=u(r(3573)),l=p(r(7086));function c(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(c=function(e){return e?r:t})(e)}function u(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=c(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}return n.default=e,r&&r.set(e,n),n}function p(e){return e&&e.__esModule?e:{default:e}}class f extends i.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentWillMount(){this.setOverrides(this.props)}componentWillReceiveProps(e){e.isOpen&&!this.props.isOpen&&this.setOverrides(e)}componentWillUnmount(){this.clearOverrides()}setOverrides(e){if(this.props.schemaUrl!==e.schemaUrl&&this.clearOverrides(),e.schemaUrl){const t=Object.assign({},e.fileAttributes);delete t.ID;const r={fields:Object.entries(t).map((e=>{const[t,r]=e;return{name:t,value:r}}))};this.props.actions.schema.setSchemaStateOverrides(e.schemaUrl,r)}}getModalProps(){const e=Object.assign({onSubmit:this.handleSubmit,onLoadingError:this.handleLoadingError,showErrorMessage:!0,responseClassBad:"alert alert-danger",identifier:"AssetAdmin.InsertEmbedModal"},this.props,{className:`insert-embed-modal ${this.props.className}`,size:"lg",onClosed:this.props.onClosed,title:this.props.targetUrl?n.default._t("AssetAdmin.EditTitle","Media from the web"):n.default._t("AssetAdmin.CreateTitle","Insert new media from the web")});return delete e.sectionConfig,delete e.onInsert,delete e.fileAttributes,e}clearOverrides(){this.props.actions.schema.setSchemaStateOverrides(this.props.schemaUrl,null)}handleLoadingError(e){"function"==typeof this.props.onLoadingError&&this.props.onLoadingError(e)}handleSubmit(e,t){switch(t){case"action_addmedia":this.props.onCreate(e);break;case"action_insertmedia":this.props.onInsert(e);break;case"action_cancel":this.props.onClosed()}return Promise.resolve()}render(){return i.default.createElement(a.default,this.getModalProps())}}t.Component=f,f.propTypes={sectionConfig:l.default.shape({url:l.default.string,form:l.default.object}),isOpen:l.default.bool,onInsert:l.default.func.isRequired,onCreate:l.default.func.isRequired,fileAttributes:l.default.shape({Url:l.default.string,CaptionText:l.default.string,PreviewUrl:l.default.string,Placement:l.default.string,Width:l.default.number,Height:l.default.number}),onClosed:l.default.func.isRequired,className:l.default.string,actions:l.default.object,schemaUrl:l.default.string.isRequired,targetUrl:l.default.string,onLoadingError:l.default.func},f.defaultProps={className:"",fileAttributes:{}};var h=(0,s.connect)((function(e,t){const r=e.config.sections.find((e=>"SilverStripe\\AssetAdmin\\Controller\\AssetAdmin"===e.name)),n=t.fileAttributes?t.fileAttributes.Url:"",i=r.form.remoteEditForm.schemaUrl,o=n&&`${i}/?embedurl=${encodeURIComponent(n)}`,s=r.form.remoteCreateForm.schemaUrl;return{sectionConfig:r,schemaUrl:o||s,targetUrl:n}}),(function(e){return{actions:{schema:(0,o.bindActionCreators)(d,e)}}}))(f);t.default=h},745:function(e,t,r){var n=r(394);t.createRoot=n.createRoot,t.hydrateRoot=n.hydrateRoot},4912:function(e){e.exports=FormBuilderModal},6648:function(e){e.exports=Injector},7086:function(e){e.exports=PropTypes},7363:function(e){e.exports=React},394:function(e){e.exports=ReactDom},1624:function(e){e.exports=ReactRedux},2827:function(e){e.exports=Redux},3573:function(e){e.exports=SchemaActions},3881:function(e){e.exports=ShortcodeSerialiser},4754:function(e){e.exports=i18n},5311:function(e){e.exports=jQuery}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}!function(){var e=l(r(5311)),t=l(r(7363)),n=(l(r(394)),r(745)),i=r(6648),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(t);if(r&&r.has(e))return r.get(e);var n={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var s=i?Object.getOwnPropertyDescriptor(e,o):null;s&&(s.get||s.set)?Object.defineProperty(n,o,s):n[o]=e[o]}n.default=e,r&&r.set(e,n);return n}(r(3881)),s=l(r(961)),a=l(r(4754));function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function l(e){return e&&e.__esModule?e:{default:e}}const c=(0,i.loadComponent)(s.default),u='div[data-shortcode="embed"]';(()=>{const t=t=>{const r=a.default._t("AssetAdmin.INSERT_VIA_URL","Insert media via URL"),n=a.default._t("AssetAdmin.EDIT_MEDIA","Edit media"),i=a.default._t("AssetAdmin.MEDIA","Media");return t.addCommand("ssembed",(()=>{(0,e.default)(`#${t.id}`).entwine("ss").openEmbedDialog()})),t.ui.registry.addButton("ssembed",{tooltip:r,icon:"embed",onAction:()=>t.execCommand("ssembed"),stateSelector:u}),t.ui.registry.addMenuItem("ssembed",{text:i,icon:"embed",onAction:()=>t.execCommand("ssembed")}),t.ui.registry.addButton("ssembededit",{tooltip:n,icon:"edit-block",onAction:()=>t.execCommand("ssembed")}),t.ui.registry.addContextToolbar("ssembed",{predicate:e=>t.dom.is(e,u),position:"node",scope:"node",items:"alignleft aligncenter alignright | ssembededit"}),t.on("BeforeExecCommand",(e=>{const r=e.command,n=e.ui,i=e.value;"mceMedia"===r&&(e.preventDefault(),t.execCommand("ssembed",n,i))})),t.on("GetContent",(t=>{const r=(0,e.default)(`