diff --git a/_config/editorconfig.yml b/_config/editorconfig.yml index a2d69d7..9208686 100644 --- a/_config/editorconfig.yml +++ b/_config/editorconfig.yml @@ -50,11 +50,13 @@ SilverStripers\markdown\forms\MarkdownEditorConfig: action: ssEmbed className: 'fa fa-play' title: 'Embed Media' + dependsOn: 'silverstripe/asset-admin' - name: image action: ssImage className: 'fa fa-picture-o' title: 'Insert Image' + dependsOn: 'silverstripe/asset-admin' - '|' - name: preview diff --git a/client/dist/bundle.min.js b/client/dist/bundle.min.js index 650e193..26d5ca6 100644 --- a/client/dist/bundle.min.js +++ b/client/dist/bundle.min.js @@ -1,5 +1,5 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";n(1),n(7),n(8)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertEmbedModal.default);o.default.entwine("ss",function(e){e("#insert-md-embed-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this.setData({}),this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=function(){return t._handleCreate.apply(t,arguments)},o=function(){return t._handleLoadingError.apply(t,arguments)},a=window.ss.store,l=window.ss.apolloClient,d=this.getOriginalAttributes();u.default.render(s.default.createElement(c.ApolloProvider,{store:a,client:l},s.default.createElement(p,{show:e,onCreate:i,onInsert:r,onHide:n,onLoadingError:o,fileAttributes:d,bodyClassName:"modal__dialog modal__dialog--scrollable",className:"insert-embed-react__dialog-wrapper"})),this[0])},_handleLoadingError:function(){this.setData({}),this.open()},_handleInsert:function(e){var t=this.getData();this.setData(Object.assign({Url:t.Url},e)),this.insertRemote(),this.close()},_handleCreate:function(e){this.setData(Object.assign({},this.getData(),e)),this.open()},getOriginalAttributes:function(){var e=this.getData();return e},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];if("string"!=typeof e)return"";var n=e.split(" ");return t.find(function(e){return n.indexOf(e)>-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=(0,d.provideInjector)(window.InsertMediaModal.default);o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this,n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.InsertWidth+" height="+t.InsertHeight+" url='"+t.url+"'] \""+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("
").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'});var w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=x.markdownConfigs,n}return a(t,e),s(t,[{key:"handleChange",value:function(e){this.props.textarea.value=e}},{key:"previewRender",value:function(e,t){t.classList.add("markdown-preview"),t.classList.add(this.identifier);var n=b.parse(e);return this.parent.markdown(n)}},{key:"render",value:function(){return u.default.createElement("div",{className:"editor-container"},u.default.createElement(f.default,{value:this.props.textarea.value,onChange:this.handleChange.bind(this),options:{spellChecker:!0,dragDrop:!1,keyMap:"sublime",toolbar:this.props.toolbar,previewRender:this.previewRender,identifier:this.props.identifier}}))}}],[{key:"addCustomAction",value:function(e,t){x.markdownConfigs[e]=t}},{key:"registerShortCodes",value:function(e,t){}}]),t}(u.default.Component);window.MarkdownEditorField=w,m.default.entwine("ss",function(e){w.addCustomAction("ssEmbed",function(t){if(window.InsertMediaModal){var n=e("#insert-md-embed-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),w.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else y.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=JSON.parse(t.dataset.config),r=x.markdownConfigs.readToolbarConfigs(n.toolbar);d.default.render(u.default.createElement(w,{textarea:t,toolbar:r,identifier:n.identifier}),this[0])}})}),t.default={MarkdownEditorField:w}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like
,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
"],c=[3,"","
"],d=[1,'',""],p={"*":[1,"?

