@seafile/sdoc-editor 0.1.153 → 0.1.154

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.
@@ -0,0 +1,14 @@
1
+ export var DIFF_TYPE = {
2
+ ADD: 'add',
3
+ DELETE: 'delete',
4
+ MODIFY: 'modify',
5
+ COMMON: 'common'
6
+ };
7
+ export var DELETED_STYLE = {
8
+ computed_bg_color: '#ffeef0',
9
+ color: 'rgb(165, 32, 21)'
10
+ };
11
+ export var ADDED_STYLE = {
12
+ computed_bg_color: '#e6ffed',
13
+ color: 'rgb(137, 181, 66)'
14
+ };
@@ -14,36 +14,12 @@ export var LIST_ITEM = 'list-item';
14
14
  export var LIST_LIC = 'list-lic'; // placeholder
15
15
  export var CHECK_LIST_ITEM = 'check-list-item';
16
16
  export var PARAGRAPH = 'paragraph';
17
- export var LINK = 'link';
18
- export var HTML = 'html';
19
17
  export var CODE_BLOCK = 'code-block';
20
18
  export var CODE_LINE = 'code-line';
21
- export var IMAGE = 'image';
22
19
  export var TABLE = 'table';
23
20
  export var TABLE_ROW = 'table-row';
24
21
  export var TABLE_CELL = 'table-cell';
25
- export var CLEAR_FORMAT = 'clear-format';
22
+ export var LINK = 'link';
26
23
  export var SDOC_LINK = 'sdoc-link';
27
24
  export var FILE_LINK = 'file_link';
28
-
29
- // text style
30
- export var BOLD = 'bold';
31
- export var ITALIC = 'italic';
32
- export var UNDERLINE = 'underline';
33
- export var STRIKETHROUGH = 'strikethrough';
34
- export var SUPERSCRIPT = 'superscript';
35
- export var SUBSCRIPT = 'subscript';
36
- export var COLOR = 'color';
37
- export var HIGHLIGHT_COLOR = 'highlight-color';
38
- export var TEXT_STYLE = 'text-style';
39
- export var TEXT_STYLE_MORE = 'text-style-more';
40
- export var BOLD_ITALIC = 'bold-italic';
41
- export var TEXT_ALIGN = 'text-align';
42
- export var ALIGN_LEFT = 'align-left';
43
- export var ALIGN_RIGHT = 'align-right';
44
- export var ALIGN_CENTER = 'align-center';
45
-
46
- // font
47
- export var FONT_SIZE = 'font-size';
48
- export var FONT_SIZE_INCREASE = 'font-size-increase';
49
- export var FONT_SIZE_REDUCE = 'font-size-reduce';
25
+ export var IMAGE = 'image';
@@ -1,240 +1,19 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- var _MENUS_CONFIG_MAP, _HEADER_TITLE_MAP;
2
+ var _HEADER_TITLE_MAP;
3
3
  // extension plugin
4
4
  import * as ELEMENT_TYPE from './element-type';
