dante2-editor 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/dist/Dante2.js +19801 -32971
  3. data/dist/Dante2.min.js +6 -15
  4. data/dist/Dante2.min.js.map +1 -1
  5. data/dist/DanteStyles.css +1 -1
  6. data/dist/DanteStyles.js +6 -6
  7. data/dist/DanteStyles.min.js +1 -1
  8. data/dist/DanteStyles.min.js.map +1 -1
  9. data/dist/dante-vendors.js +10602 -28851
  10. data/dist/dante-vendors.min.js +6 -15
  11. data/dist/dante-vendors.min.js.map +1 -1
  12. data/dist/fonts/dante.svg +1 -0
  13. data/docs/app.js +10 -10
  14. data/docs/app.js.map +1 -1
  15. data/docs/dante-vendors.js +16906 -31387
  16. data/docs/dante-vendors.js.map +1 -1
  17. data/docs/dante.css +168 -0
  18. data/docs/dante.css.map +1 -1
  19. data/docs/dante.js +1593 -179
  20. data/docs/dante.js.map +1 -1
  21. data/docs/fonts/dante.svg +1 -0
  22. data/package.json +15 -13
  23. data/rb_lib/dante2-editor/version.rb +1 -1
  24. data/src/components/{dante.js → core/dante.js} +12 -20
  25. data/src/components/{debug.js → core/debug.js} +0 -0
  26. data/src/components/{dante_editor.js → core/editor.js} +50 -42
  27. data/src/components/decorators/link.js +2 -1
  28. data/src/components/init.js +8 -0
  29. data/src/components/popovers/addButton.js +7 -0
  30. data/src/components/popovers/toolTip.js +15 -5
  31. data/src/index.js +4 -3
  32. data/src/styles/custom.css +189 -0
  33. data/src/styles/dante/_icons.scss +3 -1
  34. data/src/styles/dante.scss +2 -0
  35. data/src/styles/draft.css +5 -0
  36. data/src/styles/fonts/dante/dante.svg +1 -0
  37. data/src/utils/find_entities.js +3 -2
  38. data/src/utils/html2content.js +3 -1
  39. data/webpack/base.config.js +2 -2
  40. data/yarn.lock +1781 -1362
  41. metadata +7 -6
  42. data/src/components/wrapper.js +0 -0