"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o-1})},insertRemote:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n='[embed url="'+t.Url+'" thumbnail="'+t.PreviewUrl+'" width="'+t.Width+'" height="'+t.Height+'" ]',r=e.codemirror.getCursor();return e.codemirror.setSelection(r,r),e.codemirror.replaceSelection("\n"+n+"\n"),this.updateTextarea(),!0},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t){e.exports=jQuery},function(e,t){e.exports=React},function(e,t){e.exports=ReactDom},function(e,t){e.exports=ReactApollo},function(e,t){e.exports=Injector},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}var i=n(2),o=r(i),a=n(3),s=r(a),l=n(4),u=r(l),c=n(5),d=n(6),p=window.InsertMediaModal?(0,d.provideInjector)(window.InsertMediaModal.default):null;o.default.entwine("ss",function(e){e("#insert-md-media-react__dialog-wrapper").entwine({Element:null,Data:{},onunmatch:function(){this._clearModal()},_clearModal:function(){u.default.unmountComponentAtNode(this[0])},open:function(){this._renderModal(!0)},close:function(){this._renderModal(!1)},_renderModal:function(e){var t=this;if(!p)throw new Error("Embed is not supported, Install silverstripe/asset-admin");var n=function(){return t.close()},r=function(){return t._handleInsert.apply(t,arguments)},i=window.ss.store,o=window.ss.apolloClient,a=this.getOriginalAttributes();delete a.url,u.default.render(s.default.createElement(c.ApolloProvider,{store:i,client:o},s.default.createElement(p,{title:!1,type:"insert-media",show:e,onInsert:r,onHide:n,bodyClassName:"modal__dialog",className:"insert-media-react__dialog-wrapper",requireLinkText:!1,fileAttributes:a})),this[0])},_handleInsert:function(e,t){var n=!1;this.setData(Object.assign({},e,t));try{var r=null;switch(r=t?t.category:"image"){case"image":n=this.insertImage();break;default:n=this.insertFile()}}catch(e){this.statusMessage(e,"bad")}return n&&this.close(),Promise.resolve()},getOriginalAttributes:function(){return{}},findPosition:function(e){var t=["leftAlone","center","rightAlone","left","right"];return t.find(function(t){var n=new RegExp("\\b"+t+"\\b");return n.test(e)})},getAttributes:function(){var e=this.getData();return{src:e.url,alt:e.AltText,width:e.InsertWidth,height:e.InsertHeight,title:e.TitleTooltip,class:e.Alignment,"data-id":e.ID,"data-shortcode":"image"}},getExtraData:function(){var e=this.getData();return{CaptionText:e&&e.Caption}},insertFile:function(){var e=this.getElement(),t=this.getData(),n=t.title||t.filename,r="["+n+"]([file_link,id="+t.ID+"])",i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},insertImage:function(){var e=this.getElement();if(!e)return!1;var t=this.getData(),n=this.getExtraData(),r="!["+(n.CaptionText?n.CaptionText:t.title)+"]([image_link id="+t.ID+" width="+t.InsertWidth+" height="+t.InsertHeight+" url='"+t.url+"'] \""+t.title+'")',i=e.codemirror.getCursor();return e.codemirror.setSelection(i,i),e.codemirror.replaceSelection("\n"+r+"\n"),this.updateTextarea(),!0},statusMessage:function(t,n){var r=e("