5
- import { BLOCKQUOTE, HEADER, TITLE, SUBTITLE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, CLEAR_FORMAT, COLOR, HIGHLIGHT_COLOR, SDOC_LINK, FILE_LINK } from './element-type';
6
- import { KEYBOARD, MAC_HOTKEYS, WIN_HOTKEYS } from './keyboard';
7
- import { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR } from './color';
8
- import { FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE } from './font';
9
-
10
- // history
11
- export var UNDO = 'undo';
12
- export var REDO = 'redo';
13
-
14
- // remove
15
- export var REMOVE_TABLE = 'remove_table';
16
- export var BG_COLOR = 'bg_color';
17
-
18
- // menus config
19
- export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CONFIG_MAP, BLOCKQUOTE, {
20
- id: "sdoc_".concat(BLOCKQUOTE),
21
- iconClass: 'sdocfont sdoc-quote-left',
22
- text: 'Quote'
23
- }), _defineProperty(_MENUS_CONFIG_MAP, ORDERED_LIST, {
24
- id: ORDERED_LIST,
25
- iconClass: 'sdocfont sdoc-list-ol',
26
- text: 'Ordered_list'
27
- }), _defineProperty(_MENUS_CONFIG_MAP, UNORDERED_LIST, {
28
- id: UNORDERED_LIST,
29
- iconClass: 'sdocfont sdoc-list-ul',
30
- text: 'Unordered_list'
31
- }), _defineProperty(_MENUS_CONFIG_MAP, CHECK_LIST_ITEM, {
32
- id: CHECK_LIST_ITEM,
33
- iconClass: 'sdocfont sdoc-check-square',
34
- text: 'Check_list_item'
35
- }), _defineProperty(_MENUS_CONFIG_MAP, CODE_BLOCK, {
36
- id: CODE_BLOCK,
37
- iconClass: 'sdocfont sdoc-code-block',
38
- text: 'Code_block'
39
- }), _defineProperty(_MENUS_CONFIG_MAP, LINK, {
40
- id: "sdoc_".concat(LINK),
41
- iconClass: 'sdocfont sdoc-link',
42
- text: 'Insert_link'
43
- }), _defineProperty(_MENUS_CONFIG_MAP, IMAGE, {
44
- id: "sdoc_".concat(IMAGE),
45
- iconClass: 'sdocfont sdoc-image',
46
- text: 'Insert_image'
47
- }), _defineProperty(_MENUS_CONFIG_MAP, TABLE, {
48
- id: "sdoc_".concat(TABLE),
49
- iconClass: 'sdocfont sdoc-table',
50
- text: 'Insert_table'
51
- }), _defineProperty(_MENUS_CONFIG_MAP, REMOVE_TABLE, {
52
- id: "sdoc_".concat(REMOVE_TABLE),
53
- iconClass: 'sdocfont sdoc-delete-table',
54
- text: 'Delete_table'
55
- }), _defineProperty(_MENUS_CONFIG_MAP, TEXT_STYLE, [{
56
- id: ITALIC,
57
- iconClass: 'sdocfont sdoc-italic',
58
- text: 'Italic',
59
- type: 'ITALIC'
60
- }, {
61
- id: BOLD,
62
- iconClass: 'sdocfont sdoc-bold',
63
- text: 'Bold',
64
- type: 'BOLD'
65
- }, {
66
- id: UNDERLINE,
67
- iconClass: 'sdocfont sdoc-underline',
68
- text: 'Underline',
69
- type: 'UNDERLINE'
70
- }, {
71
- id: "sdoc-".concat(HIGHLIGHT_COLOR),
72
- iconClass: 'sdocfont sdoc-highlight-color',
73
- text: 'Highlight_color',
74
- type: HIGHLIGHT_COLOR,
75
- isColor: true,
76
- recentUsedColorsKey: RECENT_USED_HIGHLIGHT_COLORS_KEY,
77
- defaultLastUsedColor: DEFAULT_LAST_USED_HIGHLIGHT_COLOR
78
- }, {
79
- id: "sdoc-font-".concat(COLOR),
80
- iconClass: 'sdocfont sdoc-font-color',
81
- text: 'Font_color',
82
- type: COLOR,
83
- defaultColor: DEFAULT_FONT_COLOR,
84
- isColor: true,
85
- recentUsedColorsKey: RECENT_USED_FONT_COLORS_KEY,
86
- defaultLastUsedColor: DEFAULT_LAST_USED_FONT_COLOR
87
- }]), _defineProperty(_MENUS_CONFIG_MAP, TEXT_STYLE_MORE, [
88
- //
89
- {
90
- id: STRIKETHROUGH,
91
- iconClass: 'sdocfont sdoc-strikethrough',
92
- text: 'Strikethrough',
93
- type: 'STRIKETHROUGH'
94
- }, {
95
- id: SUPERSCRIPT,
96
- iconClass: 'sdocfont sdoc-subscripts',
97
- text: 'Superscript',
98
- type: 'SUPERSCRIPT'
99
- }, {
100
- id: SUBSCRIPT,
101
- iconClass: 'sdocfont sdoc-subscripts',
102
- text: 'Subscript',
103
- type: 'SUBSCRIPT'
104
- }]), _defineProperty(_MENUS_CONFIG_MAP, TEXT_ALIGN, [{
105
- id: ALIGN_LEFT,
106
- iconClass: 'sdocfont sdoc-align-left',
107
- type: 'left'
108
- }, {
109
- id: ALIGN_CENTER,
110
- iconClass: 'sdocfont sdoc-align-center',
111
- type: 'center'
112
- }, {
113
- id: ALIGN_RIGHT,
114
- iconClass: 'sdocfont sdoc-align-right',
115
- type: 'right'
116
- }]), _defineProperty(_MENUS_CONFIG_MAP, UNDO, {
117
- id: UNDO,
118
- iconClass: 'sdocfont sdoc-revoke',
119
- text: 'Undo',
120
- type: 'undo'
121
- }), _defineProperty(_MENUS_CONFIG_MAP, REDO, {
122
- id: REDO,
123
- iconClass: 'sdocfont sdoc-redo',
124
- text: 'Redo',
125
- type: 'redo'
126
- }), _defineProperty(_MENUS_CONFIG_MAP, BG_COLOR, {
127
- id: "sdoc_".concat(BG_COLOR),
128
- iconClass: 'sdocfont sdoc-bg-color',
129
- text: 'Background_color'
130
- }), _defineProperty(_MENUS_CONFIG_MAP, CLEAR_FORMAT, {
131
- id: "sdoc_".concat(CLEAR_FORMAT),
132
- iconClass: 'sdocfont sdoc-format-clear',
133
- text: 'Clear_format'
134
- }), _defineProperty(_MENUS_CONFIG_MAP, SDOC_LINK, {
135
- id: "sdoc_".concat(SDOC_LINK),
136
- iconClass: 'sdocfont sdoc-document',
137
- text: 'Link_sdoc'
138
- }), _defineProperty(_MENUS_CONFIG_MAP, FILE_LINK, {
139
- id: "sdoc_".concat(FILE_LINK),
140
- iconClass: 'sdocfont sdoc-link-file',
141
- text: 'Link_file'
142
- }), _MENUS_CONFIG_MAP);
5
+ import { BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE } from './element-type';
6
+ export { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR } from './color';
7
+ export { FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE } from './font';
8
+ export { DIFF_TYPE, ADDED_STYLE, DELETED_STYLE } from './diff-view';
9
+ export { KEYBOARD, MAC_HOTKEYS, WIN_HOTKEYS } from './keyboard';
10
+ export { UNDO, REDO, TEXT_STYLE, TEXT_STYLE_MAP, TEXT_STYLE_MORE, TEXT_ALIGN, REMOVE_TABLE, BG_COLOR, CLEAR_FORMAT, MENUS_CONFIG_MAP, SIDE_MENUS_CONFIG } from './menus-config';
143
11
  export var HEADERS = [HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6];
