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