").text(t).html();e.noticeAdd({text:r,type:n,stayTime:5e3,inEffect:{left:"0",opacity:"show"}})},updateTextarea:function(){var t=this.getElement();e(t.element).closest(".js-markdown-holder").find("textarea.markdowneditor").val(t.value())}})})},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n'});var w=function(e){function t(e){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state=x.markdownConfigs,n}return a(t,e),s(t,[{key:"handleChange",value:function(e){this.props.textarea.value=e}},{key:"previewRender",value:function(e,t){t.classList.add("markdown-preview"),t.classList.add(this.identifier);var n=b.parse(e);return this.parent.markdown(n)}},{key:"render",value:function(){return u.default.createElement("div",{className:"editor-container"},u.default.createElement(f.default,{value:this.props.textarea.value,onChange:this.handleChange.bind(this),options:{spellChecker:!0,dragDrop:!1,keyMap:"sublime",toolbar:this.props.toolbar,previewRender:this.previewRender,identifier:this.props.identifier}}))}}],[{key:"addCustomAction",value:function(e,t){x.markdownConfigs[e]=t}},{key:"registerShortCodes",value:function(e,t){}}]),t}(u.default.Component);window.MarkdownEditorField=w,m.default.entwine("ss",function(e){w.addCustomAction("ssEmbed",function(t){if(window.InsertMediaModal){var n=e("#insert-md-embed-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else alert("Media embed is not supported")}),w.addCustomAction("ssImage",function(t){if(window.InsertMediaModal){var n=e("#insert-md-media-react__dialog-wrapper");n.length||(n=e('
'),e("body").append(n)),n.setElement(t),n.open()}else y.drawImage(t)}),e(".js-markdown-container:visible").entwine({onunmatch:function(){this._super(),d.default.unmountComponentAtNode(this[0])},onmatch:function(){this._super(),this.refresh()},refresh:function(){var t=e(this).parent().find("textarea")[0],n=JSON.parse(t.dataset.config),r=x.markdownConfigs.readToolbarConfigs(n.toolbar);d.default.render(u.default.createElement(w,{textarea:t,toolbar:r,identifier:n.identifier}),this[0])}})}),t.default={MarkdownEditorField:w}},function(e,t,n){(function(t){!function(t,n){e.exports=n()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";var r=n(1),i=n(158),o=n(159);e.exports=r.createClass({displayName:"exports",getInitialState:function(){return{keyChange:!1}},getDefaultProps:function(){return{onChange:o,options:{}}},componentWillMount:function(){var e=this.props.id;e?this.id=e:this.id=i()},componentDidMount:function(){this.createEditor(),this.addEvents(),this.addExtraKeys()},componentWillReceiveProps:function(e){this.state.keyChange||e.value===this.simplemde.value()||this.simplemde.value(e.value),this.setState({keyChange:!1})},componentWillUnmount:function(){this.removeEvents()},createEditor:function(){var e=n(160),t={element:document.getElementById(this.id),initialValue:this.props.value},r=Object.assign({},t,this.props.options);this.simplemde=new e(r)},eventWrapper:function(){this.setState({keyChange:!0}),this.props.onChange(this.simplemde.value())},removeEvents:function(){this.editorEl.removeEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.removeEventListener("click",this.eventWrapper)},addEvents:function(){var e=this.id+"-wrapper",t=document.getElementById(""+e);this.editorEl=t.getElementsByClassName("CodeMirror")[0],this.editorToolbarEl=t.getElementsByClassName("editor-toolbar")[0],this.editorEl.addEventListener("keyup",this.eventWrapper),this.editorToolbarEl&&this.editorToolbarEl.addEventListener("click",this.eventWrapper)},addExtraKeys:function(){this.props.extraKeys&&this.simplemde.codemirror.setOption("extraKeys",this.props.extraKeys)},render:function(){var e=r.createElement("textarea",{id:this.id});return r.createElement("div",{id:this.id+"-wrapper",className:this.props.className},e)}})},function(e,t,n){"use strict";e.exports=n(2)},function(e,t,n){"use strict";var r=n(3),i=n(148),o=n(152),a=n(39),s=n(157),l={};a(l,o),a(l,{findDOMNode:s("findDOMNode","ReactDOM","react-dom",r,r.findDOMNode),render:s("render","ReactDOM","react-dom",r,r.render),unmountComponentAtNode:s("unmountComponentAtNode","ReactDOM","react-dom",r,r.unmountComponentAtNode),renderToString:s("renderToString","ReactDOMServer","react-dom/server",i,i.renderToString),renderToStaticMarkup:s("renderToStaticMarkup","ReactDOMServer","react-dom/server",i,i.renderToStaticMarkup)}),l.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=r,l.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=i,e.exports=l},function(e,t,n){(function(t){"use strict";var r=n(5),i=n(6),o=n(71),a=n(45),s=n(28),l=n(18),u=n(50),c=n(54),d=n(146),p=n(91),f=n(147),h=n(25);o.inject();var m=l.measure("React","render",s.render),g={findDOMNode:p,render:m,unmountComponentAtNode:s.unmountComponentAtNode,version:d,unstable_batchedUpdates:c.batchedUpdates,unstable_renderSubtreeIntoContainer:f};if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject&&__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({CurrentOwner:r,InstanceHandles:a,Mount:s,Reconciler:u,TextComponent:i}),"production"!==t.env.NODE_ENV){var v=n(9);if(v.canUseDOM&&window.top===window.self){"undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&(navigator.userAgent.indexOf("Chrome")>-1&&navigator.userAgent.indexOf("Edge")===-1||navigator.userAgent.indexOf("Firefox")>-1)&&console.debug("Download the React DevTools for a better development experience: https://fb.me/react-devtools");var y=document.documentMode&&document.documentMode<8;"production"!==t.env.NODE_ENV?h(!y,'Internet Explorer is running in compatibility mode; please add the following tag to your HTML to prevent this from happening: '):void 0;for(var b=[Array.isArray,Array.prototype.every,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.map,Date.now,Function.prototype.bind,Object.keys,String.prototype.split,String.prototype.trim,Object.create,Object.freeze],x=0;x1)for(var n=1;n"+d+""},receiveComponent:function(e,t){if(e!==this._currentElement){this._currentElement=e;var n=""+e;if(n!==this._stringText){this._stringText=n;var i=a.getNode(this._rootNodeID);r.updateTextContent(i,n)}}},unmountComponent:function(){o.unmountIDFromEnvironment(this._rootNodeID)}}),e.exports=d}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t,n){var r=n>=e.childNodes.length?null:e.childNodes.item(n);e.insertBefore(t,r)}var i=n(8),o=n(16),a=n(18),s=n(19),l=n(20),u=n(13),c={dangerouslyReplaceNodeWithMarkup:i.dangerouslyReplaceNodeWithMarkup,updateTextContent:l,processUpdates:function(e,n){for(var a,c=null,d=null,p=0;p when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",f,m):u(!1),c=c||{},c[m]=c[m]||[],c[m][f]=h,d=d||[],d.push(h)}var g;if(g=n.length&&"string"==typeof n[0]?i.dangerouslyRenderMarkup(n):n,d)for(var v=0;v]+)/,c="data-danger-index",d={dangerouslyRenderMarkup:function(e){i.canUseDOM?void 0:"production"!==t.env.NODE_ENV?l(!1,"dangerouslyRenderMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString for server rendering."):l(!1);for(var n,d={},p=0;p node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString()."):l(!1):void 0;var r;r="string"==typeof n?o(n,a)[0]:n,e.parentNode.replaceChild(r,e)}};e.exports=d}).call(t,n(4))},function(e,t){"use strict";var n=!("undefined"==typeof window||!window.document||!window.document.createElement),r={canUseDOM:n,canUseWorkers:"undefined"!=typeof Worker,canUseEventListeners:n&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:n&&!!window.screen,isInWorker:!n};e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){var t=e.match(c);return t&&t[1].toLowerCase()}function i(e,n){var i=u;u?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup dummy not initialized"):l(!1);var o=r(e),c=o&&s(o);if(c){i.innerHTML=c[1]+e+c[2];for(var d=c[0];d--;)i=i.lastChild}else i.innerHTML=e;var p=i.getElementsByTagName("script");p.length&&(n?void 0:"production"!==t.env.NODE_ENV?l(!1,"createNodesFromMarkup(...): Unexpected ","
"],c=[3,"","
"],d=[1,'',""],p={"*":[1,"?