144
12
  export var HEADER_TITLE_MAP = (_HEADER_TITLE_MAP = {}, _defineProperty(_HEADER_TITLE_MAP, TITLE, 'Title'), _defineProperty(_HEADER_TITLE_MAP, SUBTITLE, 'Subtitle'), _defineProperty(_HEADER_TITLE_MAP, HEADER1, 'Header_one'), _defineProperty(_HEADER_TITLE_MAP, HEADER2, 'Header_two'), _defineProperty(_HEADER_TITLE_MAP, HEADER3, 'Header_three'), _defineProperty(_HEADER_TITLE_MAP, HEADER4, 'Header_four'), _defineProperty(_HEADER_TITLE_MAP, HEADER5, 'Header_five'), _defineProperty(_HEADER_TITLE_MAP, HEADER6, 'Header_six'), _defineProperty(_HEADER_TITLE_MAP, PARAGRAPH, 'Paragraph'), _HEADER_TITLE_MAP);
145
- export var DIFF_TYPE = {
146
- ADD: 'add',
147
- DELETE: 'delete',
148
- MODIFY: 'modify',
149
- COMMON: 'common'
150
- };
151
- export var STYLE_KEY = {
152
- TEXT_ALIGN: 'textAlign',
153
- BG_COLOR: 'bg_color'
154
- };
155
- export var DELETED_STYLE = {
156
- computed_bg_color: '#ffeef0',
157
- color: 'rgb(165, 32, 21)'
158
- };
159
- export var ADDED_STYLE = {
160
- computed_bg_color: '#e6ffed',
161
- color: 'rgb(137, 181, 66)'
162
- };
163
13
  export var LIST_TYPE_ARRAY = ['unordered_list', 'ordered_list'];
164
14
  export var TRANSPARENT = 'transparent';
165
15
  export var CLIPBOARD_FORMAT_KEY = 'x-slate-fragment';
166
16
  export var INSERT_FILE_DISPLAY_TYPE = ['text_link', 'icon_link', 'card_link'];
