diff --git a/client/dist/js/TinyMCE_ssembed.js b/client/dist/js/TinyMCE_ssembed.js index f1c54b9df..9c6cd2e6c 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=f(r(4754)),o=p(r(7363)),i=r(2827),s=r(1624),a=f(r(4912)),d=p(r(3573)),l=f(r(7086)),c=r(4845);function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(u=function(e){return e?r:t})(e)}function p(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=u(t);if(r&&r.has(e))return r.get(e);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}function f(e){return e&&e.__esModule?e:{default:e}}class m extends o.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){this.setOverrides(this.props)}componentDidUpdate(e){this.props.isOpen&&!e.isOpen&&this.setOverrides(this.props)}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 o.default.createElement(a.default,this.getModalProps())}}t.Component=m,m.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},m.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:"",o=r.form.remoteEditForm.schemaUrl,i=n&&(0,c.joinUrlPaths)(o,`/?embedurl=${encodeURIComponent(n)}`),s=r.form.remoteCreateForm.schemaUrl;return{sectionConfig:r,schemaUrl:i||s,targetUrl:n}}),(function(e){return{actions:{schema:(0,i.bindActionCreators)(d,e)}}}))(m);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},4845:function(e){e.exports=ssUrlLib}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}!function(){var e=l(r(5311)),t=l(r(7363)),n=r(745),o=r(6648),i=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={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var s=o?Object.getOwnPropertyDescriptor(e,i):null;s&&(s.get||s.set)?Object.defineProperty(n,i,s):n[i]=e[i]}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,o.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"),o=a.default._t("AssetAdmin.DELETE_MEDIA","Delete media"),s=a.default._t("AssetAdmin.MEDIA","Media");return t.addCommand("ssembed",(()=>{(0,e.default)(`#${t.id}`).entwine("ss").openEmbedDialog()})),t.addCommand("ssembed-delete",(()=>{const e=t.selection.getNode();t.dom.is(e,u)?e.remove():t.dom.is(e.parentNode,u)?e.parentNode.remove():console.error({error:"Unexpected selection - expected embed",selectedNode:e})})),t.ui.registry.addButton("ssembed",{tooltip:r,icon:"embed",onAction:()=>t.execCommand("ssembed"),stateSelector:u}),t.ui.registry.addMenuItem("ssembed",{text:s,icon:"embed",onAction:()=>t.execCommand("ssembed")}),t.ui.registry.addButton("ssembededit",{tooltip:n,icon:"edit-block",onAction:()=>t.execCommand("ssembed")}),t.ui.registry.addButton("ssembeddelete",{tooltip:o,icon:"remove",onAction:()=>t.execCommand("ssembed-delete")}),t.ui.registry.addContextToolbar("ssembed",{predicate:e=>t.dom.is(e,u),position:"node",scope:"node",items:"alignleft aligncenter alignright | ssembededit ssembeddelete"}),t.on("BeforeExecCommand",(e=>{const r=e.command,n=e.ui,o=e.value;"mceMedia"===r&&(e.preventDefault(),t.execCommand("ssembed",n,o))})),t.on("GetContent",(t=>{const r=(0,e.default)(`