dante2-editor 0.2.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/.babelrc +20 -0
  3. data/.eslint +13 -0
  4. data/.gitignore +15 -0
  5. data/README.md +5 -1
  6. data/dante2.gemspec +2 -4
  7. data/{app → demo}/assets/index.html +2 -2
  8. data/{app → demo}/assets/license.html +1 -1
  9. data/{app → demo}/assets/options.html +1 -5
  10. data/{app → demo}/assets/store.json +0 -0
  11. data/demo/data/poc.js +9 -0
  12. data/demo/demo.js +9 -0
  13. data/demo/initialize.js +7 -0
  14. data/{app → demo}/styles/layout/layout.scss +0 -0
  15. data/{app → demo}/styles/layout/normalize.css +0 -0
  16. data/{app → demo}/styles/layout/scaffold.scss +0 -0
  17. data/{app → demo}/styles/layout/tooltips.scss +0 -0
  18. data/dist/Dante2.js +2995 -0
  19. data/dist/Dante2.min.js +3 -0
  20. data/dist/Dante2.min.js.map +1 -0
  21. data/dist/DanteStyles.css +2 -0
  22. data/dist/DanteStyles.css.map +1 -0
  23. data/dist/DanteStyles.js +102 -0
  24. data/dist/DanteStyles.min.js +2 -0
  25. data/dist/DanteStyles.min.js.map +1 -0
  26. data/dist/dante-vendors.js +48316 -0
  27. data/dist/dante-vendors.min.js +29 -0
  28. data/dist/dante-vendors.min.js.map +1 -0
  29. data/{app/styles/fonts/dante → dist/fonts}/dante.eot +0 -0
  30. data/{app/styles/fonts/dante → dist/fonts}/dante.svg +0 -0
  31. data/{app/styles/fonts/dante → dist/fonts}/dante.ttf +0 -0
  32. data/{app/styles/fonts/dante → dist/fonts}/dante.woff +0 -0
  33. data/{app/styles/fonts/dante → dist/fonts}/fontello.eot +0 -0
  34. data/{app/styles/fonts/dante → dist/fonts}/fontello.svg +0 -0
  35. data/{app/styles/fonts/dante → dist/fonts}/fontello.ttf +0 -0
  36. data/{app/styles/fonts/dante → dist/fonts}/fontello.woff +0 -0
  37. data/docs/app.css +430 -1
  38. data/docs/app.css.map +1 -1
  39. data/docs/app.js +62 -2
  40. data/docs/app.js.map +1 -1
  41. data/docs/dante-vendors.js +49513 -22
  42. data/docs/dante-vendors.js.map +1 -1
  43. data/docs/dante.css +1602 -1
  44. data/docs/dante.css.map +1 -1
  45. data/docs/dante.js +3310 -3
  46. data/docs/dante.js.map +1 -1
  47. data/docs/doc.html +3 -7
  48. data/docs/index.html +4 -4
  49. data/docs/license.html +3 -3
  50. data/docs/options.html +53 -0
  51. data/package.json +47 -17
  52. data/rb_lib/dante2-editor/rails.rb +15 -0
  53. data/{lib → rb_lib}/dante2-editor/version.rb +1 -1
  54. data/{lib → rb_lib}/dante2-editor.rb +0 -0
  55. data/src/components/blocks/embed.js +126 -0
  56. data/src/components/blocks/image.js +377 -0
  57. data/src/components/blocks/placeholder.js +68 -0
  58. data/src/components/blocks/video.js +80 -0
  59. data/src/components/dante.js +291 -0
  60. data/src/components/dante_editor.js +928 -0
  61. data/src/components/debug.js +104 -0
  62. data/src/components/decorators/link.js +64 -0
  63. data/src/components/popovers/addButton.js +318 -0
  64. data/src/components/popovers/image.js +188 -0
  65. data/src/components/popovers/link.js +107 -0
  66. data/src/components/popovers/toolTip.js +402 -0
  67. data/{app/utils/logger.coffee → src/components/wrapper.js} +0 -0
  68. data/{app → src}/images/dante/media-loading-placeholder.png +0 -0
  69. data/{app → src}/images/site/dante-demo.png +0 -0
  70. data/{app → src}/images/site/dante-editor-logo.png +0 -0
  71. data/{app → src}/images/site/github-logo.png +0 -0
  72. data/src/index.js +9 -0
  73. data/{app → src}/model/index.js +0 -0
  74. data/src/style.js +3 -0
  75. data/{app → src}/styles/dante/_animations.scss +0 -0
  76. data/{app → src}/styles/dante/_caption.scss +0 -0
  77. data/{app → src}/styles/dante/_debug.scss +0 -0
  78. data/{app → src}/styles/dante/_fonts.scss +0 -0
  79. data/{app → src}/styles/dante/_graf.scss +0 -0
  80. data/{app → src}/styles/dante/_icons.scss +0 -0
  81. data/{app → src}/styles/dante/_media.scss +0 -0
  82. data/{app → src}/styles/dante/_menu.scss +0 -0
  83. data/{app → src}/styles/dante/_needsorder.scss +0 -0
  84. data/{app → src}/styles/dante/_popover.scss +0 -0
  85. data/{app → src}/styles/dante/_post.scss +0 -0
  86. data/{app → src}/styles/dante/_scaffold.scss +0 -0
  87. data/{app → src}/styles/dante/_tooltip.scss +0 -0
  88. data/{app → src}/styles/dante/_utilities.scss +0 -0
  89. data/{app → src}/styles/dante/_variables.scss +0 -0
  90. data/{app → src}/styles/dante/blame.scss +0 -0
  91. data/{app → src}/styles/dante.scss +0 -0
  92. data/{app → src}/styles/draft.css +0 -0
  93. data/src/styles/fonts/dante/dante.eot +0 -0
  94. data/src/styles/fonts/dante/dante.svg +18 -0
  95. data/src/styles/fonts/dante/dante.ttf +0 -0
  96. data/src/styles/fonts/dante/dante.woff +0 -0
  97. data/src/styles/fonts/dante/fontello.eot +0 -0
  98. data/src/styles/fonts/dante/fontello.svg +36 -0
  99. data/src/styles/fonts/dante/fontello.ttf +0 -0
  100. data/src/styles/fonts/dante/fontello.woff +0 -0
  101. data/src/utils/find_entities.js +17 -0
  102. data/src/utils/html2content.js +127 -0
  103. data/src/utils/save_content.js +80 -0
  104. data/{app → src}/utils/selection.js +0 -0
  105. data/tools/.eslintrc +9 -0
  106. data/tools/amd/README.md +7 -0
  107. data/tools/amd/bower.json +19 -0
  108. data/tools/amd/build.js +36 -0
  109. data/tools/build-cli.js +46 -0
  110. data/tools/build.js +30 -0
  111. data/tools/buildBabel.js +32 -0
  112. data/tools/constants.js +10 -0
  113. data/tools/dist/build.js +13 -0
  114. data/tools/docs/build.js +12 -0
  115. data/tools/es/build.js +27 -0
  116. data/tools/exec.js +50 -0
  117. data/tools/fs-utils.js +35 -0
  118. data/tools/lib/build.js +14 -0
  119. data/tools/promisify.js +14 -0
  120. data/webpack/base.config.js +89 -0
  121. data/webpack/docs.config.js +147 -0
  122. data/webpack/webpack.config.js +78 -0
  123. data/webpack.config-doc.js +5 -0
  124. data/webpack.config.js +3 -147
  125. data/yarn.lock +973 -718
  126. metadata +108 -64
  127. data/app/components/App.cjsx +0 -1083
  128. data/app/components/blocks/embed.cjsx +0 -109
  129. data/app/components/blocks/image.cjsx +0 -316
  130. data/app/components/blocks/placeholder.cjsx +0 -60
  131. data/app/components/blocks/video.cjsx +0 -75
  132. data/app/components/debug.cjsx +0 -96
  133. data/app/components/decorators/link.cjsx +0 -61
  134. data/app/components/popovers/addButton.cjsx +0 -247
  135. data/app/components/popovers/image.cjsx +0 -160
  136. data/app/components/popovers/link.cjsx +0 -87
  137. data/app/components/popovers/toolTip.cjsx +0 -326
  138. data/app/data/poc.js +0 -15
  139. data/app/demo.js +0 -7
  140. data/app/initialize.js +0 -4
  141. data/app/utils/find_entities.coffee +0 -20
  142. data/app/utils/html2content.coffee +0 -120
  143. data/app/utils/save_content.coffee +0 -63
  144. data/lib/dante2-editor/rails.rb +0 -16