167
- export var SIDE_MENUS_CONFIG = [{
168
- id: PARAGRAPH,
169
- iconClass: 'sdocfont sdoc-text',
170
- type: PARAGRAPH,
171
- text: 'Paragraph'
172
- }, {
173
- id: HEADER1,
174
- iconClass: 'sdocfont sdoc-header1',
175
- type: HEADER1,
176
- text: 'Header_one'
177
- }, {
178
- id: HEADER2,
179
- iconClass: 'sdocfont sdoc-header2',
180
- type: HEADER2,
181
- text: 'Header_two'
182
- }, {
183
- id: HEADER3,
184
- iconClass: 'sdocfont sdoc-header3',
185
- type: HEADER3,
186
- text: 'Header_three'
187
- }, {
188
- id: HEADER4,
189
- iconClass: 'sdocfont sdoc-header4',
190
- type: HEADER4,
191
- text: 'Header_four'
192
- }, {
193
- id: HEADER5,
194
- iconClass: 'sdocfont sdoc-header5',
195
- type: HEADER5,
196
- text: 'Header_five'
197
- }, {
198
- id: HEADER6,
199
- iconClass: 'sdocfont sdoc-header6',
200
- type: HEADER6,
201
- text: 'Header_six'
202
- }, {
203
- id: UNORDERED_LIST,
204
- iconClass: 'sdocfont sdoc-list-ul',
205
- type: UNORDERED_LIST,
206
- text: 'Unordered_list'
207
- }, {
208
- id: ORDERED_LIST,
209
- iconClass: 'sdocfont sdoc-list-ol',
210
- type: ORDERED_LIST,
211
- text: 'Ordered_list'
212
- }, {
213
- id: CHECK_LIST_ITEM,
214
- iconClass: 'sdocfont sdoc-check-square',
215
- type: CHECK_LIST_ITEM,
216
- text: 'Check_list_item'
217
- }, {
218
- id: ALIGN_LEFT,
219
- iconClass: 'sdocfont sdoc-align-left',
220
- type: 'left',
221
- text: 'Left'
222
- }, {
223
- id: ALIGN_CENTER,
224
- iconClass: 'sdocfont sdoc-align-center',
225
- type: 'center',
226
- text: 'Center'
227
- }, {
228
- id: ALIGN_RIGHT,
229
- iconClass: 'sdocfont sdoc-align-right',
230
- type: 'right',
231
- text: 'Right'
232
- }, {
233
- id: BLOCKQUOTE,
234
- iconClass: 'sdocfont sdoc-quote1',
235
- type: BLOCKQUOTE,
236
- text: 'Quote'
237
- }];
238
17
  export var INSERT_POSITION = {
239
18
  BEFORE: 'before',
240
19
  CURRENT: 'current',
@@ -243,4 +22,4 @@ export var INSERT_POSITION = {
243
22
  export var LOCAL_IMAGE = 'local-image';
244
23
  export var LIST_ITEM_CORRELATION_TYPE = ['unordered_list', 'ordered_list', 'list-item'];
245
24
  export var LIST_ITEM_SUPPORTED_TRANSFORMATION = ['unordered_list', 'ordered_list', 'left', 'center', 'right', 'blockquote'];
246
- export { BLOCKQUOTE, HEADER, TITLE, SUBTITLE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ELEMENT_TYPE, KEYBOARD, MAC_HOTKEYS, WIN_HOTKEYS, DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_LIST, CLEAR_FORMAT, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR, FONT_SIZE, DEFAULT_FONT, FONT, GOOGLE_FONT_CLASS, RECENT_USED_FONTS_KEY, SDOC_FONT_SIZE, SDOC_LINK, FILE_LINK };
25
+ export { ELEMENT_TYPE, BLOCKQUOTE, TITLE, SUBTITLE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST_ITEM, CODE_BLOCK, CODE_LINE, TABLE, TABLE_CELL, TABLE_ROW, LINK, SDOC_LINK, FILE_LINK, IMAGE };
@@ -0,0 +1,234 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ var _MENUS_CONFIG_MAP;
3
+ import { RECENT_USED_HIGHLIGHT_COLORS_KEY, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, RECENT_USED_FONT_COLORS_KEY, DEFAULT_FONT_COLOR, DEFAULT_LAST_USED_FONT_COLOR } from './color';
4
+ import { BLOCKQUOTE, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, ORDERED_LIST, UNORDERED_LIST, CHECK_LIST_ITEM, CODE_BLOCK, LINK, IMAGE, TABLE, SDOC_LINK, FILE_LINK, PARAGRAPH } from './element-type';
5
+ export var UNDO = 'undo';
6
+ export var REDO = 'redo';
7
+ export var CLEAR_FORMAT = 'clear_format';
8
+ export var REMOVE_TABLE = 'remove_table';
9
+ export var BG_COLOR = 'bg_color';
10
+
11
+ // text style
12
+ var ITALIC = 'italic';
13
+ var BOLD = 'bold';
14
+ var UNDERLINE = 'underline';
15
+ var HIGHLIGHT_COLOR = 'highlight-color';
16
+ var COLOR = 'color';
17
+ export var TEXT_STYLE = 'text_style';
18
+ export var TEXT_STYLE_MAP = {
19
+ ITALIC: ITALIC,
20
+ BOLD: BOLD,
21
+ BOLD_ITALIC: "".concat(BOLD, "-").concat(ITALIC),
22
+ COLOR: COLOR
23
+ };
24
+
25
+ // text-align
26
+ export var TEXT_ALIGN = 'text_align';
27
+ var ALIGN_LEFT = 'align_left';
28
+ var ALIGN_RIGHT = 'align_right';
29
+ var ALIGN_CENTER = 'align_center';
30
+ export var TEXT_STYLE_MORE = 'text_style_more';
31
+ var STRIKETHROUGH = 'strikethrough';
32
+ var SUPERSCRIPT = 'superscript';
33
+ var SUBSCRIPT = 'subscript';
34
+ // const FONT_SIZE_INCREASE = 'font-size-increase';
35
+ // const FONT_SIZE_REDUCE = 'font-size-reduce';
36
+
37
+ // header menu config
38
+ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CONFIG_MAP, BLOCKQUOTE, {
39
+ id: "sdoc_".concat(BLOCKQUOTE),
40
+ iconClass: 'sdocfont sdoc-quote-left',
41
+ text: 'Quote'
42
+ }), _defineProperty(_MENUS_CONFIG_MAP, ORDERED_LIST, {
43
+ id: ORDERED_LIST,
44
+ iconClass: 'sdocfont sdoc-list-ol',
45
+ text: 'Ordered_list'
46
+ }), _defineProperty(_MENUS_CONFIG_MAP, UNORDERED_LIST, {
47
+ id: UNORDERED_LIST,
48
+ iconClass: 'sdocfont sdoc-list-ul',
49
+ text: 'Unordered_list'
50
+ }), _defineProperty(_MENUS_CONFIG_MAP, CHECK_LIST_ITEM, {
51
+ id: CHECK_LIST_ITEM,
52
+ iconClass: 'sdocfont sdoc-check-square',
53
+ text: 'Check_list_item'
54
+ }), _defineProperty(_MENUS_CONFIG_MAP, CODE_BLOCK, {
55
+ id: CODE_BLOCK,
56
+ iconClass: 'sdocfont sdoc-code-block',
57
+ text: 'Code_block'
58
+ }), _defineProperty(_MENUS_CONFIG_MAP, LINK, {
59
+ id: "sdoc_".concat(LINK),
60
+ iconClass: 'sdocfont sdoc-link',
61
+ text: 'Insert_link'
62
+ }), _defineProperty(_MENUS_CONFIG_MAP, IMAGE, {
63
+ id: "sdoc_".concat(IMAGE),
64
+ iconClass: 'sdocfont sdoc-image',
65
+ text: 'Insert_image'
66
+ }), _defineProperty(_MENUS_CONFIG_MAP, TABLE, {
67
+ id: "sdoc_".concat(TABLE),
68
+ iconClass: 'sdocfont sdoc-table',
69
+ text: 'Insert_table'
70
+ }), _defineProperty(_MENUS_CONFIG_MAP, REMOVE_TABLE, {
71
+ id: "sdoc_".concat(REMOVE_TABLE),
72
+ iconClass: 'sdocfont sdoc-delete-table',
73
+ text: 'Delete_table'
74
+ }), _defineProperty(_MENUS_CONFIG_MAP, TEXT_STYLE, [{
75
+ id: ITALIC,
76
+ iconClass: 'sdocfont sdoc-italic',
77
+ text: 'Italic',
78
+ type: 'ITALIC'
79
+ }, {
80
+ id: BOLD,
81
+ iconClass: 'sdocfont sdoc-bold',
82
+ text: 'Bold',
83
+ type: 'BOLD'
84
+ }, {
85
+ id: UNDERLINE,
86
+ iconClass: 'sdocfont sdoc-underline',
87
+ text: 'Underline',
88
+ type: 'UNDERLINE'
89
+ }, {
90
+ id: "sdoc-".concat(HIGHLIGHT_COLOR),
91
+ iconClass: 'sdocfont sdoc-highlight-color',
92
+ text: 'Highlight_color',
93
+ type: HIGHLIGHT_COLOR,
94
+ isColor: true,
95
+ recentUsedColorsKey: RECENT_USED_HIGHLIGHT_COLORS_KEY,
96
+ defaultLastUsedColor: DEFAULT_LAST_USED_HIGHLIGHT_COLOR
97
+ }, {
98
+ id: "sdoc-font-".concat(COLOR),
99
+ iconClass: 'sdocfont sdoc-font-color',
100
+ text: 'Font_color',
101
+ type: COLOR,
102
+ defaultColor: DEFAULT_FONT_COLOR,
103
+ isColor: true,
104
+ recentUsedColorsKey: RECENT_USED_FONT_COLORS_KEY,
105
+ defaultLastUsedColor: DEFAULT_LAST_USED_FONT_COLOR
106
+ }]), _defineProperty(_MENUS_CONFIG_MAP, TEXT_STYLE_MORE, [
107
+ //
108
+ {
109
+ id: STRIKETHROUGH,
110
+ iconClass: 'sdocfont sdoc-strikethrough',
111
+ text: 'Strikethrough',
112
+ type: 'STRIKETHROUGH'
113
+ }, {
114
+ id: SUPERSCRIPT,
115
+ iconClass: 'sdocfont sdoc-subscripts',
116
+ text: 'Superscript',
117
+ type: 'SUPERSCRIPT'
118
+ }, {
119
+ id: SUBSCRIPT,
120
+ iconClass: 'sdocfont sdoc-subscripts',
121
+ text: 'Subscript',
122
+ type: 'SUBSCRIPT'
123
+ }]), _defineProperty(_MENUS_CONFIG_MAP, TEXT_ALIGN, [{
124
+ id: ALIGN_LEFT,
125
+ iconClass: 'sdocfont sdoc-align-left',
126
+ type: 'left'
127
+ }, {
128
+ id: ALIGN_CENTER,
129
+ iconClass: 'sdocfont sdoc-align-center',
130
+ type: 'center'
131
+ }, {
132
+ id: ALIGN_RIGHT,
133
+ iconClass: 'sdocfont sdoc-align-right',
134
+ type: 'right'
135
+ }]), _defineProperty(_MENUS_CONFIG_MAP, UNDO, {
136
+ id: UNDO,
137
+ iconClass: 'sdocfont sdoc-revoke',
138
+ text: 'Undo',
139
+ type: 'undo'
140
+ }), _defineProperty(_MENUS_CONFIG_MAP, REDO, {
141
+ id: REDO,
142
+ iconClass: 'sdocfont sdoc-redo',
143
+ text: 'Redo',
144
+ type: 'redo'
145
+ }), _defineProperty(_MENUS_CONFIG_MAP, BG_COLOR, {
146
+ id: "sdoc_".concat(BG_COLOR),
147
+ iconClass: 'sdocfont sdoc-bg-color',
148
+ text: 'Background_color'
149
+ }), _defineProperty(_MENUS_CONFIG_MAP, CLEAR_FORMAT, {
150
+ id: "sdoc_".concat(CLEAR_FORMAT),
151
+ iconClass: 'sdocfont sdoc-format-clear',
152
+ text: 'Clear_format'
153
+ }), _defineProperty(_MENUS_CONFIG_MAP, SDOC_LINK, {
154
+ id: "sdoc_".concat(SDOC_LINK),
155
+ iconClass: 'sdocfont sdoc-document',
156
+ text: 'Link_sdoc'
157
+ }), _defineProperty(_MENUS_CONFIG_MAP, FILE_LINK, {
158
+ id: "sdoc_".concat(FILE_LINK),
159
+ iconClass: 'sdocfont sdoc-link-file',
160
+ text: 'Link_file'
161
+ }), _MENUS_CONFIG_MAP);
162
+
163
+ // side menu config
164
+ export var SIDE_MENUS_CONFIG = [{
165
+ id: PARAGRAPH,
166
+ iconClass: 'sdocfont sdoc-text',
167
+ type: PARAGRAPH,
168
+ text: 'Paragraph'
169
+ }, {
170
+ id: HEADER1,
171
+ iconClass: 'sdocfont sdoc-header1',
172
+ type: HEADER1,
173
+ text: 'Header_one'
174
+ }, {
175
+ id: HEADER2,
176
+ iconClass: 'sdocfont sdoc-header2',
177
+ type: HEADER2,
178
+ text: 'Header_two'
179
+ }, {
180
+ id: HEADER3,
181
+ iconClass: 'sdocfont sdoc-header3',
182
+ type: HEADER3,
183
+ text: 'Header_three'
184
+ }, {
185
+ id: HEADER4,
186
+ iconClass: 'sdocfont sdoc-header4',
187
+ type: HEADER4,
188
+ text: 'Header_four'
189
+ }, {
190
+ id: HEADER5,
191
+ iconClass: 'sdocfont sdoc-header5',
192
+ type: HEADER5,
193
+ text: 'Header_five'
194
+ }, {
195
+ id: HEADER6,
196
+ iconClass: 'sdocfont sdoc-header6',
197
+ type: HEADER6,
198
+ text: 'Header_six'
199
+ }, {
200
+ id: UNORDERED_LIST,
201
+ iconClass: 'sdocfont sdoc-list-ul',
202
+ type: UNORDERED_LIST,
203
+ text: 'Unordered_list'
204
+ }, {
205
+ id: ORDERED_LIST,
206
+ iconClass: 'sdocfont sdoc-list-ol',
207
+ type: ORDERED_LIST,
208
+ text: 'Ordered_list'
209
+ }, {
210
+ id: CHECK_LIST_ITEM,
211
+ iconClass: 'sdocfont sdoc-check-square',
212
+ type: CHECK_LIST_ITEM,
213
+ text: 'Check_list_item'
214
+ }, {
215
+ id: ALIGN_LEFT,
216
+ iconClass: 'sdocfont sdoc-align-left',
217
+ type: 'left',
218
+ text: 'Left'
219
+ }, {
220
+ id: ALIGN_CENTER,
221
+ iconClass: 'sdocfont sdoc-align-center',
222
+ type: 'center',
223
+ text: 'Center'
224
+ }, {
225
+ id: ALIGN_RIGHT,
226
+ iconClass: 'sdocfont sdoc-align-right',
227
+ type: 'right',
228
+ text: 'Right'
229
+ }, {
230
+ id: BLOCKQUOTE,
231
+ iconClass: 'sdocfont sdoc-quote1',
232
+ type: BLOCKQUOTE,
233
+ text: 'Quote'
234
+ }];
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { Editor, Transforms, Range } from '@seafile/slate';
3
3
  import { toggleList } from '../list/transforms';
