dante2-editor 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -1,28 +1,21 @@
1
1
  import React from 'react'
2
2
  import ReactDOM from 'react-dom'
3
- //import Immutable from 'immutable'
4
3
  import { Map, fromJS } from 'immutable'
4
+ import DanteEditor from './editor.js'
5
+ import DanteImagePopover from '../popovers/image'
6
+ import DanteAnchorPopover from '../popovers/link'
7
+ import DanteInlineTooltip from '../popovers/addButton'
8
+ import DanteTooltip from '../popovers/toolTip'
5
9
 
6
- import DanteEditor from './dante_editor.js'
7
-
8
- import DanteImagePopover from './popovers/image'
9
- import DanteAnchorPopover from './popovers/link'
10
-
11
- //import { getSelectionRect, getSelection } from "../utils/selection.js"
12
- import DanteInlineTooltip from './popovers/addButton'
13
- import DanteTooltip from './popovers/toolTip'
14
- //import Link from './decorators/link'
15
-
16
- //import Debug from './debug'
17
- //import findEntities from '../utils/find_entities'
18
- import ImageBlock from './blocks/image'
19
- import EmbedBlock from './blocks/embed'
20
- import VideoBlock from './blocks/video'
21
- import PlaceholderBlock from './blocks/placeholder'
10
+ import ImageBlock from '../blocks/image'
11
+ import EmbedBlock from '../blocks/embed'
12
+ import VideoBlock from '../blocks/video'
13
+ import PlaceholderBlock from '../blocks/placeholder'
22
14
 
23
15
  import {
24
16
  resetBlockWithType,
25
- addNewBlockAt } from '../model/index.js'
17
+ addNewBlockAt
18
+ } from '../../model/index.js'
26
19
 