@@ -0,0 +1,3 @@
1
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],e):"object"==typeof exports?exports.Dante2=e(require("react"),require("react-dom")):t.Dante2=e(t.React,t.ReactDOM)}(this,function(t,e){return webpackJsonpDante2([1],{0:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var r=o(227),i=n(r),a=o(137),l=n(a);t.exports={Dante:i["default"],DanteEditor:l["default"]}},5:function(e,o){e.exports=t},9:function(t,o){t.exports=e},24:function(t,e,o){"use strict";e.__esModule=!0,e.addNewBlockAt=e.updateTextOfBlock=e.updateDataOfBlock=e.resetBlockWithType=e.addNewBlock=e.getCurrentBlock=e.getNode=e.getDefaultBlockData=void 0;var n=o(46),r=o(10),i=e.getDefaultBlockData=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(t){default:return e}},a=(e.getNode=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:window,e=null;return t.getSelection?e=t.getSelection():t.document.getSelection?e=t.document.getSelection():t.document.selection&&(e=t.document.selection.createRange().text),e},e.getCurrentBlock=function(t){var e=t.getSelection(),o=t.getCurrentContent(),n=o.getBlockForKey(e.getStartKey());return n});e.addNewBlock=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unstyled",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.getSelection();if(!n.isCollapsed())return t;var l=t.getCurrentContent(),s=n.getStartKey(),d=l.getBlockMap(),u=a(t);if(!u)return t;if(0===u.getLength()){if(u.getType()===e)return t;var c=u.merge({type:e,data:i(e,o)}),p=l.merge({blockMap:d.set(s,c),selectionAfter:n});return r.EditorState.push(t,p,"change-block-type")}return t},e.resetBlockWithType=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"unstyled",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=t.getCurrentContent(),a=t.getSelection(),l=a.getStartKey(),s=n.getBlockMap(),d=s.get(l),u="";console.log("DATA FOR PLACEHOLDER!",o);var c=d.getText();d.getLength()>=2&&(u=c.substr(1));var p=d.merge({text:u,type:e,data:i(e,o)}),h=n.merge({blockMap:s.set(l,p),selectionAfter:a.merge({anchorOffset:0,focusOffset:0})});return r.EditorState.push(t,h,"change-block-type")},e.updateDataOfBlock=function(t,e,o){var n=t.getCurrentContent(),i=e.merge({data:o}),a=n.merge({blockMap:n.getBlockMap().set(e.getKey(),i)});return r.EditorState.push(t,a,"change-block-type")},e.updateTextOfBlock=function(t,e,o){var n=t.getCurrentContent(),i=e.merge({text:o}),a=n.merge({blockMap:n.getBlockMap().set(e.getKey(),i)});return r.EditorState.push(t,a,"change-block-type")},e.addNewBlockAt=function(t,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"unstyled",a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=t.getCurrentContent(),s=l.getBlockMap(),d=s.get(e),u=s.toSeq().takeUntil(function(t){return t===d}),c=s.toSeq().skipUntil(function(t){return t===d}).rest(),p=(0,r.genKey)(),h=new r.ContentBlock({key:p,type:o,text:"",characterList:d.getCharacterList().slice(0,0),depth:0,data:(0,n.Map)(i(o,a))}),f=u.concat([[e,d],[p,h]],c).toOrderedMap(),g=t.getSelection(),m=l.merge({blockMap:f,selectionBefore:g,selectionAfter:g.merge({anchorKey:p,anchorOffset:0,focusKey:p,focusOffset:0,isBackward:!1})});return r.EditorState.push(t,m,"split-block")}},78:function(t,e){"use strict";e.__esModule=!0;e.getSelectionRect=function(t){var e=t.getRangeAt(0).getBoundingClientRect(),o=e&&e.top?e:t.getRangeAt(0).getClientRects()[0];if(!o){if(!t.anchorNode||!t.anchorNode.getBoundingClientRect)return null;o=t.anchorNode.getBoundingClientRect(),o.isEmptyline=!0}return o},e.getSelection=function(t){var e=null;return t.getSelection?e=t.getSelection():t.document.getSelection?e=t.document.getSelection():t.document.selection&&(e=t.document.selection.createRange().text),e},e.getSelectedBlockNode=function(t){var e=t.getSelection();if(0===e.rangeCount)return null;var o=e.getRangeAt(0).startContainer;do{if(o.getAttribute&&"true"===o.getAttribute("data-block"))return o;o=o.parentNode}while(null!==o);return null}},137:function(t,e,o){(function(e){"use strict";t.exports=e.DanteEditor=o(242)}).call(e,function(){return this}())},227:function(t,e,o){(function(e){"use strict";t.exports=e.Dante=o(241)}).call(e,function(){return this}())},228:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(9),h=(n(p),o(10),o(61)),f=n(h),g=o(24),m=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n.updateData=n.updateData.bind(n),n.dataForUpdate=n.dataForUpdate.bind(n),n.componentDidMount=n.componentDidMount.bind(n),n.state={embed_data:n.defaultData(),error:""},n}return(0,d["default"])(e,t),e.prototype.defaultData=function(){var t=this.props.block.getData().toJS();return t.embed_data||{}},e.prototype.updateData=function(){var t=this.props,e=t.block,o=(t.blockProps,this.props.blockProps),n=o.getEditorState,r=o.setEditorState,i=e.getData(),a=i.merge(this.state);return r((0,g.updateDataOfBlock)(n(),e,a))},e.prototype.dataForUpdate=function(){return this.props.blockProps.data.toJS()},e.prototype.componentDidMount=function(){var t=this;if(this.props.blockProps.data&&(this.dataForUpdate().endpoint||this.dataForUpdate().provisory_text))return(0,f["default"])({method:"get",url:""+this.dataForUpdate().endpoint+this.dataForUpdate().provisory_text+"&scheme=https"}).then(function(e){return t.setState({embed_data:e.data},t.updateData)})["catch"](function(e){return t.setState({error:e.response.data.error_message}),console.log("TODO: error")})},e.prototype.classForImage=function(){return this.state.embed_data.images?"":"mixtapeImage--empty u-ignoreBlock"},e.prototype.picture=function(){return this.state.embed_data.images&&this.state.embed_data.images.length>0?this.state.embed_data.images[0].url:""},e.prototype.render=function(){return console.log("ERROR",this.state.error),c["default"].createElement("span",null,this.picture()?c["default"].createElement("a",{target:"_blank",className:"js-mixtapeImage mixtapeImage "+this.classForImage(),href:this.state.embed_data.url,style:{backgroundImage:"url('"+this.picture()+"')"}}):void 0,this.state.error?c["default"].createElement("h2",null,this.state.error):void 0,c["default"].createElement("a",{className:"markup--anchor markup--mixtapeEmbed-anchor",target:"_blank",href:this.state.embed_data.url},c["default"].createElement("strong",{className:"markup--strong markup--mixtapeEmbed-strong"},this.state.embed_data.title),c["default"].createElement("em",{className:"markup--em markup--mixtapeEmbed-em"},this.state.embed_data.description)),this.state.embed_data.provider_url)},e}(c["default"].Component);e["default"]=m,t.exports=e["default"]},229:function(t,e,o){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var i=o(80),a=r(i),l=o(14),s=r(l),d=o(18),u=r(d),c=o(17),p=r(c),h=o(5),f=r(h),g=o(9),m=(r(g),o(10)),y=o(61),v=r(y),k=o(24),b=function(t){function e(o){(0,s["default"])(this,e);var n=(0,u["default"])(this,t.call(this,o));n.blockPropsSrc=n.blockPropsSrc.bind(n),n.defaultUrl=n.defaultUrl.bind(n),n.defaultAspectRatio=n.defaultAspectRatio.bind(n),n.updateData=n.updateData.bind(n),n.replaceImg=n.replaceImg.bind(n),n.startLoader=n.startLoader.bind(n),n.stopLoader=n.stopLoader.bind(n),n.handleUpload=n.handleUpload.bind(n),n.aspectRatio=n.aspectRatio.bind(n),n.updateDataSelection=n.updateDataSelection.bind(n),n.handleGrafFigureSelectImg=n.handleGrafFigureSelectImg.bind(n),n.getUploadUrl=n.getUploadUrl.bind(n),n.uploadFile=n.uploadFile.bind(n),n.uploadCompleted=n.uploadCompleted.bind(n),n.updateProgressBar=n.updateProgressBar.bind(n),n.placeHolderEnabled=n.placeHolderEnabled.bind(n),n.placeholderText=n.placeholderText.bind(n),n.handleFocus=n.handleFocus.bind(n),n.render=n.render.bind(n);var r=n.props.block.getData().toJS();return n.config=n.props.blockProps.config,n.file=n.props.blockProps.data.get("file"),n.state={loading:!1,selected:!1,loading_progress:0,enabled:!1,caption:n.defaultPlaceholder(),direction:r.direction||"center",width:0,height:0,file:null,url:n.blockPropsSrc()||n.defaultUrl(r),aspect_ratio:n.defaultAspectRatio(r)},n}return(0,p["default"])(e,t),e.prototype.blockPropsSrc=function(){return this.props.blockProps.data.src},e.prototype.defaultUrl=function(t){return t.url?t.url:t.url?t.file?URL.createObjectURL(t.file):t.url:this.props.blockProps.data.src},e.prototype.defaultPlaceholder=function(){return this.props.blockProps.config.image_caption_placeholder},e.prototype.defaultAspectRatio=function(t){return t.aspect_ratio?{width:t.aspect_ratio.width,height:t.aspect_ratio.height,ratio:t.aspect_ratio.ratio}:{width:0,height:0,ratio:100}},e.prototype.getAspectRatio=function(t,e){var o=1e3,n=1e3,r=0,i=t,a=e;i>o?(r=o/i,a*=r,i*=r):a>n&&(r=n/a,i*=r,a*=r);var l=a/i*100,s={width:i,height:a,ratio:l};return s},e.prototype.updateData=function(){var t=(this.props.blockProps,this.props.block),e=this.props.blockProps.getEditorState,o=this.props.blockProps.setEditorState,n=t.getData(),r=n.merge(this.state).merge({forceUpload:!1});return o((0,k.updateDataOfBlock)(e(),t,r))},e.prototype.replaceImg=function(){var t=this;this.img=new Image,this.img.src=this.refs.image_tag.src,this.setState({url:this.img.src});var e=this;if(this.img.src.includes("blob:")||this.props.block.data.get("forceUpload"))return this.img.onload=function(){return t.setState({width:t.img.width,height:t.img.height,aspect_ratio:e.getAspectRatio(t.img.width,t.img.height)}),t.handleUpload()}},e.prototype.startLoader=function(){return this.setState({loading:!0})},e.prototype.stopLoader=function(){return this.setState({loading:!1})},e.prototype.handleUpload=function(){return this.startLoader(),this.props.blockProps.addLock(),this.updateData(),this.uploadFile()},e.prototype.componentDidMount=function(){return this.replaceImg()},e.prototype.aspectRatio=function(){return{maxWidth:""+this.state.aspect_ratio.width,maxHeight:""+this.state.aspect_ratio.height,ratio:""+this.state.aspect_ratio.height}},e.prototype.updateDataSelection=function(){var t=this.props.blockProps,e=t.getEditorState,o=t.setEditorState,n=e().getSelection().merge({anchorKey:this.props.block.getKey(),focusKey:this.props.block.getKey()});return o(m.EditorState.forceSelection(e(),n))},e.prototype.handleGrafFigureSelectImg=function(t){return t.preventDefault(),this.setState({selected:!0},this.updateDataSelection)},e.prototype.coords=function(){return{maxWidth:this.state.aspect_ratio.width+"px",maxHeight:this.state.aspect_ratio.height+"px"}},e.prototype.getBase64Image=function(t){var e=document.createElement("canvas");e.width=t.width,e.height=t.height;var o=e.getContext("2d");o.drawImage(t,0,0);var n=e.toDataURL("image/png");return n},e.prototype.formatData=function(){var t=new FormData;if(this.file){var e=this.config.upload_formName||"file";return t.append(e,this.file),t}return t.append("url",this.props.blockProps.data.get("url")),t},e.prototype.getUploadUrl=function(){var t=this.config.upload_url;return"function"==typeof t?t():t},e.prototype.getUploadHeaders=function(){return this.config.upload_headers||{}},e.prototype.uploadFile=function(){var t=this,e=void 0;return(0,v["default"])({method:"post",url:this.getUploadUrl(),headers:this.getUploadHeaders(),data:this.formatData(),onUploadProgress:function(e){return t.updateProgressBar(e)}}).then(function(e){if(t.uploadCompleted(e.data),t.props.blockProps.removeLock(),t.stopLoader(),t.file=null,t.config.upload_callback)return t.config.upload_callback(e,t)})["catch"](function(e){if(t.props.blockProps.removeLock(),t.stopLoader(),console.log("ERROR: got error uploading file "+e),t.config.upload_error_callback)return t.config.upload_error_callback(e,t)}),e=function(e){return t.uploadCompleted(e,n)}},e.prototype.uploadCompleted=function(t){return this.setState({url:t.url},this.updateData)},e.prototype.updateProgressBar=function(t){var e=this.state.loading_progress;if(t.lengthComputable)return e=t.loaded/t.total*100,e=null!=e?e:{complete:0},this.setState({loading_progress:e}),console.log("complete: "+e)},e.prototype.placeHolderEnabled=function(){return this.state.enabled||this.props.block.getText()},e.prototype.placeholderText=function(){return this.placeHolderEnabled()?"":"Write caption for image (optional)"},e.prototype.handleFocus=function(t){var e=this;return setTimeout(function(){return e.setState({enabled:!0})},0)},e.prototype.render=function(){return f["default"].createElement("div",{ref:"image_tag2",suppressContentEditableWarning:!0},f["default"].createElement("div",{className:"aspectRatioPlaceholder is-locked",style:this.coords(),onClick:this.handleGrafFigureSelectImg},f["default"].createElement("div",{style:{paddingBottom:this.state.aspect_ratio.ratio+"%"},className:"aspect-ratio-fill"}),f["default"].createElement("img",{src:this.state.url,ref:"image_tag",height:this.state.aspect_ratio.height,width:this.state.aspect_ratio.width,className:"graf-image"}),f["default"].createElement(_,{toggle:this.state.loading,progress:this.state.loading_progress})),f["default"].createElement("figcaption",{className:"imageCaption",onMouseDown:this.handleFocus},this.state.enabled?void 0:f["default"].createElement("span",{className:"danteDefaultPlaceholder"},this.placeholderText()),f["default"].createElement(m.EditorBlock,(0,a["default"])({},this.props,{editable:!0,className:"imageCaption"}))))},e}(f["default"].Component);e["default"]=b;var _=function(t){function e(){return(0,s["default"])(this,e),(0,u["default"])(this,t.apply(this,arguments))}return(0,p["default"])(e,t),e.prototype.render=function(){return f["default"].createElement("div",null,this.props.toggle?f["default"].createElement("div",{className:"image-upoader-loader"},f["default"].createElement("p",null,100===this.props.progress?"processing image...":f["default"].createElement("span",null,f["default"].createElement("span",null,"loading")," ",Math.round(this.props.progress)))):void 0)},e}(f["default"].Component);t.exports=e["default"]},230:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(80),i=n(r),a=o(14),l=n(a),s=o(18),d=n(s),u=o(17),c=n(u),p=o(5),h=n(p),f=o(9),g=(n(f),o(10)),m=function(t){function e(o){(0,l["default"])(this,e);var n=(0,d["default"])(this,t.call(this,o));return n.placeholderText=n.placeholderText.bind(n),n.placeholderFromProps=n.placeholderFromProps.bind(n),n.defaultText=n.defaultText.bind(n),n.handleFocus=n.handleFocus.bind(n),n.classForDefault=n.classForDefault.bind(n),n.state={enabled:!1,data:n.props.blockProps.data.toJS()},n}return(0,c["default"])(e,t),e.prototype.placeholderText=function(){return this.state.enabled?"":this.props.blockProps.data.toJS().placeholder||this.placeholderFromProps()||this.defaultText()},e.prototype.placeholderFromProps=function(){return this.props.block.toJS().placeholder},e.prototype.defaultText=function(){return"write something "},e.prototype.componentDidMount=function(){},e.prototype.handleFocus=function(t){var e=this;return setTimeout(function(){return e.setState({enabled:!0})},0)},e.prototype.classForDefault=function(){return this.state.enabled?"":"defaultValue defaultValue--root"},e.prototype.render=function(){return h["default"].createElement("span",{className:this.classForDefault(),onMouseDown:this.handleFocus},this.placeholderText(),h["default"].createElement(g.EditorBlock,(0,i["default"])({},this.props,{className:"imageCaption",placeholder:"escrive alalal"})))},e}(h["default"].Component);e["default"]=m,t.exports=e["default"]},231:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(80),i=n(r),a=o(14),l=n(a),s=o(18),d=n(s),u=o(17),c=n(u),p=o(5),h=n(p),f=o(9),g=(n(f),o(10)),m=o(24),y=o(61),v=n(y),k=function(t){function e(o){(0,l["default"])(this,e);var n=(0,d["default"])(this,t.call(this,o));return n.updateData=n.updateData.bind(n),n.dataForUpdate=n.dataForUpdate.bind(n),n.state={embed_data:n.defaultData()},n}return(0,c["default"])(e,t),e.prototype.defaultData=function(){var t=this.props.block.getData().toJS();return t.embed_data||{}},e.prototype.updateData=function(){var t=this.props,e=t.block,o=(t.blockProps,this.props.blockProps),n=o.getEditorState,r=o.setEditorState,i=e.getData(),a=i.merge(this.state);return r((0,m.updateDataOfBlock)(n(),e,a))},e.prototype.dataForUpdate=function(){return this.props.blockProps.data.toJS()},e.prototype.componentDidMount=function(){var t=this;if(this.props.blockProps.data&&(this.dataForUpdate().endpoint||this.dataForUpdate().provisory_text))return(0,v["default"])({method:"get",url:""+this.dataForUpdate().endpoint+this.dataForUpdate().provisory_text+"&scheme=https"}).then(function(e){return t.setState({embed_data:e.data},t.updateData)})["catch"](function(t){return console.log("TODO: error")})},e.prototype.classForImage=function(){return this.state.embed_data.thumbnail_url?"":"mixtapeImage--empty u-ignoreBlock"},e.prototype.render=function(){return h["default"].createElement("figure",{className:"graf--figure graf--iframe graf--first",tabIndex:"0"},h["default"].createElement("div",{className:"iframeContainer",dangerouslySetInnerHTML:{__html:this.state.embed_data.html}}),h["default"].createElement("figcaption",{className:"imageCaption"},h["default"].createElement(g.EditorBlock,(0,i["default"])({},this.props,{className:"imageCaption"}))))},e}(h["default"].Component);e["default"]=k,t.exports=e["default"]},232:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(79),i=n(r),a=o(14),l=n(a),s=o(18),d=n(s),u=o(17),c=n(u),p=o(5),h=n(p),f=function(t){function e(){(0,l["default"])(this,e);var o=(0,d["default"])(this,t.call(this));return o.handleToggleReadOnly=o.handleToggleReadOnly.bind(o),o.handleTestEmitAndDecode=o.handleTestEmitAndDecode.bind(o),o.handleTestEmitTEXT=o.handleTestEmitTEXT.bind(o),o.testEmitAndDecode=o.testEmitAndDecode.bind(o),o.testEmitTEXT=o.testEmitTEXT.bind(o),o.logState=o.logState.bind(o),o.toggleDisplay=o.toggleDisplay.bind(o),o.open=o.open.bind(o),o.render=o.render.bind(o),o.state={output:"",display:"none"},o}return(0,c["default"])(e,t),e.prototype.handleToggleReadOnly=function(t){return t.preventDefault(),this.props.editor.toggleEditable(),!1},e.prototype.handleTestEmitAndDecode=function(t){return t.preventDefault(),this.testEmitAndDecode()},e.prototype.handleTestEmitTEXT=function(t){return t.preventDefault(),this.testEmitTEXT()},e.prototype.testEmitAndDecode=function(t){var e=this.props.editor.emitSerializedOutput();return this.props.editor.setState({editorState:this.props.editor.decodeEditorContent(e)},this.logState((0,i["default"])(e))),!1},e.prototype.testEmitTEXT=function(){var t=this.props.editor.getTextFromEditor();return this.logState(t)},e.prototype.logState=function(t){return this.setState({output:t},this.open)},e.prototype.toggleDisplay=function(t){t.preventDefault();var e="block"===this.state.display?"none":this.state.display;return this.setState({display:e})},e.prototype.open=function(){return this.setState({display:"block"})},e.prototype.render=function(){return h["default"].createElement("div",null,h["default"].createElement("div",{className:"debugControls"},h["default"].createElement("ul",null,h["default"].createElement("li",null," LOCKS: ",this.props.editor.state.locks," "),h["default"].createElement("li",null,h["default"].createElement("a",{href:"#",onClick:this.handleToggleReadOnly},"EDITABLE: ",this.props.editor.state.read_only?"NO":"YES")),h["default"].createElement("li",null,h["default"].createElement("a",{href:"#",onClick:this.handleTestEmitTEXT},"EDITOR TEXT")),h["default"].createElement("li",null,h["default"].createElement("a",{href:"#",onClick:this.handleTestEmitAndDecode},"EDITOR STATE")))),h["default"].createElement("div",{className:"debugZone",style:{display:this.state.display}},h["default"].createElement("a",{href:"#",className:"dante-debug-close close",onClick:this.toggleDisplay}),h["default"].createElement("div",{className:"debugOutput"},h["default"].createElement("h2",null,"EDITOR OUTPUT"),this.state.output.length>0?h["default"].createElement("pre",null,this.state.output):void 0)))},e}(h["default"].Component);e["default"]=f,t.exports=e["default"]},233:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(10),h=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n._validateLink=n._validateLink.bind(n),n._checkProtocol=n._checkProtocol.bind(n),n._showPopLinkOver=n._showPopLinkOver.bind(n),n._hidePopLinkOver=n._hidePopLinkOver.bind(n),n.isHover=!1,n}return(0,d["default"])(e,t),e.prototype._validateLink=function(){var t=new RegExp("^(https?://)?((([a-zd]([a-zd-]*[a-zd])*).)+[a-z]{2,}|((d{1,3}.){3}d{1,3}))(:d+)?(/[-a-zd%_.~+]*)*(?[&a-zd%_.~+=-]*)?(#[-a-zd_]*)?$","i");return!!t.test(str)||(alert("Please enter a valid URL."),!1)},e.prototype._checkProtocol=function(){return console.log("xcvd")},e.prototype._showPopLinkOver=function(t){if(this.data.showPopLinkOver)return this.data.showPopLinkOver(this.refs.link)},e.prototype._hidePopLinkOver=function(t){if(this.data.hidePopLinkOver)return this.data.hidePopLinkOver()},e.prototype.render=function(){return this.data=p.Entity.get(this.props.entityKey).getData(),c["default"].createElement("a",{ref:"link",href:this.data.url,className:"markup--anchor",onMouseOver:this._showPopLinkOver,onMouseOut:this._hidePopLinkOver},this.props.children)},e}(c["default"].Component);e["default"]=h,t.exports=e["default"]},234:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(9),h=n(p),f=(o(10),o(24)),g=o(78),m=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n.display=n.display.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n._toggleScaled=n._toggleScaled.bind(n),n.scale=n.scale.bind(n),n.collapse=n.collapse.bind(n),n.componentWillReceiveProps=n.componentWillReceiveProps.bind(n),n.clickOnFileUpload=n.clickOnFileUpload.bind(n),n.handlePlaceholder=n.handlePlaceholder.bind(n),n.insertImage=n.insertImage.bind(n),n.handleFileInput=n.handleFileInput.bind(n),n.widgets=n.widgets.bind(n),n.clickHandler=n.clickHandler.bind(n),n.relocate=n.relocate.bind(n),n.state={position:{top:0,left:0},show:!1,scaled:!1},n}return(0,d["default"])(e,t),e.prototype.display=function(t){return t?this.show():this.hide()},e.prototype.show=function(){return this.setState({show:!0})},e.prototype.hide=function(){return this.setState({show:!1})},e.prototype.setPosition=function(t){return this.setState({position:t})},e.prototype._toggleScaled=function(t){return this.state.scaled?this.collapse():this.scale()},e.prototype.scale=function(){return this.setState({scaled:!0})},e.prototype.collapse=function(){return this.setState({scaled:!1})},e.prototype.componentWillReceiveProps=function(t){return this.collapse()},e.prototype.activeClass=function(){return this.isActive()?"is-active":""},e.prototype.isActive=function(){return this.state.show},e.prototype.scaledClass=function(){return this.state.scaled?"is-scaled":""},e.prototype.scaledWidth=function(){return this.state.scaled?"124":"0"},e.prototype.clickOnFileUpload=function(){return this.refs.fileInput.click(),this.collapse(),this.hide()},e.prototype.handlePlaceholder=function(t){var e={type:t.widget_options.insert_block,placeholder:t.options.placeholder,endpoint:t.options.endpoint};return this.props.onChange((0,f.resetBlockWithType)(this.props.editorState,"placeholder",e))},e.prototype.insertImage=function(t){var e={url:URL.createObjectURL(t),file:t};return this.props.onChange((0,f.addNewBlock)(this.props.editorState,"image",e))},e.prototype.handleFileInput=function(t){var e=t.target.files;return this.insertImage(e[0])},e.prototype.widgets=function(){return this.props.editor.widgets},e.prototype.clickHandler=function(t,e){var o=this.widgets().find(function(t){return t.icon===e});switch(o.widget_options.insertion){case"upload":return this.clickOnFileUpload(t,o);case"placeholder":return this.handlePlaceholder(o);default:return console.log("WRONG TYPE FOR "+o.widget_options.insertion)}},e.prototype.getItems=function(){return this.widgets().filter(function(t){return t.widget_options.displayOnInlineTooltip})},e.prototype.isDescendant=function(t,e){for(var o=e.parentNode;null!==o;){if(o===t)return!0;o=o.parentNode}return!1},e.prototype.relocate=function(){var t=this.props.editorState;if(t.getSelection().isCollapsed()){var e=(0,f.getCurrentBlock)(t),o=e.getType(),n=t.getCurrentContent(),r=t.getSelection(),i=n.getBlockForKey(r.anchorKey),a=(0,g.getSelection)(window);if(!a.rangeCount)return;var l=((0,f.getNode)(),(0,g.getSelectionRect)(a)),s=l,d=h["default"].findDOMNode(this.props.editor);d.getBoundingClientRect();return this.isDescendant(d,a.anchorNode)?(this.display(0===i.getText().length&&"unstyled"===o),this.setPosition({top:s.top+window.scrollY,left:s.left+window.scrollX-60})):void this.hide()}return this.hide()},e.prototype.render=function(){var t=this;return c["default"].createElement("div",{className:"inlineTooltip "+this.activeClass()+" "+this.scaledClass(),style:this.state.position},c["default"].createElement("button",{className:"inlineTooltip-button control",title:"Close Menu","data-action":"inline-menu",onClick:this._toggleScaled},c["default"].createElement("span",{className:"tooltip-icon dante-icon-plus"})),c["default"].createElement("div",{className:"inlineTooltip-menu",style:{width:this.scaledWidth()+"px"}},this.getItems().map(function(e,o){return c["default"].createElement(y,{item:e,key:o,clickHandler:t.clickHandler})}),c["default"].createElement("input",{type:"file",style:{display:"none"},ref:"fileInput",multiple:"multiple",onChange:this.handleFileInput})))},e}(c["default"].Component),y=function(t){function e(){(0,i["default"])(this,e);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];var a=(0,l["default"])(this,t.call.apply(t,[this].concat(n)));return a.clickHandler=a.clickHandler.bind(a),a}return(0,d["default"])(e,t),e.prototype.clickHandler=function(t){return t.preventDefault(),this.props.clickHandler(t,this.props.item.icon)},e.prototype.render=function(){return c["default"].createElement("button",{className:"inlineTooltip-button scale",title:this.props.title,onMouseDown:this.clickHandler},c["default"].createElement("span",{className:"tooltip-icon dante-icon-"+this.props.item.icon}))},e}(c["default"].Component);e["default"]=m,t.exports=e["default"]},235:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(9),h=n(p),f=(o(10),o(78)),g=o(24),m=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n.display=n.display.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n._toggleScaled=n._toggleScaled.bind(n),n.scale=n.scale.bind(n),n.collapse=n.collapse.bind(n),n.relocate=n.relocate.bind(n),n.componentWillReceiveProps=n.componentWillReceiveProps.bind(n),n.handleClick=n.handleClick.bind(n),n.state={position:{top:0,left:0},show:!1,scaled:!1,buttons:[{type:"left"},{type:"center"},{type:"fill"},{type:"wide"}]},n}return(0,d["default"])(e,t),e.prototype.display=function(t){return t?this.show():this.hide()},e.prototype.show=function(){return this.setState({show:!0})},e.prototype.hide=function(){return this.setState({show:!1})},e.prototype.setPosition=function(t){return this.setState({position:t})},e.prototype._toggleScaled=function(t){return this.state.scaled?this.collapse():this.scale()},e.prototype.scale=function(){return this.setState({scaled:!0})},e.prototype.collapse=function(){return this.setState({scaled:!1})},e.prototype.relocate=function(){var t=this.props.editorState;if(!t.getSelection().isCollapsed())return this.hide();var e=(0,g.getCurrentBlock)(t),o=e.getType(),n=t.getCurrentContent(),r=t.getSelection(),i=(n.getBlockForKey(r.anchorKey),(0,f.getSelection)(window));if(i.rangeCount){var a=(0,g.getNode)(),l=(0,f.getSelectionRect)(i),s=h["default"].findDOMNode(this.props.editor),d=s.getBoundingClientRect();if(this.display("image"===o),"image"===o){l=a.anchorNode.parentNode.parentNode.parentNode.getBoundingClientRect();var u=this.refs.image_popover,c=u.offsetWidth/2;return this.setPosition({top:l.top-d.top+60,left:l.left+l.width/2-c})}}},e.prototype.componentWillReceiveProps=function(t){return this.collapse()},e.prototype.getStyle=function(){if(!this.state.position)return{}},e.prototype.handleClick=function(t){return this.props.editor.setDirection(t.type)},e.prototype.render=function(){var t=this;return c["default"].createElement("div",{ref:"image_popover",className:"dante-popover popover--Aligntooltip popover--top popover--animated "+(this.state.show?"is-active":void 0),style:{top:this.state.position.top,left:this.state.position.left}},c["default"].createElement("div",{className:"popover-inner"},c["default"].createElement("ul",{className:"dante-menu-buttons"},this.state.buttons.map(function(e,o){return c["default"].createElement(y,{item:e,handleClick:t.handleClick,key:o})}))),c["default"].createElement("div",{className:"popover-arrow"}))},e}(c["default"].Component),y=function(t){function e(){(0,i["default"])(this,e);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];var a=(0,l["default"])(this,t.call.apply(t,[this].concat(n)));return a.handleClick=a.handleClick.bind(a),a.render=a.render.bind(a),a}return(0,d["default"])(e,t),e.prototype.handleClick=function(t){return t.preventDefault(),this.props.handleClick(this.props.item)},e.prototype.render=function(){return c["default"].createElement("li",{className:"dante-menu-button align-"+this.props.item.type,onMouseDown:this.handleClick},c["default"].createElement("span",{className:"tooltip-icon dante-icon-image-"+this.props.item.type}))},e}(c["default"].Component);e["default"]=m,t.exports=e["default"]},236:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(9),h=n(p),f=o(24),g=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n.display=n.display.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.relocate=n.relocate.bind(n),n.render=n.render.bind(n),n.state={position:{top:0,left:0},show:!1,url:""},n}return(0,d["default"])(e,t),e.prototype.display=function(t){return t?this.show():this.hide()},e.prototype.show=function(){return this.setState({show:!0})},e.prototype.hide=function(){return this.setState({show:!1})},e.prototype.setPosition=function(t){return this.setState({position:t})},e.prototype.relocate=function(t){if(null==t&&(t=null),t){var e=this.props.editorState,o=(0,f.getCurrentBlock)(e),n=(o.getType(),e.getCurrentContent(),e.getSelection(),t.getBoundingClientRect()),r=this.refs.dante_popover,i=r.offsetWidth/2,a=h["default"].findDOMNode(this.props.editor),l=a.getBoundingClientRect();return{top:n.top-l.top+160,left:n.left+n.width/2-i}}},e.prototype.render=function(){var t=this.state.position,e={left:t.left,top:t.top,visibility:""+(this.state.show?"visible":"hidden")};return c["default"].createElement("div",{ref:"dante_popover",className:"dante-popover popover--tooltip popover--Linktooltip popover--bottom is-active",style:e,onMouseOver:this.props.handleOnMouseOver,onMouseOut:this.props.handleOnMouseOut},c["default"].createElement("div",{className:"popover-inner"},c["default"].createElement("a",{href:this.props.url,target:"_blank"},this.state.url)),c["default"].createElement("div",{className:"popover-arrow"}))},e}(c["default"].Component);e["default"]=g,
2
+ t.exports=e["default"]},237:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(14),i=n(r),a=o(18),l=n(a),s=o(17),d=n(s),u=o(5),c=n(u),p=o(9),h=n(p),f=o(10),g=o(78),m=o(24),y=function(t){function e(o){(0,i["default"])(this,e);var n=(0,l["default"])(this,t.call(this,o));return n._clickInlineHandler=n._clickInlineHandler.bind(n),n.display=n.display.bind(n),n.show=n.show.bind(n),n.hide=n.hide.bind(n),n.relocate=n.relocate.bind(n),n._clickBlockHandler=n._clickBlockHandler.bind(n),n.displayLinkMode=n.displayLinkMode.bind(n),n.displayActiveMenu=n.displayActiveMenu.bind(n),n._enableLinkMode=n._enableLinkMode.bind(n),n._disableLinkMode=n._disableLinkMode.bind(n),n.handleInputEnter=n.handleInputEnter.bind(n),n.confirmLink=n.confirmLink.bind(n),n.inlineItems=n.inlineItems.bind(n),n.blockItems=n.blockItems.bind(n),n.getDefaultValue=n.getDefaultValue.bind(n),n.getVisibleSelectionRect=f.getVisibleSelectionRect,n.state={link_mode:!1,show:!1,position:{}},n}return(0,d["default"])(e,t),e.prototype._clickInlineHandler=function(t,e){var o=this;return t.preventDefault(),this.props.onChange(f.RichUtils.toggleInlineStyle(this.props.editorState,e)),setTimeout(function(){return o.relocate()},0)},e.prototype.display=function(t){return t?this.show():this.hide()},e.prototype.show=function(){return this.setState({show:!0})},e.prototype.hide=function(){return this.setState({link_mode:!1,show:!1})},e.prototype.setPosition=function(t){return this.setState({position:t})},e.prototype.isDescendant=function(t,e){for(var o=e.parentNode;null!==o;){if(o===t)return!0;o=o.parentNode}return!1},e.prototype.relocate=function(){var t=(0,m.getCurrentBlock)(this.props.editorState),e=t.getType();if(this.props.configTooltip.selectionElements.indexOf(e)<0)return void this.hide();if(!this.state.link_mode&&this.state.show){var o=this.refs.dante_menu,n=o.offsetWidth/2,r=(0,g.getSelection)(window);if(r.rangeCount){var i=(0,g.getSelectionRect)(r),a=h["default"].findDOMNode(this.props.editor),l=a.getBoundingClientRect();if(!this.isDescendant(a,r.anchorNode))return void this.hide();var s=i.top-l.top- -90-5,d=i.left+i.width/2-n;if(s&&d)return this.setState({show:!0,position:{left:d,top:s}})}}},e.prototype._clickBlockHandler=function(t,e){var o=this;return t.preventDefault(),this.props.onChange(f.RichUtils.toggleBlockType(this.props.editorState,e)),setTimeout(function(){return o.relocate()},0)},e.prototype.displayLinkMode=function(){return this.state.link_mode?"dante-menu--linkmode":""},e.prototype.displayActiveMenu=function(){return this.state.show?"dante-menu--active":""},e.prototype._enableLinkMode=function(t){return t.preventDefault(),this.setState({link_mode:!0})},e.prototype._disableLinkMode=function(t){return t.preventDefault(),this.setState({link_mode:!1,url:""})},e.prototype.hideMenu=function(){return this.hide()},e.prototype.handleInputEnter=function(t){if(13===t.which)return this.confirmLink(t)},e.prototype.confirmLink=function(t){t.preventDefault();var e=this.props.editorState,o=t.currentTarget.value,n=(e.getCurrentContent(),e.getSelection()),r={url:o,showPopLinkOver:this.props.showPopLinkOver,hidePopLinkOver:this.props.hidePopLinkOver},i=f.Entity.create("LINK","MUTABLE",r);return n.isCollapsed()?void console.log("COLLAPSED SKIPPING LINK"):(this.props.onChange(f.RichUtils.toggleLink(e,n,i)),this._disableLinkMode(t))},e.prototype.getPosition=function(){var t=this.state.position;return t},e.prototype.inlineItems=function(){return this.props.widget_options.block_types.filter(function(t){return"inline"===t.type})},e.prototype.blockItems=function(){return this.props.widget_options.block_types.filter(function(t){return"block"===t.type})},e.prototype.getDefaultValue=function(){var t=this;this.refs.dante_menu_input&&(this.refs.dante_menu_input.value="");var e=(0,m.getCurrentBlock)(this.props.editorState),o=(e.getType(),this.props.editor.state.editorState.getSelection()),n=null,r=null;return e.findEntityRanges(function(t){var e=t.getEntity();return n=e,null!==e&&"LINK"===f.Entity.get(e).getType()},function(e,i){var a=o.getAnchorOffset(),l=o.getFocusOffset();if(o.getIsBackward()&&(a=o.getFocusOffset(),l=o.getAnchorOffset()),e===a&&i===l)return r=f.Entity.get(n).getData().url,t.refs.dante_menu_input.value=r})},e.prototype.render=function(){var t=this;return c["default"].createElement("div",{id:"dante-menu",ref:"dante_menu",className:"dante-menu "+this.displayActiveMenu()+" "+this.displayLinkMode(),style:this.getPosition()},c["default"].createElement("div",{className:"dante-menu-linkinput"},c["default"].createElement("input",{className:"dante-menu-input",ref:"dante_menu_input",placeholder:"Paste or type a link",onKeyPress:this.handleInputEnter,defaultValue:this.getDefaultValue()}),c["default"].createElement("div",{className:"dante-menu-button",onMouseDown:this._disableLinkMode})),c["default"].createElement("ul",{className:"dante-menu-buttons"},this.blockItems().map(function(e,o){return c["default"].createElement(v,{key:o,item:e,handleClick:t._clickBlockHandler,editorState:t.props.editorState,type:"block",currentStyle:t.props.editorState.getCurrentInlineStyle})}),c["default"].createElement(k,{editorState:this.props.editorState,enableLinkMode:this._enableLinkMode}),this.inlineItems().map(function(e,o){return c["default"].createElement(v,{key:o,item:e,type:"inline",editorState:t.props.editorState,handleClick:t._clickInlineHandler})})))},e}(c["default"].Component),v=function(t){function e(){(0,i["default"])(this,e);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];var a=(0,l["default"])(this,t.call.apply(t,[this].concat(n)));return a.handleClick=a.handleClick.bind(a),a.activeClass=a.activeClass.bind(a),a.isActive=a.isActive.bind(a),a.activeClassInline=a.activeClassInline.bind(a),a.activeClassBlock=a.activeClassBlock.bind(a),a.render=a.render.bind(a),a}return(0,d["default"])(e,t),e.prototype.handleClick=function(t){return this.props.handleClick(t,this.props.item.style)},e.prototype.activeClass=function(){return this.isActive()?"active":""},e.prototype.isActive=function(){return"block"===this.props.type?this.activeClassBlock():this.activeClassInline()},e.prototype.activeClassInline=function(){if(this.props.editorState)return this.props.editorState.getCurrentInlineStyle().has(this.props.item.style)},e.prototype.activeClassBlock=function(){if(this.props.editorState){var t=this.props.editorState.getSelection(),e=this.props.editorState.getCurrentContent().getBlockForKey(t.getStartKey()).getType();return this.props.item.style===e}},e.prototype.render=function(){return c["default"].createElement("li",{className:"dante-menu-button "+this.activeClass(),onMouseDown:this.handleClick},c["default"].createElement("i",{className:"dante-icon dante-icon-"+this.props.item.label,"data-action":"bold"}))},e}(c["default"].Component),k=function(t){function e(){(0,i["default"])(this,e);for(var o=arguments.length,n=Array(o),r=0;r<o;r++)n[r]=arguments[r];var a=(0,l["default"])(this,t.call.apply(t,[this].concat(n)));return a.promptForLink=a.promptForLink.bind(a),a}return(0,d["default"])(e,t),e.prototype.promptForLink=function(t){var e=this.props.editorState.getSelection();if(!e.isCollapsed())return this.props.enableLinkMode(t)},e.prototype.render=function(){return c["default"].createElement("li",{className:"dante-menu-button",onMouseDown:this.promptForLink},c["default"].createElement("i",{className:"dante-icon icon-createlink","data-action":"createlink"},"link"))},e}(c["default"].Component);e["default"]=y,t.exports=e["default"]},238:function(t,e,o){"use strict";e.__esModule=!0;var n=o(10),r=function(t,e,o,r){return o.findEntityRanges(function(o){return function(o){var r,i,a;return r=o.getEntity(),a=null!==r&&n.Entity.get(r).getType()===t,a?(i={showPopLinkOver:e.showPopLinkOver,hidePopLinkOver:e.hidePopLinkOver},n.Entity.mergeData(r,i)):void 0,a}}(void 0),r)};e["default"]=r,t.exports=e["default"]},239:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(79),i=n(r),a=o(10),l=(o(46),function(){var t=arguments,e=t.length-1;return function(){for(var o=e,n=t[e].apply(this,arguments);o--;)n=t[o].call(this,n);return n}}),s=function(t){return{contentType:"image",imgSrc:t.getAttribute("src")}},d=function(t){if(null===t)return null;var e=document.createElement("blockquote");return e.innerText=(0,i["default"])(t),e},u=function(t,e){if(e instanceof HTMLElement){var o=c(t);return o.parentNode.insertBefore(e,o)}},c=function(t){for(;t.parentNode;)if("BODY"!==t.parentNode.tagName&&(t=t.parentNode),"BODY"===t.parentNode.tagName)return t},p=l(d,s),h=function(t){return u(t,p(t))},f=function(t,e){var o=(new DOMParser).parseFromString(t,"text/html");o.querySelectorAll("img").forEach(function(t){return h(t)});console.log(o.body.innerHTML);var n=(0,a.convertFromHTML)(o.body.innerHTML,a.getSafeBodyFromHTML,e);return n=n.map(function(t){var e=void 0;if(console.log("CHECK BLOCK",t.getType()),"blockquote"!==t.getType())return t;var o="";try{o=JSON.parse(t.getText())}catch(n){return t}return e=t.merge({type:"image",text:"",data:{url:o.imgSrc,forceUpload:!0}})}),o=null,a.ContentState.createFromBlockArray(n)};e["default"]=f,t.exports=e["default"]},240:function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=o(79),i=n(r),a=o(14),l=n(a),s=o(61),d=n(s),u=o(46),c=n(u),p=function(){function t(e){(0,l["default"])(this,t),this.getLocks=e.getLocks,this.config=e.config,this.editorContent=e.editorContent,this.editorState=e.editorState}return t.prototype.handleStore=function(t){return this.store()},t.prototype.store=function(t){var e=this;if(this.config.data_storage.url&&!(this.getLocks()>0))return clearTimeout(this.timeout),this.timeout=setTimeout(function(){return e.checkforStore(t)},this.config.data_storage.interval)},t.prototype.getTextFromEditor=function(t){return t.blocks.map(function(t){return t.text}).join("\n")},t.prototype.getUrl=function(){var t=this.config.data_storage.url;return"function"==typeof t?t():t},t.prototype.getMethod=function(){var t=this.config.data_storage.method;return"function"==typeof t?t():t},t.prototype.checkforStore=function(t){var e=this,o=!c["default"].is(c["default"].fromJS(this.editorContent),c["default"].fromJS(t));if(o)return this.config.xhr.before_handler&&this.config.xhr.before_handler(),(0,d["default"])({method:this.getMethod(),url:this.getUrl(),data:{editor_content:(0,i["default"])(t),text_content:this.getTextFromEditor(t)}}).then(function(t){if(e.config.data_storage.success_handler&&e.config.data_storage.success_handler(t),e.config.xhr.success_handler)return e.config.xhr.success_handler(t)})["catch"](function(t){if(e.config.xhr.failure_handler)return e.config.xhr.failure_handler(t)})},t}();e["default"]=p,t.exports=e["default"]}})});
3
+ //# sourceMappingURL=Dante2.min.js.map