This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
content.js
68 lines (64 loc) · 1.8 KB
/
content.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/**
* Copyright (c) 2013-present, Facebook, Inc. All rights reserved.
*
* This file provided by Facebook is for non-commercial testing and evaluation
* purposes only. Facebook reserves all rights not expressly granted.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import {convertFromRaw} from 'draft-js';
var rawContent = {
blocks: [
{
text: 'This is a Draft-based editor that supports TeX rendering.',
type: 'unstyled',
},
{
text: '',
type: 'unstyled',
},
{
text: (
'Each TeX block below is represented as a DraftEntity object and ' +
'rendered using Khan Academy\'s KaTeX library.'
),
type: 'unstyled',
},
{
text: '',
type: 'unstyled',
},
{
text: 'Click any TeX block to edit.',
type: 'unstyled',
},
{
text: ' ',
type: 'media',
entityRanges: [{offset: 0, length: 1, key: 'first'}],
},
{
text: 'You can also insert a new TeX block at the cursor location.',
type: 'unstyled',
},
],
entityMap: {
first: {
type: 'TOKEN',
mutability: 'IMMUTABLE',
data: {
content: (
'\\left( \\sum_{k=1}^n a_k b_k \\right)^{\\!\\!2} \\leq\n' +
'\\left( \\sum_{k=1}^n a_k^2 \\right)\n' +
'\\left( \\sum_{k=1}^n b_k^2 \\right)'
),
},
}
}
};
export var content = convertFromRaw(rawContent);