27
20
  class Dante {
28
21
  constructor(options) {
@@ -50,7 +43,6 @@ class Dante {
50
43
  defaultOptions.spellcheck = false
51
44
  defaultOptions.title_placeholder = "Title"
52
45
  defaultOptions.body_placeholder = "Write your story"
53
- // @defaultOptions.api_key = "86c28a410a104c8bb58848733c82f840"
54
46
 
55
47
  defaultOptions.widgets = [{
56
48
  title: 'add an image',
@@ -293,4 +285,4 @@ class Dante {
293
285
  }
294
286
  }
295
287
 
296
- module.exports = Dante
288
+ export default Dante
File without changes
@@ -7,10 +7,7 @@ import {
7
7
  convertToRaw,
8
8
  convertFromRaw,
9
9
  CompositeDecorator,
10
- //getVisibleSelectionRect,
11
- getDefaultKeyBinding,
12
- //getSelectionOffsetKeyForNode,
13
- //KeyBindingUtil,
10
+ getDefaultKeyBinding,
14
11
  ContentState,
15
12
  Editor,
16
13
  EditorState,
@@ -18,20 +15,14 @@ import {
18
15
  RichUtils,
19
16
  DefaultDraftBlockRenderMap,
20
17
  SelectionState,
21
- Modifier,
22
- //BlockMapBuilder,
23
- //getSafeBodyFromHTML
18
+ Modifier
24
19
  } from 'draft-js'
25
20
 
26
- //import DraftPasteProcessor from 'draft-js/lib/DraftPasteProcessor'
27
-
28
21
  import {
29
22
  convertToHTML,
30
23
  //, convertFromHTML
31
24
  } from 'draft-convert'
32
25
 
33
- //import isSoftNewlineEvent from 'draft-js/lib/isSoftNewlineEvent'
34
-
35
26
  import {
36
27
  addNewBlock,
37
28
  resetBlockWithType,
@@ -39,26 +30,13 @@ import {
39
30
  //updateTextOfBlock,
40
31
  getCurrentBlock,
41
32
  addNewBlockAt
42
- } from '../model/index.js'
43
-
44
- //import DanteImagePopover from './popovers/image'
45
- //import DanteAnchorPopover from './popovers/link'
46
-
47
- //import { getSelectionRect, getSelection } from "../utils/selection.js"
48
- //import DanteInlineTooltip from './popovers/addButton'
49
- //import DanteTooltip from './popovers/toolTip'
50
- import Link from './decorators/link'
33
+ } from '../../model/index.js'
51
34
 
35
+ import Link from '../decorators/link'
52
36
  import Debug from './debug'
53
- import findEntities from '../utils/find_entities'
54
-
55
- /*import ImageBlock from './blocks/image'
56
- import EmbedBlock from './blocks/embed'
57
- import VideoBlock from './blocks/video'
58
- import PlaceholderBlock from './blocks/placeholder'*/
59
-
60
- import SaveBehavior from '../utils/save_content'
61
- import customHTML2Content from '../utils/html2content'
37
+ import findEntities from '../../utils/find_entities'
38
+ import SaveBehavior from '../../utils/save_content'
39
+ import customHTML2Content from '../../utils/html2content'
62
40
 
63
41
 
64
42
  class DanteEditor extends React.Component {
@@ -101,6 +79,8 @@ class DanteEditor extends React.Component {
101
79
  this.updateBlockData = this.updateBlockData.bind(this)
102
80
  this.setDirection = this.setDirection.bind(this)
103
81
  this.toggleEditable = this.toggleEditable.bind(this)
82
+ this.disableEditable = this.disableEditable.bind(this)
83
+ this.enableEditable = this.enableEditable.bind(this)
104
84
  this.closePopOvers = this.closePopOvers.bind(this)
105
85
  this.relocateTooltips = this.relocateTooltips.bind(this)
106
86
  this.tooltipsWithProp = this.tooltipsWithProp.bind(this)
@@ -110,6 +90,7 @@ class DanteEditor extends React.Component {
110
90
  this.showPopLinkOver = this.showPopLinkOver.bind(this)
111
91
  this.hidePopLinkOver = this.hidePopLinkOver.bind(this)
112
92
  this.render = this.render.bind(this)
93
+
113
94
  this.decorator = new CompositeDecorator([{
114
95
  strategy: findEntities.bind(null, 'LINK', this),
115
96
  component: Link
@@ -143,7 +124,7 @@ class DanteEditor extends React.Component {
143
124
  this.extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(this.blockRenderMap)
144
125
 
145
126
  this.state = {
146
- editorState: this.initializeState(),
127
+ editorState: EditorState.createWithContent(convertFromRaw(this.props.content)),
147
128
  read_only: this.props.config.read_only,
148
129
  blockRenderMap: this.extendedBlockRenderMap,
149
130
  locks: 0,
@@ -172,6 +153,14 @@ class DanteEditor extends React.Component {
172
153
  editorState: this.state.editorState,
173
154
  editorContent: this.emitSerializedOutput()
174
155
  })
156
+
157
+ // TODO: fix this amateur mode
158
+ // here we add a new contentstate with the decorator in order to get contentState
159
+ setTimeout(()=>{
160
+ let newEditorState = EditorState.set(this.decodeEditorContent(this.props.content), {decorator: this.decorator});
161
+ this.onChange(newEditorState)
162
+ }, 0)
163
+
175
164
  }
176
165
 
177
166
  initializeState() {
@@ -183,6 +172,12 @@ class DanteEditor extends React.Component {
183
172
  }
184
173
  }
185
174
 
175
+ decodeEditorContent(raw_as_json) {
176
+ const new_content = convertFromRaw(raw_as_json)
177
+ let editorState
178
+ return editorState = EditorState.createWithContent(new_content, this.decorator)
179
+ }
180
+
186
181
  refreshSelection(newEditorState) {
187
182
  const { editorState } = this.state
188
183
  // Setting cursor position after inserting to content
@@ -250,7 +245,9 @@ class DanteEditor extends React.Component {
250
245
  return this.save.editorContent = content
251
246
  }
252
247
 
253
- focus() {}
248
+ focus() {
249
+ //debugger
250
+ }
254
251
  //@props.refs.richEditor.focus()
255
252
 
256
253
  getEditorState() {
@@ -263,13 +260,6 @@ class DanteEditor extends React.Component {
263
260
  return raw
264
261
  }
265
262
 
266
- decodeEditorContent(raw_as_json) {
267
- const new_content = convertFromRaw(raw_as_json)
268
- let editorState
269
-
270
- return editorState = EditorState.createWithContent(new_content, this.decorator)
271
- }
272
-
273
263
  //# title utils
274
264
  getTextFromEditor() {
275
265
  const c = this.state.editorState.getCurrentContent()
@@ -354,6 +344,9 @@ class DanteEditor extends React.Component {
354
344
  getEditorState: this.getEditorState,
355
345
  setEditorState: this.onChange,
356
346
  addLock: this.addLock,
347
+ toggleEditable: this.toggleEditable,
348
+ disableEditable: this.disableEditable,
349
+ enableEditable: this.enableEditable,
357
350
  removeLock: this.removeLock,
358
351
  getLocks: this.getLocks,
359
352
  config: dataBlock.options
@@ -405,6 +398,7 @@ class DanteEditor extends React.Component {
405
398
 
406
399
  return setTimeout(() => {
407
400
  const items = this.tooltipsWithProp(prop)
401
+ console.log(items)
408
402
  return items.map(o => {
409
403
  this.refs[o.ref].display(display)
410
404
  return this.refs[o.ref].relocate()
@@ -571,6 +565,7 @@ class DanteEditor extends React.Component {
571
565
 
572
566
  if (currentBlock.getText().length > 0) {
573
567
 
568
+ /*
574
569
  if (blockType === "unstyled") {
575
570
  // hack hackety hack
576
571
  // https://github.com/facebook/draft-js/issues/304
@@ -590,7 +585,7 @@ class DanteEditor extends React.Component {
590
585
  }, 0)
591
586
 
592
587
  return true
593
- }
588
+ }*/
594
589
 
595
590
  if (config_block && config_block.handleEnterWithText) {
596
591
  config_block.handleEnterWithText(this, currentBlock)
@@ -780,10 +775,22 @@ class DanteEditor extends React.Component {
780
775
  //# read only utils
781
776
  toggleEditable() {
782
777
  this.closePopOvers()
783
-
784
778
  return this.setState({ read_only: !this.state.read_only }, this.testEmitAndDecode)
785
779
  }
786
780
 
781
+ disableEditable() {
782
+ console.log("in !!")
783
+ this.closePopOvers()
784
+ return this.setState({ read_only: true }, this.testEmitAndDecode)
785
+ }
786
+
787
+ enableEditable() {
788
+ this.closePopOvers()
789
+ console.log("out !!")
790
+
791
+ return this.setState({ read_only: false }, this.testEmitAndDecode)
792
+ }
793
+
787
794
  closePopOvers() {
788
795
  return this.tooltips.map(o => {
789
796
  return this.refs[o.ref].hide()
@@ -870,7 +877,8 @@ class DanteEditor extends React.Component {
870
877
  <hr className="section-divider" />
871
878
  </div>
872
879
  <div className="section-content">
873
- <div ref="richEditor" className="section-inner layoutSingleColumn"
880
+ <div ref="richEditor"
881
+ className="section-inner layoutSingleColumn"
874
882
  onClick={ this.focus }>
875
883
  <Editor
876
884
  blockRendererFn={ this.blockRenderer }
@@ -928,4 +936,4 @@ class DanteEditor extends React.Component {
928
936
  }
929
937
  }
930
938
 
931
- module.exports = DanteEditor
939
+ export default DanteEditor
@@ -46,7 +46,8 @@ export default class Link extends React.Component {
46
46
  }
47
47
 
48
48
  render() {
49
- this.data = Entity.get(this.props.entityKey).getData()
49
+ this.data = this.props.contentState.getEntity(this.props.entityKey).getData()
50
+ //Entity.get(this.props.entityKey).getData()
50
51
 
51
52
  return (
52
53
  <a
@@ -0,0 +1,8 @@
1
+
2
+ import Dante from './core/dante'
3
+ import DanteEditor from './core/editor'
4
+
5
+ export {
6
+ Dante,
7
+ DanteEditor
8
+ }
@@ -152,6 +152,11 @@ class DanteInlineTooltip extends React.Component {
152
152
  return this.insertImage(fileList[0])
153
153
  }
154
154
 
155
+ handleInsertion(e){
156
+ this.hide()
157
+ return this.props.onChange(addNewBlock(this.props.editorState, e.type, {}))
158
+ }
159
+
155
160
  widgets() {
156
161
  return this.props.editor.widgets
157
162
  }
@@ -164,6 +169,8 @@ class DanteInlineTooltip extends React.Component {
164
169
  return this.clickOnFileUpload(e, request_block)
165
170
  case "placeholder":
166
171
  return this.handlePlaceholder(request_block)
172
+ case "insertion":
173
+ return this.handleInsertion(request_block)
167
174
  default:
168
175
  return console.log(`WRONG TYPE FOR ${ request_block.widget_options.insertion }`)
169
176
  }
@@ -207,8 +207,9 @@ class DanteTooltip extends React.Component {
207
207
  showPopLinkOver: this.props.showPopLinkOver,
208
208
  hidePopLinkOver: this.props.hidePopLinkOver
209
209
  }
210
-
210
+
211
211
  let entityKey = Entity.create('LINK', 'MUTABLE', opts)
212
+ //contentState.createEntity('LINK', 'MUTABLE', opts)
212
213
 
213
214
  if (selection.isCollapsed()) {
214
215
  console.log("COLLAPSED SKIPPING LINK")
@@ -241,16 +242,17 @@ class DanteTooltip extends React.Component {
241
242
  if (this.refs.dante_menu_input) {
242
243
  this.refs.dante_menu_input.value = ""
243
244
  }
244
-
245
+
245
246
  let currentBlock = getCurrentBlock(this.props.editorState)
246
247
  let blockType = currentBlock.getType()
247
248
  let selection = this.props.editor.state.editorState.getSelection()
249
+ let contentState = this.props.editorState.getCurrentContent()
248
250
  let selectedEntity = null
249
251
  let defaultUrl = null
250
252
  return currentBlock.findEntityRanges(character => {
251
253
  let entityKey = character.getEntity()
252
254
  selectedEntity = entityKey
253
- return entityKey !== null && Entity.get(entityKey).getType() === 'LINK'
255
+ return entityKey !== null && contentState.getEntity(entityKey).getType() === 'LINK'
254
256
  }, (start, end) => {
255
257
  let selStart = selection.getAnchorOffset()
256
258
  let selEnd = selection.getFocusOffset()
@@ -260,7 +262,7 @@ class DanteTooltip extends React.Component {
260
262
  }
261
263
 
262
264
  if (start === selStart && end === selEnd) {
263
- defaultUrl = Entity.get(selectedEntity).getData().url
265
+ defaultUrl = contentState.getEntity(selectedEntity).getData().url
264
266
  return this.refs.dante_menu_input.value = defaultUrl
265
267
  }
266
268
  })
@@ -296,11 +298,14 @@ class DanteTooltip extends React.Component {
296
298
  />
297
299
  })
298
300
  }
301
+
299
302
  <DanteTooltipLink
300
303
  editorState={ this.props.editorState }
301
304
  enableLinkMode={ this._enableLinkMode }
302
305
  />
303
- { this.inlineItems().map( (item, i) => {
306
+
307
+
308
+ { this.inlineItems().map( (item, i) => {
304
309
  return <DanteTooltipItem
305
310
  key={ i }
306
311
  item={ item }
@@ -398,5 +403,10 @@ class DanteTooltipLink extends React.Component {
398
403
  }
399
404
  }
400
405
 
406
+
407
+
408
+
409
+
410
+
401
411
  export default DanteTooltip
402
412
 
data/src/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
 
2
- import Dante from './components/dante'
3
- import DanteEditor from './components/dante_editor'
2
+ import {DanteEditor, Dante} from './components/init.js'
4
3
 
4
+ window.Dante = Dante
5
+ window.DanteEditor = DanteEditor
5
6
 
6
- module.exports = {
7
+ export {
7
8
  Dante,
8
9
  DanteEditor
9
10
  }
@@ -0,0 +1,189 @@
1
+ .signature {
2
+ position: relative;
3
+ display: table;
4
+ float: left;
5
+ margin-bottom: 20px;
6
+ }
7
+
8
+ .signature img {
9
+ float: left;
10
+ margin-right: 30px;
11
+ margin-bottom: 0!important;
12
+ height: 100px;
13
+ width: 100px;
14
+ border-radius: 50px;
15
+ }
16
+
17
+ .signature .text {
18
+ width: 100%;
19
+ display: table-cell;
20
+ vertical-align: middle;
21
+ }
22
+
23
+ .signature .text p {
24
+ margin-bottom: 0!important;
25
+ }
26
+
27
+ .dante-clearfix:after {
28
+ clear:both
29
+ }
30
+ .dante-clearfix:before{
31
+ display: table;
32
+ content: " ";
33
+ }
34
+
35
+
36
+
37
+ .dropdown .btn {
38
+ color: #BEC2CC;
39
+ padding: 0 10px;
40
+ width: auto;
41
+ font-size: 12px;
42
+ }
43
+
44
+ .text-toolbar button {
45
+ position: relative;
46
+ float: left;
47
+ height: 40px;
48
+ width: 40px;
49
+ background: transparent;
50
+ border: 0;
51
+ padding: 0;
52
+ cursor: pointer;
53
+ padding: 0;
54
+ }
55
+
56
+
57
+ // dropdown
58
+
59
+ .dropdown {
60
+ float: left;
61
+ }
62
+
63
+ .dropdown, .dropup {
64
+ position: relative;
65
+ }
66
+
67
+ .dropdown .btn {
68
+ color: #BEC2CC;
69
+ padding: 0 10px;
70
+ width: auto;
71
+ font-size: 12px;
72
+ }
73
+
74
+ .dante-menu-button.visible-overflow{
75
+ overflow:visible;
76
+ }
77
+
78
+ .dante-menu-button button {
79
+ position: relative;
80
+ float: left;
81
+ height: 40px;
82
+ width: 40px;
83
+ background: transparent !important;
84
+ border: 0;
85
+ padding: 0;
86
+ cursor: pointer;
87
+ padding: 0;
88
+ }
89
+
90
+ .dropdown .dropdown-menu {
91
+ background: #2A2B32;
92
+ padding: 0;
93
+ max-height: 300px;
94
+ overflow-y: auto;
95
+ width: auto;
96
+ min-width: 60px;
97
+ }
98
+
99
+ .open>.dropdown-menu {
100
+ display: block;
101
+ }
102
+
103
+ .dropdown-menu {
104
+ position: absolute;
105
+ top: 100%;
106
+ left: 0;
107
+ z-index: 1000;
108
+ display: none;
109
+ float: left;
110
+ min-width: 160px;
111
+ padding: 5px 0;
112
+ margin: 2px 0 0;
113
+ font-size: 14px;
114
+ text-align: left;
115
+ list-style: none;
116
+ background-color: #fff;
117
+ -webkit-background-clip: padding-box;
118
+ background-clip: padding-box;
119
+ border: 1px solid #ccc;
120
+ border: 1px solid rgba(0,0,0,.15);
121
+ border-radius: 4px;
122
+ -webkit-box-shadow: 0 6px 12px rgba(0,0,0,.175);
123
+ box-shadow: 0 6px 12px rgba(0,0,0,.175);
124
+ }
125
+
126
+ .dropdown .dropdown-menu li {
127
+ border-bottom: 1px solid #383943;
128
+ }
129
+
130
+ .editor .container .content-edit .text-toolbar .dropdown .dropdown-menu li a {
131
+ color: #BEC2CC;
132
+ font-size: 12px;
133
+ padding: 0 10px;
134
+ line-height: 30px;
135
+ }
136
+
137
+ .dropdown-menu>li>a {
138
+ display: block;
139
+ padding: 3px 20px;
140
+ clear: both;
141
+ font-weight: 400;
142
+ line-height: 1.42857143;
143
+ color: #fff;
144
+ white-space: nowrap;
145
+ }
146
+
147
+ .btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default {
148
+ color: #fff;
149
+ background-color: #e6e6e6;
150
+ border-color: #adadad;
151
+ }
152
+
153
+ .btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default {
154
+ background-image: none;
155
+ }
156
+
157
+ .btn-default.active, .btn-default:active, .open>.dropdown-toggle.btn-default {
158
+ color: #fff;
159
+ background-color: #e6e6e6;
160
+ border-color: #adadad;
161
+ }
162
+
163
+ .btn-default {
164
+ color: #fff;
165
+ background-color: #fff;
166
+ border-color: #ccc;
167
+ }
168
+
169
+ .btn {
170
+ display: inline-block;
171
+ padding: 6px 12px;
172
+ margin-bottom: 0;
173
+ font-size: 14px;
174
+ font-weight: 400;
175
+ line-height: 1.42857143;
176
+ text-align: center;
177
+ white-space: nowrap;
178
+ vertical-align: middle;
179
+ -ms-touch-action: manipulation;
180
+ touch-action: manipulation;
181
+ cursor: pointer;
182
+ -webkit-user-select: none;
183
+ -moz-user-select: none;
184
+ -ms-user-select: none;
185
+ user-select: none;
186
+ background-image: none;
187
+ border: 1px solid transparent;
188
+ border-radius: 4px;
189
+ }
@@ -45,11 +45,13 @@
45
45
  line-height: 1;
46
46
 
47
47
  // Better Font Rendering
48
- -webkit-font-smoothing: antialiased;
48
+ -webkit-font-smoothing: antialiased;
49
49
  -moz-osx-font-smoothing: grayscale;
50
50
  }
51
51
  }
52
52
 
53
+ .dante-icon-divider:before { content: "\e904"; }
54
+
53
55
  .dante-icon-image-center:before { content: "\e900"; }
54
56
  .dante-icon-image-fill:before { content: "\e901"; }
55
57
  .dante-icon-image-left:before { content: "\e902"; }
@@ -19,4 +19,6 @@
19
19
 
20
20
  @import "./dante/debug";
21
21
 
22
+ @import "./custom"
23
+
22
24
  //@import "./layout/normalize"
data/src/styles/draft.css CHANGED
@@ -18,6 +18,11 @@
18
18
  position: relative;
19
19
  }
20
20
 
21
+ // HACK FOR ISSUE https://github.com/facebook/draft-js/issues/304 , proposal from @bradbumbalough
22
+ .DraftEditor-root {
23
+ overflow: auto;
24
+ }
25
+
21
26
  /**
22
27
  * Zero-opacity background used to allow focus in IE. Otherwise, clicks
23
28
  * fall through to the placeholder.
@@ -15,4 +15,5 @@
15
15
  <glyph unicode="&#xe901;" glyph-name="image-fill" horiz-adv-x="1152" d="M128 128h896v-96h-896v96zM0 896h1152v-672h-1152v672z" />
16
16
  <glyph unicode="&#xe902;" glyph-name="image-left" horiz-adv-x="1152" d="M256 128h896v-96h-896v96zM768 320h384v-96h-384v96zM0 704h672v-480h-672v480zM768 512h384v-96h-384v96zM768 704h384v-96h-384v96zM256 896h896v-96h-896v96z" />
17
17
  <glyph unicode="&#xe903;" glyph-name="image-wide" horiz-adv-x="1152" d="M128 128h896v-96h-896v96zM0 704h1152v-480h-1152v480zM128 896h896v-96h-896v96z" />
18
+ <glyph unicode="&#xe904;" glyph-name="divider" d="M0 13v6c0 0.552 0.448 1 1 1h30c0.552 0 1-0.448 1-1v-6c0-0.552-0.448-1-1-1h-30c-0.552 0-1 0.448-1 1z" />
18
19
  </font></defs></svg>
@@ -5,11 +5,12 @@ const findEntities = (entityType, instance, contentBlock, callback) => {
5
5
  return contentBlock.findEntityRanges((function(_this) {
6
6
  return function(character) {
7
7
  var entityKey, opts, res
8
+ let contentState = instance.state.editorState.getCurrentContent()
8
9
  entityKey = character.getEntity()
9
- return (res = entityKey !== null && Entity.get(entityKey).getType() === entityType, res ? (opts = {
10
+ return (res = entityKey !== null && contentState.getEntity(entityKey).getType() === entityType, res ? (opts = {
10
11
  showPopLinkOver: instance.showPopLinkOver,
11
12
  hidePopLinkOver: instance.hidePopLinkOver
12
- }, Entity.mergeData(entityKey, opts)) : void 0, res)
13
+ }, contentState.mergeEntityData(entityKey, opts)) : void 0, res)
13
14
  }
14
15
  })(this), callback)
15
16
  }
@@ -89,11 +89,13 @@ let customHTML2Content = function(HTML, blockRn){
89
89
  // use DraftJS converter to do initial conversion. I don't provide DOMBuilder and
90
90
  // blockRenderMap arguments here since it should fall back to its default ones, which are fine
91
91
  console.log(tempDoc.body.innerHTML)
92
- let contentBlocks = convertFromHTML(tempDoc.body.innerHTML,
92
+ let content = convertFromHTML(tempDoc.body.innerHTML,
93
93
  getSafeBodyFromHTML,
94
94
  blockRn
95
95
  )
96
96
 
97
+ let contentBlocks = content.contentBlocks
98
+
97
99
  // now replace <blockquote /> ContentBlocks with 'atomic' ones
98
100
  contentBlocks = contentBlocks.map(function(block){
99
101
  let newBlock
@@ -47,10 +47,10 @@ const baseConfig = {
47
47
  loader: ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader!sass-loader' })
48
48
  },
49
49
 
50
- { test: path.resolve("./src/components/dante_editor.js"),
50
+ { test: path.resolve("./src/components/core/dante_editor.js"),
51
51
  loaders: ["expose-loader?DanteEditor", "babel-loader?presets[]=es2015"]},
52
52
 
53
- { test: path.resolve("./src/components/dante.js"),
53
+ { test: path.resolve("./src/components/core/dante.js"),
54
54
  loaders: ["expose-loader?Dante", "babel-loader?presets[]=es2015"]},
55
55
 
56
56
  {