forked from slab/quill
-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathquill.js
113 lines (93 loc) · 3.42 KB
/
quill.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
import './polyfills';
import Quill from './core';
import { AlignClass, AlignStyle } from './formats/align';
import {
DirectionAttribute,
DirectionClass,
DirectionStyle,
} from './formats/direction';
import Indent from './formats/indent';
import Blockquote from './formats/blockquote';
import Header from './formats/header';
import List from './formats/list';
import { BackgroundClass, BackgroundStyle } from './formats/background';
import { ColorClass, ColorStyle } from './formats/color';
import { FontClass, FontStyle } from './formats/font';
import { SizeClass, SizeStyle } from './formats/size';
import Bold from './formats/bold';
import Italic from './formats/italic';
import Link from './formats/link';
import Script from './formats/script';
import Strike from './formats/strike';
import Underline from './formats/underline';
import Formula from './formats/formula';
import Image from './formats/image';
import Video from './formats/video';
import CodeBlock, { Code as InlineCode } from './formats/code';
import Syntax from './modules/syntax';
import Table from './modules/table';
import Multiline from './modules/multiline';
import TableLite from './modules/table/lite';
import { TABLE_CELL_ATTR_ATTRIBUTORS, TABLE_CELL_STYLE_ATTRIBUTORS } from './formats/table/attributors/cell';
import { TABLE_STYLE_ATTRIBUTORS, TABLE_ATTR_ATTRIBUTORS } from './formats/table/attributors/table';
function registerAttributorArray(path, attributorArray) {
return attributorArray.reduce((result, attributor) => {
const key = `${path}${attributor.attrName}`;
result[key] = attributor;
return result;
}, {});
}
Quill.register(
{
'attributors/attribute/direction': DirectionAttribute,
...registerAttributorArray('attributors/attribute/', TABLE_ATTR_ATTRIBUTORS),
...registerAttributorArray('attributors/attribute/', TABLE_CELL_ATTR_ATTRIBUTORS),
'attributors/class/align': AlignClass,
'attributors/class/background': BackgroundClass,
'attributors/class/color': ColorClass,
'attributors/class/direction': DirectionClass,
'attributors/class/font': FontClass,
'attributors/class/size': SizeClass,
'attributors/style/align': AlignStyle,
'attributors/style/background': BackgroundStyle,
'attributors/style/color': ColorStyle,
'attributors/style/direction': DirectionStyle,
'attributors/style/font': FontStyle,
'attributors/style/size': SizeStyle,
...registerAttributorArray('attributors/style/', TABLE_STYLE_ATTRIBUTORS),
...registerAttributorArray('attributors/style/', TABLE_CELL_STYLE_ATTRIBUTORS),
},
true,
);
Quill.register(
{
'formats/align': AlignClass,
'formats/direction': DirectionClass,
'formats/indent': Indent,
'formats/background': BackgroundStyle,
'formats/color': ColorStyle,
'formats/font': FontClass,
'formats/size': SizeClass,
'formats/blockquote': Blockquote,
'formats/code-block': CodeBlock,
'formats/header': Header,
'formats/list': List,
'formats/bold': Bold,
'formats/code': InlineCode,
'formats/italic': Italic,
'formats/link': Link,
'formats/script': Script,
'formats/strike': Strike,
'formats/underline': Underline,
'formats/formula': Formula,
'formats/image': Image,
'formats/video': Video,
'tableModules/lite': TableLite,
'tableModules/main': Table,
'modules/syntax': Syntax,
'modules/multiline': Multiline,
'modules/table': Table,
},
true,
);
export default Quill;