data/docs/dante.js CHANGED
@@ -1,84 +1,60 @@
1
1
  webpackJsonp([0],{
2
2
 
3
- /***/ 146:
4
- /***/ (function(module, exports, __webpack_require__) {
5
-
6
- "use strict";
7
- /* WEBPACK VAR INJECTION */(function(global) {
8
-
9
- module.exports = global["DanteEditor"] = __webpack_require__(263);
10
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35)))
11
-
12
- /***/ }),
13
-
14
- /***/ 192:
3
+ /***/ 135:
15
4
  /***/ (function(module, exports, __webpack_require__) {
16
5
 
17
6
  module.exports = __webpack_require__.p + "fonts/dante.eot";
18
7
 
19
8
  /***/ }),
20
9
 
21
- /***/ 193:
10
+ /***/ 136:
22
11
  /***/ (function(module, exports, __webpack_require__) {
23
12
 
24
13
  module.exports = __webpack_require__.p + "fonts/fontello.eot";
25
14
 
26
15
  /***/ }),
27
16
 
28
- /***/ 224:
17
+ /***/ 139:
29
18
  /***/ (function(module, exports, __webpack_require__) {
30
19
 
31
20
  "use strict";
32
21
 
33
22
 
34
- var _dante = __webpack_require__(248);
35
-
36
- var _dante2 = _interopRequireDefault(_dante);
37
-
38
- var _dante_editor = __webpack_require__(146);
23
+ Object.defineProperty(exports, "__esModule", {
24
+ value: true
25
+ });
26
+ exports.DanteEditor = exports.Dante = undefined;
39
27
 
40
- var _dante_editor2 = _interopRequireDefault(_dante_editor);
28
+ var _init = __webpack_require__(170);
41
29
 
42
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
30
+ window.Dante = _init.Dante;
31
+ window.DanteEditor = _init.DanteEditor;
43
32
 
44
- module.exports = {
45
- Dante: _dante2['default'],
46
- DanteEditor: _dante_editor2['default']
47
- };
33
+ exports.Dante = _init.Dante;
34
+ exports.DanteEditor = _init.DanteEditor;
48
35
 
49
36
  /***/ }),
50
37
 
51
- /***/ 228:
38
+ /***/ 143:
52
39
  /***/ (function(module, exports) {
53
40
 
54
41
  // removed by extract-text-webpack-plugin
55
42
 
56
43
  /***/ }),
57
44
 
58
- /***/ 247:
45
+ /***/ 162:
59
46
  /***/ (function(module, exports, __webpack_require__) {
60
47
 
61
48
  "use strict";
62
49
 
63
50
 
64
- __webpack_require__(228);
65
-
66
- var _index = __webpack_require__(224);
51
+ __webpack_require__(143);
67
52
 
68
- /***/ }),
69
-
70
- /***/ 248:
71
- /***/ (function(module, exports, __webpack_require__) {
72
-
73
- "use strict";
74
- /* WEBPACK VAR INJECTION */(function(global) {
75
-
76
- module.exports = global["Dante"] = __webpack_require__(262);
77
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(35)))
53
+ var _index = __webpack_require__(139);
78
54
 
79
55
  /***/ }),
80
56
 
81
- /***/ 249:
57
+ /***/ 163:
82
58
  /***/ (function(module, exports, __webpack_require__) {
83
59
 
84
60
  "use strict";
@@ -88,41 +64,41 @@ Object.defineProperty(exports, "__esModule", {
88
64
  value: true
89
65
  });
90
66
 
91
- var _getPrototypeOf = __webpack_require__(18);
67
+ var _getPrototypeOf = __webpack_require__(11);
92
68
 
93
69
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
94
70
 
95
- var _classCallCheck2 = __webpack_require__(13);
71
+ var _classCallCheck2 = __webpack_require__(7);
96
72
 
97
73
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
98
74
 
99
- var _createClass2 = __webpack_require__(14);
75
+ var _createClass2 = __webpack_require__(8);
100
76
 
101
77
  var _createClass3 = _interopRequireDefault(_createClass2);
102
78
 
103
- var _possibleConstructorReturn2 = __webpack_require__(20);
79
+ var _possibleConstructorReturn2 = __webpack_require__(13);
104
80
 
105
81
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
106
82
 
107
- var _inherits2 = __webpack_require__(19);
83
+ var _inherits2 = __webpack_require__(12);
108
84
 
109
85
  var _inherits3 = _interopRequireDefault(_inherits2);
110
86
 
111
- var _react = __webpack_require__(4);
87
+ var _react = __webpack_require__(1);
112
88
 
113
89
  var _react2 = _interopRequireDefault(_react);
114
90
 
115
- var _reactDom = __webpack_require__(8);
91
+ var _reactDom = __webpack_require__(4);
116
92
 
117
93
  var _reactDom2 = _interopRequireDefault(_reactDom);
118
94
 
119
- var _draftJs = __webpack_require__(9);
95
+ var _draftJs = __webpack_require__(5);
120
96
 
121
- var _axios = __webpack_require__(65);
97
+ var _axios = __webpack_require__(41);
122
98
 
123
99
  var _axios2 = _interopRequireDefault(_axios);
124
100
 
125
- var _index = __webpack_require__(27);
101
+ var _index = __webpack_require__(19);
126
102
 
127
103
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
128
104
 
@@ -197,8 +173,8 @@ var EmbedBlock = function (_React$Component) {
197
173
  url: '' + this.dataForUpdate().endpoint + this.dataForUpdate().provisory_text + '&scheme=https'
198
174
  }).then(function (result) {
199
175
 
200
- return _this2.setState({ embed_data: result.data } //JSON.parse(data.responseText)
201
- , _this2.updateData);
176
+ return _this2.setState({ embed_data: result.data //JSON.parse(data.responseText)
177
+ }, _this2.updateData);
202
178
  })['catch'](function (error) {
203
179
 
204
180
  _this2.setState({
@@ -276,7 +252,7 @@ exports['default'] = EmbedBlock;
276
252
 
277
253
  /***/ }),
278
254
 
279
- /***/ 250:
255
+ /***/ 164:
280
256
  /***/ (function(module, exports, __webpack_require__) {
281
257
 
282
258
  "use strict";
@@ -286,45 +262,45 @@ Object.defineProperty(exports, "__esModule", {
286
262
  value: true
287
263
  });
288
264
 
289
- var _assign = __webpack_require__(86);
265
+ var _assign = __webpack_require__(59);
290
266
 
291
267
  var _assign2 = _interopRequireDefault(_assign);
292
268
 
293
- var _getPrototypeOf = __webpack_require__(18);
269
+ var _getPrototypeOf = __webpack_require__(11);
294
270
 
295
271
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
296
272
 
297
- var _classCallCheck2 = __webpack_require__(13);
273
+ var _classCallCheck2 = __webpack_require__(7);
298
274
 
299
275
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
300
276
 
301
- var _createClass2 = __webpack_require__(14);
277
+ var _createClass2 = __webpack_require__(8);
302
278
 
303
279
  var _createClass3 = _interopRequireDefault(_createClass2);
304
280
 
305
- var _possibleConstructorReturn2 = __webpack_require__(20);
281
+ var _possibleConstructorReturn2 = __webpack_require__(13);
306
282
 
307
283
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
308
284
 
309
- var _inherits2 = __webpack_require__(19);
285
+ var _inherits2 = __webpack_require__(12);
310
286
 
311
287
  var _inherits3 = _interopRequireDefault(_inherits2);
312
288
 
313
- var _react = __webpack_require__(4);
289
+ var _react = __webpack_require__(1);
314
290
 
315
291
  var _react2 = _interopRequireDefault(_react);
316
292
 
317
- var _reactDom = __webpack_require__(8);
293
+ var _reactDom = __webpack_require__(4);
318
294
 
319
295
  var _reactDom2 = _interopRequireDefault(_reactDom);
320
296
 
321
- var _draftJs = __webpack_require__(9);
297
+ var _draftJs = __webpack_require__(5);
322
298
 
323
- var _axios = __webpack_require__(65);
299
+ var _axios = __webpack_require__(41);
324
300
 
325
301
  var _axios2 = _interopRequireDefault(_axios);
326
302
 
327
- var _index = __webpack_require__(27);
303
+ var _index = __webpack_require__(19);
328
304
 
329
305
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
330
306
 
@@ -454,9 +430,9 @@ var ImageBlock = function (_React$Component) {
454
430
  }
455
431
 
456
432
  var fill_ratio = height / width * 100;
457
- var result = { width: width, height: height, ratio: fill_ratio };
458
- // console.log result
459
- return result;
433
+ var result = { width: width, height: height, ratio: fill_ratio
434
+ // console.log result
435
+ };return result;
460
436
  }
461
437
 
462
438
  // will update block state
@@ -773,7 +749,7 @@ var Loader = function (_React$Component2) {
773
749
 
774
750
  /***/ }),
775
751
 
776
- /***/ 251:
752
+ /***/ 165:
777
753
  /***/ (function(module, exports, __webpack_require__) {
778
754
 
779
755
  "use strict";
@@ -783,39 +759,39 @@ Object.defineProperty(exports, "__esModule", {
783
759
  value: true
784
760
  });
785
761
 
786
- var _assign = __webpack_require__(86);
762
+ var _assign = __webpack_require__(59);
787
763
 
788
764
  var _assign2 = _interopRequireDefault(_assign);
789
765
 
790
- var _getPrototypeOf = __webpack_require__(18);
766
+ var _getPrototypeOf = __webpack_require__(11);
791
767
 
792
768
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
793
769
 
794
- var _classCallCheck2 = __webpack_require__(13);
770
+ var _classCallCheck2 = __webpack_require__(7);
795
771
 
796
772
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
797
773
 
798
- var _createClass2 = __webpack_require__(14);
774
+ var _createClass2 = __webpack_require__(8);
799
775
 
800
776
  var _createClass3 = _interopRequireDefault(_createClass2);
801
777
 
802
- var _possibleConstructorReturn2 = __webpack_require__(20);
778
+ var _possibleConstructorReturn2 = __webpack_require__(13);
803
779
 
804
780
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
805
781
 
806
- var _inherits2 = __webpack_require__(19);
782
+ var _inherits2 = __webpack_require__(12);
807
783
 
808
784
  var _inherits3 = _interopRequireDefault(_inherits2);
809
785
 
810
- var _react = __webpack_require__(4);
786
+ var _react = __webpack_require__(1);
811
787
 
812
788
  var _react2 = _interopRequireDefault(_react);
813
789
 
814
- var _reactDom = __webpack_require__(8);
790
+ var _reactDom = __webpack_require__(4);
815
791
 
816
792
  var _reactDom2 = _interopRequireDefault(_reactDom);
817
793
 
818
- var _draftJs = __webpack_require__(9);
794
+ var _draftJs = __webpack_require__(5);
819
795
 
820
796
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
821
797
 
@@ -904,7 +880,7 @@ exports['default'] = PlaceholderBlock;
904
880
 
905
881
  /***/ }),
906
882
 
907
- /***/ 252:
883
+ /***/ 166:
908
884
  /***/ (function(module, exports, __webpack_require__) {
909
885
 
910
886
  "use strict";
@@ -914,43 +890,43 @@ Object.defineProperty(exports, "__esModule", {
914
890
  value: true
915
891
  });
916
892
 
917
- var _assign = __webpack_require__(86);
893
+ var _assign = __webpack_require__(59);
918
894
 
919
895
  var _assign2 = _interopRequireDefault(_assign);
920
896
 
921
- var _getPrototypeOf = __webpack_require__(18);
897
+ var _getPrototypeOf = __webpack_require__(11);
922
898
 
923
899
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
924
900
 
925
- var _classCallCheck2 = __webpack_require__(13);
901
+ var _classCallCheck2 = __webpack_require__(7);
926
902
 
927
903
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
928
904
 
929
- var _createClass2 = __webpack_require__(14);
905
+ var _createClass2 = __webpack_require__(8);
930
906
 
931
907
  var _createClass3 = _interopRequireDefault(_createClass2);
932
908
 
933
- var _possibleConstructorReturn2 = __webpack_require__(20);
909
+ var _possibleConstructorReturn2 = __webpack_require__(13);
934
910
 
935
911
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
936
912
 
937
- var _inherits2 = __webpack_require__(19);
913
+ var _inherits2 = __webpack_require__(12);
938
914
 
939
915
  var _inherits3 = _interopRequireDefault(_inherits2);
940
916
 
941
- var _react = __webpack_require__(4);
917
+ var _react = __webpack_require__(1);
942
918
 
943
919
  var _react2 = _interopRequireDefault(_react);
944
920
 
945
- var _reactDom = __webpack_require__(8);
921
+ var _reactDom = __webpack_require__(4);
946
922
 
947
923
  var _reactDom2 = _interopRequireDefault(_reactDom);
948
924
 
949
- var _draftJs = __webpack_require__(9);
925
+ var _draftJs = __webpack_require__(5);
950
926
 
951
- var _index = __webpack_require__(27);
927
+ var _index = __webpack_require__(19);
952
928
 
953
- var _axios = __webpack_require__(65);
929
+ var _axios = __webpack_require__(41);
954
930
 
955
931
  var _axios2 = _interopRequireDefault(_axios);
956
932
 
@@ -1017,8 +993,8 @@ var VideoBlock = function (_React$Component) {
1017
993
  method: 'get',
1018
994
  url: '' + this.dataForUpdate().endpoint + this.dataForUpdate().provisory_text + '&scheme=https'
1019
995
  }).then(function (result) {
1020
- return _this2.setState({ embed_data: result.data } //JSON.parse(data.responseText)
1021
- , _this2.updateData);
996
+ return _this2.setState({ embed_data: result.data //JSON.parse(data.responseText)
997
+ }, _this2.updateData);
1022
998
  })['catch'](function (error) {
1023
999
  return console.log("TODO: error");
1024
1000
  });
@@ -1055,7 +1031,320 @@ exports['default'] = VideoBlock;
1055
1031
 
1056
1032
  /***/ }),
1057
1033
 
1058
- /***/ 253:
1034
+ /***/ 167:
1035
+ /***/ (function(module, exports, __webpack_require__) {
1036
+
1037
+ "use strict";
1038
+
1039
+
1040
+ Object.defineProperty(exports, "__esModule", {
1041
+ value: true
1042
+ });
1043
+
1044
+ var _classCallCheck2 = __webpack_require__(7);
1045
+
1046
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1047
+
1048
+ var _createClass2 = __webpack_require__(8);
1049
+
1050
+ var _createClass3 = _interopRequireDefault(_createClass2);
1051
+
1052
+ var _react = __webpack_require__(1);
1053
+
1054
+ var _react2 = _interopRequireDefault(_react);
1055
+
1056
+ var _reactDom = __webpack_require__(4);
1057
+
1058
+ var _reactDom2 = _interopRequireDefault(_reactDom);
1059
+
1060
+ var _immutable = __webpack_require__(40);
1061
+
1062
+ var _editor = __webpack_require__(92);
1063
+
1064
+ var _editor2 = _interopRequireDefault(_editor);
1065
+
1066
+ var _image = __webpack_require__(172);
1067
+
1068
+ var _image2 = _interopRequireDefault(_image);
1069
+
1070
+ var _link = __webpack_require__(173);
1071
+
1072
+ var _link2 = _interopRequireDefault(_link);
1073
+
1074
+ var _addButton = __webpack_require__(171);
1075
+
1076
+ var _addButton2 = _interopRequireDefault(_addButton);
1077
+
1078
+ var _toolTip = __webpack_require__(174);
1079
+
1080
+ var _toolTip2 = _interopRequireDefault(_toolTip);
1081
+
1082
+ var _image3 = __webpack_require__(164);
1083
+
1084
+ var _image4 = _interopRequireDefault(_image3);
1085
+
1086
+ var _embed = __webpack_require__(163);
1087
+
1088
+ var _embed2 = _interopRequireDefault(_embed);
1089
+
1090
+ var _video = __webpack_require__(166);
1091
+
1092
+ var _video2 = _interopRequireDefault(_video);
1093
+
1094
+ var _placeholder = __webpack_require__(165);
1095
+
1096
+ var _placeholder2 = _interopRequireDefault(_placeholder);
1097
+
1098
+ var _index = __webpack_require__(19);
1099
+
1100
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1101
+
1102
+ var Dante = function () {
1103
+ function Dante(options) {
1104
+ (0, _classCallCheck3['default'])(this, Dante);
1105
+
1106
+ if (options == null) {
1107
+ options = {};
1108
+ }
1109
+ console.log("init editor Dante!");
1110
+
1111
+ // deep merge on config
1112
+ var config = (0, _immutable.Map)((0, _immutable.fromJS)(this.defaultOptions(options)));
1113
+
1114
+ this.options = config.mergeDeep(options).toJS();
1115
+ console.log(this.options);
1116
+ }
1117
+
1118
+ (0, _createClass3['default'])(Dante, [{
1119
+ key: 'defaultOptions',
1120
+ value: function defaultOptions(options) {
1121
+ // default options
1122
+ if (options == null) {
1123
+ options = {};
1124
+ }
1125
+ var defaultOptions = {};
1126
+ defaultOptions.el = 'app';
1127
+ defaultOptions.content = "";
1128
+ defaultOptions.read_only = false;
1129
+ defaultOptions.spellcheck = false;
1130
+ defaultOptions.title_placeholder = "Title";
1131
+ defaultOptions.body_placeholder = "Write your story";
1132
+
1133
+ defaultOptions.widgets = [{
1134
+ title: 'add an image',
1135
+ icon: 'image',
1136
+ type: 'image',
1137
+ block: _image4['default'],
1138
+ editable: true,
1139
+ renderable: true,
1140
+ breakOnContinuous: true,
1141
+ wrapper_class: "graf graf--figure",
1142
+ selected_class: "is-selected is-mediaFocused",
1143
+ selectedFn: function selectedFn(block) {
1144
+ var _block$getData$toJS = block.getData().toJS(),
1145
+ direction = _block$getData$toJS.direction;
1146
+
1147
+ switch (direction) {
1148
+ case "left":
1149
+ return "graf--layoutOutsetLeft";
1150
+ case "center":
1151
+ return "";
1152
+ case "wide":
1153
+ return "sectionLayout--fullWidth";
1154
+ case "fill":
1155
+ return "graf--layoutFillWidth";
1156
+ }
1157
+ },
1158
+ handleEnterWithoutText: function handleEnterWithoutText(ctx, block) {
1159
+ var editorState = ctx.state.editorState;
1160
+
1161
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1162
+ },
1163
+ handleEnterWithText: function handleEnterWithText(ctx, block) {
1164
+ var editorState = ctx.state.editorState;
1165
+
1166
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1167
+ },
1168
+
1169
+ widget_options: {
1170
+ displayOnInlineTooltip: true,
1171
+ insertion: "upload",
1172
+ insert_block: "image"
1173
+ },
1174
+ options: {
1175
+ upload_url: options.upload_url,
1176
+ upload_headers: options.upload_headers,
1177
+ upload_formName: options.upload_formName,
1178
+ upload_handler: options.image_upload_handler,
1179
+ upload_callback: options.image_upload_callback,
1180
+ image_delete_callback: options.image_delete_callback,
1181
+ image_caption_placeholder: options.image_caption_placeholder || "Write caption for image (optional)"
1182
+ }
1183
+ }, {
1184
+ icon: 'embed',
1185
+ title: 'insert embed',
1186
+ type: 'embed',
1187
+ block: _embed2['default'],
1188
+ editable: true,
1189
+ renderable: true,
1190
+ breakOnContinuous: true,
1191
+ wrapper_class: "graf graf--mixtapeEmbed",
1192
+ selected_class: "is-selected is-mediaFocused",
1193
+ widget_options: {
1194
+ displayOnInlineTooltip: true,
1195
+ insertion: "placeholder",
1196
+ insert_block: "embed"
1197
+ },
1198
+ options: {
1199
+ endpoint: '//api.embed.ly/1/extract?key=' + options.api_key + '&url=',
1200
+ placeholder: 'Paste a link to embed content from another site (e.g. Twitter) and press Enter'
1201
+ },
1202
+ handleEnterWithoutText: function handleEnterWithoutText(ctx, block) {
1203
+ var editorState = ctx.state.editorState;
1204
+
1205
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1206
+ },
1207
+ handleEnterWithText: function handleEnterWithText(ctx, block) {
1208
+ var editorState = ctx.state.editorState;
1209
+
1210
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1211
+ }
1212
+ }, {
1213
+ icon: 'video',
1214
+ title: 'insert video',
1215
+ editable: true,
1216
+ type: 'video',
1217
+ block: _video2['default'],
1218
+ renderable: true,
1219
+ breakOnContinuous: true,
1220
+ wrapper_class: "graf--figure graf--iframe",
1221
+ selected_class: " is-selected is-mediaFocused",
1222
+ widget_options: {
1223
+ displayOnInlineTooltip: true,
1224
+ insertion: "placeholder",
1225
+ insert_block: "video"
1226
+ },
1227
+ options: {
1228
+ endpoint: '//api.embed.ly/1/oembed?key=' + options.api_key + '&url=',
1229
+ placeholder: 'Paste a YouTube, Vine, Vimeo, or other video link, and press Enter',
1230
+ caption: 'Type caption for embed (optional)'
1231
+ },
1232
+
1233
+ handleEnterWithoutText: function handleEnterWithoutText(ctx, block) {
1234
+ var editorState = ctx.state.editorState;
1235
+
1236
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1237
+ },
1238
+ handleEnterWithText: function handleEnterWithText(ctx, block) {
1239
+ var editorState = ctx.state.editorState;
1240
+
1241
+ return ctx.onChange((0, _index.addNewBlockAt)(editorState, block.getKey()));
1242
+ }
1243
+ }, {
1244
+ renderable: true,
1245
+ editable: true,
1246
+ block: _placeholder2['default'],
1247
+ type: 'placeholder',
1248
+ wrapper_class: "is-embedable",
1249
+ selected_class: " is-selected is-mediaFocused",
1250
+ widget_options: {
1251
+ displayOnInlineTooltip: false
1252
+ },
1253
+ handleEnterWithText: function handleEnterWithText(ctx, block) {
1254
+ var editorState = ctx.state.editorState;
1255
+
1256
+ var data = {
1257
+ provisory_text: block.getText(),
1258
+ endpoint: block.getData().get('endpoint'),
1259
+ type: block.getData().get('type')
1260
+ };
1261
+
1262
+ return ctx.onChange((0, _index.resetBlockWithType)(editorState, data.type, data));
1263
+ }
1264
+ }];
1265
+
1266
+ defaultOptions.tooltips = [{
1267
+ ref: 'insert_tooltip',
1268
+ component: _toolTip2['default'],
1269
+ displayOnSelection: true,
1270
+ selectionElements: ["unstyled", "blockquote", "ordered-list", "unordered-list", "unordered-list-item", "ordered-list-item", "code-block", 'header-one', 'header-two', 'header-three', 'header-four'],
1271
+ widget_options: {
1272
+ placeholder: "Paste or type a link",
1273
+ block_types: [
1274
+ // {label: 'p', style: 'unstyled'},
1275
+ { label: 'h2', style: 'header-one', type: "block" }, { label: 'h3', style: 'header-two', type: "block" }, { label: 'h4', style: 'header-three', type: "block" }, { label: 'blockquote', style: 'blockquote', type: "block" }, { label: 'insertunorderedlist', style: 'unordered-list-item', type: "block" }, { label: 'insertorderedlist', style: 'ordered-list-item', type: "block" }, { label: 'code', style: 'code-block', type: "block" }, { label: 'bold', style: 'BOLD', type: "inline" }, { label: 'italic', style: 'ITALIC', type: "inline" }]
1276
+ }
1277
+ }, {
1278
+ ref: 'add_tooltip',
1279
+ component: _addButton2['default']
1280
+ }, {
1281
+ ref: 'anchor_popover',
1282
+ component: _link2['default']
1283
+ }, {
1284
+ ref: 'image_popover',
1285
+ component: _image2['default']
1286
+ }];
1287
+
1288
+ defaultOptions.xhr = {
1289
+ before_handler: null,
1290
+ success_handler: null,
1291
+ error_handler: null
1292
+ };
1293
+
1294
+ defaultOptions.data_storage = {
1295
+ url: null,
1296
+ method: "POST",
1297
+ success_handler: null,
1298
+ failure_handler: null,
1299
+ interval: 1500,
1300
+ withCredentials: false,
1301
+ crossDomain: false,
1302
+ headers: {}
1303
+ };
1304
+
1305
+ defaultOptions.default_wrappers = [{ className: 'graf--p', block: 'unstyled' }, { className: 'graf--h2', block: 'header-one' }, { className: 'graf--h3', block: 'header-two' }, { className: 'graf--h4', block: 'header-three' }, { className: 'graf--blockquote', block: 'blockquote' }, { className: 'graf--insertunorderedlist', block: 'unordered-list-item' }, { className: 'graf--insertorderedlist', block: 'ordered-list-item' }, { className: 'graf--code', block: 'code-block' }, { className: 'graf--bold', block: 'BOLD' }, { className: 'graf--italic', block: 'ITALIC' }];
1306
+
1307
+ defaultOptions.continuousBlocks = ["unstyled", "blockquote", "ordered-list", "unordered-list", "unordered-list-item", "ordered-list-item", "code-block"];
1308
+
1309
+ defaultOptions.key_commands = {
1310
+ "alt-shift": [{ key: 65, cmd: 'add-new-block' }],
1311
+ "alt-cmd": [{ key: 49, cmd: 'toggle_block:header-one' }, { key: 50, cmd: 'toggle_block:header-two' }, { key: 53, cmd: 'toggle_block:blockquote' }],
1312
+ "cmd": [{ key: 66, cmd: 'toggle_inline:BOLD' }, { key: 73, cmd: 'toggle_inline:ITALIC' }, { key: 75, cmd: 'insert:link' }]
1313
+ };
1314
+
1315
+ defaultOptions.character_convert_mapping = {
1316
+ '> ': "blockquote",
1317
+ '*.': "unordered-list-item",
1318
+ '* ': "unordered-list-item",
1319
+ '- ': "unordered-list-item",
1320
+ '1.': "ordered-list-item",
1321
+ '# ': 'header-one',
1322
+ '##': 'header-two',
1323
+ '==': "unstyled",
1324
+ '` ': "code-block"
1325
+ };
1326
+
1327
+ return defaultOptions;
1328
+ }
1329
+ }, {
1330
+ key: 'getContent',
1331
+ value: function getContent() {
1332
+ return this.options.content;
1333
+ }
1334
+ }, {
1335
+ key: 'render',
1336
+ value: function render() {
1337
+ return this.editor = _reactDom2['default'].render(_react2['default'].createElement(_editor2['default'], { content: this.getContent(), config: this.options }), document.getElementById(this.options.el));
1338
+ }
1339
+ }]);
1340
+ return Dante;
1341
+ }();
1342
+
1343
+ exports['default'] = Dante;
1344
+
1345
+ /***/ }),
1346
+
1347
+ /***/ 168:
1059
1348
  /***/ (function(module, exports, __webpack_require__) {
1060
1349
 
1061
1350
  "use strict";
@@ -1065,31 +1354,31 @@ Object.defineProperty(exports, "__esModule", {
1065
1354
  value: true
1066
1355
  });
1067
1356
 
1068
- var _stringify = __webpack_require__(85);
1357
+ var _stringify = __webpack_require__(58);
1069
1358
 
1070
1359
  var _stringify2 = _interopRequireDefault(_stringify);
1071
1360
 
1072
- var _getPrototypeOf = __webpack_require__(18);
1361
+ var _getPrototypeOf = __webpack_require__(11);
1073
1362
 
1074
1363
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
1075
1364
 
1076
- var _classCallCheck2 = __webpack_require__(13);
1365
+ var _classCallCheck2 = __webpack_require__(7);
1077
1366
 
1078
1367
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1079
1368
 
1080
- var _createClass2 = __webpack_require__(14);
1369
+ var _createClass2 = __webpack_require__(8);
1081
1370
 
1082
1371
  var _createClass3 = _interopRequireDefault(_createClass2);
1083
1372
 
1084
- var _possibleConstructorReturn2 = __webpack_require__(20);
1373
+ var _possibleConstructorReturn2 = __webpack_require__(13);
1085
1374
 
1086
1375
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1087
1376
 
1088
- var _inherits2 = __webpack_require__(19);
1377
+ var _inherits2 = __webpack_require__(12);
1089
1378
 
1090
1379
  var _inherits3 = _interopRequireDefault(_inherits2);
1091
1380
 
1092
- var _react = __webpack_require__(4);
1381
+ var _react = __webpack_require__(1);
1093
1382
 
1094
1383
  var _react2 = _interopRequireDefault(_react);
1095
1384
 
@@ -1249,7 +1538,7 @@ exports["default"] = Debug;
1249
1538
 
1250
1539
  /***/ }),
1251
1540
 
1252
- /***/ 254:
1541
+ /***/ 169:
1253
1542
  /***/ (function(module, exports, __webpack_require__) {
1254
1543
 
1255
1544
  "use strict";
@@ -1259,31 +1548,31 @@ Object.defineProperty(exports, "__esModule", {
1259
1548
  value: true
1260
1549
  });
1261
1550
 
1262
- var _getPrototypeOf = __webpack_require__(18);
1551
+ var _getPrototypeOf = __webpack_require__(11);
1263
1552
 
1264
1553
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
1265
1554
 
1266
- var _classCallCheck2 = __webpack_require__(13);
1555
+ var _classCallCheck2 = __webpack_require__(7);
1267
1556
 
1268
1557
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1269
1558
 
1270
- var _createClass2 = __webpack_require__(14);
1559
+ var _createClass2 = __webpack_require__(8);
1271
1560
 
1272
1561
  var _createClass3 = _interopRequireDefault(_createClass2);
1273
1562
 
1274
- var _possibleConstructorReturn2 = __webpack_require__(20);
1563
+ var _possibleConstructorReturn2 = __webpack_require__(13);
1275
1564
 
1276
1565
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1277
1566
 
1278
- var _inherits2 = __webpack_require__(19);
1567
+ var _inherits2 = __webpack_require__(12);
1279
1568
 
1280
1569
  var _inherits3 = _interopRequireDefault(_inherits2);
1281
1570
 
1282
- var _react = __webpack_require__(4);
1571
+ var _react = __webpack_require__(1);
1283
1572
 
1284
1573
  var _react2 = _interopRequireDefault(_react);
1285
1574
 
1286
- var _draftJs = __webpack_require__(9);
1575
+ var _draftJs = __webpack_require__(5);
1287
1576
 
1288
1577
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1289
1578
 
@@ -1343,7 +1632,8 @@ var Link = function (_React$Component) {
1343
1632
  }, {
1344
1633
  key: 'render',
1345
1634
  value: function render() {
1346
- this.data = _draftJs.Entity.get(this.props.entityKey).getData();
1635
+ this.data = this.props.contentState.getEntity(this.props.entityKey).getData();
1636
+ //Entity.get(this.props.entityKey).getData()
1347
1637
 
1348
1638
  return _react2['default'].createElement(
1349
1639
  'a',
@@ -1365,7 +1655,33 @@ exports['default'] = Link;
1365
1655
 
1366
1656
  /***/ }),
1367
1657
 
1368
- /***/ 255:
1658
+ /***/ 170:
1659
+ /***/ (function(module, exports, __webpack_require__) {
1660
+
1661
+ "use strict";
1662
+
1663
+
1664
+ Object.defineProperty(exports, "__esModule", {
1665
+ value: true
1666
+ });
1667
+ exports.DanteEditor = exports.Dante = undefined;
1668
+
1669
+ var _dante = __webpack_require__(167);
1670
+
1671
+ var _dante2 = _interopRequireDefault(_dante);
1672
+
1673
+ var _editor = __webpack_require__(92);
1674
+
1675
+ var _editor2 = _interopRequireDefault(_editor);
1676
+
1677
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1678
+
1679
+ exports.Dante = _dante2['default'];
1680
+ exports.DanteEditor = _editor2['default'];
1681
+
1682
+ /***/ }),
1683
+
1684
+ /***/ 171:
1369
1685
  /***/ (function(module, exports, __webpack_require__) {
1370
1686
 
1371
1687
  "use strict";
@@ -1375,39 +1691,39 @@ Object.defineProperty(exports, "__esModule", {
1375
1691
  value: true
1376
1692
  });
1377
1693
 
1378
- var _getPrototypeOf = __webpack_require__(18);
1694
+ var _getPrototypeOf = __webpack_require__(11);
1379
1695
 
1380
1696
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
1381
1697
 
1382
- var _classCallCheck2 = __webpack_require__(13);
1698
+ var _classCallCheck2 = __webpack_require__(7);
1383
1699
 
1384
1700
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1385
1701
 
1386
- var _createClass2 = __webpack_require__(14);
1702
+ var _createClass2 = __webpack_require__(8);
1387
1703
 
1388
1704
  var _createClass3 = _interopRequireDefault(_createClass2);
1389
1705
 
1390
- var _possibleConstructorReturn2 = __webpack_require__(20);
1706
+ var _possibleConstructorReturn2 = __webpack_require__(13);
1391
1707
 
1392
1708
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1393
1709
 
1394
- var _inherits2 = __webpack_require__(19);
1710
+ var _inherits2 = __webpack_require__(12);
1395
1711
 
1396
1712
  var _inherits3 = _interopRequireDefault(_inherits2);
1397
1713
 
1398
- var _react = __webpack_require__(4);
1714
+ var _react = __webpack_require__(1);
1399
1715
 
1400
1716
  var _react2 = _interopRequireDefault(_react);
1401
1717
 
1402
- var _reactDom = __webpack_require__(8);
1718
+ var _reactDom = __webpack_require__(4);
1403
1719
 
1404
1720
  var _reactDom2 = _interopRequireDefault(_reactDom);
1405
1721
 
1406
- var _draftJs = __webpack_require__(9);
1722
+ var _draftJs = __webpack_require__(5);
1407
1723
 
1408
- var _index = __webpack_require__(27);
1724
+ var _index = __webpack_require__(19);
1409
1725
 
1410
- var _selection = __webpack_require__(84);
1726
+ var _selection = __webpack_require__(57);
1411
1727
 
1412
1728
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1413
1729
 
@@ -1566,6 +1882,12 @@ var DanteInlineTooltip = function (_React$Component) {
1566
1882
  */
1567
1883
  return this.insertImage(fileList[0]);
1568
1884
  }
1885
+ }, {
1886
+ key: 'handleInsertion',
1887
+ value: function handleInsertion(e) {
1888
+ this.hide();
1889
+ return this.props.onChange((0, _index.addNewBlock)(this.props.editorState, e.type, {}));
1890
+ }
1569
1891
  }, {
1570
1892
  key: 'widgets',
1571
1893
  value: function widgets() {
@@ -1583,6 +1905,8 @@ var DanteInlineTooltip = function (_React$Component) {
1583
1905
  return this.clickOnFileUpload(e, request_block);
1584
1906
  case "placeholder":
1585
1907
  return this.handlePlaceholder(request_block);
1908
+ case "insertion":
1909
+ return this.handleInsertion(request_block);
1586
1910
  default:
1587
1911
  return console.log('WRONG TYPE FOR ' + request_block.widget_options.insertion);
1588
1912
  }
@@ -1764,7 +2088,7 @@ exports['default'] = DanteInlineTooltip;
1764
2088
 
1765
2089
  /***/ }),
1766
2090
 
1767
- /***/ 256:
2091
+ /***/ 172:
1768
2092
  /***/ (function(module, exports, __webpack_require__) {
1769
2093
 
1770
2094
  "use strict";
@@ -1774,39 +2098,39 @@ Object.defineProperty(exports, "__esModule", {
1774
2098
  value: true
1775
2099
  });
1776
2100
 
1777
- var _getPrototypeOf = __webpack_require__(18);
2101
+ var _getPrototypeOf = __webpack_require__(11);
1778
2102
 
1779
2103
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
1780
2104
 
1781
- var _classCallCheck2 = __webpack_require__(13);
2105
+ var _classCallCheck2 = __webpack_require__(7);
1782
2106
 
1783
2107
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
1784
2108
 
1785
- var _createClass2 = __webpack_require__(14);
2109
+ var _createClass2 = __webpack_require__(8);
1786
2110
 
1787
2111
  var _createClass3 = _interopRequireDefault(_createClass2);
1788
2112
 
1789
- var _possibleConstructorReturn2 = __webpack_require__(20);
2113
+ var _possibleConstructorReturn2 = __webpack_require__(13);
1790
2114
 
1791
2115
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
1792
2116
 
1793
- var _inherits2 = __webpack_require__(19);
2117
+ var _inherits2 = __webpack_require__(12);
1794
2118
 
1795
2119
  var _inherits3 = _interopRequireDefault(_inherits2);
1796
2120
 
1797
- var _react = __webpack_require__(4);
2121
+ var _react = __webpack_require__(1);
1798
2122
 
1799
2123
  var _react2 = _interopRequireDefault(_react);
1800
2124
 
1801
- var _reactDom = __webpack_require__(8);
2125
+ var _reactDom = __webpack_require__(4);
1802
2126
 
1803
2127
  var _reactDom2 = _interopRequireDefault(_reactDom);
1804
2128
 
1805
- var _draftJs = __webpack_require__(9);
2129
+ var _draftJs = __webpack_require__(5);
1806
2130
 
1807
- var _selection = __webpack_require__(84);
2131
+ var _selection = __webpack_require__(57);
1808
2132
 
1809
- var _index = __webpack_require__(27);
2133
+ var _index = __webpack_require__(19);
1810
2134
 
1811
2135
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
1812
2136
 
@@ -2027,7 +2351,7 @@ exports['default'] = DanteImagePopover;
2027
2351
 
2028
2352
  /***/ }),
2029
2353
 
2030
- /***/ 257:
2354
+ /***/ 173:
2031
2355
  /***/ (function(module, exports, __webpack_require__) {
2032
2356
 
2033
2357
  "use strict";
@@ -2037,35 +2361,35 @@ Object.defineProperty(exports, "__esModule", {
2037
2361
  value: true
2038
2362
  });
2039
2363
 
2040
- var _getPrototypeOf = __webpack_require__(18);
2364
+ var _getPrototypeOf = __webpack_require__(11);
2041
2365
 
2042
2366
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
2043
2367
 
2044
- var _classCallCheck2 = __webpack_require__(13);
2368
+ var _classCallCheck2 = __webpack_require__(7);
2045
2369
 
2046
2370
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2047
2371
 
2048
- var _createClass2 = __webpack_require__(14);
2372
+ var _createClass2 = __webpack_require__(8);
2049
2373
 
2050
2374
  var _createClass3 = _interopRequireDefault(_createClass2);
2051
2375
 
2052
- var _possibleConstructorReturn2 = __webpack_require__(20);
2376
+ var _possibleConstructorReturn2 = __webpack_require__(13);
2053
2377
 
2054
2378
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2055
2379
 
2056
- var _inherits2 = __webpack_require__(19);
2380
+ var _inherits2 = __webpack_require__(12);
2057
2381
 
2058
2382
  var _inherits3 = _interopRequireDefault(_inherits2);
2059
2383
 
2060
- var _react = __webpack_require__(4);
2384
+ var _react = __webpack_require__(1);
2061
2385
 
2062
2386
  var _react2 = _interopRequireDefault(_react);
2063
2387
 
2064
- var _reactDom = __webpack_require__(8);
2388
+ var _reactDom = __webpack_require__(4);
2065
2389
 
2066
2390
  var _reactDom2 = _interopRequireDefault(_reactDom);
2067
2391
 
2068
- var _index = __webpack_require__(27);
2392
+ var _index = __webpack_require__(19);
2069
2393
 
2070
2394
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2071
2395
 
@@ -2191,7 +2515,7 @@ exports['default'] = DanteAnchorPopover;
2191
2515
 
2192
2516
  /***/ }),
2193
2517
 
2194
- /***/ 258:
2518
+ /***/ 174:
2195
2519
  /***/ (function(module, exports, __webpack_require__) {
2196
2520
 
2197
2521
  "use strict";
@@ -2201,39 +2525,39 @@ Object.defineProperty(exports, "__esModule", {
2201
2525
  value: true
2202
2526
  });
2203
2527
 
2204
- var _getPrototypeOf = __webpack_require__(18);
2528
+ var _getPrototypeOf = __webpack_require__(11);
2205
2529
 
2206
2530
  var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
2207
2531
 
2208
- var _classCallCheck2 = __webpack_require__(13);
2532
+ var _classCallCheck2 = __webpack_require__(7);
2209
2533
 
2210
2534
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2211
2535
 
2212
- var _createClass2 = __webpack_require__(14);
2536
+ var _createClass2 = __webpack_require__(8);
2213
2537
 
2214
2538
  var _createClass3 = _interopRequireDefault(_createClass2);
2215
2539
 
2216
- var _possibleConstructorReturn2 = __webpack_require__(20);
2540
+ var _possibleConstructorReturn2 = __webpack_require__(13);
2217
2541
 
2218
2542
  var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
2219
2543
 
2220
- var _inherits2 = __webpack_require__(19);
2544
+ var _inherits2 = __webpack_require__(12);
2221
2545
 
2222
2546
  var _inherits3 = _interopRequireDefault(_inherits2);
2223
2547
 
2224
- var _react = __webpack_require__(4);
2548
+ var _react = __webpack_require__(1);
2225
2549
 
2226
2550
  var _react2 = _interopRequireDefault(_react);
2227
2551
 
2228
- var _reactDom = __webpack_require__(8);
2552
+ var _reactDom = __webpack_require__(4);
2229
2553
 
2230
2554
  var _reactDom2 = _interopRequireDefault(_reactDom);
2231
2555
 
2232
- var _draftJs = __webpack_require__(9);
2556
+ var _draftJs = __webpack_require__(5);
2233
2557
 
2234
- var _selection = __webpack_require__(84);
2558
+ var _selection = __webpack_require__(57);
2235
2559
 
2236
- var _index = __webpack_require__(27);
2560
+ var _index = __webpack_require__(19);
2237
2561
 
2238
2562
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2239
2563
 
@@ -2454,6 +2778,7 @@ var DanteTooltip = function (_React$Component) {
2454
2778
  };
2455
2779
 
2456
2780
  var entityKey = _draftJs.Entity.create('LINK', 'MUTABLE', opts);
2781
+ //contentState.createEntity('LINK', 'MUTABLE', opts)
2457
2782
 
2458
2783
  if (selection.isCollapsed()) {
2459
2784
  console.log("COLLAPSED SKIPPING LINK");
@@ -2496,12 +2821,13 @@ var DanteTooltip = function (_React$Component) {
2496
2821
  var currentBlock = (0, _index.getCurrentBlock)(this.props.editorState);
2497
2822
  var blockType = currentBlock.getType();
2498
2823
  var selection = this.props.editor.state.editorState.getSelection();
2824
+ var contentState = this.props.editorState.getCurrentContent();
2499
2825
  var selectedEntity = null;
2500
2826
  var defaultUrl = null;
2501
2827
  return currentBlock.findEntityRanges(function (character) {
2502
2828
  var entityKey = character.getEntity();
2503
2829
  selectedEntity = entityKey;
2504
- return entityKey !== null && _draftJs.Entity.get(entityKey).getType() === 'LINK';
2830
+ return entityKey !== null && contentState.getEntity(entityKey).getType() === 'LINK';
2505
2831
  }, function (start, end) {
2506
2832
  var selStart = selection.getAnchorOffset();
2507
2833
  var selEnd = selection.getFocusOffset();
@@ -2511,7 +2837,7 @@ var DanteTooltip = function (_React$Component) {
2511
2837
  }
2512
2838
 
2513
2839
  if (start === selStart && end === selEnd) {
2514
- defaultUrl = _draftJs.Entity.get(selectedEntity).getData().url;
2840
+ defaultUrl = contentState.getEntity(selectedEntity).getData().url;
2515
2841
  return _this4.refs.dante_menu_input.value = defaultUrl;
2516
2842
  }
2517
2843
  });
@@ -2700,7 +3026,7 @@ exports['default'] = DanteTooltip;
2700
3026
 
2701
3027
  /***/ }),
2702
3028
 
2703
- /***/ 259:
3029
+ /***/ 175:
2704
3030
  /***/ (function(module, exports, __webpack_require__) {
2705
3031
 
2706
3032
  "use strict";
@@ -2710,18 +3036,19 @@ Object.defineProperty(exports, "__esModule", {
2710
3036
  value: true
2711
3037
  });
2712
3038
 
2713
- var _draftJs = __webpack_require__(9);
3039
+ var _draftJs = __webpack_require__(5);
2714
3040
 
2715
3041
  //TODO: what the f*ck is happening here? ;-;
2716
3042
  var findEntities = function findEntities(entityType, instance, contentBlock, callback) {
2717
3043
  return contentBlock.findEntityRanges(function (_this) {
2718
3044
  return function (character) {
2719
3045
  var entityKey, opts, res;
3046
+ var contentState = instance.state.editorState.getCurrentContent();
2720
3047
  entityKey = character.getEntity();
2721
- return res = entityKey !== null && _draftJs.Entity.get(entityKey).getType() === entityType, res ? (opts = {
3048
+ return res = entityKey !== null && contentState.getEntity(entityKey).getType() === entityType, res ? (opts = {
2722
3049
  showPopLinkOver: instance.showPopLinkOver,
2723
3050
  hidePopLinkOver: instance.hidePopLinkOver
2724
- }, _draftJs.Entity.mergeData(entityKey, opts)) : void 0, res;
3051
+ }, contentState.mergeEntityData(entityKey, opts)) : void 0, res;
2725
3052
  };
2726
3053
  }(undefined), callback);
2727
3054
  };
@@ -2730,7 +3057,7 @@ exports['default'] = findEntities;
2730
3057
 
2731
3058
  /***/ }),
2732
3059
 
2733
- /***/ 260:
3060
+ /***/ 176:
2734
3061
  /***/ (function(module, exports, __webpack_require__) {
2735
3062
 
2736
3063
  "use strict";
@@ -2740,13 +3067,13 @@ Object.defineProperty(exports, "__esModule", {
2740
3067
  value: true
2741
3068
  });
2742
3069
 
2743
- var _stringify = __webpack_require__(85);
3070
+ var _stringify = __webpack_require__(58);
2744
3071
 
2745
3072
  var _stringify2 = _interopRequireDefault(_stringify);
2746
3073
 
2747
- var _draftJs = __webpack_require__(9);
3074
+ var _draftJs = __webpack_require__(5);
2748
3075
 
2749
- var _immutable = __webpack_require__(51);
3076
+ var _immutable = __webpack_require__(40);
2750
3077
 
2751
3078
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
2752
3079
 
@@ -2840,7 +3167,9 @@ var customHTML2Content = function customHTML2Content(HTML, blockRn) {
2840
3167
  // use DraftJS converter to do initial conversion. I don't provide DOMBuilder and
2841
3168
  // blockRenderMap arguments here since it should fall back to its default ones, which are fine
2842
3169
  console.log(tempDoc.body.innerHTML);
2843
- var contentBlocks = (0, _draftJs.convertFromHTML)(tempDoc.body.innerHTML, _draftJs.getSafeBodyFromHTML, blockRn);
3170
+ var content = (0, _draftJs.convertFromHTML)(tempDoc.body.innerHTML, _draftJs.getSafeBodyFromHTML, blockRn);
3171
+
3172
+ var contentBlocks = content.contentBlocks;
2844
3173
 
2845
3174
  // now replace <blockquote /> ContentBlocks with 'atomic' ones
2846
3175
  contentBlocks = contentBlocks.map(function (block) {
@@ -2875,7 +3204,7 @@ exports['default'] = customHTML2Content;
2875
3204
 
2876
3205
  /***/ }),
2877
3206
 
2878
- /***/ 261:
3207
+ /***/ 177:
2879
3208
  /***/ (function(module, exports, __webpack_require__) {
2880
3209
 
2881
3210
  "use strict";
@@ -2885,23 +3214,23 @@ Object.defineProperty(exports, "__esModule", {
2885
3214
  value: true
2886
3215
  });
2887
3216
 
2888
- var _stringify = __webpack_require__(85);
3217
+ var _stringify = __webpack_require__(58);
2889
3218
 
2890
3219
  var _stringify2 = _interopRequireDefault(_stringify);
2891
3220
 
2892
- var _classCallCheck2 = __webpack_require__(13);
3221
+ var _classCallCheck2 = __webpack_require__(7);
2893
3222
 
2894
3223
  var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
2895
3224
 
2896
- var _createClass2 = __webpack_require__(14);
3225
+ var _createClass2 = __webpack_require__(8);
2897
3226
 
2898
3227
  var _createClass3 = _interopRequireDefault(_createClass2);
2899
3228
 
2900
- var _axios = __webpack_require__(65);
3229
+ var _axios = __webpack_require__(41);
2901
3230
 
2902
3231
  var _axios2 = _interopRequireDefault(_axios);
2903
3232
 
2904
- var _immutable = __webpack_require__(51);
3233
+ var _immutable = __webpack_require__(40);
2905
3234
 
2906
3235
  var _immutable2 = _interopRequireDefault(_immutable);
2907
3236
 
@@ -3064,7 +3393,7 @@ exports["default"] = SaveBehavior;
3064
3393
 
3065
3394
  /***/ }),
3066
3395
 
3067
- /***/ 27:
3396
+ /***/ 19:
3068
3397
  /***/ (function(module, exports, __webpack_require__) {
3069
3398
 
3070
3399
  "use strict";
@@ -3075,9 +3404,9 @@ Object.defineProperty(exports, "__esModule", {
3075
3404
  });
3076
3405
  exports.addNewBlockAt = exports.updateTextOfBlock = exports.updateDataOfBlock = exports.resetBlockWithType = exports.addNewBlock = exports.getCurrentBlock = exports.getNode = exports.getDefaultBlockData = undefined;
3077
3406
 
3078
- var _immutable = __webpack_require__(51);
3407
+ var _immutable = __webpack_require__(40);
3079
3408
 
3080
- var _draftJs = __webpack_require__(9);
3409
+ var _draftJs = __webpack_require__(5);
3081
3410
 
3082
3411
  /*
3083
3412
  Used from [react-rte](https://github.com/brijeshb42/medium-draft)
@@ -3277,49 +3606,49 @@ var addNewBlockAt = exports.addNewBlockAt = function addNewBlockAt(editorState,
3277
3606
 
3278
3607
  /***/ }),
3279
3608
 
3280
- /***/ 399:
3609
+ /***/ 321:
3281
3610
  /***/ (function(module, exports, __webpack_require__) {
3282
3611
 
3283
3612
  module.exports = __webpack_require__.p + "fonts/dante.svg";
3284
3613
 
3285
3614
  /***/ }),
3286
3615
 
3287
- /***/ 400:
3616
+ /***/ 322:
3288
3617
  /***/ (function(module, exports, __webpack_require__) {
3289
3618
 
3290
3619
  module.exports = __webpack_require__.p + "fonts/dante.ttf";
3291
3620
 
3292
3621
  /***/ }),
3293
3622
 
3294
- /***/ 401:
3623
+ /***/ 323:
3295
3624
  /***/ (function(module, exports, __webpack_require__) {
3296
3625
 
3297
3626
  module.exports = __webpack_require__.p + "fonts/dante.woff";
3298
3627
 
3299
3628
  /***/ }),
3300
3629
 
3301
- /***/ 402:
3630
+ /***/ 324:
3302
3631
  /***/ (function(module, exports, __webpack_require__) {
3303
3632
 
3304
3633
  module.exports = __webpack_require__.p + "fonts/fontello.svg";
3305
3634
 
3306
3635
  /***/ }),
3307
3636
 
3308
- /***/ 403:
3637
+ /***/ 325:
3309
3638
  /***/ (function(module, exports, __webpack_require__) {
3310
3639
 
3311
3640
  module.exports = __webpack_require__.p + "fonts/fontello.ttf";
3312
3641
 
3313
3642
  /***/ }),
3314
3643
 
3315
- /***/ 404:
3644
+ /***/ 326:
3316
3645
  /***/ (function(module, exports, __webpack_require__) {
3317
3646
 
3318
3647
  module.exports = __webpack_require__.p + "fonts/fontello.woff";
3319
3648
 
3320
3649
  /***/ }),
3321
3650
 
3322
- /***/ 84:
3651
+ /***/ 57:
3323
3652
  /***/ (function(module, exports, __webpack_require__) {
3324
3653
 
3325
3654
  "use strict";
@@ -3382,7 +3711,1092 @@ var getSelectedBlockNode = exports.getSelectedBlockNode = function getSelectedBl
3382
3711
  return null;
3383
3712
  };
3384
3713
 
3714
+ /***/ }),
3715
+
3716
+ /***/ 92:
3717
+ /***/ (function(module, exports, __webpack_require__) {
3718
+
3719
+ "use strict";
3720
+
3721
+
3722
+ Object.defineProperty(exports, "__esModule", {
3723
+ value: true
3724
+ });
3725
+
3726
+ var _getPrototypeOf = __webpack_require__(11);
3727
+
3728
+ var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
3729
+
3730
+ var _classCallCheck2 = __webpack_require__(7);
3731
+
3732
+ var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
3733
+
3734
+ var _createClass2 = __webpack_require__(8);
3735
+
3736
+ var _createClass3 = _interopRequireDefault(_createClass2);
3737
+
3738
+ var _possibleConstructorReturn2 = __webpack_require__(13);
3739
+
3740
+ var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
3741
+
3742
+ var _inherits2 = __webpack_require__(12);
3743
+
3744
+ var _inherits3 = _interopRequireDefault(_inherits2);
3745
+
3746
+ var _react = __webpack_require__(1);
3747
+
3748
+ var _react2 = _interopRequireDefault(_react);
3749
+
3750
+ var _reactDom = __webpack_require__(4);
3751
+
3752
+ var _reactDom2 = _interopRequireDefault(_reactDom);
3753
+
3754
+ var _immutable = __webpack_require__(40);
3755
+
3756
+ var _immutable2 = _interopRequireDefault(_immutable);
3757
+
3758
+ var _draftJs = __webpack_require__(5);
3759
+
3760
+ var _draftConvert = __webpack_require__(227);
3761
+
3762
+ var _index = __webpack_require__(19);
3763
+
3764
+ var _link = __webpack_require__(169);
3765
+
3766
+ var _link2 = _interopRequireDefault(_link);
3767
+
3768
+ var _debug = __webpack_require__(168);
3769
+
3770
+ var _debug2 = _interopRequireDefault(_debug);
3771
+
3772
+ var _find_entities = __webpack_require__(175);
3773
+
3774
+ var _find_entities2 = _interopRequireDefault(_find_entities);
3775
+
3776
+ var _save_content = __webpack_require__(177);
3777
+
3778
+ var _save_content2 = _interopRequireDefault(_save_content);
3779
+
3780
+ var _html2content = __webpack_require__(176);
3781
+
3782
+ var _html2content2 = _interopRequireDefault(_html2content);
3783
+
3784
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
3785
+
3786
+ var DanteEditor = function (_React$Component) {
3787
+ (0, _inherits3['default'])(DanteEditor, _React$Component);
3788
+
3789
+ function DanteEditor(props) {
3790
+ (0, _classCallCheck3['default'])(this, DanteEditor);
3791
+
3792
+ var _this = (0, _possibleConstructorReturn3['default'])(this, (DanteEditor.__proto__ || (0, _getPrototypeOf2['default'])(DanteEditor)).call(this, props));
3793
+
3794
+ _this.initializeState = _this.initializeState.bind(_this);
3795
+ _this.refreshSelection = _this.refreshSelection.bind(_this);
3796
+ _this.forceRender = _this.forceRender.bind(_this);
3797
+ _this.onChange = _this.onChange.bind(_this);
3798
+ _this.dispatchChangesToSave = _this.dispatchChangesToSave.bind(_this);
3799
+ _this.setPreContent = _this.setPreContent.bind(_this);
3800
+ _this.focus = _this.focus.bind(_this);
3801
+ _this.getEditorState = _this.getEditorState.bind(_this);
3802
+ _this.emitSerializedOutput = _this.emitSerializedOutput.bind(_this);
3803
+ _this.decodeEditorContent = _this.decodeEditorContent.bind(_this);
3804
+ _this.getTextFromEditor = _this.getTextFromEditor.bind(_this);
3805
+ _this.getLocks = _this.getLocks.bind(_this);
3806
+ _this.addLock = _this.addLock.bind(_this);
3807
+ _this.removeLock = _this.removeLock.bind(_this);
3808
+ _this.renderableBlocks = _this.renderableBlocks.bind(_this);
3809
+ _this.defaultWrappers = _this.defaultWrappers.bind(_this);
3810
+ _this.blockRenderer = _this.blockRenderer.bind(_this);
3811
+ _this.handleBlockRenderer = _this.handleBlockRenderer.bind(_this);
3812
+ _this.blockStyleFn = _this.blockStyleFn.bind(_this);
3813
+ _this.getDataBlock = _this.getDataBlock.bind(_this);
3814
+ _this.styleForBlock = _this.styleForBlock.bind(_this);
3815
+ _this.handlePasteText = _this.handlePasteText.bind(_this);
3816
+ _this.handleTXTPaste = _this.handleTXTPaste.bind(_this);
3817
+ _this.handleHTMLPaste = _this.handleHTMLPaste.bind(_this);
3818
+ _this.handlePasteImage = _this.handlePasteImage.bind(_this);
3819
+ _this.handleDroppedFiles = _this.handleDroppedFiles.bind(_this);
3820
+ _this.handleUpArrow = _this.handleUpArrow.bind(_this);
3821
+ _this.handleDownArrow = _this.handleDownArrow.bind(_this);
3822
+ _this.handleReturn = _this.handleReturn.bind(_this);
3823
+ _this.handleBeforeInput = _this.handleBeforeInput.bind(_this);
3824
+ _this.handleKeyCommand = _this.handleKeyCommand.bind(_this);
3825
+ _this.findCommandKey = _this.findCommandKey.bind(_this);
3826
+ _this.KeyBindingFn = _this.KeyBindingFn.bind(_this);
3827
+ _this.updateBlockData = _this.updateBlockData.bind(_this);
3828
+ _this.setDirection = _this.setDirection.bind(_this);
3829
+ _this.toggleEditable = _this.toggleEditable.bind(_this);
3830
+ _this.disableEditable = _this.disableEditable.bind(_this);
3831
+ _this.enableEditable = _this.enableEditable.bind(_this);
3832
+ _this.closePopOvers = _this.closePopOvers.bind(_this);
3833
+ _this.relocateTooltips = _this.relocateTooltips.bind(_this);
3834
+ _this.tooltipsWithProp = _this.tooltipsWithProp.bind(_this);
3835
+ _this.tooltipHasSelectionElement = _this.tooltipHasSelectionElement.bind(_this);
3836
+ _this.handleShowPopLinkOver = _this.handleShowPopLinkOver.bind(_this);
3837
+ _this.handleHidePopLinkOver = _this.handleHidePopLinkOver.bind(_this);
3838
+ _this.showPopLinkOver = _this.showPopLinkOver.bind(_this);
3839
+ _this.hidePopLinkOver = _this.hidePopLinkOver.bind(_this);
3840
+ _this.render = _this.render.bind(_this);
3841
+
3842
+ _this.decorator = new _draftJs.CompositeDecorator([{
3843
+ strategy: _find_entities2['default'].bind(null, 'LINK', _this),
3844
+ component: _link2['default']
3845
+ }]);
3846
+
3847
+ _this.blockRenderMap = (0, _immutable.Map)({
3848
+ "image": {
3849
+ element: 'figure'
3850
+ },
3851
+ "video": {
3852
+ element: 'figure'
3853
+ },
3854
+ "embed": {
3855
+ element: 'div'
3856
+ },
3857
+ 'unstyled': {
3858
+ wrapper: null,
3859
+ element: 'div'
3860
+ },
3861
+ 'paragraph': {
3862
+ wrapper: null,
3863
+ element: 'div'
3864
+ },
3865
+ 'placeholder': {
3866
+ wrapper: null,
3867
+ element: 'div'
3868
+ }
3869
+
3870
+ });
3871
+
3872
+ _this.extendedBlockRenderMap = _draftJs.DefaultDraftBlockRenderMap.merge(_this.blockRenderMap);
3873
+
3874
+ _this.state = {
3875
+ editorState: _draftJs.EditorState.createWithContent((0, _draftJs.convertFromRaw)(_this.props.content)),
3876
+ read_only: _this.props.config.read_only,
3877
+ blockRenderMap: _this.extendedBlockRenderMap,
3878
+ locks: 0,
3879
+ debug: _this.props.config.debug
3880
+ };
3881
+
3882
+ _this.widgets = _this.props.config.widgets;
3883
+ _this.tooltips = _this.props.config.tooltips;
3884
+
3885
+ _this.key_commands = _this.props.config.key_commands;
3886
+
3887
+ _this.continuousBlocks = _this.props.config.continuousBlocks;
3888
+
3889
+ _this.block_types = _this.props.config.block_types;
3890
+
3891
+ _this.default_wrappers = _this.props.config.default_wrappers;
3892
+
3893
+ _this.character_convert_mapping = _this.props.config.character_convert_mapping;
3894
+
3895
+ _this.save = new _save_content2['default']({
3896
+ getLocks: _this.getLocks,
3897
+ config: {
3898
+ xhr: _this.props.config.xhr,
3899
+ data_storage: _this.props.config.data_storage
3900
+ },
3901
+ editorState: _this.state.editorState,
3902
+ editorContent: _this.emitSerializedOutput()
3903
+ });
3904
+
3905
+ // TODO: fix this amateur mode
3906
+ // here we add a new contentstate with the decorator in order to get contentState
3907
+ setTimeout(function () {
3908
+ var newEditorState = _draftJs.EditorState.set(_this.decodeEditorContent(_this.props.content), { decorator: _this.decorator });
3909
+ _this.onChange(newEditorState);
3910
+ }, 0);
3911
+
3912
+ return _this;
3913
+ }
3914
+
3915
+ (0, _createClass3['default'])(DanteEditor, [{
3916
+ key: 'initializeState',
3917
+ value: function initializeState() {
3918
+ if (this.props.content) {
3919
+ //and @.props.content.trim() isnt ""
3920
+ return this.decodeEditorContent(this.props.content);
3921
+ } else {
3922
+ return _draftJs.EditorState.createEmpty(this.decorator);
3923
+ }
3924
+ }
3925
+ }, {
3926
+ key: 'decodeEditorContent',
3927
+ value: function decodeEditorContent(raw_as_json) {
3928
+ var new_content = (0, _draftJs.convertFromRaw)(raw_as_json);
3929
+ var editorState = void 0;
3930
+ return editorState = _draftJs.EditorState.createWithContent(new_content, this.decorator);
3931
+ }
3932
+ }, {
3933
+ key: 'refreshSelection',
3934
+ value: function refreshSelection(newEditorState) {
3935
+ var editorState = this.state.editorState;
3936
+ // Setting cursor position after inserting to content
3937
+
3938
+ var s = this.state.editorState.getSelection();
3939
+ var c = editorState.getCurrentContent();
3940
+ var focusOffset = s.getFocusOffset();
3941
+ var anchorKey = s.getAnchorKey();
3942
+
3943
+ var selectionState = _draftJs.SelectionState.createEmpty(s.getAnchorKey());
3944
+
3945
+ // console.log anchorKey, focusOffset
3946
+ selectionState = selectionState.merge({
3947
+ anchorOffset: focusOffset,
3948
+ focusKey: anchorKey,
3949
+ focusOffset: focusOffset
3950
+ });
3951
+
3952
+ var newState = _draftJs.EditorState.forceSelection(newEditorState, selectionState);
3953
+
3954
+ return this.onChange(newState);
3955
+ }
3956
+ }, {
3957
+ key: 'forceRender',
3958
+ value: function forceRender(editorState) {
3959
+ var selection = this.state.editorState.getSelection();
3960
+ var content = editorState.getCurrentContent();
3961
+ var newEditorState = _draftJs.EditorState.createWithContent(content, this.decorator);
3962
+
3963
+ return this.refreshSelection(newEditorState);
3964
+ }
3965
+ }, {
3966
+ key: 'onChange',
3967
+ value: function onChange(editorState) {
3968
+ var _this2 = this;
3969
+
3970
+ this.setPreContent();
3971
+ this.setState({ editorState: editorState });
3972
+
3973
+ var currentBlock = (0, _index.getCurrentBlock)(this.state.editorState);
3974
+ var blockType = currentBlock.getType();
3975
+
3976
+ if (!editorState.getSelection().isCollapsed()) {
3977
+
3978
+ var tooltip = this.tooltipsWithProp('displayOnSelection')[0];
3979
+ if (!this.tooltipHasSelectionElement(tooltip, blockType)) {
3980
+ return;
3981
+ }
3982
+ this.handleTooltipDisplayOn('displayOnSelection');
3983
+ } else {
3984
+ this.handleTooltipDisplayOn('displayOnSelection', false);
3985
+ }
3986
+
3987
+ setTimeout(function () {
3988
+ return _this2.relocateTooltips();
3989
+ }, 0);
3990
+
3991
+ return this.dispatchChangesToSave();
3992
+ }
3993
+ }, {
3994
+ key: 'dispatchChangesToSave',
3995
+ value: function dispatchChangesToSave() {
3996
+ var _this3 = this;
3997
+
3998
+ clearTimeout(this.saveTimeout);
3999
+ return this.saveTimeout = setTimeout(function () {
4000
+ return _this3.save.store(_this3.emitSerializedOutput());
4001
+ }, 100);
4002
+ }
4003
+ }, {
4004
+ key: 'setPreContent',
4005
+ value: function setPreContent() {
4006
+ var content = this.emitSerializedOutput();
4007
+ return this.save.editorContent = content;
4008
+ }
4009
+ }, {
4010
+ key: 'focus',
4011
+ value: function focus() {}
4012
+ //debugger
4013
+
4014
+ //@props.refs.richEditor.focus()
4015
+
4016
+ }, {
4017
+ key: 'getEditorState',
4018
+ value: function getEditorState() {
4019
+ return this.state.editorState;
4020
+ }
4021
+ }, {
4022
+ key: 'emitSerializedOutput',
4023
+ value: function emitSerializedOutput() {
4024
+ var raw = (0, _draftJs.convertToRaw)(this.state.editorState.getCurrentContent());
4025
+
4026
+ return raw;
4027
+ }
4028
+
4029
+ //# title utils
4030
+
4031
+ }, {
4032
+ key: 'getTextFromEditor',
4033
+ value: function getTextFromEditor() {
4034
+ var c = this.state.editorState.getCurrentContent();
4035
+ var out = c.getBlocksAsArray().map(function (o) {
4036
+ return o.getText();
4037
+ }).join("\n");
4038
+
4039
+ return out;
4040
+ }
4041
+ }, {
4042
+ key: 'emitHTML2',
4043
+ value: function emitHTML2() {
4044
+ var html = void 0;
4045
+
4046
+ return html = (0, _draftConvert.convertToHTML)({
4047
+ entityToHTML: function entityToHTML(entity, originalText) {
4048
+ if (entity.type === 'LINK') {
4049
+ return '<a href="' + entity.data.url + '">' + originalText + '</a>';
4050
+ } else {
4051
+ return originalText;
4052
+ }
4053
+ }
4054
+
4055
+ })(this.state.editorState.getCurrentContent());
4056
+ }
4057
+ }, {
4058
+ key: 'getLocks',
4059
+ value: function getLocks() {
4060
+ return this.state.locks;
4061
+ }
4062
+ }, {
4063
+ key: 'addLock',
4064
+ value: function addLock() {
4065
+ return this.setState({
4066
+ locks: this.state.locks += 1 });
4067
+ }
4068
+ }, {
4069
+ key: 'removeLock',
4070
+ value: function removeLock() {
4071
+ return this.setState({
4072
+ locks: this.state.locks -= 1 });
4073
+ }
4074
+ }, {
4075
+ key: 'renderableBlocks',
4076
+ value: function renderableBlocks() {
4077
+ return this.widgets.filter(function (o) {
4078
+ return o.renderable;
4079
+ }).map(function (o) {
4080
+ return o.type;
4081
+ });
4082
+ }
4083
+ }, {
4084
+ key: 'defaultWrappers',
4085
+ value: function defaultWrappers(blockType) {
4086
+ return this.default_wrappers.filter(function (o) {
4087
+ return o.block === blockType;
4088
+ }).map(function (o) {
4089
+ return o.className;
4090
+ });
4091
+ }
4092
+ }, {
4093
+ key: 'blockRenderer',
4094
+ value: function blockRenderer(block) {
4095
+
4096
+ switch (block.getType()) {
4097
+
4098
+ case "atomic":
4099
+
4100
+ var entity = block.getEntityAt(0);
4101
+ var entity_type = _draftJs.Entity.get(entity).getType();
4102
+
4103
+ break;
4104
+ }
4105
+
4106
+ if (this.renderableBlocks().includes(block.getType())) {
4107
+ return this.handleBlockRenderer(block);
4108
+ }
4109
+
4110
+ return null;
4111
+ }
4112
+ }, {
4113
+ key: 'handleBlockRenderer',
4114
+ value: function handleBlockRenderer(block) {
4115
+ var dataBlock = this.getDataBlock(block);
4116
+ if (!dataBlock) {
4117
+ return null;
4118
+ }
4119
+
4120
+ var read_only = this.state.read_only ? false : null;
4121
+ var editable = read_only !== null ? read_only : dataBlock.editable;
4122
+ return {
4123
+ component: eval(dataBlock.block),
4124
+ editable: editable,
4125
+ props: {
4126
+ data: block.getData(),
4127
+ getEditorState: this.getEditorState,
4128
+ setEditorState: this.onChange,
4129
+ addLock: this.addLock,
4130
+ toggleEditable: this.toggleEditable,
4131
+ disableEditable: this.disableEditable,
4132
+ enableEditable: this.enableEditable,
4133
+ removeLock: this.removeLock,
4134
+ getLocks: this.getLocks,
4135
+ config: dataBlock.options
4136
+ }
4137
+ };
4138
+
4139
+ return null;
4140
+ }
4141
+ }, {
4142
+ key: 'blockStyleFn',
4143
+ value: function blockStyleFn(block) {
4144
+ var currentBlock = (0, _index.getCurrentBlock)(this.state.editorState);
4145
+ var is_selected = currentBlock.getKey() === block.getKey() ? "is-selected" : "";
4146
+
4147
+ if (this.renderableBlocks().includes(block.getType())) {
4148
+ return this.styleForBlock(block, currentBlock, is_selected);
4149
+ }
4150
+
4151
+ var defaultBlockClass = this.defaultWrappers(block.getType());
4152
+ if (defaultBlockClass.length > 0) {
4153
+ return 'graf ' + defaultBlockClass[0] + ' ' + is_selected;
4154
+ } else {
4155
+ return 'graf nana ' + is_selected;
4156
+ }
4157
+ }
4158
+ }, {
4159
+ key: 'getDataBlock',
4160
+ value: function getDataBlock(block) {
4161
+ return this.widgets.find(function (o) {
4162
+ return o.type === block.getType();
4163
+ });
4164
+ }
4165
+ }, {
4166
+ key: 'styleForBlock',
4167
+ value: function styleForBlock(block, currentBlock, is_selected) {
4168
+ var dataBlock = this.getDataBlock(block);
4169
+
4170
+ if (!dataBlock) {
4171
+ return null;
4172
+ }
4173
+
4174
+ var selectedFn = dataBlock.selectedFn ? dataBlock.selectedFn(block) : null;
4175
+ var selected_class = is_selected ? dataBlock.selected_class : '';
4176
+
4177
+ return dataBlock.wrapper_class + ' ' + selected_class + ' ' + selectedFn;
4178
+ }
4179
+ }, {
4180
+ key: 'handleTooltipDisplayOn',
4181
+ value: function handleTooltipDisplayOn(prop, display) {
4182
+ var _this4 = this;
4183
+
4184
+ if (display == null) {
4185
+ display = true;
4186
+ }
4187
+
4188
+ return setTimeout(function () {
4189
+ var items = _this4.tooltipsWithProp(prop);
4190
+ console.log(items);
4191
+ return items.map(function (o) {
4192
+ _this4.refs[o.ref].display(display);
4193
+ return _this4.refs[o.ref].relocate();
4194
+ });
4195
+ }, 20);
4196
+ }
4197
+ }, {
4198
+ key: 'handlePasteText',
4199
+ value: function handlePasteText(text, html) {
4200
+
4201
+ // https://github.com/facebook/draft-js/issues/685
4202
+ /*
4203
+ html = "<p>chao</p>
4204
+ <avv>aaa</avv>
4205
+ <p>oli</p>
4206
+ <img src='x'/>"
4207
+ */
4208
+
4209
+ // if not html then fallback to default handler
4210
+
4211
+ if (!html) {
4212
+ return this.handleTXTPaste(text, html);
4213
+ }
4214
+ if (html) {
4215
+ return this.handleHTMLPaste(text, html);
4216
+ }
4217
+ }
4218
+ }, {
4219
+ key: 'handleTXTPaste',
4220
+ value: function handleTXTPaste(text, html) {
4221
+ var currentBlock = (0, _index.getCurrentBlock)(this.state.editorState);
4222
+
4223
+ var editorState = this.state.editorState;
4224
+
4225
+
4226
+ switch (currentBlock.getType()) {
4227
+ case "image":case "video":case "placeholder":
4228
+ var newContent = _draftJs.Modifier.replaceText(editorState.getCurrentContent(), new _draftJs.SelectionState({
4229
+ anchorKey: currentBlock.getKey(),
4230
+ anchorOffset: 0,
4231
+ focusKey: currentBlock.getKey(),
4232
+ focusOffset: 2
4233
+ }), text);
4234
+
4235
+ editorState = _draftJs.EditorState.push(editorState, newContent, 'replace-text');
4236
+
4237
+ this.onChange(editorState);
4238
+
4239
+ return true;
4240
+ default:
4241
+ return false;
4242
+ }
4243
+ }
4244
+ }, {
4245
+ key: 'handleHTMLPaste',
4246
+ value: function handleHTMLPaste(text, html) {
4247
+
4248
+ var currentBlock = (0, _index.getCurrentBlock)(this.state.editorState);
4249
+
4250
+ // TODO: make this configurable
4251
+ switch (currentBlock.getType()) {
4252
+ case "image":case "video":case "placeholder":
4253
+ return this.handleTXTPaste(text, html);
4254
+ break;
4255
+ }
4256
+
4257
+ var newContentState = (0, _html2content2['default'])(html, this.extendedBlockRenderMap);
4258
+
4259
+ var selection = this.state.editorState.getSelection();
4260
+ var endKey = selection.getEndKey();
4261
+
4262
+ var content = this.state.editorState.getCurrentContent();
4263
+ var blocksBefore = content.blockMap.toSeq().takeUntil(function (v) {
4264
+ return v.key === endKey;
4265
+ });
4266
+ var blocksAfter = content.blockMap.toSeq().skipUntil(function (v) {
4267
+ return v.key === endKey;
4268
+ }).rest();
4269
+
4270
+ var newBlockKey = newContentState.blockMap.first().getKey();
4271
+
4272
+ var newBlockMap = blocksBefore.concat(newContentState.blockMap, blocksAfter).toOrderedMap();
4273
+
4274
+ var newContent = content.merge({
4275
+ blockMap: newBlockMap,
4276
+ selectionBefore: selection,
4277
+ selectionAfter: selection.merge({
4278
+ anchorKey: newBlockKey,
4279
+ anchorOffset: 0,
4280
+ focusKey: newBlockKey,
4281
+ focusOffset: 0,
4282
+ isBackward: false
4283
+ })
4284
+ });
4285
+
4286
+ var pushedContentState = _draftJs.EditorState.push(this.state.editorState, newContent, 'insert-fragment');
4287
+
4288
+ this.onChange(pushedContentState);
4289
+
4290
+ return true;
4291
+ }
4292
+ }, {
4293
+ key: 'handlePasteImage',
4294
+ value: function handlePasteImage(files) {
4295
+ var _this5 = this;
4296
+
4297
+ //TODO: check file types
4298
+ return files.map(function (file) {
4299
+ var opts = {
4300
+ url: URL.createObjectURL(file),
4301
+ file: file
4302
+ };
4303
+
4304
+ return _this5.onChange((0, _index.addNewBlock)(_this5.state.editorState, 'image', opts));
4305
+ });
4306
+ }
4307
+ }, {
4308
+ key: 'handleDroppedFiles',
4309
+ value: function handleDroppedFiles(state, files) {
4310
+ var _this6 = this;
4311
+
4312
+ return files.map(function (file) {
4313
+ var opts = {
4314
+ url: URL.createObjectURL(file),
4315
+ file: file
4316
+ };
4317
+
4318
+ return _this6.onChange((0, _index.addNewBlock)(_this6.state.editorState, 'image', opts));
4319
+ });
4320
+ }
4321
+ }, {
4322
+ key: 'handleUpArrow',
4323
+ value: function handleUpArrow(e) {
4324
+ var _this7 = this;
4325
+
4326
+ return setTimeout(function () {
4327
+ return _this7.forceRender(_this7.state.editorState);
4328
+ }, 10);
4329
+ }
4330
+ }, {
4331
+ key: 'handleDownArrow',
4332
+ value: function handleDownArrow(e) {
4333
+ var _this8 = this;
4334
+
4335
+ return setTimeout(function () {
4336
+ return _this8.forceRender(_this8.state.editorState);
4337
+ }, 10);
4338
+ }
4339
+ }, {
4340
+ key: 'handleReturn',
4341
+ value: function handleReturn(e) {
4342
+ if (this.props.handleReturn) {
4343
+ if (this.props.handleReturn()) {
4344
+ return true;
4345
+ }
4346
+ }
4347
+
4348
+ var editorState = this.state.editorState;
4349
+
4350
+
4351
+ if (!e.altKey && !e.metaKey && !e.ctrlKey) {
4352
+ var currentBlock = (0, _index.getCurrentBlock)(editorState);
4353
+ var blockType = currentBlock.getType();
4354
+ var selection = editorState.getSelection();
4355
+
4356
+ var config_block = this.getDataBlock(currentBlock);
4357
+
4358
+ if (currentBlock.getText().length === 0) {
4359
+
4360
+ if (config_block && config_block.handleEnterWithoutText) {
4361
+ config_block.handleEnterWithText(this, currentBlock);
4362
+ this.closePopOvers();
4363
+ return true;
4364
+ }
4365
+
4366
+ //TODO turn this in configurable
4367
+ switch (blockType) {
4368
+ case "header-one":
4369
+ this.onChange((0, _index.resetBlockWithType)(editorState, "unstyled"));
4370
+ return true;
4371
+ break;
4372
+ default:
4373
+ return false;
4374
+ }
4375
+ }
4376
+
4377
+ if (currentBlock.getText().length > 0) {
4378
+
4379
+ /*
4380
+ if (blockType === "unstyled") {
4381
+ // hack hackety hack
4382
+ // https://github.com/facebook/draft-js/issues/304
4383
+ const newContent = Modifier.splitBlock(
4384
+ this.state.editorState.getCurrentContent(),
4385
+ this.state.editorState.getSelection())
4386
+ const newEditorState = EditorState.push(this.state.editorState,
4387
+ newContent, 'insert-characters')
4388
+ this.onChange(newEditorState)
4389
+ setTimeout(() => {
4390
+ //TODO: check is element is in viewport
4391
+ const a = document.getElementsByClassName("is-selected")
4392
+ const pos = a[0].getBoundingClientRect()
4393
+ return window.scrollTo(0, pos.top + window.scrollY - 100)
4394
+ }, 0)
4395
+ return true
4396
+ }*/
4397
+
4398
+ if (config_block && config_block.handleEnterWithText) {
4399
+ config_block.handleEnterWithText(this, currentBlock);
4400
+ this.closePopOvers();
4401
+ return true;
4402
+ }
4403
+
4404
+ if (currentBlock.getLength() === selection.getStartOffset()) {
4405
+ if (this.continuousBlocks.indexOf(blockType) < 0) {
4406
+ this.onChange((0, _index.addNewBlockAt)(editorState, currentBlock.getKey()));
4407
+ return true;
4408
+ }
4409
+ }
4410
+
4411
+ return false;
4412
+ }
4413
+
4414
+ // selection.isCollapsed() and # should we check collapsed here?
4415
+ if (currentBlock.getLength() === selection.getStartOffset()) {
4416
+ //or (config_block && config_block.breakOnContinuous))
4417
+ // it will match the unstyled for custom blocks
4418
+ if (this.continuousBlocks.indexOf(blockType) < 0) {
4419
+ this.onChange((0, _index.addNewBlockAt)(editorState, currentBlock.getKey()));
4420
+ return true;
4421
+ }
4422
+ return false;
4423
+ }
4424
+
4425
+ return false;
4426
+ }
4427
+ }
4428
+
4429
+ //return false
4430
+
4431
+ // TODO: make this configurable
4432
+
4433
+ }, {
4434
+ key: 'handleBeforeInput',
4435
+ value: function handleBeforeInput(chars) {
4436
+ var currentBlock = (0, _index.getCurrentBlock)(this.state.editorState);
4437
+ var blockType = currentBlock.getType();
4438
+ var selection = this.state.editorState.getSelection();
4439
+
4440
+ var editorState = this.state.editorState;
4441
+
4442
+ // close popovers
4443
+
4444
+ if (currentBlock.getText().length !== 0) {
4445
+ //@closeInlineButton()
4446
+ this.closePopOvers();
4447
+ }
4448
+
4449
+ // handle space on link
4450
+ var endOffset = selection.getEndOffset();
4451
+ var endKey = currentBlock.getEntityAt(endOffset - 1);
4452
+ var endEntityType = endKey && _draftJs.Entity.get(endKey).getType();
4453
+ var afterEndKey = currentBlock.getEntityAt(endOffset);
4454
+ var afterEndEntityType = afterEndKey && _draftJs.Entity.get(afterEndKey).getType();
4455
+
4456
+ // will insert blank space when link found
4457
+ if (chars === ' ' && endEntityType === 'LINK' && afterEndEntityType !== 'LINK') {
4458
+ var newContentState = _draftJs.Modifier.insertText(editorState.getCurrentContent(), selection, ' ');
4459
+ var newEditorState = _draftJs.EditorState.push(editorState, newContentState, 'insert-characters');
4460
+ this.onChange(newEditorState);
4461
+ return true;
4462
+ }
4463
+
4464
+ // block transform
4465
+ if (blockType.indexOf('atomic') === 0) {
4466
+ return false;
4467
+ }
4468
+
4469
+ var blockLength = currentBlock.getLength();
4470
+ if (selection.getAnchorOffset() > 1 || blockLength > 1) {
4471
+ return false;
4472
+ }
4473
+
4474
+ var blockTo = this.character_convert_mapping[currentBlock.getText() + chars];
4475
+
4476
+ console.log('BLOCK TO SHOW: ' + blockTo);
4477
+
4478
+ if (!blockTo) {
4479
+ return false;
4480
+ }
4481
+
4482
+ this.onChange((0, _index.resetBlockWithType)(editorState, blockTo));
4483
+
4484
+ return true;
4485
+ }
4486
+
4487
+ // TODO: make this configurable
4488
+
4489
+ }, {
4490
+ key: 'handleKeyCommand',
4491
+ value: function handleKeyCommand(command) {
4492
+ var editorState = this.state.editorState;
4493
+
4494
+ var currentBlockType = void 0,
4495
+ newBlockType = void 0;
4496
+
4497
+ if (this.props.handleKeyCommand && this.props.handleKeyCommand(command)) {
4498
+ return true;
4499
+ }
4500
+
4501
+ if (command === 'add-new-block') {
4502
+ this.onChange((0, _index.addNewBlock)(editorState, 'blockquote'));
4503
+ return true;
4504
+ }
4505
+
4506
+ var block = (0, _index.getCurrentBlock)(editorState);
4507
+
4508
+ if (command.indexOf('toggle_inline:') === 0) {
4509
+ newBlockType = command.split(':')[1];
4510
+ currentBlockType = block.getType();
4511
+ this.onChange(_draftJs.RichUtils.toggleInlineStyle(editorState, newBlockType));
4512
+ return true;
4513
+ }
4514
+
4515
+ if (command.indexOf('toggle_block:') === 0) {
4516
+ newBlockType = command.split(':')[1];
4517
+ currentBlockType = block.getType();
4518
+
4519
+ this.onChange(_draftJs.RichUtils.toggleBlockType(editorState, newBlockType));
4520
+ return true;
4521
+ }
4522
+
4523
+ var newState = _draftJs.RichUtils.handleKeyCommand(this.state.editorState, command);
4524
+ if (newState) {
4525
+ this.onChange(newState);
4526
+ return true;
4527
+ }
4528
+
4529
+ return false;
4530
+ }
4531
+ }, {
4532
+ key: 'findCommandKey',
4533
+ value: function findCommandKey(opt, command) {
4534
+ // console.log "COMMAND find: #{opt} #{command}"
4535
+ return this.key_commands[opt].find(function (o) {
4536
+ return o.key === command;
4537
+ });
4538
+ }
4539
+ }, {
4540
+ key: 'KeyBindingFn',
4541
+ value: function KeyBindingFn(e) {
4542
+
4543
+ //⌘ + B / Ctrl + B Bold
4544
+ //⌘ + I / Ctrl + I Italic
4545
+ //⌘ + K / Ctrl + K Turn into link
4546
+ //⌘ + Alt + 1 / Ctrl + Alt + 1 Header
4547
+ //⌘ + Alt + 2 / Ctrl + Alt + 2 Sub-Header
4548
+ //⌘ + Alt + 5 / Ctrl + Alt + 5 Quote (Press once for a block quote, again for a pull quote and a third time to turn off quote)
4549
+
4550
+ var cmd = void 0;
4551
+ if (e.altKey) {
4552
+ if (e.shiftKey) {
4553
+ cmd = this.findCommandKey("alt-shift", e.which);
4554
+ if (cmd) {
4555
+ return cmd.cmd;
4556
+ }
4557
+
4558
+ return (0, _draftJs.getDefaultKeyBinding)(e);
4559
+ }
4560
+
4561
+ if (e.ctrlKey || e.metaKey) {
4562
+ cmd = this.findCommandKey("alt-cmd", e.which);
4563
+ if (cmd) {
4564
+ return cmd.cmd;
4565
+ }
4566
+ return (0, _draftJs.getDefaultKeyBinding)(e);
4567
+ }
4568
+ } else if (e.ctrlKey || e.metaKey) {
4569
+ cmd = this.findCommandKey("cmd", e.which);
4570
+ if (cmd) {
4571
+ return cmd.cmd;
4572
+ }
4573
+ return (0, _draftJs.getDefaultKeyBinding)(e);
4574
+ }
4575
+
4576
+ return (0, _draftJs.getDefaultKeyBinding)(e);
4577
+ }
4578
+
4579
+ // will update block state todo: movo to utils
4580
+
4581
+ }, {
4582
+ key: 'updateBlockData',
4583
+ value: function updateBlockData(block, options) {
4584
+ var data = block.getData();
4585
+ var newData = data.merge(options);
4586
+ var newState = (0, _index.updateDataOfBlock)(this.state.editorState, block, newData);
4587
+ // this fixes enter from image caption
4588
+ return this.forceRender(newState);
4589
+ }
4590
+ }, {
4591
+ key: 'setDirection',
4592
+ value: function setDirection(direction_type) {
4593
+ var contentState = this.state.editorState.getCurrentContent();
4594
+ var selectionState = this.state.editorState.getSelection();
4595
+ var block = contentState.getBlockForKey(selectionState.anchorKey);
4596
+
4597
+ return this.updateBlockData(block, { direction: direction_type });
4598
+ }
4599
+
4600
+ //# read only utils
4601
+
4602
+ }, {
4603
+ key: 'toggleEditable',
4604
+ value: function toggleEditable() {
4605
+ this.closePopOvers();
4606
+ return this.setState({ read_only: !this.state.read_only }, this.testEmitAndDecode);
4607
+ }
4608
+ }, {
4609
+ key: 'disableEditable',
4610
+ value: function disableEditable() {
4611
+ console.log("in !!");
4612
+ this.closePopOvers();
4613
+ return this.setState({ read_only: true }, this.testEmitAndDecode);
4614
+ }
4615
+ }, {
4616
+ key: 'enableEditable',
4617
+ value: function enableEditable() {
4618
+ this.closePopOvers();
4619
+ console.log("out !!");
4620
+
4621
+ return this.setState({ read_only: false }, this.testEmitAndDecode);
4622
+ }
4623
+ }, {
4624
+ key: 'closePopOvers',
4625
+ value: function closePopOvers() {
4626
+ var _this9 = this;
4627
+
4628
+ return this.tooltips.map(function (o) {
4629
+ return _this9.refs[o.ref].hide();
4630
+ });
4631
+ }
4632
+ }, {
4633
+ key: 'relocateTooltips',
4634
+ value: function relocateTooltips() {
4635
+ var _this10 = this;
4636
+
4637
+ if (this.state.read_only) return;
4638
+
4639
+ return this.tooltips.map(function (o) {
4640
+ return _this10.refs[o.ref].relocate();
4641
+ });
4642
+ }
4643
+ }, {
4644
+ key: 'tooltipsWithProp',
4645
+ value: function tooltipsWithProp(prop) {
4646
+ return this.tooltips.filter(function (o) {
4647
+ return o[prop];
4648
+ });
4649
+ }
4650
+ }, {
4651
+ key: 'tooltipHasSelectionElement',
4652
+ value: function tooltipHasSelectionElement(tooltip, element) {
4653
+ return tooltip.selectionElements.includes(element);
4654
+ }
4655
+
4656
+ //################################
4657
+ // TODO: this methods belongs to popovers/link
4658
+ //################################
4659
+
4660
+ }, {
4661
+ key: 'handleShowPopLinkOver',
4662
+ value: function handleShowPopLinkOver(e) {
4663
+ return this.showPopLinkOver();
4664
+ }
4665
+ }, {
4666
+ key: 'handleHidePopLinkOver',
4667
+ value: function handleHidePopLinkOver(e) {
4668
+ return this.hidePopLinkOver();
4669
+ }
4670
+ }, {
4671
+ key: 'showPopLinkOver',
4672
+ value: function showPopLinkOver(el) {
4673
+ // handles popover display
4674
+ // using anchor or from popover
4675
+
4676
+ var parent_el = _reactDom2['default'].findDOMNode(this);
4677
+
4678
+ // set url first in order to calculate popover width
4679
+ var coords = void 0;
4680
+ this.refs.anchor_popover.setState({ url: el ? el.href : this.refs.anchor_popover.state.url });
4681
+
4682
+ if (el) {
4683
+ coords = this.refs.anchor_popover.relocate(el);
4684
+ }
4685
+
4686
+ if (coords) {
4687
+ this.refs.anchor_popover.setPosition(coords);
4688
+ }
4689
+
4690
+ this.refs.anchor_popover.setState({ show: true });
4691
+
4692
+ this.isHover = true;
4693
+ return this.cancelHide();
4694
+ }
4695
+ }, {
4696
+ key: 'hidePopLinkOver',
4697
+ value: function hidePopLinkOver() {
4698
+ var _this11 = this;
4699
+
4700
+ return this.hideTimeout = setTimeout(function () {
4701
+ return _this11.refs.anchor_popover.hide();
4702
+ }, 300);
4703
+ }
4704
+ }, {
4705
+ key: 'cancelHide',
4706
+ value: function cancelHide() {
4707
+ // console.log "Cancel Hide"
4708
+ return clearTimeout(this.hideTimeout);
4709
+ }
4710
+
4711
+ //##############################
4712
+
4713
+ }, {
4714
+ key: 'render',
4715
+ value: function render() {
4716
+ var _this12 = this;
4717
+
4718
+ return _react2['default'].createElement(
4719
+ 'div',
4720
+ { id: 'content', suppressContentEditableWarning: true },
4721
+ _react2['default'].createElement(
4722
+ 'article',
4723
+ { className: 'postArticle' },
4724
+ _react2['default'].createElement(
4725
+ 'div',
4726
+ { className: 'postContent' },
4727
+ _react2['default'].createElement(
4728
+ 'div',
4729
+ { className: 'notesSource' },
4730
+ _react2['default'].createElement(
4731
+ 'div',
4732
+ { id: 'editor', className: 'postField postField--body' },
4733
+ _react2['default'].createElement(
4734
+ 'section',
4735
+ { className: 'section--first section--last' },
4736
+ _react2['default'].createElement(
4737
+ 'div',
4738
+ { className: 'section-divider layoutSingleColumn' },
4739
+ _react2['default'].createElement('hr', { className: 'section-divider' })
4740
+ ),
4741
+ _react2['default'].createElement(
4742
+ 'div',
4743
+ { className: 'section-content' },
4744
+ _react2['default'].createElement(
4745
+ 'div',
4746
+ { ref: 'richEditor',
4747
+ className: 'section-inner layoutSingleColumn',
4748
+ onClick: this.focus },
4749
+ _react2['default'].createElement(_draftJs.Editor, {
4750
+ blockRendererFn: this.blockRenderer,
4751
+ editorState: this.state.editorState,
4752
+ onChange: this.onChange,
4753
+ onUpArrow: this.handleUpArrow,
4754
+ onDownArrow: this.handleDownArrow,
4755
+ handleReturn: this.handleReturn,
4756
+ blockRenderMap: this.state.blockRenderMap,
4757
+ blockStyleFn: this.blockStyleFn,
4758
+ handlePastedText: this.handlePasteText,
4759
+ handlePastedFiles: this.handlePasteImage,
4760
+ handleDroppedFiles: this.handleDroppedFiles,
4761
+ handleKeyCommand: this.handleKeyCommand,
4762
+ keyBindingFn: this.KeyBindingFn,
4763
+ handleBeforeInput: this.handleBeforeInput,
4764
+ readOnly: this.state.read_only,
4765
+ placeholder: this.props.config.body_placeholder,
4766
+ ref: 'editor'
4767
+ })
4768
+ )
4769
+ )
4770
+ )
4771
+ )
4772
+ )
4773
+ )
4774
+ ),
4775
+ this.tooltips.map(function (o, i) {
4776
+ return _react2['default'].createElement(o.component, {
4777
+ ref: o.ref,
4778
+ key: i,
4779
+ editor: _this12,
4780
+ editorState: _this12.state.editorState,
4781
+ onChange: _this12.onChange,
4782
+ configTooltip: o,
4783
+ widget_options: o.widget_options,
4784
+ showPopLinkOver: _this12.showPopLinkOver,
4785
+ hidePopLinkOver: _this12.hidePopLinkOver,
4786
+ handleOnMouseOver: _this12.handleShowPopLinkOver,
4787
+ handleOnMouseOut: _this12.handleHidePopLinkOver
4788
+ });
4789
+ }),
4790
+ this.state.debug ? _react2['default'].createElement(_debug2['default'], { locks: this.state.locks, editor: this }) : undefined
4791
+ );
4792
+ }
4793
+ }]);
4794
+ return DanteEditor;
4795
+ }(_react2['default'].Component);
4796
+
4797
+ exports['default'] = DanteEditor;
4798
+
3385
4799
  /***/ })
3386
4800
 
3387
- },[247]);
4801
+ },[162]);
3388
4802
  //# sourceMappingURL=dante.js.map