| author | ymh <ymh.work@gmail.com> |
| Thu, 11 Oct 2018 11:05:04 +0200 | |
| changeset 169 | f98efa1bddd1 |
| parent 168 | ea92f4fe783d |
| child 170 | 7da1d5137b0b |
| permissions | -rw-r--r-- |
| 157 | 1 |
import { Value } from 'slate' |
2 |
import Plain from 'slate-plain-serializer' |
|
3 |
import { Editor } from 'slate-react' |
|
| 5 | 4 |
import React from 'react' |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
5 |
import { Portal } from 'react-portal' |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
6 |
import HtmlSerializer from './HtmlSerializer' |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
7 |
import AnnotationPlugin from './AnnotationPlugin' |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
8 |
import CategoriesTooltip from './CategoriesTooltip' |
|
161
a642639dbc07
Split scss files and adapt session page design
salimr <riwad.salim@yahoo.fr>
parents:
159
diff
changeset
|
9 |
import './SlateEditor.css'; |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
10 |
import { now } from '../../utils'; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
11 |
import { defaultAnnotationsCategories } from '../../constants'; |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
12 |
|
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
13 |
const plugins = []; |
| 5 | 14 |
|
15 |
/** |
|
16 |
* Define the default node type. |
|
17 |
*/ |
|
18 |
||
19 |
const DEFAULT_NODE = 'paragraph' |
|
20 |
||
21 |
/** |
|
22 |
* Define a schema. |
|
23 |
* |
|
24 |
* @type {Object} |
|
25 |
*/ |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
26 |
// TODO Check if we can move this to the plugin using the schema option |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
27 |
// https://docs.slatejs.org/reference/plugins/plugin.html#schema |
| 5 | 28 |
const schema = { |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
29 |
|
| 5 | 30 |
nodes: { |
31 |
'bulleted-list': props => <ul {...props.attributes}>{props.children}</ul>, |
|
32 |
'list-item': props => <li {...props.attributes}>{props.children}</li>, |
|
33 |
'numbered-list': props => <ol {...props.attributes}>{props.children}</ol>, |
|
34 |
}, |
|
35 |
marks: { |
|
36 |
bold: { |
|
37 |
fontWeight: 'bold' |
|
38 |
}, |
|
|
25
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
39 |
category: props => { |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
40 |
const data = props.mark.data; |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
41 |
return <span style={{ backgroundColor: data.color }}>{props.children}</span> |
| 5 | 42 |
}, |
43 |
italic: { |
|
44 |
fontStyle: 'italic' |
|
45 |
}, |
|
46 |
underlined: { |
|
| 157 | 47 |
textDecoration: 'underlined' |
| 5 | 48 |
} |
49 |
} |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
50 |
|
| 5 | 51 |
} |
52 |
||
| 157 | 53 |
const initialValue = Value.fromJSON({ |
54 |
document: { |
|
55 |
nodes: [ |
|
56 |
{ |
|
57 |
object: 'block', |
|
58 |
type: 'paragraph', |
|
59 |
nodes: [ |
|
60 |
{ |
|
61 |
object: 'text', |
|
62 |
leaves: [ |
|
63 |
{ |
|
64 |
text: '', |
|
65 |
}, |
|
66 |
], |
|
67 |
}, |
|
68 |
], |
|
69 |
}, |
|
70 |
], |
|
71 |
}, |
|
72 |
}) |
|
73 |
||
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
74 |
|
| 5 | 75 |
/** |
76 |
* The rich text example. |
|
77 |
* |
|
78 |
* @type {Component} |
|
79 |
*/ |
|
80 |
||
| 8 | 81 |
class SlateEditor extends React.Component { |
| 5 | 82 |
|
83 |
/** |
|
84 |
* Deserialize the initial editor state. |
|
85 |
* |
|
86 |
* @type {Object} |
|
87 |
*/ |
|
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
88 |
constructor(props) { |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
89 |
super(props); |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
90 |
|
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
91 |
const annotationPlugin = AnnotationPlugin({ |
|
102
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
92 |
onChange: (text, start, end) => { |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
93 |
this.setState({ |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
94 |
currentSelectionText: text, |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
95 |
currentSelectionStart: start, |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
96 |
currentSelectionEnd: end, |
|
102
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
97 |
}); |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
98 |
} |
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
99 |
}); |
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
100 |
|
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
101 |
plugins.push(annotationPlugin); |
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
102 |
|
| 157 | 103 |
|
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
104 |
this.state = { |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
105 |
value: props.note ? Value.fromJSON(initialValue) : Plain.deserialize(''), |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
106 |
startedAt: null, |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
107 |
finishedAt: null, |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
108 |
currentSelectionText: '', |
|
102
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
109 |
currentSelectionStart: 0, |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
110 |
currentSelectionEnd: 0, |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
111 |
hoveringMenu: null, |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
112 |
isPortalOpen: false, |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
113 |
categories: [], |
|
72
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
114 |
isCheckboxChecked: false, |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
115 |
enterKeyValue: 0, |
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
116 |
}; |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
117 |
} |
| 5 | 118 |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
119 |
componentDidMount = () => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
120 |
this.updateMenu(); |
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
121 |
this.focus(); |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
122 |
} |
| 5 | 123 |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
124 |
componentDidUpdate = () => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
125 |
this.updateMenu(); |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
126 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
127 |
|
| 157 | 128 |
/** |
129 |
* On change, save the new state. |
|
| 5 | 130 |
* |
| 157 | 131 |
* @param {Change} change |
| 5 | 132 |
*/ |
133 |
||
| 157 | 134 |
onChange = ({value}) => { |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
135 |
|
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
136 |
let newState = { |
| 157 | 137 |
value: value, |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
138 |
startedAt: this.state.startedAt |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
139 |
}; |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
140 |
|
| 157 | 141 |
const isEmpty = value.document.length === 0; |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
142 |
|
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
143 |
// Reset timers when the text is empty |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
144 |
if (isEmpty) { |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
145 |
Object.assign(newState, { |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
146 |
startedAt: null, |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
147 |
finishedAt: null |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
148 |
}); |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
149 |
} else { |
|
74
043477fd5c5c
add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
72
diff
changeset
|
150 |
Object.assign(newState, { finishedAt: now() }); |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
151 |
} |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
152 |
|
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
153 |
// Store start time once when the first character is typed |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
154 |
if (!isEmpty && this.state.startedAt === null) { |
|
74
043477fd5c5c
add api call to save notes. internally use ts for time data for notes and session
ymh <ymh.work@gmail.com>
parents:
72
diff
changeset
|
155 |
Object.assign(newState, { startedAt: now() }); |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
156 |
} |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
157 |
|
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
158 |
this.setState(newState) |
|
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
159 |
|
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
160 |
if (typeof this.props.onChange === 'function') { |
|
16
e67cd18cc594
Draft implementation of note timing.
Alexandre Segura <mex.zktk@gmail.com>
parents:
15
diff
changeset
|
161 |
this.props.onChange(newState); |
| 8 | 162 |
} |
| 5 | 163 |
} |
164 |
||
| 157 | 165 |
/** |
166 |
* Check if the current selection has a mark with `type` in it. |
|
167 |
* |
|
168 |
* @param {String} type |
|
169 |
* @return {Boolean} |
|
170 |
*/ |
|
171 |
||
172 |
hasMark = type => { |
|
173 |
const { value } = this.state |
|
174 |
return value.activeMarks.some(mark => mark.type === type) |
|
175 |
} |
|
176 |
||
177 |
/** |
|
178 |
* Check if the any of the currently selected blocks are of `type`. |
|
179 |
* |
|
180 |
* @param {String} type |
|
181 |
* @return {Boolean} |
|
182 |
*/ |
|
183 |
||
184 |
hasBlock = type => { |
|
185 |
const { value } = this.state |
|
186 |
return value.blocks.some(node => node.type === type) |
|
187 |
} |
|
188 |
||
| 5 | 189 |
asPlain = () => { |
| 157 | 190 |
return Plain.serialize(this.state.value); |
| 5 | 191 |
} |
192 |
||
| 15 | 193 |
asRaw = () => { |
| 157 | 194 |
return JSON.stringify(this.state.value.toJSON()); |
| 15 | 195 |
} |
196 |
||
|
17
877d8796b86d
Store serialized HTML in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
16
diff
changeset
|
197 |
asHtml = () => { |
| 157 | 198 |
return HtmlSerializer.serialize(this.state.value); |
|
17
877d8796b86d
Store serialized HTML in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
16
diff
changeset
|
199 |
} |
|
877d8796b86d
Store serialized HTML in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
16
diff
changeset
|
200 |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
201 |
asCategories = () => { |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
202 |
return this.state.categories |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
203 |
} |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
204 |
|
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
205 |
removeCategory = (categories, key, text) => { |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
206 |
const categoryIndex = categories.findIndex(category => category.key === key && category.text === text) |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
207 |
return categories.delete(categoryIndex) |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
208 |
} |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
209 |
|
| 5 | 210 |
clear = () => { |
| 157 | 211 |
const value = Plain.deserialize(''); |
212 |
this.onChange({value}); |
|
| 5 | 213 |
} |
214 |
||
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
215 |
focus = () => { |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
216 |
this.refs.editor.focus(); |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
217 |
} |
|
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
218 |
|
| 157 | 219 |
/** |
| 5 | 220 |
* When a mark button is clicked, toggle the current mark. |
221 |
* |
|
222 |
* @param {Event} e |
|
223 |
* @param {String} type |
|
224 |
*/ |
|
225 |
||
226 |
onClickMark = (e, type) => { |
|
| 157 | 227 |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
228 |
e.preventDefault() |
| 157 | 229 |
const { value } = this.state |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
230 |
let { categories } = this.state |
| 5 | 231 |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
232 |
let isPortalOpen = false; |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
233 |
|
|
25
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
234 |
if (type === 'category') { |
|
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
235 |
// Can't use toggleMark here, because it expects the same object |
|
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
236 |
// @see https://github.com/ianstormtaylor/slate/issues/873 |
|
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
237 |
if (this.hasMark('category')) { |
| 157 | 238 |
const categoryMarks = value.activeMarks.filter(mark => mark.type === 'category') |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
239 |
categoryMarks.forEach(mark => { |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
240 |
const key = mark.data.key; |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
241 |
const text = mark.data.text; |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
242 |
|
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
243 |
categories = this.removeCategory(categories, key, text) |
| 157 | 244 |
const change = value.change().removeMark(mark) |
245 |
this.onChange(change) |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
246 |
}) |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
247 |
|
|
25
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
248 |
} else { |
|
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
249 |
isPortalOpen = !this.state.isPortalOpen; |
|
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
250 |
} |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
251 |
} else { |
| 157 | 252 |
const change = value.change().toggleMark(type) |
253 |
this.onChange(change) |
|
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
254 |
} |
|
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
255 |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
256 |
this.setState({ |
| 157 | 257 |
state: value.change, |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
258 |
isPortalOpen: isPortalOpen, |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
259 |
categories: categories |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
260 |
}) |
| 5 | 261 |
} |
262 |
||
263 |
/** |
|
264 |
* When a block button is clicked, toggle the block type. |
|
265 |
* |
|
266 |
* @param {Event} e |
|
267 |
* @param {String} type |
|
268 |
*/ |
|
269 |
||
270 |
onClickBlock = (e, type) => { |
|
271 |
e.preventDefault() |
|
| 157 | 272 |
const { value } = this.state |
273 |
const change = value.change() |
|
274 |
const { document } = value |
|
| 5 | 275 |
|
276 |
// Handle everything but list buttons. |
|
277 |
if (type !== 'bulleted-list' && type !== 'numbered-list') { |
|
278 |
const isActive = this.hasBlock(type) |
|
279 |
const isList = this.hasBlock('list-item') |
|
280 |
||
281 |
if (isList) { |
|
| 157 | 282 |
change |
283 |
.setBlocks(isActive ? DEFAULT_NODE : type) |
|
| 5 | 284 |
.unwrapBlock('bulleted-list') |
285 |
.unwrapBlock('numbered-list') |
|
286 |
} |
|
287 |
||
288 |
else { |
|
| 157 | 289 |
change |
290 |
.setBlocks(isActive ? DEFAULT_NODE : type) |
|
| 5 | 291 |
} |
292 |
} |
|
293 |
||
294 |
// Handle the extra wrapping required for list buttons. |
|
295 |
else { |
|
296 |
const isList = this.hasBlock('list-item') |
|
| 157 | 297 |
const isType = value.blocks.some((block) => { |
| 5 | 298 |
return !!document.getClosest(block.key, parent => parent.type === type) |
299 |
}) |
|
300 |
||
301 |
if (isList && isType) { |
|
| 157 | 302 |
change |
303 |
.setBlocks(DEFAULT_NODE) |
|
| 5 | 304 |
.unwrapBlock('bulleted-list') |
305 |
.unwrapBlock('numbered-list') |
|
| 157 | 306 |
|
| 5 | 307 |
} else if (isList) { |
| 157 | 308 |
change |
| 5 | 309 |
.unwrapBlock(type === 'bulleted-list' ? 'numbered-list' : 'bulleted-list') |
310 |
.wrapBlock(type) |
|
| 157 | 311 |
|
| 5 | 312 |
} else { |
| 157 | 313 |
change |
314 |
.setBlocks('list-item') |
|
| 5 | 315 |
.wrapBlock(type) |
| 157 | 316 |
|
| 5 | 317 |
} |
318 |
} |
|
319 |
||
| 157 | 320 |
|
321 |
this.onChange(change) |
|
| 5 | 322 |
} |
323 |
||
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
324 |
onPortalOpen = (portal) => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
325 |
// When the portal opens, cache the menu element. |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
326 |
this.setState({ hoveringMenu: portal.firstChild }) |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
327 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
328 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
329 |
onPortalClose = (portal) => { |
| 157 | 330 |
let { value } = this.state |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
331 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
332 |
this.setState({ |
| 157 | 333 |
value: value.change, |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
334 |
isPortalOpen: false |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
335 |
}) |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
336 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
337 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
338 |
onCategoryClick = (category) => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
339 |
|
| 157 | 340 |
const { value, currentSelectionText, currentSelectionStart, currentSelectionEnd } = this.state; |
341 |
const change = value.change() |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
342 |
let { categories } = this.state; |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
343 |
|
| 157 | 344 |
const categoryMarks = value.activeMarks.filter(mark => mark.type === 'category') |
345 |
categoryMarks.forEach(mark => change.removeMark(mark)); |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
346 |
|
| 157 | 347 |
change.addMark({ |
|
25
e04714a1d4eb
Improve categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
21
diff
changeset
|
348 |
type: 'category', |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
349 |
data: { |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
350 |
text: currentSelectionText, |
|
102
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
351 |
selection: { |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
352 |
start: currentSelectionStart, |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
353 |
end: currentSelectionEnd, |
|
b0e36664f1f2
Add TextPositionSelector.
Alexandre Segura <mex.zktk@gmail.com>
parents:
80
diff
changeset
|
354 |
}, |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
355 |
color: category.color, |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
356 |
key: category.key |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
357 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
358 |
}) |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
359 |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
360 |
Object.assign(category, { |
| 103 | 361 |
text: currentSelectionText, |
362 |
selection: { |
|
363 |
start: currentSelectionStart, |
|
364 |
end: currentSelectionEnd, |
|
365 |
}, |
|
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
366 |
}); |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
367 |
categories = categories.push(category); |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
368 |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
369 |
this.onChange(change) |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
370 |
|
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
371 |
this.setState({ |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
372 |
value: value, |
|
26
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
373 |
isPortalOpen: false, |
|
930e486ad0a8
Store categories in note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
25
diff
changeset
|
374 |
categories: categories |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
375 |
}); |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
376 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
377 |
|
|
72
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
378 |
onButtonClick = () => { |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
379 |
if (typeof this.props.onButtonClick === 'function') { |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
380 |
this.props.onButtonClick(); |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
381 |
} |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
382 |
} |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
383 |
|
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
384 |
onCheckboxChange = (e) => { |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
385 |
if (typeof this.props.onCheckboxChange === 'function') { |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
386 |
this.props.onCheckboxChange(e); |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
387 |
} |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
388 |
} |
|
7634b424f426
Add checkbox to add not on enter key.
Alexandre Segura <mex.zktk@gmail.com>
parents:
64
diff
changeset
|
389 |
|
| 8 | 390 |
/** |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
391 |
* On key down, if it's a formatting command toggle a mark. |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
392 |
* |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
393 |
* @param {Event} e |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
394 |
* @param {Change} change |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
395 |
* @return {Change} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
396 |
*/ |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
397 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
398 |
onKeyDown = (e, change) => { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
399 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
400 |
const {value} = this.state; |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
401 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
402 |
if (e.key === 'Enter' && value.document.text !== '') { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
403 |
this.setState({enterKeyValue: 1}) |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
404 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
405 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
406 |
if (e.key !== 'Enter') { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
407 |
this.setState({ |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
408 |
enterKeyValue: 0, |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
409 |
}) |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
410 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
411 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
412 |
|
| 169 | 413 |
//TODO review the double enter case. |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
414 |
if (e.key === 'Enter' && !this.props.isChecked && this.state.enterKeyValue === 1 && typeof this.props.onEnterKeyDown === 'function') { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
415 |
e.preventDefault(); |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
416 |
this.props.onEnterKeyDown(); |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
417 |
this.setState({ |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
418 |
enterKeyValue: 0, |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
419 |
}) |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
420 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
421 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
422 |
return change |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
423 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
424 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
425 |
else if (e.key === 'Enter' && value.document.text !== '' && this.props.isChecked && typeof this.props.onEnterKeyDown === 'function') { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
426 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
427 |
e.preventDefault(); |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
428 |
this.props.onEnterKeyDown(); |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
429 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
430 |
return change |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
431 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
432 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
433 |
if (!e.ctrlKey) return |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
434 |
// Decide what to do based on the key code... |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
435 |
switch (e.key) { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
436 |
default: { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
437 |
break; |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
438 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
439 |
// When "B" is pressed, add a "bold" mark to the text. |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
440 |
case 'b': { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
441 |
e.preventDefault() |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
442 |
change.toggleMark('bold') |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
443 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
444 |
return true |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
445 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
446 |
case 'i': { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
447 |
// When "U" is pressed, add an "italic" mark to the text. |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
448 |
e.preventDefault() |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
449 |
change.toggleMark('italic') |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
450 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
451 |
return true |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
452 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
453 |
case 'u': { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
454 |
// When "U" is pressed, add an "underline" mark to the text. |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
455 |
e.preventDefault() |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
456 |
change.toggleMark('underlined') |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
457 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
458 |
return true |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
459 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
460 |
case 'Enter': { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
461 |
// When "ENTER" is pressed, autosubmit the note. |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
462 |
if (value.document.text !== '' && typeof this.props.onEnterKeyDown === 'function') { |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
463 |
e.preventDefault() |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
464 |
this.props.onEnterKeyDown(); |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
465 |
this.setState({ |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
466 |
enterKeyValue: 0, |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
467 |
}) |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
468 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
469 |
return true |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
470 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
471 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
472 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
473 |
} |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
474 |
|
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
475 |
/** |
| 5 | 476 |
* Render. |
477 |
* |
|
478 |
* @return {Element} |
|
479 |
*/ |
|
480 |
||
481 |
render = () => { |
|
482 |
return ( |
|
| 157 | 483 |
<div className="bg-secondary mb-5"> |
484 |
<div className="sticky-top"> |
|
| 5 | 485 |
{this.renderToolbar()} |
| 157 | 486 |
</div> |
| 5 | 487 |
{this.renderEditor()} |
| 157 | 488 |
</div> |
| 5 | 489 |
) |
490 |
} |
|
491 |
||
492 |
/** |
|
493 |
* Render the toolbar. |
|
494 |
* |
|
495 |
* @return {Element} |
|
496 |
*/ |
|
497 |
||
498 |
renderToolbar = () => { |
|
499 |
return ( |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
500 |
<div className="menu toolbar-menu d-flex sticky-top bg-secondary"> |
| 157 | 501 |
{this.renderMarkButton('bold', 'format_bold')} |
502 |
{this.renderMarkButton('italic', 'format_italic')} |
|
503 |
{this.renderMarkButton('underlined', 'format_underlined')} |
|
504 |
{this.renderMarkButton('category', 'label')} |
|
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
505 |
|
|
79
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
506 |
|
| 157 | 507 |
{this.renderBlockButton('numbered-list', 'format_list_numbered')} |
508 |
{this.renderBlockButton('bulleted-list', 'format_list_bulleted')} |
|
509 |
||
510 |
{this.renderToolbarButtons()} |
|
| 5 | 511 |
</div> |
512 |
) |
|
513 |
} |
|
514 |
||
|
80
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
515 |
renderToolbarCheckbox = () => { |
|
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
516 |
return ( |
| 157 | 517 |
<div className="checkbox float-right"> |
518 |
<label className="mr-2"> |
|
519 |
<input type="checkbox" checked={this.props.isChecked} onChange={this.onCheckboxChange} /><small className="text-muted ml-1"> Appuyer sur <kbd className="bg-danger text-muted ml-1">Entrée</kbd> pour ajouter une note</small> |
|
|
80
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
520 |
</label> |
|
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
521 |
</div> |
|
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
522 |
) |
|
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
523 |
} |
|
b3a02ea6d097
Implement note edition.
Alexandre Segura <mex.zktk@gmail.com>
parents:
79
diff
changeset
|
524 |
|
|
79
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
525 |
renderToolbarButtons = () => { |
|
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
526 |
return ( |
|
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
527 |
<div> |
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
528 |
<button type="button" id="btn-editor" className="btn btn-primary btn-sm text-secondary font-weight-bold float-right" disabled={this.props.isButtonDisabled} onClick={this.onButtonClick}> |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
529 |
{ this.props.note ? 'Sauvegarder' : 'Ajouter' } |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
530 |
</button> |
| 157 | 531 |
{ !this.props.note && this.renderToolbarCheckbox() } |
|
79
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
532 |
</div> |
|
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
533 |
); |
|
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
534 |
} |
|
772b73e31069
Introduce note editing, allow deleting note.
Alexandre Segura <mex.zktk@gmail.com>
parents:
74
diff
changeset
|
535 |
|
| 5 | 536 |
/** |
537 |
* Render a mark-toggling toolbar button. |
|
538 |
* |
|
539 |
* @param {String} type |
|
540 |
* @param {String} icon |
|
541 |
* @return {Element} |
|
542 |
*/ |
|
543 |
||
544 |
renderMarkButton = (type, icon) => { |
|
545 |
const isActive = this.hasMark(type) |
|
546 |
const onMouseDown = e => this.onClickMark(e, type) |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
547 |
const markActivation = "button sticky-top" + ((!isActive)?" text-primary":" text-dark"); |
| 157 | 548 |
|
| 5 | 549 |
return ( |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
550 |
// <span className="button text-primary" onMouseDown={onMouseDown} data-active={isActive}> |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
551 |
<span className={markActivation} onMouseDown={onMouseDown} data-active={isActive}> |
|
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
552 |
|
| 5 | 553 |
<span className="material-icons">{icon}</span> |
554 |
</span> |
|
555 |
) |
|
556 |
} |
|
557 |
||
| 157 | 558 |
// Add a `renderMark` method to render marks. |
559 |
||
560 |
renderMark = props => { |
|
561 |
const { children, mark, attributes } = props |
|
562 |
||
563 |
switch (mark.type) { |
|
564 |
case 'bold': |
|
565 |
return <strong {...attributes}>{children}</strong> |
|
566 |
case 'code': |
|
567 |
return <code {...attributes}>{children}</code> |
|
568 |
case 'italic': |
|
569 |
return <em {...attributes}>{children}</em> |
|
570 |
case 'underlined': |
|
571 |
return <ins {...attributes}>{children}</ins> |
|
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
572 |
default: |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
573 |
return {children}; |
| 157 | 574 |
} |
575 |
} |
|
| 5 | 576 |
/** |
577 |
* Render a block-toggling toolbar button. |
|
578 |
* |
|
579 |
* @param {String} type |
|
580 |
* @param {String} icon |
|
581 |
* @return {Element} |
|
582 |
*/ |
|
583 |
||
584 |
renderBlockButton = (type, icon) => { |
|
| 157 | 585 |
let isActive = this.hasBlock(type) |
586 |
||
587 |
if (['numbered-list', 'bulleted-list'].includes(type)) { |
|
588 |
const { value } = this.state |
|
589 |
const parent = value.document.getParent(value.blocks.first().key) |
|
590 |
isActive = this.hasBlock('list-item') && parent && parent.type === type |
|
591 |
} |
|
| 5 | 592 |
const onMouseDown = e => this.onClickBlock(e, type) |
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
593 |
const blockActivation = "button sticky-top" + ((!isActive)?" text-primary":" text-dark"); |
| 5 | 594 |
|
595 |
return ( |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
596 |
<span className={blockActivation} onMouseDown={onMouseDown} data-active={isActive}> |
| 5 | 597 |
<span className="material-icons">{icon}</span> |
598 |
</span> |
|
599 |
) |
|
600 |
} |
|
601 |
||
| 157 | 602 |
renderNode = props => { |
603 |
const { attributes, children, node } = props |
|
604 |
||
605 |
switch (node.type) { |
|
606 |
case 'block-quote': |
|
607 |
return <blockquote {...attributes}>{children}</blockquote> |
|
608 |
case 'bulleted-list': |
|
609 |
return <ul {...attributes}>{children}</ul> |
|
610 |
case 'heading-one': |
|
611 |
return <h1 {...attributes}>{children}</h1> |
|
612 |
case 'heading-two': |
|
613 |
return <h2 {...attributes}>{children}</h2> |
|
614 |
case 'list-item': |
|
615 |
return <li {...attributes}>{children}</li> |
|
616 |
case 'numbered-list': |
|
617 |
return <ol {...attributes}>{children}</ol> |
|
|
168
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
618 |
default: |
|
ea92f4fe783d
- move SlateEditor and dependencies to its own folder
ymh <ymh.work@gmail.com>
parents:
161
diff
changeset
|
619 |
return null; |
| 157 | 620 |
} |
621 |
} |
|
622 |
||
| 5 | 623 |
/** |
624 |
* Render the Slate editor. |
|
625 |
* |
|
626 |
* @return {Element} |
|
627 |
*/ |
|
628 |
||
629 |
renderEditor = () => { |
|
630 |
return ( |
|
|
159
a4705c2b4544
Add send note options to the editor
salimr <riwad.salim@yahoo.fr>
parents:
157
diff
changeset
|
631 |
<div className="editor-slatejs p-2"> |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
632 |
{this.renderHoveringMenu()} |
| 5 | 633 |
<Editor |
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
634 |
ref="editor" |
| 5 | 635 |
spellCheck |
| 157 | 636 |
placeholder={'Votre espace de prise de note...'} |
| 5 | 637 |
schema={schema} |
|
19
f1b125b95fe9
Introduce "annotation" plugin.
Alexandre Segura <mex.zktk@gmail.com>
parents:
17
diff
changeset
|
638 |
plugins={plugins} |
| 157 | 639 |
value={this.state.value} |
| 5 | 640 |
onChange={this.onChange} |
641 |
onKeyDown={this.onKeyDown} |
|
| 157 | 642 |
renderMark={this.renderMark} |
643 |
renderNode = {this.renderNode} |
|
| 5 | 644 |
/> |
645 |
</div> |
|
646 |
) |
|
647 |
} |
|
648 |
||
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
649 |
renderHoveringMenu = () => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
650 |
return ( |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
651 |
<Portal ref="portal" |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
652 |
isOpened={this.state.isPortalOpen} isOpen={this.state.isPortalOpen} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
653 |
onOpen={this.onPortalOpen} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
654 |
onClose={this.onPortalClose} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
655 |
closeOnOutsideClick={false} closeOnEsc={true}> |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
656 |
<div className="hovering-menu"> |
|
138
a1fb2ced3049
propagate annotations categories from session protocol definition
ymh <ymh.work@gmail.com>
parents:
103
diff
changeset
|
657 |
<CategoriesTooltip categories={this.props.annotationCategories || defaultAnnotationsCategories} onCategoryClick={this.onCategoryClick} /> |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
658 |
</div> |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
659 |
</Portal> |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
660 |
) |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
661 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
662 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
663 |
updateMenu = () => { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
664 |
|
|
62
b2514a9bcd49
migrate to redux-offline + various optimisation
ymh <ymh.work@gmail.com>
parents:
35
diff
changeset
|
665 |
const { hoveringMenu } = this.state |
|
21
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
666 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
667 |
if (!hoveringMenu) return |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
668 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
669 |
// if (state.isBlurred || state.isCollapsed) { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
670 |
// hoveringMenu.removeAttribute('style') |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
671 |
// return |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
672 |
// } |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
673 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
674 |
const selection = window.getSelection() |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
675 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
676 |
if (selection.isCollapsed) { |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
677 |
return |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
678 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
679 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
680 |
const range = selection.getRangeAt(0) |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
681 |
const rect = range.getBoundingClientRect() |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
682 |
|
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
683 |
hoveringMenu.style.opacity = 1 |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
684 |
hoveringMenu.style.top = `${rect.top + window.scrollY + hoveringMenu.offsetHeight}px` |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
685 |
hoveringMenu.style.left = `${rect.left + window.scrollX - hoveringMenu.offsetWidth / 2 + rect.width / 2}px` |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
686 |
} |
|
284e866f55c7
First version of categories tooltip.
Alexandre Segura <mex.zktk@gmail.com>
parents:
19
diff
changeset
|
687 |
|
| 5 | 688 |
} |
689 |
||
690 |
/** |
|
691 |
* Export. |
|
692 |
*/ |
|
693 |
||
|
11
6fb4de54acea
Delete default state, focus on textarea.
Alexandre Segura <mex.zktk@gmail.com>
parents:
8
diff
changeset
|
694 |
export default SlateEditor |