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
data/dist/Dante2.js ADDED
@@ -0,0 +1,2995 @@
1
+ (function webpackUniversalModuleDefinition(root, factory) {
2
+ if(typeof exports === 'object' && typeof module === 'object')
3
+ module.exports = factory(require("react"), require("react-dom"));
4
+ else if(typeof define === 'function' && define.amd)
5
+ define(["react", "react-dom"], factory);
6
+ else if(typeof exports === 'object')
7
+ exports["Dante2"] = factory(require("react"), require("react-dom"));
8
+ else
9
+ root["Dante2"] = factory(root["React"], root["ReactDOM"]);
10
+ })(this, function(__WEBPACK_EXTERNAL_MODULE_23__, __WEBPACK_EXTERNAL_MODULE_24__) {
11
+ return webpackJsonpDante2([0],{
12
+
13
+ /***/ 0:
14
+ /***/ function(module, exports, __webpack_require__) {
15
+
16
+ 'use strict';
17
+
18
+ var _dante = __webpack_require__(1);
19
+
20
+ var _dante2 = _interopRequireDefault(_dante);
21
+
22
+ var _dante_editor = __webpack_require__(26);
23
+
24
+ var _dante_editor2 = _interopRequireDefault(_dante_editor);
25
+
26
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
27
+
28
+ module.exports = {
29
+ Dante: _dante2['default'],
30
+ DanteEditor: _dante_editor2['default']
31
+ };
32
+
33
+ /***/ },
34
+
35
+ /***/ 1:
36
+ /***/ function(module, exports, __webpack_require__) {
37
+
38
+ /* WEBPACK VAR INJECTION */(function(global) {"use strict";
39
+
40
+ module.exports = global["Dante"] = __webpack_require__(2);
41
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
42
+
43
+ /***/ },
44
+
45
+ /***/ 23:
46
+ /***/ function(module, exports) {
47
+
48
+ module.exports = __WEBPACK_EXTERNAL_MODULE_23__;
49
+
50
+ /***/ },
51
+
52
+ /***/ 24:
53
+ /***/ function(module, exports) {
54
+
55
+ module.exports = __WEBPACK_EXTERNAL_MODULE_24__;
56
+
57
+ /***/ },
58
+
59
+ /***/ 26:
60
+ /***/ function(module, exports, __webpack_require__) {
61
+
62
+ /* WEBPACK VAR INJECTION */(function(global) {"use strict";
63
+
64
+ module.exports = global["DanteEditor"] = __webpack_require__(27);
65
+ /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))
66
+
67
+ /***/ },
68
+
69
+ /***/ 396:
70
+ /***/ function(module, exports, __webpack_require__) {
71
+
72
+ 'use strict';
73
+
74
+ exports.__esModule = true;
75
+ exports.addNewBlockAt = exports.updateTextOfBlock = exports.updateDataOfBlock = exports.resetBlockWithType = exports.addNewBlock = exports.getCurrentBlock = exports.getNode = exports.getDefaultBlockData = undefined;
76
+
77
+ var _immutable = __webpack_require__(25);
78
+
79
+ var _draftJs = __webpack_require__(94);
80
+
81
+ /*
82
+ Used from [react-rte](https://github.com/brijeshb42/medium-draft)
83
+ by [brijeshb42](https://github.com/brijeshb42/medium-draft)
84
+ */
85
+
86
+ /*
87
+ Returns default block-level metadata for various block type. Empty object otherwise.
88
+ */
89
+ var getDefaultBlockData = exports.getDefaultBlockData = function getDefaultBlockData(blockType) {
90
+ var initialData = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
91
+
92
+ switch (blockType) {
93
+ //case Block.TODO: return { checked: false };
94
+ default:
95
+ return initialData;
96
+ }
97
+ };
98
+
99
+ var getNode = exports.getNode = function getNode() {
100
+ var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window;
101
+
102
+ var t = null;
103
+ if (root.getSelection) {
104
+ t = root.getSelection();
105
+ } else if (root.document.getSelection) {
106
+ t = root.document.getSelection();
107
+ } else if (root.document.selection) {
108
+ t = root.document.selection.createRange().text;
109
+ }
110
+ return t;
111
+ };
112
+
113
+ /*
114
+ Get currentBlock in the editorState.
115
+ */
116
+ var getCurrentBlock = exports.getCurrentBlock = function getCurrentBlock(editorState) {
117
+ var selectionState = editorState.getSelection();
118
+ var contentState = editorState.getCurrentContent();
119
+ var block = contentState.getBlockForKey(selectionState.getStartKey());
120
+ return block;
121
+ };
122
+
123
+ /*
124
+ Adds a new block (currently replaces an empty block) at the current cursor position
125
+ of the given `newType`.
126
+ */
127
+ var addNewBlock = exports.addNewBlock = function addNewBlock(editorState) {
128
+ var newType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unstyled";
129
+ var initialData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
130
+
131
+ var selectionState = editorState.getSelection();
132
+ if (!selectionState.isCollapsed()) {
133
+ return editorState;
134
+ }
135
+ var contentState = editorState.getCurrentContent();
136
+ var key = selectionState.getStartKey();
137
+ var blockMap = contentState.getBlockMap();
138
+ var currentBlock = getCurrentBlock(editorState);
139
+ if (!currentBlock) {
140
+ return editorState;
141
+ }
142
+ if (currentBlock.getLength() === 0) {
143
+ if (currentBlock.getType() === newType) {
144
+ return editorState;
145
+ }
146
+ var newBlock = currentBlock.merge({
147
+ type: newType,
148
+ data: getDefaultBlockData(newType, initialData)
149
+ });
150
+ var newContentState = contentState.merge({
151
+ blockMap: blockMap.set(key, newBlock),
152
+ selectionAfter: selectionState
153
+ });
154
+ return _draftJs.EditorState.push(editorState, newContentState, 'change-block-type');
155
+ }
156
+ return editorState;
157
+ };
158
+
159
+ /*
160
+ Changes the block type of the current block.
161
+ */
162
+ var resetBlockWithType = exports.resetBlockWithType = function resetBlockWithType(editorState) {
163
+ var newType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "unstyled";
164
+ var data = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
165
+
166
+ var contentState = editorState.getCurrentContent();
167
+ var selectionState = editorState.getSelection();
168
+ var key = selectionState.getStartKey();
169
+ var blockMap = contentState.getBlockMap();
170
+ var block = blockMap.get(key);
171
+
172
+ var newText = '';
173
+ console.log("DATA FOR PLACEHOLDER!", data);
174
+ var text = block.getText();
175
+ if (block.getLength() >= 2) {
176
+ newText = text.substr(1);
177
+ }
178
+
179
+ /*if(data.text){
180
+ newText = data.text
181
+ }*/
182
+
183
+ //let newText = data.text
184
+
185
+ var newBlock = block.merge({
186
+ text: newText,
187
+ type: newType,
188
+ data: getDefaultBlockData(newType, data)
189
+ });
190
+ var newContentState = contentState.merge({
191
+ blockMap: blockMap.set(key, newBlock),
192
+ selectionAfter: selectionState.merge({
193
+ anchorOffset: 0,
194
+ focusOffset: 0
195
+ })
196
+ });
197
+ return _draftJs.EditorState.push(editorState, newContentState, 'change-block-type');
198
+ };
199
+
200
+ /*
201
+ Update block-level metadata of the given `block` to the `newData`/
202
+ */
203
+ var updateDataOfBlock = exports.updateDataOfBlock = function updateDataOfBlock(editorState, block, newData) {
204
+ var contentState = editorState.getCurrentContent();
205
+ var newBlock = block.merge({
206
+ data: newData
207
+ });
208
+ var newContentState = contentState.merge({
209
+ blockMap: contentState.getBlockMap().set(block.getKey(), newBlock)
210
+ });
211
+ return _draftJs.EditorState.push(editorState, newContentState, 'change-block-type');
212
+ // return editorState;
213
+ };
214
+
215
+ var updateTextOfBlock = exports.updateTextOfBlock = function updateTextOfBlock(editorState, block, text) {
216
+ var contentState = editorState.getCurrentContent();
217
+ var newBlock = block.merge({
218
+ text: text
219
+ });
220
+ var newContentState = contentState.merge({
221
+ blockMap: contentState.getBlockMap().set(block.getKey(), newBlock)
222
+ });
223
+
224
+ return _draftJs.EditorState.push(editorState, newContentState, 'change-block-type');
225
+ // return editorState;
226
+ };
227
+
228
+ // const BEFORE = -1;
229
+ // const AFTER = 1;
230
+
231
+ /*
232
+ Used from [react-rte](https://github.com/sstur/react-rte/blob/master/src/lib/insertBlockAfter.js)
233
+ by [sstur](https://github.com/sstur)
234
+ */
235
+ var addNewBlockAt = exports.addNewBlockAt = function addNewBlockAt(editorState, pivotBlockKey) {
236
+ var newBlockType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "unstyled";
237
+ var initialData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
238
+
239
+ var content = editorState.getCurrentContent();
240
+ var blockMap = content.getBlockMap();
241
+ var block = blockMap.get(pivotBlockKey);
242
+ var blocksBefore = blockMap.toSeq().takeUntil(function (v) {
243
+ return v === block;
244
+ });
245
+ var blocksAfter = blockMap.toSeq().skipUntil(function (v) {
246
+ return v === block;
247
+ }).rest();
248
+ var newBlockKey = (0, _draftJs.genKey)();
249
+
250
+ var newBlock = new _draftJs.ContentBlock({
251
+ key: newBlockKey,
252
+ type: newBlockType,
253
+ text: '',
254
+ characterList: block.getCharacterList().slice(0, 0),
255
+ depth: 0,
256
+ data: (0, _immutable.Map)(getDefaultBlockData(newBlockType, initialData))
257
+ });
258
+
259
+ var newBlockMap = blocksBefore.concat([[pivotBlockKey, block], [newBlockKey, newBlock]], blocksAfter).toOrderedMap();
260
+
261
+ var selection = editorState.getSelection();
262
+
263
+ var newContent = content.merge({
264
+ blockMap: newBlockMap,
265
+ selectionBefore: selection,
266
+ selectionAfter: selection.merge({
267
+ anchorKey: newBlockKey,
268
+ anchorOffset: 0,
269
+ focusKey: newBlockKey,
270
+ focusOffset: 0,
271
+ isBackward: false
272
+ })
273
+ });
274
+ return _draftJs.EditorState.push(editorState, newContent, 'split-block');
275
+ };
276
+
277
+ /***/ },
278
+
279
+ /***/ 397:
280
+ /***/ function(module, exports, __webpack_require__) {
281
+
282
+ 'use strict';
283
+
284
+ exports.__esModule = true;
285
+
286
+ var _classCallCheck2 = __webpack_require__(3);
287
+
288
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
289
+
290
+ var _possibleConstructorReturn2 = __webpack_require__(39);
291
+
292
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
293
+
294
+ var _inherits2 = __webpack_require__(86);
295
+
296
+ var _inherits3 = _interopRequireDefault(_inherits2);
297
+
298
+ var _react = __webpack_require__(23);
299
+
300
+ var _react2 = _interopRequireDefault(_react);
301
+
302
+ var _draftJs = __webpack_require__(94);
303
+
304
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
305
+
306
+ var Link = function (_React$Component) {
307
+ (0, _inherits3['default'])(Link, _React$Component);
308
+
309
+ function Link(props) {
310
+ (0, _classCallCheck3['default'])(this, Link);
311
+
312
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
313
+
314
+ _this._validateLink = _this._validateLink.bind(_this);
315
+ _this._checkProtocol = _this._checkProtocol.bind(_this);
316
+ _this._showPopLinkOver = _this._showPopLinkOver.bind(_this);
317
+ _this._hidePopLinkOver = _this._hidePopLinkOver.bind(_this);
318
+ _this.isHover = false;
319
+ return _this;
320
+ }
321
+
322
+ Link.prototype._validateLink = function _validateLink() {
323
+ var pattern = new RegExp('^(https?:\/\/)?' + // protocol
324
+ '((([a-z\d]([a-z\d-]*[a-z\d])*)\.)+[a-z]{2,}|' + // domain name
325
+ '((\d{1,3}\.){3}\d{1,3}))' + // OR ip (v4) address
326
+ '(\:\d+)?(\/[-a-z\d%_.~+]*)*' + // port and path
327
+ '(\?[&a-z\d%_.~+=-]*)?' + // query string
328
+ '(\#[-a-z\d_]*)?$', 'i'); // fragment locater
329
+ if (!pattern.test(str)) {
330
+ alert("Please enter a valid URL.");
331
+ return false;
332
+ } else {
333
+ return true;
334
+ }
335
+ };
336
+
337
+ Link.prototype._checkProtocol = function _checkProtocol() {
338
+ return console.log("xcvd");
339
+ };
340
+
341
+ Link.prototype._showPopLinkOver = function _showPopLinkOver(e) {
342
+ if (!this.data.showPopLinkOver) {
343
+ return;
344
+ }
345
+ return this.data.showPopLinkOver(this.refs.link);
346
+ };
347
+
348
+ Link.prototype._hidePopLinkOver = function _hidePopLinkOver(e) {
349
+ if (!this.data.hidePopLinkOver) {
350
+ return;
351
+ }
352
+ return this.data.hidePopLinkOver();
353
+ };
354
+
355
+ Link.prototype.render = function render() {
356
+ this.data = _draftJs.Entity.get(this.props.entityKey).getData();
357
+
358
+ return _react2['default'].createElement(
359
+ 'a',
360
+ {
361
+ ref: 'link',
362
+ href: this.data.url,
363
+ className: 'markup--anchor',
364
+ onMouseOver: this._showPopLinkOver,
365
+ onMouseOut: this._hidePopLinkOver
366
+ },
367
+ this.props.children
368
+ );
369
+ };
370
+
371
+ return Link;
372
+ }(_react2['default'].Component);
373
+
374
+ exports['default'] = Link;
375
+ module.exports = exports['default'];
376
+
377
+ /***/ },
378
+
379
+ /***/ 398:
380
+ /***/ function(module, exports, __webpack_require__) {
381
+
382
+ "use strict";
383
+
384
+ exports.__esModule = true;
385
+
386
+ var _stringify = __webpack_require__(399);
387
+
388
+ var _stringify2 = _interopRequireDefault(_stringify);
389
+
390
+ var _classCallCheck2 = __webpack_require__(3);
391
+
392
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
393
+
394
+ var _possibleConstructorReturn2 = __webpack_require__(39);
395
+
396
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
397
+
398
+ var _inherits2 = __webpack_require__(86);
399
+
400
+ var _inherits3 = _interopRequireDefault(_inherits2);
401
+
402
+ var _react = __webpack_require__(23);
403
+
404
+ var _react2 = _interopRequireDefault(_react);
405
+
406
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
407
+
408
+ var Debug = function (_React$Component) {
409
+ (0, _inherits3["default"])(Debug, _React$Component);
410
+
411
+ function Debug() {
412
+ (0, _classCallCheck3["default"])(this, Debug);
413
+
414
+ var _this = (0, _possibleConstructorReturn3["default"])(this, _React$Component.call(this));
415
+
416
+ _this.handleToggleReadOnly = _this.handleToggleReadOnly.bind(_this);
417
+ _this.handleTestEmitAndDecode = _this.handleTestEmitAndDecode.bind(_this);
418
+ _this.handleTestEmitTEXT = _this.handleTestEmitTEXT.bind(_this);
419
+ _this.testEmitAndDecode = _this.testEmitAndDecode.bind(_this);
420
+ _this.testEmitTEXT = _this.testEmitTEXT.bind(_this);
421
+ _this.logState = _this.logState.bind(_this);
422
+ _this.toggleDisplay = _this.toggleDisplay.bind(_this);
423
+ _this.open = _this.open.bind(_this);
424
+ _this.render = _this.render.bind(_this);
425
+ _this.state = {
426
+ output: "",
427
+ display: "none"
428
+ };
429
+ return _this;
430
+ }
431
+
432
+ Debug.prototype.handleToggleReadOnly = function handleToggleReadOnly(e) {
433
+ e.preventDefault();
434
+ this.props.editor.toggleEditable();
435
+ return false;
436
+ };
437
+
438
+ Debug.prototype.handleTestEmitAndDecode = function handleTestEmitAndDecode(e) {
439
+ e.preventDefault();
440
+ return this.testEmitAndDecode();
441
+ };
442
+
443
+ Debug.prototype.handleTestEmitTEXT = function handleTestEmitTEXT(e) {
444
+ e.preventDefault();
445
+ return this.testEmitTEXT();
446
+ };
447
+
448
+ Debug.prototype.testEmitAndDecode = function testEmitAndDecode(e) {
449
+ var raw_as_json = this.props.editor.emitSerializedOutput();
450
+ this.props.editor.setState({
451
+ editorState: this.props.editor.decodeEditorContent(raw_as_json) }, this.logState((0, _stringify2["default"])(raw_as_json)));
452
+ return false;
453
+ };
454
+
455
+ Debug.prototype.testEmitTEXT = function testEmitTEXT() {
456
+ var text = this.props.editor.getTextFromEditor();
457
+ return this.logState(text);
458
+ };
459
+
460
+ Debug.prototype.logState = function logState(raw) {
461
+ return this.setState({ output: raw }, this.open);
462
+ };
463
+
464
+ Debug.prototype.toggleDisplay = function toggleDisplay(e) {
465
+ e.preventDefault();
466
+ var d = this.state.display === "block" ? "none" : this.state.display;
467
+ return this.setState({
468
+ display: d });
469
+ };
470
+
471
+ Debug.prototype.open = function open() {
472
+ return this.setState({
473
+ display: "block" });
474
+ };
475
+
476
+ Debug.prototype.render = function render() {
477
+ return _react2["default"].createElement(
478
+ "div",
479
+ null,
480
+ _react2["default"].createElement(
481
+ "div",
482
+ { className: "debugControls" },
483
+ _react2["default"].createElement(
484
+ "ul",
485
+ null,
486
+ _react2["default"].createElement(
487
+ "li",
488
+ null,
489
+ " LOCKS: ",
490
+ this.props.editor.state.locks,
491
+ " "
492
+ ),
493
+ _react2["default"].createElement(
494
+ "li",
495
+ null,
496
+ _react2["default"].createElement(
497
+ "a",
498
+ { href: "#", onClick: this.handleToggleReadOnly },
499
+ "EDITABLE: ",
500
+ this.props.editor.state.read_only ? 'NO' : 'YES'
501
+ )
502
+ ),
503
+ _react2["default"].createElement(
504
+ "li",
505
+ null,
506
+ _react2["default"].createElement(
507
+ "a",
508
+ { href: "#", onClick: this.handleTestEmitTEXT },
509
+ "EDITOR TEXT"
510
+ )
511
+ ),
512
+ _react2["default"].createElement(
513
+ "li",
514
+ null,
515
+ _react2["default"].createElement(
516
+ "a",
517
+ { href: "#", onClick: this.handleTestEmitAndDecode },
518
+ "EDITOR STATE"
519
+ )
520
+ )
521
+ )
522
+ ),
523
+ _react2["default"].createElement(
524
+ "div",
525
+ { className: "debugZone", style: { display: this.state.display } },
526
+ _react2["default"].createElement("a", { href: "#", className: "dante-debug-close close", onClick: this.toggleDisplay }),
527
+ _react2["default"].createElement(
528
+ "div",
529
+ { className: "debugOutput" },
530
+ _react2["default"].createElement(
531
+ "h2",
532
+ null,
533
+ "EDITOR OUTPUT"
534
+ ),
535
+ this.state.output.length > 0 ? _react2["default"].createElement(
536
+ "pre",
537
+ null,
538
+ this.state.output
539
+ ) : undefined
540
+ )
541
+ )
542
+ );
543
+ };
544
+
545
+ return Debug;
546
+ }(_react2["default"].Component);
547
+
548
+ exports["default"] = Debug;
549
+ module.exports = exports["default"];
550
+
551
+ /***/ },
552
+
553
+ /***/ 401:
554
+ /***/ function(module, exports, __webpack_require__) {
555
+
556
+ 'use strict';
557
+
558
+ exports.__esModule = true;
559
+
560
+ var _draftJs = __webpack_require__(94);
561
+
562
+ //TODO: what the f*ck is happening here? ;-;
563
+ var findEntities = function findEntities(entityType, instance, contentBlock, callback) {
564
+ return contentBlock.findEntityRanges(function (_this) {
565
+ return function (character) {
566
+ var entityKey, opts, res;
567
+ entityKey = character.getEntity();
568
+ return res = entityKey !== null && _draftJs.Entity.get(entityKey).getType() === entityType, res ? (opts = {
569
+ showPopLinkOver: instance.showPopLinkOver,
570
+ hidePopLinkOver: instance.hidePopLinkOver
571
+ }, _draftJs.Entity.mergeData(entityKey, opts)) : void 0, res;
572
+ };
573
+ }(undefined), callback);
574
+ };
575
+
576
+ exports['default'] = findEntities;
577
+ module.exports = exports['default'];
578
+
579
+ /***/ },
580
+
581
+ /***/ 402:
582
+ /***/ function(module, exports, __webpack_require__) {
583
+
584
+ "use strict";
585
+
586
+ exports.__esModule = true;
587
+
588
+ var _stringify = __webpack_require__(399);
589
+
590
+ var _stringify2 = _interopRequireDefault(_stringify);
591
+
592
+ var _classCallCheck2 = __webpack_require__(3);
593
+
594
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
595
+
596
+ var _axios = __webpack_require__(403);
597
+
598
+ var _axios2 = _interopRequireDefault(_axios);
599
+
600
+ var _immutable = __webpack_require__(25);
601
+
602
+ var _immutable2 = _interopRequireDefault(_immutable);
603
+
604
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
605
+
606
+ var SaveBehavior = function () {
607
+ function SaveBehavior(options) {
608
+ (0, _classCallCheck3["default"])(this, SaveBehavior);
609
+
610
+ this.getLocks = options.getLocks;
611
+ this.config = options.config;
612
+ this.editorContent = options.editorContent;
613
+ this.editorState = options.editorState;
614
+ }
615
+
616
+ SaveBehavior.prototype.handleStore = function handleStore(ev) {
617
+ return this.store();
618
+ };
619
+
620
+ SaveBehavior.prototype.store = function store(content) {
621
+ var _this = this;
622
+
623
+ if (!this.config.data_storage.url) {
624
+ return;
625
+ }
626
+ if (this.getLocks() > 0) {
627
+ return;
628
+ }
629
+
630
+ clearTimeout(this.timeout);
631
+
632
+ return this.timeout = setTimeout(function () {
633
+ return _this.checkforStore(content);
634
+ }, this.config.data_storage.interval);
635
+ };
636
+
637
+ SaveBehavior.prototype.getTextFromEditor = function getTextFromEditor(content) {
638
+ return content.blocks.map(function (o) {
639
+ return o.text;
640
+ }).join("\n");
641
+ };
642
+
643
+ SaveBehavior.prototype.getUrl = function getUrl() {
644
+ var url = this.config.data_storage.url;
645
+
646
+ if (typeof url === "function") {
647
+ return url();
648
+ } else {
649
+ return url;
650
+ }
651
+ };
652
+
653
+ SaveBehavior.prototype.getMethod = function getMethod() {
654
+ var method = this.config.data_storage.method;
655
+
656
+ if (typeof method === "function") {
657
+ return method();
658
+ } else {
659
+ return method;
660
+ }
661
+ };
662
+
663
+ SaveBehavior.prototype.checkforStore = function checkforStore(content) {
664
+ var _this2 = this;
665
+
666
+ // ENTER DATA STORE
667
+ var isChanged = !_immutable2["default"].is(_immutable2["default"].fromJS(this.editorContent), _immutable2["default"].fromJS(content));
668
+ // console.log("CONTENT CHANGED:", isChanged)
669
+
670
+ if (!isChanged) {
671
+ return;
672
+ }
673
+
674
+ if (this.config.xhr.before_handler) {
675
+ this.config.xhr.before_handler();
676
+ }
677
+ // console.log "SAVING TO: #{@getMethod()} #{@getUrl()}"
678
+
679
+ return (0, _axios2["default"])({
680
+ method: this.getMethod(),
681
+ url: this.getUrl(),
682
+ data: {
683
+ editor_content: (0, _stringify2["default"])(content),
684
+ text_content: this.getTextFromEditor(content)
685
+ }
686
+ }).then(function (result) {
687
+ // console.log "STORING CONTENT", result
688
+ if (_this2.config.data_storage.success_handler) {
689
+ _this2.config.data_storage.success_handler(result);
690
+ }
691
+ if (_this2.config.xhr.success_handler) {
692
+ return _this2.config.xhr.success_handler(result);
693
+ }
694
+ })["catch"](function (error) {
695
+ // console.log("ERROR: got error saving content at #{@config.data_storage.url} - #{error}")
696
+ if (_this2.config.xhr.failure_handler) {
697
+ return _this2.config.xhr.failure_handler(error);
698
+ }
699
+ });
700
+ };
701
+
702
+ return SaveBehavior;
703
+ }();
704
+
705
+ exports["default"] = SaveBehavior;
706
+ module.exports = exports["default"];
707
+
708
+ /***/ },
709
+
710
+ /***/ 428:
711
+ /***/ function(module, exports, __webpack_require__) {
712
+
713
+ 'use strict';
714
+
715
+ exports.__esModule = true;
716
+
717
+ var _stringify = __webpack_require__(399);
718
+
719
+ var _stringify2 = _interopRequireDefault(_stringify);
720
+
721
+ var _draftJs = __webpack_require__(94);
722
+
723
+ var _immutable = __webpack_require__(25);
724
+
725
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
726
+
727
+ // { compose
728
+ // } = require('underscore')
729
+
730
+ // underscore compose function
731
+ var compose = function compose() {
732
+ var args = arguments;
733
+ var start = args.length - 1;
734
+ return function () {
735
+ var i = start;
736
+ var result = args[start].apply(this, arguments);
737
+ while (i--) {
738
+ result = args[i].call(this, result);
739
+ }
740
+ return result;
741
+ };
742
+ };
743
+
744
+ // from https://gist.github.com/N1kto/6702e1c2d89a33a15a032c234fc4c34e
745
+
746
+ /*
747
+ * Helpers
748
+ */
749
+
750
+ // Prepares img meta data object based on img attributes
751
+ var getBlockSpecForElement = function getBlockSpecForElement(imgElement) {
752
+ return {
753
+ contentType: 'image',
754
+ imgSrc: imgElement.getAttribute('src')
755
+ };
756
+ };
757
+
758
+ // Wraps meta data in HTML element which is 'understandable' by Draft, I used <blockquote />.
759
+ var wrapBlockSpec = function wrapBlockSpec(blockSpec) {
760
+ if (blockSpec === null) {
761
+ return null;
762
+ }
763
+
764
+ var tempEl = document.createElement('blockquote');
765
+ // stringify meta data and insert it as text content of temp HTML element. We will later extract
766
+ // and parse it.
767
+ tempEl.innerText = (0, _stringify2['default'])(blockSpec);
768
+ return tempEl;
769
+ };
770
+
771
+ // Replaces <img> element with our temp element
772
+ var replaceElement = function replaceElement(oldEl, newEl) {
773
+ if (!(newEl instanceof HTMLElement)) {
774
+ return;
775
+ }
776
+
777
+ var upEl = getUpEl(oldEl);
778
+ //parentNode = oldEl.parentNode
779
+ //return parentNode.replaceChild(newEl, oldEl)
780
+ return upEl.parentNode.insertBefore(newEl, upEl);
781
+ };
782
+
783
+ var getUpEl = function getUpEl(el) {
784
+ var original_el = el;
785
+ while (el.parentNode) {
786
+ if (el.parentNode.tagName !== 'BODY') {
787
+ el = el.parentNode;
788
+ }
789
+ if (el.parentNode.tagName === 'BODY') {
790
+ return el;
791
+ }
792
+ }
793
+ };
794
+
795
+ var elementToBlockSpecElement = compose(wrapBlockSpec, getBlockSpecForElement);
796
+
797
+ var imgReplacer = function imgReplacer(imgElement) {
798
+ return replaceElement(imgElement, elementToBlockSpecElement(imgElement));
799
+ };
800
+
801
+ /*
802
+ * Main function
803
+ */
804
+
805
+ // takes HTML string and returns DraftJS ContentState
806
+ var customHTML2Content = function customHTML2Content(HTML, blockRn) {
807
+ var tempDoc = new DOMParser().parseFromString(HTML, 'text/html');
808
+ // replace all <img /> with <blockquote /> elements
809
+
810
+ var a = tempDoc.querySelectorAll('img').forEach(function (item) {
811
+ return imgReplacer(item);
812
+ });
813
+
814
+ // use DraftJS converter to do initial conversion. I don't provide DOMBuilder and
815
+ // blockRenderMap arguments here since it should fall back to its default ones, which are fine
816
+ console.log(tempDoc.body.innerHTML);
817
+ var contentBlocks = (0, _draftJs.convertFromHTML)(tempDoc.body.innerHTML, _draftJs.getSafeBodyFromHTML, blockRn);
818
+
819
+ // now replace <blockquote /> ContentBlocks with 'atomic' ones
820
+ contentBlocks = contentBlocks.map(function (block) {
821
+ var newBlock = void 0;
822
+ console.log("CHECK BLOCK", block.getType());
823
+ if (block.getType() !== 'blockquote') {
824
+ return block;
825
+ }
826
+
827
+ var json = "";
828
+ try {
829
+ json = JSON.parse(block.getText());
830
+ } catch (error) {
831
+ return block;
832
+ }
833
+
834
+ return newBlock = block.merge({
835
+ type: "image",
836
+ text: "",
837
+ data: {
838
+ url: json.imgSrc,
839
+ forceUpload: true
840
+ }
841
+ });
842
+ });
843
+
844
+ tempDoc = null;
845
+ return _draftJs.ContentState.createFromBlockArray(contentBlocks);
846
+ };
847
+
848
+ exports['default'] = customHTML2Content;
849
+ module.exports = exports['default'];
850
+
851
+ /***/ },
852
+
853
+ /***/ 429:
854
+ /***/ function(module, exports, __webpack_require__) {
855
+
856
+ 'use strict';
857
+
858
+ exports.__esModule = true;
859
+
860
+ var _classCallCheck2 = __webpack_require__(3);
861
+
862
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
863
+
864
+ var _possibleConstructorReturn2 = __webpack_require__(39);
865
+
866
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
867
+
868
+ var _inherits2 = __webpack_require__(86);
869
+
870
+ var _inherits3 = _interopRequireDefault(_inherits2);
871
+
872
+ var _react = __webpack_require__(23);
873
+
874
+ var _react2 = _interopRequireDefault(_react);
875
+
876
+ var _reactDom = __webpack_require__(24);
877
+
878
+ var _reactDom2 = _interopRequireDefault(_reactDom);
879
+
880
+ var _draftJs = __webpack_require__(94);
881
+
882
+ var _selection = __webpack_require__(430);
883
+
884
+ var _index = __webpack_require__(396);
885
+
886
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
887
+
888
+ var DanteImagePopover = function (_React$Component) {
889
+ (0, _inherits3['default'])(DanteImagePopover, _React$Component);
890
+
891
+ function DanteImagePopover(props) {
892
+ (0, _classCallCheck3['default'])(this, DanteImagePopover);
893
+
894
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
895
+
896
+ _this.display = _this.display.bind(_this);
897
+ _this.show = _this.show.bind(_this);
898
+ _this.hide = _this.hide.bind(_this);
899
+ _this._toggleScaled = _this._toggleScaled.bind(_this);
900
+ _this.scale = _this.scale.bind(_this);
901
+ _this.collapse = _this.collapse.bind(_this);
902
+ _this.relocate = _this.relocate.bind(_this);
903
+ _this.componentWillReceiveProps = _this.componentWillReceiveProps.bind(_this);
904
+ _this.handleClick = _this.handleClick.bind(_this);
905
+ _this.state = {
906
+ position: {
907
+ top: 0,
908
+ left: 0
909
+ },
910
+ show: false,
911
+ scaled: false,
912
+ buttons: [{ type: "left" }, { type: "center" }, { type: "fill" }, { type: "wide" }]
913
+ };
914
+ return _this;
915
+ }
916
+
917
+ DanteImagePopover.prototype.display = function display(b) {
918
+ if (b) {
919
+ return this.show();
920
+ } else {
921
+ return this.hide();
922
+ }
923
+ };
924
+
925
+ DanteImagePopover.prototype.show = function show() {
926
+ return this.setState({
927
+ show: true });
928
+ };
929
+
930
+ DanteImagePopover.prototype.hide = function hide() {
931
+ return this.setState({
932
+ show: false });
933
+ };
934
+
935
+ DanteImagePopover.prototype.setPosition = function setPosition(coords) {
936
+ return this.setState({
937
+ position: coords });
938
+ };
939
+
940
+ DanteImagePopover.prototype._toggleScaled = function _toggleScaled(ev) {
941
+ if (this.state.scaled) {
942
+ return this.collapse();
943
+ } else {
944
+ return this.scale();
945
+ }
946
+ };
947
+
948
+ DanteImagePopover.prototype.scale = function scale() {
949
+ return this.setState({
950
+ scaled: true });
951
+ };
952
+
953
+ DanteImagePopover.prototype.collapse = function collapse() {
954
+ return this.setState({
955
+ scaled: false });
956
+ };
957
+
958
+ DanteImagePopover.prototype.relocate = function relocate() {
959
+ var editorState = this.props.editorState;
960
+
961
+
962
+ if (editorState.getSelection().isCollapsed()) {
963
+
964
+ var currentBlock = (0, _index.getCurrentBlock)(editorState);
965
+ var blockType = currentBlock.getType();
966
+
967
+ var contentState = editorState.getCurrentContent();
968
+ var selectionState = editorState.getSelection();
969
+
970
+ var block = contentState.getBlockForKey(selectionState.anchorKey);
971
+
972
+ var nativeSelection = (0, _selection.getSelection)(window);
973
+ if (!nativeSelection.rangeCount) {
974
+ return;
975
+ }
976
+
977
+ var node = (0, _index.getNode)();
978
+
979
+ var selectionBoundary = (0, _selection.getSelectionRect)(nativeSelection);
980
+ var coords = selectionBoundary;
981
+
982
+ var parent = _reactDom2['default'].findDOMNode(this.props.editor);
983
+ var parentBoundary = parent.getBoundingClientRect();
984
+
985
+ this.display(blockType === "image");
986
+
987
+ if (blockType === "image") {
988
+ selectionBoundary = node.anchorNode.parentNode.parentNode.parentNode.getBoundingClientRect();
989
+ var el = this.refs.image_popover;
990
+ var padd = el.offsetWidth / 2;
991
+ return this.setPosition({
992
+ top: selectionBoundary.top - parentBoundary.top + 60,
993
+ left: selectionBoundary.left + selectionBoundary.width / 2 - padd
994
+ });
995
+ }
996
+ } else {
997
+ return this.hide();
998
+ }
999
+ };
1000
+
1001
+ DanteImagePopover.prototype.componentWillReceiveProps = function componentWillReceiveProps(newProps) {
1002
+ return this.collapse();
1003
+ };
1004
+
1005
+ DanteImagePopover.prototype.getStyle = function getStyle() {
1006
+ if (!this.state.position) {
1007
+ return {};
1008
+ }
1009
+ };
1010
+
1011
+ DanteImagePopover.prototype.handleClick = function handleClick(item) {
1012
+ return this.props.editor.setDirection(item.type);
1013
+ };
1014
+
1015
+ DanteImagePopover.prototype.render = function render() {
1016
+ var _this2 = this;
1017
+
1018
+ return _react2['default'].createElement(
1019
+ 'div',
1020
+ {
1021
+ ref: 'image_popover',
1022
+ className: 'dante-popover popover--Aligntooltip popover--top popover--animated ' + (this.state.show ? 'is-active' : undefined),
1023
+ style: { top: this.state.position.top,
1024
+ left: this.state.position.left }
1025
+ },
1026
+ _react2['default'].createElement(
1027
+ 'div',
1028
+ { className: 'popover-inner' },
1029
+ _react2['default'].createElement(
1030
+ 'ul',
1031
+ { className: 'dante-menu-buttons' },
1032
+ this.state.buttons.map(function (item, i) {
1033
+ return _react2['default'].createElement(DanteImagePopoverItem, {
1034
+ item: item,
1035
+ handleClick: _this2.handleClick,
1036
+ key: i
1037
+ });
1038
+ })
1039
+ )
1040
+ ),
1041
+ _react2['default'].createElement('div', { className: 'popover-arrow' })
1042
+ );
1043
+ };
1044
+
1045
+ return DanteImagePopover;
1046
+ }(_react2['default'].Component);
1047
+
1048
+ var DanteImagePopoverItem = function (_React$Component2) {
1049
+ (0, _inherits3['default'])(DanteImagePopoverItem, _React$Component2);
1050
+
1051
+ function DanteImagePopoverItem() {
1052
+ (0, _classCallCheck3['default'])(this, DanteImagePopoverItem);
1053
+
1054
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1055
+ args[_key] = arguments[_key];
1056
+ }
1057
+
1058
+ var _this3 = (0, _possibleConstructorReturn3['default'])(this, _React$Component2.call.apply(_React$Component2, [this].concat(args)));
1059
+
1060
+ _this3.handleClick = _this3.handleClick.bind(_this3);
1061
+ _this3.render = _this3.render.bind(_this3);
1062
+ return _this3;
1063
+ }
1064
+
1065
+ DanteImagePopoverItem.prototype.handleClick = function handleClick(e) {
1066
+ e.preventDefault();
1067
+ return this.props.handleClick(this.props.item);
1068
+ };
1069
+
1070
+ DanteImagePopoverItem.prototype.render = function render() {
1071
+ return _react2['default'].createElement(
1072
+ 'li',
1073
+ {
1074
+ className: 'dante-menu-button align-' + this.props.item.type,
1075
+ onMouseDown: this.handleClick },
1076
+ _react2['default'].createElement('span', { className: 'tooltip-icon dante-icon-image-' + this.props.item.type })
1077
+ );
1078
+ };
1079
+
1080
+ return DanteImagePopoverItem;
1081
+ }(_react2['default'].Component);
1082
+
1083
+ exports['default'] = DanteImagePopover;
1084
+ module.exports = exports['default'];
1085
+
1086
+ /***/ },
1087
+
1088
+ /***/ 430:
1089
+ /***/ function(module, exports) {
1090
+
1091
+ 'use strict';
1092
+
1093
+ exports.__esModule = true;
1094
+ /*
1095
+ Returns the `boundingClientRect` of the passed selection.
1096
+ */
1097
+ var getSelectionRect = exports.getSelectionRect = function getSelectionRect(selected) {
1098
+ var _rect = selected.getRangeAt(0).getBoundingClientRect();
1099
+ // selected.getRangeAt(0).getBoundingClientRect()
1100
+ var rect = _rect && _rect.top ? _rect : selected.getRangeAt(0).getClientRects()[0];
1101
+ if (!rect) {
1102
+ if (selected.anchorNode && selected.anchorNode.getBoundingClientRect) {
1103
+ rect = selected.anchorNode.getBoundingClientRect();
1104
+ rect.isEmptyline = true;
1105
+ } else {
1106
+ return null;
1107
+ }
1108
+ }
1109
+ return rect;
1110
+ };
1111
+
1112
+ /*
1113
+ Returns the native selection node.
1114
+ */
1115
+ var getSelection = exports.getSelection = function getSelection(root) {
1116
+ var t = null;
1117
+ if (root.getSelection) {
1118
+ t = root.getSelection();
1119
+ } else if (root.document.getSelection) {
1120
+ t = root.document.getSelection();
1121
+ } else if (root.document.selection) {
1122
+ t = root.document.selection.createRange().text;
1123
+ }
1124
+ return t;
1125
+ };
1126
+
1127
+ /*
1128
+ Recursively finds the DOM Element of the block where the cursor is currently present.
1129
+ If not found, returns null.
1130
+ */
1131
+ var getSelectedBlockNode = exports.getSelectedBlockNode = function getSelectedBlockNode(root) {
1132
+ var selection = root.getSelection();
1133
+ if (selection.rangeCount === 0) {
1134
+ return null;
1135
+ }
1136
+ var node = selection.getRangeAt(0).startContainer;
1137
+ // console.log(node);
1138
+ do {
1139
+ if (node.getAttribute && node.getAttribute('data-block') === 'true') {
1140
+ return node;
1141
+ }
1142
+ node = node.parentNode;
1143
+ // console.log(node);
1144
+ } while (node !== null);
1145
+ return null;
1146
+ };
1147
+
1148
+ /***/ },
1149
+
1150
+ /***/ 431:
1151
+ /***/ function(module, exports, __webpack_require__) {
1152
+
1153
+ 'use strict';
1154
+
1155
+ exports.__esModule = true;
1156
+
1157
+ var _classCallCheck2 = __webpack_require__(3);
1158
+
1159
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1160
+
1161
+ var _possibleConstructorReturn2 = __webpack_require__(39);
1162
+
1163
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1164
+
1165
+ var _inherits2 = __webpack_require__(86);
1166
+
1167
+ var _inherits3 = _interopRequireDefault(_inherits2);
1168
+
1169
+ var _react = __webpack_require__(23);
1170
+
1171
+ var _react2 = _interopRequireDefault(_react);
1172
+
1173
+ var _reactDom = __webpack_require__(24);
1174
+
1175
+ var _reactDom2 = _interopRequireDefault(_reactDom);
1176
+
1177
+ var _index = __webpack_require__(396);
1178
+
1179
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1180
+
1181
+ var DanteAnchorPopover = function (_React$Component) {
1182
+ (0, _inherits3['default'])(DanteAnchorPopover, _React$Component);
1183
+
1184
+ function DanteAnchorPopover(props) {
1185
+ (0, _classCallCheck3['default'])(this, DanteAnchorPopover);
1186
+
1187
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
1188
+
1189
+ _this.display = _this.display.bind(_this);
1190
+ _this.show = _this.show.bind(_this);
1191
+ _this.hide = _this.hide.bind(_this);
1192
+ _this.relocate = _this.relocate.bind(_this);
1193
+ _this.render = _this.render.bind(_this);
1194
+ _this.state = {
1195
+ position: {
1196
+ top: 0,
1197
+ left: 0
1198
+ },
1199
+ show: false,
1200
+ url: ""
1201
+ };
1202
+ return _this;
1203
+ }
1204
+
1205
+ DanteAnchorPopover.prototype.display = function display(b) {
1206
+ if (b) {
1207
+ return this.show();
1208
+ } else {
1209
+ return this.hide();
1210
+ }
1211
+ };
1212
+
1213
+ DanteAnchorPopover.prototype.show = function show() {
1214
+ return this.setState({
1215
+ show: true });
1216
+ };
1217
+
1218
+ DanteAnchorPopover.prototype.hide = function hide() {
1219
+ return this.setState({
1220
+ show: false });
1221
+ };
1222
+
1223
+ DanteAnchorPopover.prototype.setPosition = function setPosition(coords) {
1224
+ return this.setState({
1225
+ position: coords });
1226
+ };
1227
+
1228
+ DanteAnchorPopover.prototype.relocate = function relocate(node) {
1229
+ if (node == null) {
1230
+ node = null;
1231
+ }
1232
+ if (!node) {
1233
+ return;
1234
+ }
1235
+
1236
+ var editorState = this.props.editorState;
1237
+
1238
+ var currentBlock = (0, _index.getCurrentBlock)(editorState);
1239
+ var blockType = currentBlock.getType();
1240
+
1241
+ var contentState = editorState.getCurrentContent();
1242
+ var selectionState = editorState.getSelection();
1243
+
1244
+ var selectionBoundary = node.getBoundingClientRect();
1245
+ var coords = selectionBoundary;
1246
+
1247
+ var el = this.refs.dante_popover;
1248
+ var padd = el.offsetWidth / 2;
1249
+
1250
+ var parent = _reactDom2['default'].findDOMNode(this.props.editor);
1251
+ var parentBoundary = parent.getBoundingClientRect();
1252
+
1253
+ return {
1254
+ top: selectionBoundary.top - parentBoundary.top + 160,
1255
+ left: selectionBoundary.left + selectionBoundary.width / 2 - padd
1256
+ };
1257
+ };
1258
+
1259
+ DanteAnchorPopover.prototype.render = function render() {
1260
+ var position = this.state.position;
1261
+
1262
+ var style = {
1263
+ left: position.left,
1264
+ top: position.top,
1265
+ visibility: '' + (this.state.show ? 'visible' : 'hidden')
1266
+ };
1267
+ return _react2['default'].createElement(
1268
+ 'div',
1269
+ {
1270
+ ref: 'dante_popover',
1271
+ className: 'dante-popover popover--tooltip popover--Linktooltip popover--bottom is-active',
1272
+ style: style,
1273
+ onMouseOver: this.props.handleOnMouseOver,
1274
+ onMouseOut: this.props.handleOnMouseOut
1275
+ },
1276
+ _react2['default'].createElement(
1277
+ 'div',
1278
+ { className: 'popover-inner' },
1279
+ _react2['default'].createElement(
1280
+ 'a',
1281
+ { href: this.props.url, target: '_blank' },
1282
+ this.state.url
1283
+ )
1284
+ ),
1285
+ _react2['default'].createElement('div', { className: 'popover-arrow' })
1286
+ );
1287
+ };
1288
+
1289
+ return DanteAnchorPopover;
1290
+ }(_react2['default'].Component);
1291
+
1292
+ exports['default'] = DanteAnchorPopover;
1293
+ module.exports = exports['default'];
1294
+
1295
+ /***/ },
1296
+
1297
+ /***/ 432:
1298
+ /***/ function(module, exports, __webpack_require__) {
1299
+
1300
+ 'use strict';
1301
+
1302
+ exports.__esModule = true;
1303
+
1304
+ var _classCallCheck2 = __webpack_require__(3);
1305
+
1306
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1307
+
1308
+ var _possibleConstructorReturn2 = __webpack_require__(39);
1309
+
1310
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1311
+
1312
+ var _inherits2 = __webpack_require__(86);
1313
+
1314
+ var _inherits3 = _interopRequireDefault(_inherits2);
1315
+
1316
+ var _react = __webpack_require__(23);
1317
+
1318
+ var _react2 = _interopRequireDefault(_react);
1319
+
1320
+ var _reactDom = __webpack_require__(24);
1321
+
1322
+ var _reactDom2 = _interopRequireDefault(_reactDom);
1323
+
1324
+ var _draftJs = __webpack_require__(94);
1325
+
1326
+ var _index = __webpack_require__(396);
1327
+
1328
+ var _selection = __webpack_require__(430);
1329
+
1330
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1331
+
1332
+ var DanteInlineTooltip = function (_React$Component) {
1333
+ (0, _inherits3['default'])(DanteInlineTooltip, _React$Component);
1334
+
1335
+ function DanteInlineTooltip(props) {
1336
+ (0, _classCallCheck3['default'])(this, DanteInlineTooltip);
1337
+
1338
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
1339
+
1340
+ _this.display = _this.display.bind(_this);
1341
+ _this.show = _this.show.bind(_this);
1342
+ _this.hide = _this.hide.bind(_this);
1343
+ _this._toggleScaled = _this._toggleScaled.bind(_this);
1344
+ _this.scale = _this.scale.bind(_this);
1345
+ _this.collapse = _this.collapse.bind(_this);
1346
+ _this.componentWillReceiveProps = _this.componentWillReceiveProps.bind(_this);
1347
+ _this.clickOnFileUpload = _this.clickOnFileUpload.bind(_this);
1348
+ _this.handlePlaceholder = _this.handlePlaceholder.bind(_this);
1349
+ _this.insertImage = _this.insertImage.bind(_this);
1350
+ _this.handleFileInput = _this.handleFileInput.bind(_this);
1351
+ _this.widgets = _this.widgets.bind(_this);
1352
+ _this.clickHandler = _this.clickHandler.bind(_this);
1353
+ _this.relocate = _this.relocate.bind(_this);
1354
+ _this.state = {
1355
+ position: { top: 0, left: 0 },
1356
+ show: false,
1357
+ scaled: false
1358
+ };
1359
+ return _this;
1360
+ }
1361
+
1362
+ DanteInlineTooltip.prototype.display = function display(b) {
1363
+ if (b) {
1364
+ return this.show();
1365
+ } else {
1366
+ return this.hide();
1367
+ }
1368
+ };
1369
+
1370
+ DanteInlineTooltip.prototype.show = function show() {
1371
+ return this.setState({
1372
+ show: true });
1373
+ };
1374
+
1375
+ DanteInlineTooltip.prototype.hide = function hide() {
1376
+ return this.setState({
1377
+ show: false });
1378
+ };
1379
+
1380
+ DanteInlineTooltip.prototype.setPosition = function setPosition(coords) {
1381
+ return this.setState({
1382
+ position: coords });
1383
+ };
1384
+
1385
+ DanteInlineTooltip.prototype._toggleScaled = function _toggleScaled(ev) {
1386
+ if (this.state.scaled) {
1387
+ return this.collapse();
1388
+ } else {
1389
+ return this.scale();
1390
+ }
1391
+ };
1392
+
1393
+ DanteInlineTooltip.prototype.scale = function scale() {
1394
+ return this.setState({
1395
+ scaled: true });
1396
+ };
1397
+
1398
+ DanteInlineTooltip.prototype.collapse = function collapse() {
1399
+ return this.setState({
1400
+ scaled: false });
1401
+ };
1402
+
1403
+ DanteInlineTooltip.prototype.componentWillReceiveProps = function componentWillReceiveProps(newProps) {
1404
+ return this.collapse();
1405
+ };
1406
+
1407
+ DanteInlineTooltip.prototype.activeClass = function activeClass() {
1408
+ //if @props.show then "is-active" else ""
1409
+ if (this.isActive()) {
1410
+ return "is-active";
1411
+ } else {
1412
+ return "";
1413
+ }
1414
+ };
1415
+
1416
+ DanteInlineTooltip.prototype.isActive = function isActive() {
1417
+ return this.state.show;
1418
+ };
1419
+
1420
+ DanteInlineTooltip.prototype.scaledClass = function scaledClass() {
1421
+ if (this.state.scaled) {
1422
+ return "is-scaled";
1423
+ } else {
1424
+ return "";
1425
+ }
1426
+ };
1427
+
1428
+ DanteInlineTooltip.prototype.scaledWidth = function scaledWidth() {
1429
+ if (this.state.scaled) {
1430
+ return "124";
1431
+ } else {
1432
+ return "0";
1433
+ }
1434
+ };
1435
+
1436
+ DanteInlineTooltip.prototype.clickOnFileUpload = function clickOnFileUpload() {
1437
+ this.refs.fileInput.click();
1438
+ this.collapse();
1439
+ return this.hide();
1440
+ };
1441
+
1442
+ DanteInlineTooltip.prototype.handlePlaceholder = function handlePlaceholder(input) {
1443
+ var opts = {
1444
+ type: input.widget_options.insert_block,
1445
+ placeholder: input.options.placeholder,
1446
+ endpoint: input.options.endpoint
1447
+ };
1448
+
1449
+ return this.props.onChange((0, _index.resetBlockWithType)(this.props.editorState, 'placeholder', opts));
1450
+ };
1451
+
1452
+ DanteInlineTooltip.prototype.insertImage = function insertImage(file) {
1453
+ var opts = {
1454
+ url: URL.createObjectURL(file),
1455
+ file: file
1456
+ };
1457
+
1458
+ return this.props.onChange((0, _index.addNewBlock)(this.props.editorState, 'image', opts));
1459
+ };
1460
+
1461
+ DanteInlineTooltip.prototype.handleFileInput = function handleFileInput(e) {
1462
+ var fileList = e.target.files;
1463
+ // TODO: support multiple file uploads
1464
+ /*
1465
+ Object.keys(fileList).forEach (o)=>
1466
+ @.insertImage(fileList[0])
1467
+ */
1468
+ return this.insertImage(fileList[0]);
1469
+ };
1470
+
1471
+ DanteInlineTooltip.prototype.widgets = function widgets() {
1472
+ return this.props.editor.widgets;
1473
+ };
1474
+
1475
+ DanteInlineTooltip.prototype.clickHandler = function clickHandler(e, type) {
1476
+ var request_block = this.widgets().find(function (o) {
1477
+ return o.icon === type;
1478
+ });
1479
+
1480
+ switch (request_block.widget_options.insertion) {
1481
+ case "upload":
1482
+ return this.clickOnFileUpload(e, request_block);
1483
+ case "placeholder":
1484
+ return this.handlePlaceholder(request_block);
1485
+ default:
1486
+ return console.log('WRONG TYPE FOR ' + request_block.widget_options.insertion);
1487
+ }
1488
+ };
1489
+
1490
+ DanteInlineTooltip.prototype.getItems = function getItems() {
1491
+ return this.widgets().filter(function (o) {
1492
+ return o.widget_options.displayOnInlineTooltip;
1493
+ });
1494
+ };
1495
+
1496
+ DanteInlineTooltip.prototype.isDescendant = function isDescendant(parent, child) {
1497
+ var node = child.parentNode;
1498
+ while (node !== null) {
1499
+ if (node === parent) {
1500
+ return true;
1501
+ }
1502
+ node = node.parentNode;
1503
+ }
1504
+ return false;
1505
+ };
1506
+
1507
+ DanteInlineTooltip.prototype.relocate = function relocate() {
1508
+ var editorState = this.props.editorState;
1509
+
1510
+
1511
+ if (editorState.getSelection().isCollapsed()) {
1512
+
1513
+ var currentBlock = (0, _index.getCurrentBlock)(editorState);
1514
+ var blockType = currentBlock.getType();
1515
+
1516
+ var contentState = editorState.getCurrentContent();
1517
+ var selectionState = editorState.getSelection();
1518
+
1519
+ var block = contentState.getBlockForKey(selectionState.anchorKey);
1520
+
1521
+ var nativeSelection = (0, _selection.getSelection)(window);
1522
+ if (!nativeSelection.rangeCount) {
1523
+ return;
1524
+ }
1525
+
1526
+ var node = (0, _index.getNode)();
1527
+
1528
+ var selectionBoundary = (0, _selection.getSelectionRect)(nativeSelection);
1529
+ var coords = selectionBoundary; //utils.getSelectionDimensions(node)
1530
+
1531
+ var parent = _reactDom2['default'].findDOMNode(this.props.editor);
1532
+ var parentBoundary = parent.getBoundingClientRect();
1533
+
1534
+ // hide if selected node is not in editor
1535
+ // debugger
1536
+ //console.log @isDescendant(parent, nativeSelection.anchorNode)
1537
+
1538
+ if (!this.isDescendant(parent, nativeSelection.anchorNode)) {
1539
+ this.hide();
1540
+ return;
1541
+ }
1542
+
1543
+ // checkeamos si esta vacio
1544
+ this.display(block.getText().length === 0 && blockType === "unstyled");
1545
+ return this.setPosition({
1546
+ top: coords.top + window.scrollY,
1547
+ left: coords.left + window.scrollX - 60
1548
+ });
1549
+
1550
+ /*
1551
+ @refs.image_popover.display(blockType is "image")
1552
+ if blockType is "image"
1553
+ selectionBoundary = node.anchorNode.parentNode.parentNode.parentNode.getBoundingClientRect()
1554
+ *el = document.querySelector("#dante_image_popover")
1555
+ el = @refs.image_popover.refs.image_popover
1556
+ padd = el.offsetWidth / 2
1557
+ @refs.image_popover.setPosition
1558
+ top: selectionBoundary.top - parentBoundary.top + 60
1559
+ left: selectionBoundary.left + (selectionBoundary.width / 2) - padd
1560
+ *@setState
1561
+ * image_popover_position:
1562
+ * top: selectionBoundary.top - parentBoundary.top + 60
1563
+ * left: selectionBoundary.left + (selectionBoundary.width / 2) - padd
1564
+ *
1565
+ */
1566
+ } else {
1567
+ return this.hide();
1568
+ }
1569
+ };
1570
+
1571
+ DanteInlineTooltip.prototype.render = function render() {
1572
+ var _this2 = this;
1573
+
1574
+ return _react2['default'].createElement(
1575
+ 'div',
1576
+ {
1577
+ className: 'inlineTooltip ' + this.activeClass() + ' ' + this.scaledClass(),
1578
+ style: this.state.position
1579
+ },
1580
+ _react2['default'].createElement(
1581
+ 'button',
1582
+ {
1583
+ className: 'inlineTooltip-button control',
1584
+ title: 'Close Menu',
1585
+ 'data-action': 'inline-menu',
1586
+ onClick: this._toggleScaled
1587
+ },
1588
+ _react2['default'].createElement('span', { className: 'tooltip-icon dante-icon-plus' })
1589
+ ),
1590
+ _react2['default'].createElement(
1591
+ 'div',
1592
+ {
1593
+ className: 'inlineTooltip-menu',
1594
+ style: { width: this.scaledWidth() + 'px' }
1595
+ },
1596
+ this.getItems().map(function (item, i) {
1597
+ return _react2['default'].createElement(InlineTooltipItem, {
1598
+ item: item,
1599
+ key: i,
1600
+ clickHandler: _this2.clickHandler
1601
+ });
1602
+ }),
1603
+ _react2['default'].createElement('input', {
1604
+ type: 'file',
1605
+ style: { display: 'none' },
1606
+ ref: 'fileInput',
1607
+ multiple: 'multiple',
1608
+ onChange: this.handleFileInput
1609
+ })
1610
+ )
1611
+ );
1612
+ };
1613
+
1614
+ return DanteInlineTooltip;
1615
+ }(_react2['default'].Component);
1616
+
1617
+ var InlineTooltipItem = function (_React$Component2) {
1618
+ (0, _inherits3['default'])(InlineTooltipItem, _React$Component2);
1619
+
1620
+ function InlineTooltipItem() {
1621
+ (0, _classCallCheck3['default'])(this, InlineTooltipItem);
1622
+
1623
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
1624
+ args[_key] = arguments[_key];
1625
+ }
1626
+
1627
+ var _this3 = (0, _possibleConstructorReturn3['default'])(this, _React$Component2.call.apply(_React$Component2, [this].concat(args)));
1628
+
1629
+ _this3.clickHandler = _this3.clickHandler.bind(_this3);
1630
+ return _this3;
1631
+ }
1632
+
1633
+ InlineTooltipItem.prototype.clickHandler = function clickHandler(e) {
1634
+ e.preventDefault();
1635
+ return this.props.clickHandler(e, this.props.item.icon);
1636
+ };
1637
+
1638
+ InlineTooltipItem.prototype.render = function render() {
1639
+ return _react2['default'].createElement(
1640
+ 'button',
1641
+ {
1642
+ className: 'inlineTooltip-button scale',
1643
+ title: this.props.title,
1644
+ onMouseDown: this.clickHandler
1645
+ },
1646
+ _react2['default'].createElement('span', { className: 'tooltip-icon dante-icon-' + this.props.item.icon })
1647
+ );
1648
+ };
1649
+
1650
+ return InlineTooltipItem;
1651
+ }(_react2['default'].Component);
1652
+
1653
+ exports['default'] = DanteInlineTooltip;
1654
+ module.exports = exports['default'];
1655
+
1656
+ /***/ },
1657
+
1658
+ /***/ 433:
1659
+ /***/ function(module, exports, __webpack_require__) {
1660
+
1661
+ 'use strict';
1662
+
1663
+ exports.__esModule = true;
1664
+
1665
+ var _classCallCheck2 = __webpack_require__(3);
1666
+
1667
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1668
+
1669
+ var _possibleConstructorReturn2 = __webpack_require__(39);
1670
+
1671
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1672
+
1673
+ var _inherits2 = __webpack_require__(86);
1674
+
1675
+ var _inherits3 = _interopRequireDefault(_inherits2);
1676
+
1677
+ var _react = __webpack_require__(23);
1678
+
1679
+ var _react2 = _interopRequireDefault(_react);
1680
+
1681
+ var _reactDom = __webpack_require__(24);
1682
+
1683
+ var _reactDom2 = _interopRequireDefault(_reactDom);
1684
+
1685
+ var _draftJs = __webpack_require__(94);
1686
+
1687
+ var _selection = __webpack_require__(430);
1688
+
1689
+ var _index = __webpack_require__(396);
1690
+
1691
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1692
+
1693
+ var DanteTooltip = function (_React$Component) {
1694
+ (0, _inherits3['default'])(DanteTooltip, _React$Component);
1695
+
1696
+ function DanteTooltip(props) {
1697
+ (0, _classCallCheck3['default'])(this, DanteTooltip);
1698
+
1699
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
1700
+
1701
+ _this._clickInlineHandler = _this._clickInlineHandler.bind(_this);
1702
+ _this.display = _this.display.bind(_this);
1703
+ _this.show = _this.show.bind(_this);
1704
+ _this.hide = _this.hide.bind(_this);
1705
+ _this.relocate = _this.relocate.bind(_this);
1706
+ _this._clickBlockHandler = _this._clickBlockHandler.bind(_this);
1707
+ _this.displayLinkMode = _this.displayLinkMode.bind(_this);
1708
+ _this.displayActiveMenu = _this.displayActiveMenu.bind(_this);
1709
+ _this._enableLinkMode = _this._enableLinkMode.bind(_this);
1710
+ _this._disableLinkMode = _this._disableLinkMode.bind(_this);
1711
+ _this.handleInputEnter = _this.handleInputEnter.bind(_this);
1712
+ _this.confirmLink = _this.confirmLink.bind(_this);
1713
+ _this.inlineItems = _this.inlineItems.bind(_this);
1714
+ _this.blockItems = _this.blockItems.bind(_this);
1715
+ _this.getDefaultValue = _this.getDefaultValue.bind(_this);
1716
+ _this.getVisibleSelectionRect = _draftJs.getVisibleSelectionRect;
1717
+ _this.state = {
1718
+ link_mode: false,
1719
+ show: false,
1720
+ position: {}
1721
+ };
1722
+ return _this;
1723
+ }
1724
+
1725
+ DanteTooltip.prototype._clickInlineHandler = function _clickInlineHandler(ev, style) {
1726
+ var _this2 = this;
1727
+
1728
+ ev.preventDefault();
1729
+
1730
+ this.props.onChange(_draftJs.RichUtils.toggleInlineStyle(this.props.editorState, style));
1731
+
1732
+ return setTimeout(function () {
1733
+ return _this2.relocate();
1734
+ }, 0);
1735
+ };
1736
+
1737
+ DanteTooltip.prototype.display = function display(b) {
1738
+ if (b) {
1739
+ return this.show();
1740
+ } else {
1741
+ return this.hide();
1742
+ }
1743
+ };
1744
+
1745
+ DanteTooltip.prototype.show = function show() {
1746
+ return this.setState({
1747
+ show: true });
1748
+ };
1749
+
1750
+ DanteTooltip.prototype.hide = function hide() {
1751
+ return this.setState({
1752
+ link_mode: false,
1753
+ show: false
1754
+ });
1755
+ };
1756
+
1757
+ DanteTooltip.prototype.setPosition = function setPosition(coords) {
1758
+ return this.setState({
1759
+ position: coords });
1760
+ };
1761
+
1762
+ DanteTooltip.prototype.isDescendant = function isDescendant(parent, child) {
1763
+ var node = child.parentNode;
1764
+ while (node !== null) {
1765
+ if (node === parent) {
1766
+ return true;
1767
+ }
1768
+ node = node.parentNode;
1769
+ }
1770
+ return false;
1771
+ };
1772
+
1773
+ DanteTooltip.prototype.relocate = function relocate() {
1774
+
1775
+ var currentBlock = (0, _index.getCurrentBlock)(this.props.editorState);
1776
+ var blockType = currentBlock.getType();
1777
+ // display tooltip only for unstyled
1778
+
1779
+ if (this.props.configTooltip.selectionElements.indexOf(blockType) < 0) {
1780
+ this.hide();
1781
+ return;
1782
+ }
1783
+
1784
+ if (this.state.link_mode) {
1785
+ return;
1786
+ }
1787
+ if (!this.state.show) {
1788
+ return;
1789
+ }
1790
+
1791
+ var el = this.refs.dante_menu;
1792
+ var padd = el.offsetWidth / 2;
1793
+
1794
+ var nativeSelection = (0, _selection.getSelection)(window);
1795
+ if (!nativeSelection.rangeCount) {
1796
+ return;
1797
+ }
1798
+
1799
+ var selectionBoundary = (0, _selection.getSelectionRect)(nativeSelection);
1800
+
1801
+ var parent = _reactDom2['default'].findDOMNode(this.props.editor);
1802
+ var parentBoundary = parent.getBoundingClientRect();
1803
+
1804
+ // hide if selected node is not in editor
1805
+ if (!this.isDescendant(parent, nativeSelection.anchorNode)) {
1806
+ this.hide();
1807
+ return;
1808
+ }
1809
+
1810
+ var top = selectionBoundary.top - parentBoundary.top - -90 - 5;
1811
+ var left = selectionBoundary.left + selectionBoundary.width / 2 - padd;
1812
+
1813
+ if (!top || !left) {
1814
+ return;
1815
+ }
1816
+
1817
+ // console.log "SET SHOW FOR TOOLTIP INSERT MENU"
1818
+ return this.setState({
1819
+ show: true,
1820
+ position: {
1821
+ left: left,
1822
+ top: top
1823
+ }
1824
+ });
1825
+ };
1826
+
1827
+ DanteTooltip.prototype._clickBlockHandler = function _clickBlockHandler(ev, style) {
1828
+ var _this3 = this;
1829
+
1830
+ ev.preventDefault();
1831
+
1832
+ this.props.onChange(_draftJs.RichUtils.toggleBlockType(this.props.editorState, style));
1833
+
1834
+ return setTimeout(function () {
1835
+ return _this3.relocate();
1836
+ }, 0);
1837
+ };
1838
+
1839
+ DanteTooltip.prototype.displayLinkMode = function displayLinkMode() {
1840
+ if (this.state.link_mode) {
1841
+ return "dante-menu--linkmode";
1842
+ } else {
1843
+ return "";
1844
+ }
1845
+ };
1846
+
1847
+ DanteTooltip.prototype.displayActiveMenu = function displayActiveMenu() {
1848
+ if (this.state.show) {
1849
+ return "dante-menu--active";
1850
+ } else {
1851
+ return "";
1852
+ }
1853
+ };
1854
+
1855
+ DanteTooltip.prototype._enableLinkMode = function _enableLinkMode(ev) {
1856
+ ev.preventDefault();
1857
+ return this.setState({
1858
+ link_mode: true });
1859
+ };
1860
+
1861
+ DanteTooltip.prototype._disableLinkMode = function _disableLinkMode(ev) {
1862
+ ev.preventDefault();
1863
+ return this.setState({
1864
+ link_mode: false,
1865
+ url: ""
1866
+ });
1867
+ };
1868
+
1869
+ DanteTooltip.prototype.hideMenu = function hideMenu() {
1870
+ return this.hide();
1871
+ };
1872
+
1873
+ DanteTooltip.prototype.handleInputEnter = function handleInputEnter(e) {
1874
+ if (e.which === 13) {
1875
+ return this.confirmLink(e);
1876
+ }
1877
+ };
1878
+
1879
+ DanteTooltip.prototype.confirmLink = function confirmLink(e) {
1880
+ e.preventDefault();
1881
+ var editorState = this.props.editorState;
1882
+
1883
+ var urlValue = e.currentTarget.value;
1884
+ var contentState = editorState.getCurrentContent();
1885
+ var selection = editorState.getSelection();
1886
+
1887
+ var opts = {
1888
+ url: urlValue,
1889
+ showPopLinkOver: this.props.showPopLinkOver,
1890
+ hidePopLinkOver: this.props.hidePopLinkOver
1891
+ };
1892
+
1893
+ var entityKey = _draftJs.Entity.create('LINK', 'MUTABLE', opts);
1894
+
1895
+ if (selection.isCollapsed()) {
1896
+ console.log("COLLAPSED SKIPPING LINK");
1897
+ return;
1898
+ }
1899
+
1900
+ this.props.onChange(_draftJs.RichUtils.toggleLink(editorState, selection, entityKey));
1901
+
1902
+ return this._disableLinkMode(e);
1903
+ };
1904
+
1905
+ DanteTooltip.prototype.getPosition = function getPosition() {
1906
+ var pos = this.state.position;
1907
+ return pos;
1908
+ };
1909
+
1910
+ DanteTooltip.prototype.inlineItems = function inlineItems() {
1911
+ return this.props.widget_options.block_types.filter(function (o) {
1912
+ return o.type === "inline";
1913
+ });
1914
+ };
1915
+
1916
+ DanteTooltip.prototype.blockItems = function blockItems() {
1917
+ return this.props.widget_options.block_types.filter(function (o) {
1918
+ return o.type === "block";
1919
+ });
1920
+ };
1921
+
1922
+ DanteTooltip.prototype.getDefaultValue = function getDefaultValue() {
1923
+ var _this4 = this;
1924
+
1925
+ if (this.refs.dante_menu_input) {
1926
+ this.refs.dante_menu_input.value = "";
1927
+ }
1928
+
1929
+ var currentBlock = (0, _index.getCurrentBlock)(this.props.editorState);
1930
+ var blockType = currentBlock.getType();
1931
+ var selection = this.props.editor.state.editorState.getSelection();
1932
+ var selectedEntity = null;
1933
+ var defaultUrl = null;
1934
+ return currentBlock.findEntityRanges(function (character) {
1935
+ var entityKey = character.getEntity();
1936
+ selectedEntity = entityKey;
1937
+ return entityKey !== null && _draftJs.Entity.get(entityKey).getType() === 'LINK';
1938
+ }, function (start, end) {
1939
+ var selStart = selection.getAnchorOffset();
1940
+ var selEnd = selection.getFocusOffset();
1941
+ if (selection.getIsBackward()) {
1942
+ selStart = selection.getFocusOffset();
1943
+ selEnd = selection.getAnchorOffset();
1944
+ }
1945
+
1946
+ if (start === selStart && end === selEnd) {
1947
+ defaultUrl = _draftJs.Entity.get(selectedEntity).getData().url;
1948
+ return _this4.refs.dante_menu_input.value = defaultUrl;
1949
+ }
1950
+ });
1951
+ };
1952
+
1953
+ DanteTooltip.prototype.render = function render() {
1954
+ var _this5 = this;
1955
+
1956
+ return _react2['default'].createElement(
1957
+ 'div',
1958
+ {
1959
+ id: 'dante-menu',
1960
+ ref: 'dante_menu',
1961
+ className: 'dante-menu ' + this.displayActiveMenu() + ' ' + this.displayLinkMode(),
1962
+ style: this.getPosition()
1963
+ },
1964
+ _react2['default'].createElement(
1965
+ 'div',
1966
+ { className: 'dante-menu-linkinput' },
1967
+ _react2['default'].createElement('input', {
1968
+ className: 'dante-menu-input',
1969
+ ref: 'dante_menu_input',
1970
+ placeholder: 'Paste or type a link',
1971
+ onKeyPress: this.handleInputEnter,
1972
+ defaultValue: this.getDefaultValue()
1973
+ }),
1974
+ _react2['default'].createElement('div', { className: 'dante-menu-button', onMouseDown: this._disableLinkMode })
1975
+ ),
1976
+ _react2['default'].createElement(
1977
+ 'ul',
1978
+ { className: 'dante-menu-buttons' },
1979
+ this.blockItems().map(function (item, i) {
1980
+ return _react2['default'].createElement(DanteTooltipItem, {
1981
+ key: i,
1982
+ item: item,
1983
+ handleClick: _this5._clickBlockHandler,
1984
+ editorState: _this5.props.editorState,
1985
+ type: 'block',
1986
+ currentStyle: _this5.props.editorState.getCurrentInlineStyle
1987
+ });
1988
+ }),
1989
+ _react2['default'].createElement(DanteTooltipLink, {
1990
+ editorState: this.props.editorState,
1991
+ enableLinkMode: this._enableLinkMode
1992
+ }),
1993
+ this.inlineItems().map(function (item, i) {
1994
+ return _react2['default'].createElement(DanteTooltipItem, {
1995
+ key: i,
1996
+ item: item,
1997
+ type: 'inline',
1998
+ editorState: _this5.props.editorState,
1999
+ handleClick: _this5._clickInlineHandler
2000
+ });
2001
+ })
2002
+ )
2003
+ );
2004
+ };
2005
+
2006
+ return DanteTooltip;
2007
+ }(_react2['default'].Component);
2008
+
2009
+ var DanteTooltipItem = function (_React$Component2) {
2010
+ (0, _inherits3['default'])(DanteTooltipItem, _React$Component2);
2011
+
2012
+ function DanteTooltipItem() {
2013
+ (0, _classCallCheck3['default'])(this, DanteTooltipItem);
2014
+
2015
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
2016
+ args[_key] = arguments[_key];
2017
+ }
2018
+
2019
+ var _this6 = (0, _possibleConstructorReturn3['default'])(this, _React$Component2.call.apply(_React$Component2, [this].concat(args)));
2020
+
2021
+ _this6.handleClick = _this6.handleClick.bind(_this6);
2022
+ _this6.activeClass = _this6.activeClass.bind(_this6);
2023
+ _this6.isActive = _this6.isActive.bind(_this6);
2024
+ _this6.activeClassInline = _this6.activeClassInline.bind(_this6);
2025
+ _this6.activeClassBlock = _this6.activeClassBlock.bind(_this6);
2026
+ _this6.render = _this6.render.bind(_this6);
2027
+ return _this6;
2028
+ }
2029
+
2030
+ DanteTooltipItem.prototype.handleClick = function handleClick(ev) {
2031
+ return this.props.handleClick(ev, this.props.item.style);
2032
+ };
2033
+
2034
+ DanteTooltipItem.prototype.activeClass = function activeClass() {
2035
+ if (this.isActive()) {
2036
+ return "active";
2037
+ } else {
2038
+ return "";
2039
+ }
2040
+ };
2041
+
2042
+ DanteTooltipItem.prototype.isActive = function isActive() {
2043
+ if (this.props.type === "block") {
2044
+ return this.activeClassBlock();
2045
+ } else {
2046
+ return this.activeClassInline();
2047
+ }
2048
+ };
2049
+
2050
+ DanteTooltipItem.prototype.activeClassInline = function activeClassInline() {
2051
+ if (!this.props.editorState) {
2052
+ return;
2053
+ }
2054
+ //console.log @props.item
2055
+ return this.props.editorState.getCurrentInlineStyle().has(this.props.item.style);
2056
+ };
2057
+
2058
+ DanteTooltipItem.prototype.activeClassBlock = function activeClassBlock() {
2059
+ //console.log "EDITOR STATE", @props.editorState
2060
+ if (!this.props.editorState) {
2061
+ return;
2062
+ }
2063
+ var selection = this.props.editorState.getSelection();
2064
+ var blockType = this.props.editorState.getCurrentContent().getBlockForKey(selection.getStartKey()).getType();
2065
+ return this.props.item.style === blockType;
2066
+ };
2067
+
2068
+ DanteTooltipItem.prototype.render = function render() {
2069
+ return _react2['default'].createElement(
2070
+ 'li',
2071
+ { className: 'dante-menu-button ' + this.activeClass(), onMouseDown: this.handleClick },
2072
+ _react2['default'].createElement('i', { className: 'dante-icon dante-icon-' + this.props.item.label, 'data-action': 'bold' })
2073
+ );
2074
+ };
2075
+
2076
+ return DanteTooltipItem;
2077
+ }(_react2['default'].Component);
2078
+
2079
+ var DanteTooltipLink = function (_React$Component3) {
2080
+ (0, _inherits3['default'])(DanteTooltipLink, _React$Component3);
2081
+
2082
+ function DanteTooltipLink() {
2083
+ (0, _classCallCheck3['default'])(this, DanteTooltipLink);
2084
+
2085
+ for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2086
+ args[_key2] = arguments[_key2];
2087
+ }
2088
+
2089
+ var _this7 = (0, _possibleConstructorReturn3['default'])(this, _React$Component3.call.apply(_React$Component3, [this].concat(args)));
2090
+
2091
+ _this7.promptForLink = _this7.promptForLink.bind(_this7);
2092
+ return _this7;
2093
+ }
2094
+
2095
+ DanteTooltipLink.prototype.promptForLink = function promptForLink(ev) {
2096
+ var selection = this.props.editorState.getSelection();
2097
+ if (!selection.isCollapsed()) {
2098
+ return this.props.enableLinkMode(ev);
2099
+ }
2100
+ };
2101
+
2102
+ DanteTooltipLink.prototype.render = function render() {
2103
+ return _react2['default'].createElement(
2104
+ 'li',
2105
+ { className: 'dante-menu-button', onMouseDown: this.promptForLink },
2106
+ _react2['default'].createElement(
2107
+ 'i',
2108
+ { className: 'dante-icon icon-createlink', 'data-action': 'createlink' },
2109
+ 'link'
2110
+ )
2111
+ );
2112
+ };
2113
+
2114
+ return DanteTooltipLink;
2115
+ }(_react2['default'].Component);
2116
+
2117
+ exports['default'] = DanteTooltip;
2118
+ module.exports = exports['default'];
2119
+
2120
+ /***/ },
2121
+
2122
+ /***/ 434:
2123
+ /***/ function(module, exports, __webpack_require__) {
2124
+
2125
+ 'use strict';
2126
+
2127
+ exports.__esModule = true;
2128
+
2129
+ var _assign = __webpack_require__(435);
2130
+
2131
+ var _assign2 = _interopRequireDefault(_assign);
2132
+
2133
+ var _classCallCheck2 = __webpack_require__(3);
2134
+
2135
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2136
+
2137
+ var _possibleConstructorReturn2 = __webpack_require__(39);
2138
+
2139
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2140
+
2141
+ var _inherits2 = __webpack_require__(86);
2142
+
2143
+ var _inherits3 = _interopRequireDefault(_inherits2);
2144
+
2145
+ var _react = __webpack_require__(23);
2146
+
2147
+ var _react2 = _interopRequireDefault(_react);
2148
+
2149
+ var _reactDom = __webpack_require__(24);
2150
+
2151
+ var _reactDom2 = _interopRequireDefault(_reactDom);
2152
+
2153
+ var _draftJs = __webpack_require__(94);
2154
+
2155
+ var _axios = __webpack_require__(403);
2156
+
2157
+ var _axios2 = _interopRequireDefault(_axios);
2158
+
2159
+ var _index = __webpack_require__(396);
2160
+
2161
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2162
+
2163
+ var ImageBlock = function (_React$Component) {
2164
+ (0, _inherits3['default'])(ImageBlock, _React$Component);
2165
+
2166
+ function ImageBlock(props) {
2167
+ (0, _classCallCheck3['default'])(this, ImageBlock);
2168
+
2169
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
2170
+
2171
+ _this.blockPropsSrc = _this.blockPropsSrc.bind(_this);
2172
+ _this.defaultUrl = _this.defaultUrl.bind(_this);
2173
+ _this.defaultAspectRatio = _this.defaultAspectRatio.bind(_this);
2174
+ _this.updateData = _this.updateData.bind(_this);
2175
+ _this.replaceImg = _this.replaceImg.bind(_this);
2176
+ _this.startLoader = _this.startLoader.bind(_this);
2177
+ _this.stopLoader = _this.stopLoader.bind(_this);
2178
+ _this.handleUpload = _this.handleUpload.bind(_this);
2179
+ _this.aspectRatio = _this.aspectRatio.bind(_this);
2180
+ _this.updateDataSelection = _this.updateDataSelection.bind(_this);
2181
+ _this.handleGrafFigureSelectImg = _this.handleGrafFigureSelectImg.bind(_this);
2182
+ _this.getUploadUrl = _this.getUploadUrl.bind(_this);
2183
+ _this.uploadFile = _this.uploadFile.bind(_this);
2184
+ _this.uploadCompleted = _this.uploadCompleted.bind(_this);
2185
+ _this.updateProgressBar = _this.updateProgressBar.bind(_this);
2186
+ _this.placeHolderEnabled = _this.placeHolderEnabled.bind(_this);
2187
+ _this.placeholderText = _this.placeholderText.bind(_this);
2188
+ _this.handleFocus = _this.handleFocus.bind(_this);
2189
+ _this.render = _this.render.bind(_this);
2190
+ var existing_data = _this.props.block.getData().toJS();
2191
+
2192
+ _this.config = _this.props.blockProps.config;
2193
+ _this.file = _this.props.blockProps.data.get('file');
2194
+ _this.state = {
2195
+ loading: false,
2196
+ selected: false,
2197
+ loading_progress: 0,
2198
+ enabled: false,
2199
+ caption: _this.defaultPlaceholder(),
2200
+ direction: existing_data.direction || "center",
2201
+ width: 0,
2202
+ height: 0,
2203
+ file: null,
2204
+ url: _this.blockPropsSrc() || _this.defaultUrl(existing_data),
2205
+ aspect_ratio: _this.defaultAspectRatio(existing_data)
2206
+ };
2207
+ return _this;
2208
+ }
2209
+
2210
+ ImageBlock.prototype.blockPropsSrc = function blockPropsSrc() {
2211
+ // console.log @.props.blockProps.data.src
2212
+ return this.props.blockProps.data.src;
2213
+ };
2214
+ /*
2215
+ debugger
2216
+ block = @.props
2217
+ entity = block.block.getEntityAt(0)
2218
+ if entity
2219
+ data = Entity.get(entity).getData().src
2220
+ else
2221
+ null
2222
+ */
2223
+
2224
+ ImageBlock.prototype.defaultUrl = function defaultUrl(data) {
2225
+ if (data.url) {
2226
+ return data.url;
2227
+ }
2228
+
2229
+ if (data.url) {
2230
+ if (data.file) {
2231
+ return URL.createObjectURL(data.file);
2232
+ } else {
2233
+ return data.url;
2234
+ }
2235
+ } else {
2236
+ return this.props.blockProps.data.src;
2237
+ }
2238
+ };
2239
+
2240
+ ImageBlock.prototype.defaultPlaceholder = function defaultPlaceholder() {
2241
+ return this.props.blockProps.config.image_caption_placeholder;
2242
+ };
2243
+
2244
+ ImageBlock.prototype.defaultAspectRatio = function defaultAspectRatio(data) {
2245
+ if (data.aspect_ratio) {
2246
+ return {
2247
+ width: data.aspect_ratio['width'],
2248
+ height: data.aspect_ratio['height'],
2249
+ ratio: data.aspect_ratio['ratio']
2250
+ };
2251
+ } else {
2252
+ return {
2253
+ width: 0,
2254
+ height: 0,
2255
+ ratio: 100
2256
+ };
2257
+ }
2258
+ };
2259
+
2260
+ ImageBlock.prototype.getAspectRatio = function getAspectRatio(w, h) {
2261
+ var maxWidth = 1000;
2262
+ var maxHeight = 1000;
2263
+ var ratio = 0;
2264
+ var width = w; // Current image width
2265
+ var height = h; // Current image height
2266
+
2267
+ // Check if the current width is larger than the max
2268
+ if (width > maxWidth) {
2269
+ ratio = maxWidth / width; // get ratio for scaling image
2270
+ height = height * ratio; // Reset height to match scaled image
2271
+ width = width * ratio; // Reset width to match scaled image
2272
+
2273
+ // Check if current height is larger than max
2274
+ } else if (height > maxHeight) {
2275
+ ratio = maxHeight / height; // get ratio for scaling image
2276
+ width = width * ratio; // Reset width to match scaled image
2277
+ height = height * ratio; // Reset height to match scaled image
2278
+ }
2279
+
2280
+ var fill_ratio = height / width * 100;
2281
+ var result = { width: width, height: height, ratio: fill_ratio };
2282
+ // console.log result
2283
+ return result;
2284
+ };
2285
+
2286
+ // will update block state
2287
+
2288
+
2289
+ ImageBlock.prototype.updateData = function updateData() {
2290
+ var blockProps = this.props.blockProps;
2291
+ var block = this.props.block;
2292
+ var getEditorState = this.props.blockProps.getEditorState;
2293
+ var setEditorState = this.props.blockProps.setEditorState;
2294
+
2295
+ var data = block.getData();
2296
+ var newData = data.merge(this.state).merge({ forceUpload: false });
2297
+ return setEditorState((0, _index.updateDataOfBlock)(getEditorState(), block, newData));
2298
+ };
2299
+
2300
+ ImageBlock.prototype.replaceImg = function replaceImg() {
2301
+ var _this2 = this;
2302
+
2303
+ this.img = new Image();
2304
+ this.img.src = this.refs.image_tag.src;
2305
+ this.setState({
2306
+ url: this.img.src });
2307
+ var self = this;
2308
+ // exit only when not blob and not forceUload
2309
+ if (!this.img.src.includes("blob:") && !this.props.block.data.get("forceUpload")) {
2310
+ return;
2311
+ }
2312
+ return this.img.onload = function () {
2313
+ _this2.setState({
2314
+ width: _this2.img.width,
2315
+ height: _this2.img.height,
2316
+ aspect_ratio: self.getAspectRatio(_this2.img.width, _this2.img.height)
2317
+ });
2318
+
2319
+ return _this2.handleUpload();
2320
+ };
2321
+ };
2322
+
2323
+ ImageBlock.prototype.startLoader = function startLoader() {
2324
+ return this.setState({
2325
+ loading: true });
2326
+ };
2327
+
2328
+ ImageBlock.prototype.stopLoader = function stopLoader() {
2329
+ return this.setState({
2330
+ loading: false });
2331
+ };
2332
+
2333
+ ImageBlock.prototype.handleUpload = function handleUpload() {
2334
+ this.startLoader();
2335
+ this.props.blockProps.addLock();
2336
+ this.updateData();
2337
+ return this.uploadFile();
2338
+ };
2339
+
2340
+ ImageBlock.prototype.componentDidMount = function componentDidMount() {
2341
+ return this.replaceImg();
2342
+ };
2343
+
2344
+ ImageBlock.prototype.aspectRatio = function aspectRatio() {
2345
+ return {
2346
+ maxWidth: '' + this.state.aspect_ratio.width,
2347
+ maxHeight: '' + this.state.aspect_ratio.height,
2348
+ ratio: '' + this.state.aspect_ratio.height
2349
+ };
2350
+ };
2351
+
2352
+ ImageBlock.prototype.updateDataSelection = function updateDataSelection() {
2353
+ var _props$blockProps = this.props.blockProps,
2354
+ getEditorState = _props$blockProps.getEditorState,
2355
+ setEditorState = _props$blockProps.setEditorState;
2356
+
2357
+ var newselection = getEditorState().getSelection().merge({
2358
+ anchorKey: this.props.block.getKey(),
2359
+ focusKey: this.props.block.getKey()
2360
+ });
2361
+
2362
+ return setEditorState(_draftJs.EditorState.forceSelection(getEditorState(), newselection));
2363
+ };
2364
+
2365
+ ImageBlock.prototype.handleGrafFigureSelectImg = function handleGrafFigureSelectImg(e) {
2366
+ e.preventDefault();
2367
+ return this.setState({ selected: true }, this.updateDataSelection);
2368
+ };
2369
+
2370
+ //main_editor.onChange(main_editor.state.editorState)
2371
+
2372
+ ImageBlock.prototype.coords = function coords() {
2373
+ return {
2374
+ maxWidth: this.state.aspect_ratio.width + 'px',
2375
+ maxHeight: this.state.aspect_ratio.height + 'px'
2376
+ };
2377
+ };
2378
+
2379
+ ImageBlock.prototype.getBase64Image = function getBase64Image(img) {
2380
+ var canvas = document.createElement("canvas");
2381
+ canvas.width = img.width;
2382
+ canvas.height = img.height;
2383
+ var ctx = canvas.getContext("2d");
2384
+ ctx.drawImage(img, 0, 0);
2385
+ var dataURL = canvas.toDataURL("image/png");
2386
+
2387
+ return dataURL;
2388
+ };
2389
+
2390
+ ImageBlock.prototype.formatData = function formatData() {
2391
+ var formData = new FormData();
2392
+ if (this.file) {
2393
+ var formName = this.config.upload_formName || 'file';
2394
+
2395
+ formData.append(formName, this.file);
2396
+ return formData;
2397
+ } else {
2398
+ formData.append('url', this.props.blockProps.data.get("url"));
2399
+ return formData;
2400
+ }
2401
+ };
2402
+
2403
+ ImageBlock.prototype.getUploadUrl = function getUploadUrl() {
2404
+ var url = this.config.upload_url;
2405
+ if (typeof url === "function") {
2406
+ return url();
2407
+ } else {
2408
+ return url;
2409
+ }
2410
+ };
2411
+
2412
+ ImageBlock.prototype.getUploadHeaders = function getUploadHeaders() {
2413
+ return this.config.upload_headers || {};
2414
+ };
2415
+
2416
+ ImageBlock.prototype.uploadFile = function uploadFile() {
2417
+ var _this3 = this;
2418
+
2419
+ var handleUp = void 0;
2420
+ (0, _axios2['default'])({
2421
+ method: 'post',
2422
+ url: this.getUploadUrl(),
2423
+ headers: this.getUploadHeaders(),
2424
+ data: this.formatData(),
2425
+ onUploadProgress: function onUploadProgress(e) {
2426
+ return _this3.updateProgressBar(e);
2427
+ }
2428
+ }).then(function (result) {
2429
+ _this3.uploadCompleted(result.data);
2430
+ _this3.props.blockProps.removeLock();
2431
+ _this3.stopLoader();
2432
+ _this3.file = null;
2433
+
2434
+ if (_this3.config.upload_callback) {
2435
+ return _this3.config.upload_callback(result, _this3);
2436
+ }
2437
+ })['catch'](function (error) {
2438
+ _this3.props.blockProps.removeLock();
2439
+ _this3.stopLoader();
2440
+
2441
+ console.log('ERROR: got error uploading file ' + error);
2442
+ if (_this3.config.upload_error_callback) {
2443
+ return _this3.config.upload_error_callback(error, _this3);
2444
+ }
2445
+ });
2446
+
2447
+ return handleUp = function handleUp(json_response) {
2448
+ return _this3.uploadCompleted(json_response, n);
2449
+ };
2450
+ };
2451
+
2452
+ ImageBlock.prototype.uploadCompleted = function uploadCompleted(json) {
2453
+ return this.setState({ url: json.url }, this.updateData);
2454
+ };
2455
+
2456
+ ImageBlock.prototype.updateProgressBar = function updateProgressBar(e) {
2457
+ var complete = this.state.loading_progress;
2458
+ if (e.lengthComputable) {
2459
+ complete = e.loaded / e.total * 100;
2460
+ complete = complete != null ? complete : { complete: 0 };
2461
+ this.setState({
2462
+ loading_progress: complete });
2463
+ return console.log('complete: ' + complete);
2464
+ }
2465
+ };
2466
+
2467
+ ImageBlock.prototype.placeHolderEnabled = function placeHolderEnabled() {
2468
+ return this.state.enabled || this.props.block.getText();
2469
+ };
2470
+
2471
+ ImageBlock.prototype.placeholderText = function placeholderText() {
2472
+ if (this.placeHolderEnabled()) {
2473
+ return "";
2474
+ }
2475
+ return "Write caption for image (optional)";
2476
+ };
2477
+
2478
+ ImageBlock.prototype.handleFocus = function handleFocus(e) {
2479
+ var _this4 = this;
2480
+
2481
+ // console.log "focus on placeholder"
2482
+ return setTimeout(function () {
2483
+ return _this4.setState({
2484
+ enabled: true });
2485
+ }, 0);
2486
+ };
2487
+
2488
+ ImageBlock.prototype.render = function render() {
2489
+
2490
+ return _react2['default'].createElement(
2491
+ 'div',
2492
+ { ref: 'image_tag2', suppressContentEditableWarning: true },
2493
+ _react2['default'].createElement(
2494
+ 'div',
2495
+ { className: 'aspectRatioPlaceholder is-locked',
2496
+ style: this.coords(),
2497
+ onClick: this.handleGrafFigureSelectImg },
2498
+ _react2['default'].createElement('div', { style: { paddingBottom: this.state.aspect_ratio.ratio + '%' },
2499
+ className: 'aspect-ratio-fill' }),
2500
+ _react2['default'].createElement('img', { src: this.state.url,
2501
+ ref: 'image_tag',
2502
+ height: this.state.aspect_ratio.height,
2503
+ width: this.state.aspect_ratio.width,
2504
+ className: 'graf-image' }),
2505
+ _react2['default'].createElement(Loader, { toggle: this.state.loading,
2506
+ progress: this.state.loading_progress })
2507
+ ),
2508
+ _react2['default'].createElement(
2509
+ 'figcaption',
2510
+ { className: 'imageCaption', onMouseDown: this.handleFocus },
2511
+ !this.state.enabled ? _react2['default'].createElement(
2512
+ 'span',
2513
+ { className: 'danteDefaultPlaceholder' },
2514
+ this.placeholderText()
2515
+ ) : undefined,
2516
+ _react2['default'].createElement(_draftJs.EditorBlock, (0, _assign2['default'])({}, this.props, {
2517
+ "editable": true, "className": "imageCaption" }))
2518
+ )
2519
+ );
2520
+ };
2521
+
2522
+ return ImageBlock;
2523
+ }(_react2['default'].Component);
2524
+
2525
+ exports['default'] = ImageBlock;
2526
+
2527
+ var Loader = function (_React$Component2) {
2528
+ (0, _inherits3['default'])(Loader, _React$Component2);
2529
+
2530
+ function Loader() {
2531
+ (0, _classCallCheck3['default'])(this, Loader);
2532
+ return (0, _possibleConstructorReturn3['default'])(this, _React$Component2.apply(this, arguments));
2533
+ }
2534
+
2535
+ Loader.prototype.render = function render() {
2536
+ return _react2['default'].createElement(
2537
+ 'div',
2538
+ null,
2539
+ this.props.toggle ? _react2['default'].createElement(
2540
+ 'div',
2541
+ { className: 'image-upoader-loader' },
2542
+ _react2['default'].createElement(
2543
+ 'p',
2544
+ null,
2545
+ this.props.progress === 100 ? "processing image..." : _react2['default'].createElement(
2546
+ 'span',
2547
+ null,
2548
+ _react2['default'].createElement(
2549
+ 'span',
2550
+ null,
2551
+ 'loading'
2552
+ ),
2553
+ ' ',
2554
+ Math.round(this.props.progress)
2555
+ )
2556
+ )
2557
+ ) : undefined
2558
+ );
2559
+ };
2560
+
2561
+ return Loader;
2562
+ }(_react2['default'].Component);
2563
+
2564
+ module.exports = exports['default'];
2565
+
2566
+ /***/ },
2567
+
2568
+ /***/ 439:
2569
+ /***/ function(module, exports, __webpack_require__) {
2570
+
2571
+ 'use strict';
2572
+
2573
+ exports.__esModule = true;
2574
+
2575
+ var _classCallCheck2 = __webpack_require__(3);
2576
+
2577
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2578
+
2579
+ var _possibleConstructorReturn2 = __webpack_require__(39);
2580
+
2581
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2582
+
2583
+ var _inherits2 = __webpack_require__(86);
2584
+
2585
+ var _inherits3 = _interopRequireDefault(_inherits2);
2586
+
2587
+ var _react = __webpack_require__(23);
2588
+
2589
+ var _react2 = _interopRequireDefault(_react);
2590
+
2591
+ var _reactDom = __webpack_require__(24);
2592
+
2593
+ var _reactDom2 = _interopRequireDefault(_reactDom);
2594
+
2595
+ var _draftJs = __webpack_require__(94);
2596
+
2597
+ var _axios = __webpack_require__(403);
2598
+
2599
+ var _axios2 = _interopRequireDefault(_axios);
2600
+
2601
+ var _index = __webpack_require__(396);
2602
+
2603
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2604
+
2605
+ var EmbedBlock = function (_React$Component) {
2606
+ (0, _inherits3['default'])(EmbedBlock, _React$Component);
2607
+
2608
+ function EmbedBlock(props) {
2609
+ (0, _classCallCheck3['default'])(this, EmbedBlock);
2610
+
2611
+ //api_key = "86c28a410a104c8bb58848733c82f840"
2612
+
2613
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
2614
+
2615
+ _this.updateData = _this.updateData.bind(_this);
2616
+ _this.dataForUpdate = _this.dataForUpdate.bind(_this);
2617
+ _this.componentDidMount = _this.componentDidMount.bind(_this);
2618
+ _this.state = {
2619
+ embed_data: _this.defaultData(),
2620
+ error: ""
2621
+ };
2622
+ return _this;
2623
+ }
2624
+
2625
+ EmbedBlock.prototype.defaultData = function defaultData() {
2626
+ var existing_data = this.props.block.getData().toJS();
2627
+ return existing_data.embed_data || {};
2628
+ };
2629
+
2630
+ // will update block state
2631
+
2632
+
2633
+ EmbedBlock.prototype.updateData = function updateData() {
2634
+ var _props = this.props,
2635
+ block = _props.block,
2636
+ blockProps = _props.blockProps;
2637
+ var _props$blockProps = this.props.blockProps,
2638
+ getEditorState = _props$blockProps.getEditorState,
2639
+ setEditorState = _props$blockProps.setEditorState;
2640
+
2641
+ var data = block.getData();
2642
+ var newData = data.merge(this.state);
2643
+ return setEditorState((0, _index.updateDataOfBlock)(getEditorState(), block, newData));
2644
+ };
2645
+
2646
+ EmbedBlock.prototype.dataForUpdate = function dataForUpdate() {
2647
+
2648
+ return this.props.blockProps.data.toJS();
2649
+ };
2650
+
2651
+ EmbedBlock.prototype.componentDidMount = function componentDidMount() {
2652
+ var _this2 = this;
2653
+
2654
+ if (!this.props.blockProps.data) {
2655
+ return;
2656
+ }
2657
+
2658
+ // ensure data isnt already loaded
2659
+ // unless @dataForUpdate().endpoint or @dataForUpdate().provisory_text
2660
+
2661
+ if (!this.dataForUpdate().endpoint && !this.dataForUpdate().provisory_text) {
2662
+ //debugger
2663
+ return;
2664
+ }
2665
+
2666
+ return (0, _axios2['default'])({
2667
+ method: 'get',
2668
+ url: '' + this.dataForUpdate().endpoint + this.dataForUpdate().provisory_text + '&scheme=https'
2669
+ }).then(function (result) {
2670
+
2671
+ return _this2.setState({ embed_data: result.data } //JSON.parse(data.responseText)
2672
+ , _this2.updateData);
2673
+ })['catch'](function (error) {
2674
+
2675
+ _this2.setState({
2676
+ error: error.response.data.error_message });
2677
+ return console.log("TODO: error");
2678
+ });
2679
+ };
2680
+
2681
+ EmbedBlock.prototype.classForImage = function classForImage() {
2682
+ if (this.state.embed_data.images) {
2683
+ return "";
2684
+ } else {
2685
+ return "mixtapeImage--empty u-ignoreBlock";
2686
+ }
2687
+ };
2688
+ //if @state.embed_data.thumbnail_url then "" else "mixtapeImage--empty u-ignoreBlock"
2689
+
2690
+ EmbedBlock.prototype.picture = function picture() {
2691
+ if (this.state.embed_data.images && this.state.embed_data.images.length > 0) {
2692
+ return this.state.embed_data.images[0].url;
2693
+ } else {
2694
+ return "";
2695
+ }
2696
+ };
2697
+
2698
+ EmbedBlock.prototype.render = function render() {
2699
+ //block = @.props
2700
+ //foo = @.props.blockProps
2701
+ //data = Entity.get(block.block.getEntityAt(0)).getData()
2702
+ console.log("ERROR", this.state.error);
2703
+ return _react2['default'].createElement(
2704
+ 'span',
2705
+ null,
2706
+ this.picture() ? _react2['default'].createElement('a', {
2707
+ target: '_blank',
2708
+ className: 'js-mixtapeImage mixtapeImage ' + this.classForImage(),
2709
+ href: this.state.embed_data.url,
2710
+ style: { backgroundImage: 'url(\'' + this.picture() + '\')' }
2711
+ }) : undefined,
2712
+ this.state.error ? _react2['default'].createElement(
2713
+ 'h2',
2714
+ null,
2715
+ this.state.error
2716
+ ) : undefined,
2717
+ _react2['default'].createElement(
2718
+ 'a',
2719
+ {
2720
+ className: 'markup--anchor markup--mixtapeEmbed-anchor',
2721
+ target: '_blank',
2722
+ href: this.state.embed_data.url
2723
+ },
2724
+ _react2['default'].createElement(
2725
+ 'strong',
2726
+ { className: 'markup--strong markup--mixtapeEmbed-strong' },
2727
+ this.state.embed_data.title
2728
+ ),
2729
+ _react2['default'].createElement(
2730
+ 'em',
2731
+ { className: 'markup--em markup--mixtapeEmbed-em' },
2732
+ this.state.embed_data.description
2733
+ )
2734
+ ),
2735
+ this.state.embed_data.provider_url
2736
+ );
2737
+ };
2738
+
2739
+ return EmbedBlock;
2740
+ }(_react2['default'].Component);
2741
+
2742
+ exports['default'] = EmbedBlock;
2743
+ module.exports = exports['default'];
2744
+
2745
+ /***/ },
2746
+
2747
+ /***/ 440:
2748
+ /***/ function(module, exports, __webpack_require__) {
2749
+
2750
+ 'use strict';
2751
+
2752
+ exports.__esModule = true;
2753
+
2754
+ var _assign = __webpack_require__(435);
2755
+
2756
+ var _assign2 = _interopRequireDefault(_assign);
2757
+
2758
+ var _classCallCheck2 = __webpack_require__(3);
2759
+
2760
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2761
+
2762
+ var _possibleConstructorReturn2 = __webpack_require__(39);
2763
+
2764
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2765
+
2766
+ var _inherits2 = __webpack_require__(86);
2767
+
2768
+ var _inherits3 = _interopRequireDefault(_inherits2);
2769
+
2770
+ var _react = __webpack_require__(23);
2771
+
2772
+ var _react2 = _interopRequireDefault(_react);
2773
+
2774
+ var _reactDom = __webpack_require__(24);
2775
+
2776
+ var _reactDom2 = _interopRequireDefault(_reactDom);
2777
+
2778
+ var _draftJs = __webpack_require__(94);
2779
+
2780
+ var _index = __webpack_require__(396);
2781
+
2782
+ var _axios = __webpack_require__(403);
2783
+
2784
+ var _axios2 = _interopRequireDefault(_axios);
2785
+
2786
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2787
+
2788
+ var VideoBlock = function (_React$Component) {
2789
+ (0, _inherits3['default'])(VideoBlock, _React$Component);
2790
+
2791
+ function VideoBlock(props) {
2792
+ (0, _classCallCheck3['default'])(this, VideoBlock);
2793
+
2794
+ //api_key = "86c28a410a104c8bb58848733c82f840"
2795
+
2796
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
2797
+
2798
+ _this.updateData = _this.updateData.bind(_this);
2799
+ _this.dataForUpdate = _this.dataForUpdate.bind(_this);
2800
+ _this.state = { embed_data: _this.defaultData() };
2801
+ return _this;
2802
+ }
2803
+
2804
+ VideoBlock.prototype.defaultData = function defaultData() {
2805
+ var existing_data = this.props.block.getData().toJS();
2806
+ return existing_data.embed_data || {};
2807
+ };
2808
+
2809
+ // will update block state
2810
+
2811
+
2812
+ VideoBlock.prototype.updateData = function updateData() {
2813
+ var _props = this.props,
2814
+ block = _props.block,
2815
+ blockProps = _props.blockProps;
2816
+ var _props$blockProps = this.props.blockProps,
2817
+ getEditorState = _props$blockProps.getEditorState,
2818
+ setEditorState = _props$blockProps.setEditorState;
2819
+
2820
+ var data = block.getData();
2821
+ var newData = data.merge(this.state);
2822
+ return setEditorState((0, _index.updateDataOfBlock)(getEditorState(), block, newData));
2823
+ };
2824
+
2825
+ VideoBlock.prototype.dataForUpdate = function dataForUpdate() {
2826
+ return this.props.blockProps.data.toJS();
2827
+ };
2828
+
2829
+ VideoBlock.prototype.componentDidMount = function componentDidMount() {
2830
+ var _this2 = this;
2831
+
2832
+ if (!this.props.blockProps.data) {
2833
+ return;
2834
+ }
2835
+ // ensure data isnt already loaded
2836
+ if (!this.dataForUpdate().endpoint && !this.dataForUpdate().provisory_text) {
2837
+ return;
2838
+ }
2839
+
2840
+ return (0, _axios2['default'])({
2841
+ method: 'get',
2842
+ url: '' + this.dataForUpdate().endpoint + this.dataForUpdate().provisory_text + '&scheme=https'
2843
+ }).then(function (result) {
2844
+ return _this2.setState({ embed_data: result.data } //JSON.parse(data.responseText)
2845
+ , _this2.updateData);
2846
+ })['catch'](function (error) {
2847
+ return console.log("TODO: error");
2848
+ });
2849
+ };
2850
+
2851
+ VideoBlock.prototype.classForImage = function classForImage() {
2852
+ if (this.state.embed_data.thumbnail_url) {
2853
+ return "";
2854
+ } else {
2855
+ return "mixtapeImage--empty u-ignoreBlock";
2856
+ }
2857
+ };
2858
+
2859
+ VideoBlock.prototype.render = function render() {
2860
+ return _react2['default'].createElement(
2861
+ 'figure',
2862
+ { className: 'graf--figure graf--iframe graf--first', tabIndex: '0' },
2863
+ _react2['default'].createElement('div', { className: 'iframeContainer',
2864
+ dangerouslySetInnerHTML: { __html: this.state.embed_data.html } }),
2865
+ _react2['default'].createElement(
2866
+ 'figcaption',
2867
+ { className: 'imageCaption' },
2868
+ _react2['default'].createElement(_draftJs.EditorBlock, (0, _assign2['default'])({}, this.props, { "className": "imageCaption" }))
2869
+ )
2870
+ );
2871
+ };
2872
+
2873
+ return VideoBlock;
2874
+ }(_react2['default'].Component);
2875
+
2876
+ exports['default'] = VideoBlock;
2877
+ module.exports = exports['default'];
2878
+
2879
+ /***/ },
2880
+
2881
+ /***/ 441:
2882
+ /***/ function(module, exports, __webpack_require__) {
2883
+
2884
+ 'use strict';
2885
+
2886
+ exports.__esModule = true;
2887
+
2888
+ var _assign = __webpack_require__(435);
2889
+
2890
+ var _assign2 = _interopRequireDefault(_assign);
2891
+
2892
+ var _classCallCheck2 = __webpack_require__(3);
2893
+
2894
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2895
+
2896
+ var _possibleConstructorReturn2 = __webpack_require__(39);
2897
+
2898
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2899
+
2900
+ var _inherits2 = __webpack_require__(86);
2901
+
2902
+ var _inherits3 = _interopRequireDefault(_inherits2);
2903
+
2904
+ var _react = __webpack_require__(23);
2905
+
2906
+ var _react2 = _interopRequireDefault(_react);
2907
+
2908
+ var _reactDom = __webpack_require__(24);
2909
+
2910
+ var _reactDom2 = _interopRequireDefault(_reactDom);
2911
+
2912
+ var _draftJs = __webpack_require__(94);
2913
+
2914
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2915
+
2916
+ var PlaceholderBlock = function (_React$Component) {
2917
+ (0, _inherits3['default'])(PlaceholderBlock, _React$Component);
2918
+
2919
+ function PlaceholderBlock(props) {
2920
+ (0, _classCallCheck3['default'])(this, PlaceholderBlock);
2921
+
2922
+ var _this = (0, _possibleConstructorReturn3['default'])(this, _React$Component.call(this, props));
2923
+
2924
+ _this.placeholderText = _this.placeholderText.bind(_this);
2925
+ _this.placeholderFromProps = _this.placeholderFromProps.bind(_this);
2926
+ _this.defaultText = _this.defaultText.bind(_this);
2927
+ _this.handleFocus = _this.handleFocus.bind(_this);
2928
+ _this.classForDefault = _this.classForDefault.bind(_this);
2929
+ _this.state = {
2930
+ enabled: false,
2931
+ data: _this.props.blockProps.data.toJS()
2932
+ };
2933
+ return _this;
2934
+ }
2935
+
2936
+ PlaceholderBlock.prototype.placeholderText = function placeholderText() {
2937
+ if (this.state.enabled) {
2938
+ return "";
2939
+ }
2940
+ return this.props.blockProps.data.toJS().placeholder || this.placeholderFromProps() || this.defaultText();
2941
+ };
2942
+ //if @.props.blockProps.data then @.props.blockProps.data.placeholder else @defaultText()
2943
+
2944
+
2945
+ PlaceholderBlock.prototype.placeholderFromProps = function placeholderFromProps() {
2946
+ return this.props.block.toJS().placeholder;
2947
+ };
2948
+
2949
+ PlaceholderBlock.prototype.defaultText = function defaultText() {
2950
+ return "write something ";
2951
+ };
2952
+
2953
+ PlaceholderBlock.prototype.componentDidMount = function componentDidMount() {};
2954
+
2955
+ PlaceholderBlock.prototype.handleFocus = function handleFocus(e) {
2956
+ var _this2 = this;
2957
+
2958
+ // console.log "focus on placeholder"
2959
+ return setTimeout(function () {
2960
+ return _this2.setState({
2961
+ enabled: true });
2962
+ }, 0);
2963
+ };
2964
+
2965
+ PlaceholderBlock.prototype.classForDefault = function classForDefault() {
2966
+ if (!this.state.enabled) {
2967
+ return "defaultValue defaultValue--root";
2968
+ } else {
2969
+ return "";
2970
+ }
2971
+ };
2972
+
2973
+ PlaceholderBlock.prototype.render = function render() {
2974
+ return _react2['default'].createElement(
2975
+ 'span',
2976
+ { className: this.classForDefault(), onMouseDown: this.handleFocus },
2977
+ this.placeholderText(),
2978
+ _react2['default'].createElement(_draftJs.EditorBlock, (0, _assign2['default'])({}, this.props, {
2979
+ "className": "imageCaption",
2980
+ "placeholder": "escrive alalal"
2981
+ }))
2982
+ );
2983
+ };
2984
+
2985
+ return PlaceholderBlock;
2986
+ }(_react2['default'].Component);
2987
+
2988
+ exports['default'] = PlaceholderBlock;
2989
+ module.exports = exports['default'];
2990
+
2991
+ /***/ }
2992
+
2993
+ })
2994
+ });
2995
+ ;