"],area:[1,"",""],col:[2,"","
"],legend:[1,"
","
"],param:[1,"",""],tr:[2,"","
"],optgroup:l,option:l,caption:u,colgroup:u,tbody:u,tfoot:u,thead:u,td:c,th:c},f=["circle","clipPath","defs","ellipse","g","image","line","linearGradient","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","text","tspan"];f.forEach(function(e){p[e]=d,s[e]=!0}),e.exports=r}).call(t,n(4))},function(e,t){"use strict";function n(e){return function(){return e}}function r(){}r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(e){return e},e.exports=r},function(e,t,n){"use strict";var r=n(17),i=r({INSERT_MARKUP:null,MOVE_EXISTING:null,REMOVE_NODE:null,SET_MARKUP:null,TEXT_CONTENT:null});e.exports=i},function(e,t,n){(function(t){"use strict";var r=n(13),i=function(e){var n,i={};e instanceof Object&&!Array.isArray(e)?void 0:"production"!==t.env.NODE_ENV?r(!1,"keyMirror(...): Argument must be an object."):r(!1);for(n in e)e.hasOwnProperty(n)&&(i[n]=n);return i};e.exports=i}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function n(e,t,n){return n}var r={enableMeasure:!1,storedMeasure:n,measureMethods:function(e,n,i){if("production"!==t.env.NODE_ENV)for(var o in i)i.hasOwnProperty(o)&&(e[o]=r.measure(n,i[o],e[o]))},measure:function(e,n,i){if("production"!==t.env.NODE_ENV){var o=null,a=function(){return r.enableMeasure?(o||(o=r.storedMeasure(e,n,i)),o.apply(this,arguments)):i.apply(this,arguments)};return a.displayName=e+"_"+n,a}return i},injection:{injectMeasure:function(e){r.storedMeasure=e}}};e.exports=r}).call(t,n(4))},function(e,t,n){"use strict";var r=n(9),i=/^[ \r\n\t\f]/,o=/<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/,a=function(e,t){e.innerHTML=t};if("undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(a=function(e,t){MSApp.execUnsafeLocalFunction(function(){e.innerHTML=t})}),r.canUseDOM){var s=document.createElement("div");s.innerHTML=" ",""===s.innerHTML&&(a=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),i.test(t)||"<"===t[0]&&o.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t})}e.exports=a},function(e,t,n){"use strict";var r=n(9),i=n(21),o=n(19),a=function(e,t){e.textContent=t};r.canUseDOM&&("textContent"in document.documentElement||(a=function(e,t){o(e,i(t))})),e.exports=a},function(e,t){"use strict";function n(e){return i[e]}function r(e){return(""+e).replace(o,n)}var i={"&":"&",">":">","<":"<",'"':""","'":"'"},o=/[&><"']/g;e.exports=r},function(e,t,n){(function(t){"use strict";function r(e){return!!d.hasOwnProperty(e)||!c.hasOwnProperty(e)&&(u.test(e)?(d[e]=!0,!0):(c[e]=!0,"production"!==t.env.NODE_ENV?l(!1,"Invalid attribute name: `%s`",e):void 0,!1))}function i(e,t){return null==t||e.hasBooleanValue&&!t||e.hasNumericValue&&isNaN(t)||e.hasPositiveNumericValue&&t<1||e.hasOverloadedBooleanValue&&t===!1}var o=n(23),a=n(18),s=n(24),l=n(25),u=/^[a-zA-Z_][\w\.\-]*$/,c={},d={};if("production"!==t.env.NODE_ENV)var p={children:!0,dangerouslySetInnerHTML:!0,key:!0,ref:!0},f={},h=function(e){if(!(p.hasOwnProperty(e)&&p[e]||f.hasOwnProperty(e)&&f[e])){f[e]=!0;var n=e.toLowerCase(),r=o.isCustomAttribute(n)?n:o.getPossibleStandardName.hasOwnProperty(n)?o.getPossibleStandardName[n]:null;"production"!==t.env.NODE_ENV?l(null==r,"Unknown DOM property %s. Did you mean %s?",e,r):void 0}};var m={createMarkupForID:function(e){return o.ID_ATTRIBUTE_NAME+"="+s(e)},setAttributeForID:function(e,t){e.setAttribute(o.ID_ATTRIBUTE_NAME,t)},createMarkupForProperty:function(e,n){var r=o.properties.hasOwnProperty(e)?o.properties[e]:null;if(r){if(i(r,n))return"";var a=r.attributeName;return r.hasBooleanValue||r.hasOverloadedBooleanValue&&n===!0?a+'=""':a+"="+s(n)}return o.isCustomAttribute(e)?null==n?"":e+"="+s(n):("production"!==t.env.NODE_ENV&&h(e),null)},createMarkupForCustomAttribute:function(e,t){return r(e)&&null!=t?e+"="+s(t):""},setValueForProperty:function(e,n,r){var a=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(a){var s=a.mutationMethod;if(s)s(e,r);else if(i(a,r))this.deleteValueForProperty(e,n);else if(a.mustUseAttribute){var l=a.attributeName,u=a.attributeNamespace;u?e.setAttributeNS(u,l,""+r):a.hasBooleanValue||a.hasOverloadedBooleanValue&&r===!0?e.setAttribute(l,""):e.setAttribute(l,""+r)}else{var c=a.propertyName;a.hasSideEffects&&""+e[c]==""+r||(e[c]=r)}}else o.isCustomAttribute(n)?m.setValueForAttribute(e,n,r):"production"!==t.env.NODE_ENV&&h(n)},setValueForAttribute:function(e,t,n){r(t)&&(null==n?e.removeAttribute(t):e.setAttribute(t,""+n))},deleteValueForProperty:function(e,n){var r=o.properties.hasOwnProperty(n)?o.properties[n]:null;if(r){var i=r.mutationMethod;if(i)i(e,void 0);else if(r.mustUseAttribute)e.removeAttribute(r.attributeName);else{var a=r.propertyName,s=o.getDefaultValueForProperty(e.nodeName,a);r.hasSideEffects&&""+e[a]===s||(e[a]=s)}}else o.isCustomAttribute(n)?e.removeAttribute(n):"production"!==t.env.NODE_ENV&&h(n)}};a.measureMethods(m,"DOMPropertyOperations",{setValueForProperty:"setValueForProperty",setValueForAttribute:"setValueForAttribute",deleteValueForProperty:"deleteValueForProperty"}),e.exports=m}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e,t){return(e&t)===t}var i=n(13),o={MUST_USE_ATTRIBUTE:1,MUST_USE_PROPERTY:2,HAS_SIDE_EFFECTS:4,HAS_BOOLEAN_VALUE:8,HAS_NUMERIC_VALUE:16,HAS_POSITIVE_NUMERIC_VALUE:48,HAS_OVERLOADED_BOOLEAN_VALUE:64,injectDOMPropertyConfig:function(e){var n=o,a=e.Properties||{},l=e.DOMAttributeNamespaces||{},u=e.DOMAttributeNames||{},c=e.DOMPropertyNames||{},d=e.DOMMutationMethods||{};e.isCustomAttribute&&s._isCustomAttributeFunctions.push(e.isCustomAttribute);for(var p in a){s.properties.hasOwnProperty(p)?"production"!==t.env.NODE_ENV?i(!1,"injectDOMPropertyConfig(...): You're trying to inject DOM property '%s' which has already been injected. You may be accidentally injecting the same DOM property config twice, or you may be injecting two configs that have conflicting property names.",p):i(!1):void 0;var f=p.toLowerCase(),h=a[p],m={attributeName:f,attributeNamespace:null,propertyName:p,mutationMethod:null,mustUseAttribute:r(h,n.MUST_USE_ATTRIBUTE),mustUseProperty:r(h,n.MUST_USE_PROPERTY),hasSideEffects:r(h,n.HAS_SIDE_EFFECTS),hasBooleanValue:r(h,n.HAS_BOOLEAN_VALUE),hasNumericValue:r(h,n.HAS_NUMERIC_VALUE),hasPositiveNumericValue:r(h,n.HAS_POSITIVE_NUMERIC_VALUE),hasOverloadedBooleanValue:r(h,n.HAS_OVERLOADED_BOOLEAN_VALUE)};if(m.mustUseAttribute&&m.mustUseProperty?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Cannot require using both attribute and property: %s",p):i(!1):void 0,!m.mustUseProperty&&m.hasSideEffects?"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Properties that have side effects must use property: %s",p):i(!1):void 0,m.hasBooleanValue+m.hasNumericValue+m.hasOverloadedBooleanValue<=1?void 0:"production"!==t.env.NODE_ENV?i(!1,"DOMProperty: Value can be one of boolean, overloaded boolean, or numeric value, but not a combination: %s",p):i(!1),"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[f]=p),u.hasOwnProperty(p)){var g=u[p];m.attributeName=g,"production"!==t.env.NODE_ENV&&(s.getPossibleStandardName[g]=p)}l.hasOwnProperty(p)&&(m.attributeNamespace=l[p]),c.hasOwnProperty(p)&&(m.propertyName=c[p]),d.hasOwnProperty(p)&&(m.mutationMethod=d[p]),s.properties[p]=m}}},a={},s={ID_ATTRIBUTE_NAME:"data-reactid",properties:{},getPossibleStandardName:"production"!==t.env.NODE_ENV?{}:null,_isCustomAttributeFunctions:[],isCustomAttribute:function(e){for(var t=0;t2?n-2:0),i=2;i when using tables, nesting tags like ,

, or , or using non-SVG elements in an parent. Try inspecting the child nodes of the element with React ID `%s`.",n,ee.getID(e)):B(!1)},_mountImageIntoNode:function(e,n,o,a){if(!n||n.nodeType!==z&&n.nodeType!==q&&n.nodeType!==Y?"production"!==t.env.NODE_ENV?B(!1,"mountComponentIntoNode(...): Target container is not valid."):B(!1):void 0,o){var s=i(n);if(_.canReuseMarkup(e,s))return;var l=s.getAttribute(_.CHECKSUM_ATTR_NAME);s.removeAttribute(_.CHECKSUM_ATTR_NAME);var u=s.outerHTML;s.setAttribute(_.CHECKSUM_ATTR_NAME,l);var c=e;if("production"!==t.env.NODE_ENV){var d;n.nodeType===z?(d=document.createElement("div"),d.innerHTML=e,c=d.innerHTML):(d=document.createElement("iframe"),document.body.appendChild(d),d.contentDocument.write(e),c=d.contentDocument.documentElement.outerHTML,document.body.removeChild(d))}var p=r(c,u),f=" (client) "+c.substring(p-20,p+20)+"\n (server) "+u.substring(p-20,p+20);n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document using server rendering but the checksum was invalid. This usually means you rendered a different component type or props on the client from the one on the server, or your render() methods are impure. React cannot handle this case due to cross-browser quirks by rendering at the document root. You should look for environment dependent code in your components and ensure the props are the same client and server side:\n%s",f):B(!1):void 0,"production"!==t.env.NODE_ENV&&("production"!==t.env.NODE_ENV?U(!1,"React attempted to reuse markup in a container but the checksum was invalid. This generally means that you are using server rendering and the markup generated on the server was not what the client was expecting. React injected new markup to compensate which works but you have lost many of the benefits of server rendering. Instead, figure out why the markup being generated is different on the client or server:\n%s",f):void 0)}if(n.nodeType===q?"production"!==t.env.NODE_ENV?B(!1,"You're trying to render a component to the document but you didn't use server rendering. We can't do this without using server rendering due to cross-browser quirks. See ReactDOMServer.renderToString() for server rendering."):B(!1):void 0,a.useCreateElement){for(;n.lastChild;)n.removeChild(n.lastChild);n.appendChild(e)}else F(n,e)},ownerDocumentContextKey:G,getReactRootID:o,getID:a,setID:l,getNode:u,getNodeFromInstance:c,isValid:d,purgeID:p};M.measureMethods(ee,"ReactMount",{_renderNewRootComponent:"_renderNewRootComponent",_mountImageIntoNode:"_mountImageIntoNode"}),e.exports=ee}).call(t,n(4))},function(e,t,n){"use strict";function r(e){return Object.prototype.hasOwnProperty.call(e,g)||(e[g]=h++,p[e[g]]={}),p[e[g]]}var i=n(30),o=n(31),a=n(32),s=n(37),l=n(18),u=n(38),c=n(39),d=n(40),p={},f=!1,h=0,m={topAbort:"abort",topBlur:"blur",topCanPlay:"canplay",topCanPlayThrough:"canplaythrough",topChange:"change",topClick:"click",topCompositionEnd:"compositionend",topCompositionStart:"compositionstart",topCompositionUpdate:"compositionupdate",topContextMenu:"contextmenu",topCopy:"copy",topCut:"cut",topDoubleClick:"dblclick",topDrag:"drag",topDragEnd:"dragend",topDragEnter:"dragenter",topDragExit:"dragexit",topDragLeave:"dragleave",topDragOver:"dragover",topDragStart:"dragstart",topDrop:"drop",topDurationChange:"durationchange",topEmptied:"emptied",topEncrypted:"encrypted",topEnded:"ended",topError:"error",topFocus:"focus",topInput:"input",topKeyDown:"keydown",topKeyPress:"keypress",topKeyUp:"keyup",topLoadedData:"loadeddata",topLoadedMetadata:"loadedmetadata",topLoadStart:"loadstart",topMouseDown:"mousedown",topMouseMove:"mousemove",topMouseOut:"mouseout",topMouseOver:"mouseover",topMouseUp:"mouseup",topPaste:"paste",topPause:"pause",topPlay:"play",topPlaying:"playing",topProgress:"progress",topRateChange:"ratechange",topScroll:"scroll",topSeeked:"seeked",topSeeking:"seeking",topSelectionChange:"selectionchange",topStalled:"stalled",topSuspend:"suspend",topTextInput:"textInput",topTimeUpdate:"timeupdate",topTouchCancel:"touchcancel",topTouchEnd:"touchend",topTouchMove:"touchmove",topTouchStart:"touchstart",topVolumeChange:"volumechange",topWaiting:"waiting",topWheel:"wheel"},g="_reactListenersID"+String(Math.random()).slice(2),v=c({},s,{ReactEventListener:null,injection:{injectReactEventListener:function(e){e.setHandleTopLevel(v.handleTopLevel),v.ReactEventListener=e}},setEnabled:function(e){v.ReactEventListener&&v.ReactEventListener.setEnabled(e)},isEnabled:function(){return!(!v.ReactEventListener||!v.ReactEventListener.isEnabled())},listenTo:function(e,t){for(var n=t,o=r(n),s=a.registrationNameDependencies[e],l=i.topLevelTypes,u=0;u-1?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.",e):a(!1),!u.plugins[r]){n.extractEvents?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.",e):a(!1),u.plugins[r]=n;var o=n.eventTypes;for(var c in o)i(o[c],n,c)?void 0:"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.",c,e):a(!1)}}}function i(e,n,r){u.eventNameDispatchConfigs.hasOwnProperty(r)?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.",r):a(!1):void 0,u.eventNameDispatchConfigs[r]=e;var i=e.phasedRegistrationNames;if(i){for(var s in i)if(i.hasOwnProperty(s)){var l=i[s];o(l,n,r)}return!0}return!!e.registrationName&&(o(e.registrationName,n,r),!0)}function o(e,n,r){u.registrationNameModules[e]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.",e):a(!1):void 0,u.registrationNameModules[e]=n,u.registrationNameDependencies[e]=n.eventTypes[r].dependencies}var a=n(13),s=null,l={},u={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},injectEventPluginOrder:function(e){s?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React."):a(!1):void 0,s=Array.prototype.slice.call(e),r()},injectEventPluginsByName:function(e){var n=!1;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];l.hasOwnProperty(i)&&l[i]===o||(l[i]?"production"!==t.env.NODE_ENV?a(!1,"EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.",i):a(!1):void 0,l[i]=o,n=!0)}n&&r()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return u.registrationNameModules[t.registrationName]||null;for(var n in t.phasedRegistrationNames)if(t.phasedRegistrationNames.hasOwnProperty(n)){var r=u.registrationNameModules[t.phasedRegistrationNames[n]];if(r)return r}return null},_resetEventPlugins:function(){s=null;for(var e in l)l.hasOwnProperty(e)&&delete l[e];u.plugins.length=0;var t=u.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=u.registrationNameModules;for(var i in r)r.hasOwnProperty(i)&&delete r[i]}};e.exports=u}).call(t,n(4))},function(e,t,n){(function(t){"use strict";function r(e){return e===y.topMouseUp||e===y.topTouchEnd||e===y.topTouchCancel}function i(e){return e===y.topMouseMove||e===y.topTouchMove}function o(e){return e===y.topMouseDown||e===y.topTouchStart}function a(e,t,n,r){var i=e.type||"unknown-event";e.currentTarget=v.Mount.getNode(r),t?h.invokeGuardedCallbackWithCatch(i,n,e,r):h.invokeGuardedCallback(i,n,e,r),e.currentTarget=null}function s(e,n){var r=e._dispatchListeners,i=e._dispatchIDs;if("production"!==t.env.NODE_ENV&&p(e),Array.isArray(r))for(var o=0;o { @@ -40,6 +40,9 @@ jQuery.entwine('ss', ($) => { * @private */ _renderModal(show) { + if(!InjectableInsertEmbedModal) { + throw new Error('Embed is not supported, Install silverstripe/asset-admin'); + } const handleHide = () => this.close(); const handleInsert = (...args) => this._handleInsert(...args); const handleCreate = (...args) => this._handleCreate(...args); diff --git a/client/src/entwine/Markdown_ssmedia.js b/client/src/entwine/Markdown_ssmedia.js index c6dcc90..361456f 100644 --- a/client/src/entwine/Markdown_ssmedia.js +++ b/client/src/entwine/Markdown_ssmedia.js @@ -4,7 +4,7 @@ import ReactDOM from 'react-dom'; import { ApolloProvider } from 'react-apollo'; import { provideInjector } from 'lib/Injector'; -const InjectableInsertMediaModal = provideInjector(window.InsertMediaModal.default); +const InjectableInsertMediaModal = window.InsertMediaModal ? provideInjector(window.InsertMediaModal.default) : null; jQuery.entwine('ss', ($) => { @@ -34,6 +34,9 @@ jQuery.entwine('ss', ($) => { * @private */ _renderModal(show) { + if(!InjectableInsertMediaModal) { + throw new Error('Embed is not supported, Install silverstripe/asset-admin'); + } const handleHide = () => this.close(); const handleInsert = (...args) => this._handleInsert(...args); const store = window.ss.store; diff --git a/src/forms/MarkdownEditorConfig.php b/src/forms/MarkdownEditorConfig.php index e6ad320..09de0c4 100644 --- a/src/forms/MarkdownEditorConfig.php +++ b/src/forms/MarkdownEditorConfig.php @@ -14,6 +14,7 @@ use SilverStripe\Core\Config\Configurable; use SilverStripe\Core\Convert; use SilverStripe\Core\Injector\Injectable; +use SilverStripe\Core\Manifest\ModuleLoader; use SilverStripe\Core\Manifest\ModuleResourceLoader; use SilverStripe\View\SSViewer; use SilverStripe\View\ThemeResourceLoader; @@ -178,6 +179,22 @@ public function getEditorCSS() return $editor; } + /** + * @param $toolbar + * @return array + */ + private function checkSettingsDependencies($toolbar) + { + $moduleLoader = ModuleLoader::inst(); + $modules = array_keys($moduleLoader->getManifest()->getModules()); + $approved = []; + foreach ($toolbar as $item) { + if(empty($item['dependsOn']) || (isset($item['dependsOn']) && in_array($item['dependsOn'], $modules))) { + $approved[] = $item; + } + } + return $approved; + } /** * @return array @@ -196,7 +213,7 @@ public function getSettings() } return [ - 'toolbar' => $toolbar, + 'toolbar' => $this->checkSettingsDependencies($toolbar), 'editor_css' => $this->getEditorCSS(), 'identifier' => $this->getIdentifier() ];