|
@@ -32,7 +32,7 @@ export default class RichTextEditor extends Component {
|
32
|
32
|
this._onKeyboardWillShow = this._onKeyboardWillShow.bind(this);
|
33
|
33
|
this._onKeyboardWillHide = this._onKeyboardWillHide.bind(this);
|
34
|
34
|
this.state = {
|
35
|
|
- listeners: [],
|
|
35
|
+ selectionChangeListeners: [],
|
36
|
36
|
onChange: [],
|
37
|
37
|
showLinkDialog: false,
|
38
|
38
|
linkInitialUrl: '',
|
|
@@ -157,16 +157,11 @@ export default class RichTextEditor extends Component {
|
157
|
157
|
break;
|
158
|
158
|
case messages.SELECTION_CHANGE: {
|
159
|
159
|
const items = message.data.items;
|
160
|
|
- this.state.listeners.map((listener) => {
|
|
160
|
+ this.state.selectionChangeListeners.map((listener) => {
|
161
|
161
|
listener(items);
|
162
|
162
|
});
|
163
|
163
|
break;
|
164
|
164
|
}
|
165
|
|
- case messages.CONTENT_CHANGE: {
|
166
|
|
- const content = message.data.content;
|
167
|
|
- this.state.onChange.map((listener) => listener(content));
|
168
|
|
- break;
|
169
|
|
- }
|
170
|
165
|
case messages.SELECTED_TEXT_CHANGED: {
|
171
|
166
|
const selectedText = message.data;
|
172
|
167
|
this._selectedTextChangeListeners.forEach((listener) => {
|
|
@@ -331,7 +326,7 @@ export default class RichTextEditor extends Component {
|
331
|
326
|
|
332
|
327
|
registerToolbar(listener) {
|
333
|
328
|
this.setState({
|
334
|
|
- listeners: [...this.state.listeners, listener]
|
|
329
|
+ selectionChangeListeners: [...this.state.selectionChangeListeners, listener]
|
335
|
330
|
});
|
336
|
331
|
}
|
337
|
332
|
|