4
4
  import { getSelectedNodeByType } from '../../core';
5
- import { HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, UNORDERED_LIST, BLOCKQUOTE, BOLD, ITALIC, BOLD_ITALIC } from '../../constants';
5
+ import { HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, UNORDERED_LIST, BLOCKQUOTE, TEXT_STYLE_MAP } from '../../constants';
6
6
  var KEY_TO_TYPE_FOR_SPACE = {
7
7
  // Title shortcut
8
8
  '#': HEADER1,
@@ -19,9 +19,9 @@ var KEY_TO_TYPE_FOR_SPACE = {
19
19
  };
20
20
  var KEY_TO_INLINE_TYPE_FOR_SPACE = {
21
21
  // Inline shortcut keys
22
- '**': BOLD,
23
- '*': ITALIC,
24
- '***': BOLD_ITALIC
22
+ '**': TEXT_STYLE_MAP.BOLD,
23
+ '*': TEXT_STYLE_MAP.ITALIC,
24
+ '***': TEXT_STYLE_MAP.BOLD_ITALIC
25
25
  };
26
26
  var getBeforeText = function getBeforeText(editor) {
27
27
  var selection = editor.selection;
@@ -76,7 +76,7 @@ var withMarkDown = function withMarkDown(editor) {
76
76
  var italicType = KEY_TO_INLINE_TYPE_FOR_SPACE[beforeText.slice(-1)];
77
77
  var italicAndBoldType = KEY_TO_INLINE_TYPE_FOR_SPACE[beforeText.slice(-3)];
78
78
  if (!type && !boldType && !italicType && !italicAndBoldType) return insertText(text);
79
- if (italicAndBoldType === BOLD_ITALIC) {
79
+ if (italicAndBoldType === TEXT_STYLE_MAP.BOLD_ITALIC) {
80
80
  var restStr = beforeText === null || beforeText === void 0 ? void 0 : beforeText.slice(0, beforeText.length - 3);
81
81
  var startOffset = restStr === null || restStr === void 0 ? void 0 : restStr.lastIndexOf('***');
82
82
  var endOffset = (beforeText === null || beforeText === void 0 ? void 0 : beforeText.lastIndexOf('***')) + 3;
@@ -97,7 +97,7 @@ var withMarkDown = function withMarkDown(editor) {
97
97
  return insertText(newText);
98
98
  }
99
99
  }
100
- if (boldType === BOLD) {
100
+ if (boldType === TEXT_STYLE_MAP.BOLD) {
101
101
  var _restStr = beforeText.slice(0, beforeText.length - 2);
102
102
  var _startOffset = _restStr.lastIndexOf('**');
103
103
  var _endOffset = beforeText.lastIndexOf('**') + 2;
@@ -119,7 +119,7 @@ var withMarkDown = function withMarkDown(editor) {
119
119
  Editor.addMark(editor, newType, true);
120
120
  return insertText(_newText);
121
121
  }
122
- if (italicType === ITALIC) {
122
+ if (italicType === TEXT_STYLE_MAP.ITALIC) {
123
123
  var _restStr2 = beforeText === null || beforeText === void 0 ? void 0 : beforeText.slice(0, beforeText.length - 1);
124
124
  var _startOffset2 = _restStr2 === null || _restStr2 === void 0 ? void 0 : _restStr2.lastIndexOf('*');
125
125
  var _endOffset2 = (beforeText === null || beforeText === void 0 ? void 0 : beforeText.lastIndexOf('*')) + 1;
@@ -21,4 +21,8 @@ export var TABLE_ELEMENT_POSITION = {
21
21
  AFTER: 'after',
22
22
  BEFORE: 'before'
23
23
  };
24
- export var SELECTED_TABLE_CELL_BG_COLOR = '#dee8fe';
24
+ export var SELECTED_TABLE_CELL_BG_COLOR = '#dee8fe';
25
+ export var STYLE_KEY = {
26
+ TEXT_ALIGN: 'textAlign',
27
+ BG_COLOR: 'bg_color'
28
+ };
@@ -4,10 +4,9 @@ import classnames from 'classnames';
4
4
  import { useSlateStatic, useReadOnly } from '@seafile/slate-react';
5
5
  import { Transforms } from '@seafile/slate';
6
6
  import ObjectUtils from '../../../../utils/object-utils';
7
- import { STYLE_KEY } from '../../../constants';
8
7
  import { findPath, focusEditor } from '../../../core';
9
8
  import { useResizeHandlersContext, useTableSelectedRangeContext } from './hooks';
10
- import { EMPTY_SELECTED_RANGE, SELECTED_TABLE_CELL_BG_COLOR } from '../constants';
9
+ import { EMPTY_SELECTED_RANGE, SELECTED_TABLE_CELL_BG_COLOR, STYLE_KEY } from '../constants';
11
10
  import { getTableColumns, getCellColumn, colorBlend } from '../helpers';
12
11
  var TableCell = function TableCell(_ref) {
13
12
  var attributes = _ref.attributes,
@@ -86,7 +85,7 @@ function renderTableCell(props) {
86
85
 
87
86
  // const cellValue = element;
88
87
  var style = attributes.style || {};
89
- if (ObjectUtils.hasProperty(element, STYLE_KEY.TEXT_ALIGN)) {
88
+ if (ObjectUtils.hasProperty(element.style, STYLE_KEY.TEXT_ALIGN)) {
90
89
  style[STYLE_KEY.TEXT_ALIGN] = element[STYLE_KEY.TEXT_ALIGN];
91
90
  }
92
91
  if (ObjectUtils.hasProperty(element.style, STYLE_KEY.BG_COLOR) && element.style[STYLE_KEY.BG_COLOR]) {
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
2
  import { Editor, Transforms, Element } from '@seafile/slate';
3
- import { TEXT_ALIGN, MENUS_CONFIG_MAP, CODE_BLOCK, TABLE } from '../../constants';
3
+ import { CODE_BLOCK, TABLE } from '../../constants';
4
4
  export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
5
5
  if (readonly) return true;
6
6
  if (!editor.selection) return true;
@@ -15,13 +15,13 @@ export var isMenuDisabled = function isMenuDisabled(editor, readonly) {
15
15
  match = _Editor$nodes2[0];
16
16
  var elementType = match[0].type;
17
17
  // at present, TABLE got its own 'text align'
18
- if (elementType == CODE_BLOCK || elementType == TABLE) {
18
+ if (elementType === CODE_BLOCK || elementType === TABLE) {
19
19
  return true;
20
20
  }
21
21
  return false;
22
22
  };
23
23
  export var getAlignType = function getAlignType(editor) {
24
- var defaultType = MENUS_CONFIG_MAP[TEXT_ALIGN][0].type;
24
+ var defaultType = 'left';
25
25
  var selection = editor.selection;
26
26
  if (!selection) {
27
27
  return defaultType;
@@ -2,7 +2,7 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import React, { useCallback } from 'react';
3
3
  import { withTranslation } from 'react-i18next';
4
4
  import { Editor } from '@seafile/slate';
5
- import { TEXT_STYLE, TEXT_STYLE_MORE, MENUS_CONFIG_MAP, ELEMENT_TYPE } from '../../../constants';
5
+ import { TEXT_STYLE, TEXT_STYLE_MAP, TEXT_STYLE_MORE, MENUS_CONFIG_MAP } from '../../../constants';
6
6
  import { focusEditor } from '../../../core';
7
7
  import { MenuItem, ColorMenu, MoreDropdown } from '../../../commons';
8
8
  import { getFontSize, setFontSize } from '../../font/helpers';
@@ -82,9 +82,9 @@ var TextStyleMenuList = function TextStyleMenuList(_ref) {
82
82
  itemProps['setColor'] = function (color) {
83
83
  return setColor(item.type, color);
84
84
  };
85
- itemProps['defaultColorTip'] = item.type === ELEMENT_TYPE.COLOR ? t('Default') : '';
86
- itemProps['lastUsedColor'] = item.type === ELEMENT_TYPE.COLOR ? lastUsedFontColor : lastUsedHighlightColor;
87
- itemProps['updateLastUsedColor'] = item.type === ELEMENT_TYPE.COLOR ? updateLastUsedFontColor : updateLastUsedHighlightColor;
85
+ itemProps['defaultColorTip'] = item.type === TEXT_STYLE_MAP.COLOR ? t('Default') : '';
86
+ itemProps['lastUsedColor'] = item.type === TEXT_STYLE_MAP.COLOR ? lastUsedFontColor : lastUsedHighlightColor;
87
+ itemProps['updateLastUsedColor'] = item.type === TEXT_STYLE_MAP.COLOR ? updateLastUsedFontColor : updateLastUsedHighlightColor;
88
88
  }
89
89
  return _objectSpread(_objectSpread(_objectSpread({}, itemProps), item), {}, {
90
90
  id: idPrefix ? "".concat(idPrefix, "_").concat(item.id) : item.id
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.153",
3
+ "version": "0.1.154",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",