@seafile/sdoc-editor 1.0.50 → 1.0.52
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.
- package/dist/basic-sdk/comment/components/comment-item-content.js +3 -3
- package/dist/basic-sdk/comment/components/comment-item-wrapper.js +6 -5
- package/dist/basic-sdk/comment/components/comment-list.js +3 -3
- package/dist/basic-sdk/comment/components/global-comment/index.js +3 -3
- package/dist/basic-sdk/comment/provider/comment-context-provider.js +3 -2
- package/dist/basic-sdk/comment/provider/notification-context-provider.js +3 -2
- package/dist/basic-sdk/comment/reducer/comment-reducer.js +50 -24
- package/dist/basic-sdk/comment/reducer/notification-reducer.js +9 -7
- package/dist/basic-sdk/cursor/helper.js +11 -4
- package/dist/basic-sdk/editor/comment-article.js +3 -3
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +5 -4
- package/dist/basic-sdk/editor/sdoc-editor.js +5 -4
- package/dist/basic-sdk/editor/wiki-editor.js +5 -4
- package/dist/basic-sdk/extension/commons/file-insert-dialog/index.js +7 -6
- package/dist/basic-sdk/extension/commons/select/field-setting.js +6 -5
- package/dist/basic-sdk/extension/commons/select-file-dialog/index.js +6 -4
- package/dist/basic-sdk/extension/core/queries/index.js +21 -20
- package/dist/basic-sdk/extension/core/transforms/remove-node-children.js +3 -3
- package/dist/basic-sdk/extension/core/transforms/replace-node.js +13 -9
- package/dist/basic-sdk/extension/core/transforms/update-parent-node.js +3 -2
- package/dist/basic-sdk/extension/core/utils/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/blockquote/helpers.js +3 -3
- package/dist/basic-sdk/extension/plugins/blockquote/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/check-list/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/clear-format/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/code-block/plugin.js +6 -3
- package/dist/basic-sdk/extension/plugins/code-block/render-elem.js +3 -3
- package/dist/basic-sdk/extension/plugins/file-link/render-elem.js +6 -3
- package/dist/basic-sdk/extension/plugins/header/render-elem.js +16 -11
- package/dist/basic-sdk/extension/plugins/image/helpers.js +9 -7
- package/dist/basic-sdk/extension/plugins/image/hover-menu/index.js +7 -3
- package/dist/basic-sdk/extension/plugins/image/menu/index.js +7 -7
- package/dist/basic-sdk/extension/plugins/image/plugin.js +2 -2
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +15 -8
- package/dist/basic-sdk/extension/plugins/link/helpers.js +3 -3
- package/dist/basic-sdk/extension/plugins/link/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/list/menu/index.js +4 -5
- package/dist/basic-sdk/extension/plugins/list/plugin/on-tab-handle.js +6 -3
- package/dist/basic-sdk/extension/plugins/list/transforms/insert-list-item.js +4 -2
- package/dist/basic-sdk/extension/plugins/list/transforms/toggle-list.js +6 -4
- package/dist/basic-sdk/extension/plugins/markdown/plugin.js +17 -6
- package/dist/basic-sdk/extension/plugins/mention/plugin.js +6 -5
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +4 -4
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +3 -2
- package/dist/basic-sdk/extension/plugins/sdoc-link/render/render-elem.js +6 -3
- package/dist/basic-sdk/extension/plugins/search-replace/helper.js +6 -5
- package/dist/basic-sdk/extension/plugins/seatable-column/helpers.js +6 -3
- package/dist/basic-sdk/extension/plugins/seatable-column/render-elem.js +6 -6
- package/dist/basic-sdk/extension/plugins/seatable-tables/helpers.js +3 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/index.css +23 -1
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/record-header.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/render-element/seatable-table.js +8 -7
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/_department-utils.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/department-filter/department-single-select.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/filter-popover-widgets/rate-item/index.js +3 -3
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.js +4 -2
- package/dist/basic-sdk/extension/plugins/table/helpers.js +32 -16
- package/dist/basic-sdk/extension/plugins/table/plugin.js +6 -5
- package/dist/basic-sdk/extension/plugins/table/render/index.js +6 -3
- package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +15 -6
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/column-resize-handler.js +6 -5
- package/dist/basic-sdk/extension/plugins/table/render/resize-handlers/first-column-left-resize-handler.js +3 -3
- package/dist/basic-sdk/extension/plugins/table/render/resize-mask/index.js +19 -15
- package/dist/basic-sdk/extension/plugins/table/render/table-root.js +3 -3
- package/dist/basic-sdk/extension/plugins/text-style/caret.js +6 -5
- package/dist/basic-sdk/extension/plugins/text-style/menu/comemnt-editor-menu.js +4 -3
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +4 -3
- package/dist/basic-sdk/extension/plugins/text-style/render-elem.js +3 -5
- package/dist/basic-sdk/extension/render/custom-element.js +12 -8
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +12 -8
- package/dist/basic-sdk/extension/toolbar/header-toolbar/redo-undo.js +8 -9
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +30 -11
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +24 -9
- package/dist/basic-sdk/highlight/setNodeToDecorations.js +4 -4
- package/dist/basic-sdk/node-id/helpers.js +6 -5
- package/dist/basic-sdk/socket/helpers.js +6 -5
- package/dist/basic-sdk/socket/socket-client.js +4 -4
- package/dist/basic-sdk/utils/diff.js +43 -29
- package/dist/basic-sdk/utils/object-utils.js +4 -2
- package/dist/basic-sdk/utils/rebase.js +37 -21
- package/dist/components/toast/alert.js +24 -105
- package/dist/components/toast/index.css +118 -0
- package/dist/components/toast/toast.js +2 -41
- package/dist/components/toast/toastManager.js +9 -23
- package/dist/components/toast/toaster.js +13 -9
- package/dist/components/tooltip/index.js +7 -6
- package/dist/layout/content.js +5 -8
- package/dist/layout/header.js +5 -8
- package/dist/layout/layout.js +4 -6
- package/dist/pages/document-plugin-editor.js +1 -1
- package/dist/slate-convert/md-to-slate/transform.js +30 -23
- package/dist/slate-convert/slate-to-md/transform.js +3 -3
- package/package.json +35 -40
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
2
|
import { withTranslation } from 'react-i18next';
|
|
4
3
|
import { Dropdown, DropdownItem, DropdownMenu, DropdownToggle } from 'reactstrap';
|
|
@@ -46,9 +45,10 @@ const CommentItem = _ref => {
|
|
|
46
45
|
const time = dayjs().format('YYYY-MM-DD HH:mm:ss');
|
|
47
46
|
const newComment = {
|
|
48
47
|
comment: content,
|
|
49
|
-
detail:
|
|
48
|
+
detail: {
|
|
49
|
+
...comment.detail,
|
|
50
50
|
comment: content
|
|
51
|
-
}
|
|
51
|
+
},
|
|
52
52
|
updated_at: time
|
|
53
53
|
};
|
|
54
54
|
updateComment(commentId, newComment);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import dayjs from 'dayjs';
|
|
4
3
|
import classNames from 'classnames';
|
|
@@ -71,12 +70,13 @@ const CommentItemWrapper = _ref => {
|
|
|
71
70
|
const {
|
|
72
71
|
reply: returnReply
|
|
73
72
|
} = res.data;
|
|
74
|
-
const newReply =
|
|
73
|
+
const newReply = {
|
|
74
|
+
...reply,
|
|
75
75
|
id: returnReply.id,
|
|
76
76
|
reply: returnReply.reply,
|
|
77
77
|
user_name: returnReply.user_name,
|
|
78
78
|
avatar_url: returnReply.avatar_url
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
80
|
const {
|
|
81
81
|
element_id: elementId
|
|
82
82
|
} = comment.detail;
|
|
@@ -117,12 +117,13 @@ const CommentItemWrapper = _ref => {
|
|
|
117
117
|
const {
|
|
118
118
|
reply: returnReply
|
|
119
119
|
} = res.data;
|
|
120
|
-
const newReply =
|
|
120
|
+
const newReply = {
|
|
121
|
+
...reply,
|
|
121
122
|
id: returnReply.id,
|
|
122
123
|
reply: returnReply.reply,
|
|
123
124
|
user_name: returnReply.user_name,
|
|
124
125
|
avatar_url: returnReply.avatar_url
|
|
125
|
-
}
|
|
126
|
+
};
|
|
126
127
|
dispatch({
|
|
127
128
|
type: 'INSERT_REPLY',
|
|
128
129
|
payload: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import dayjs from 'dayjs';
|
|
4
3
|
import context from '../../../context';
|
|
@@ -45,12 +44,13 @@ const CommentList = _ref => {
|
|
|
45
44
|
const {
|
|
46
45
|
comment: returnComment
|
|
47
46
|
} = res.data;
|
|
48
|
-
const newComment =
|
|
47
|
+
const newComment = {
|
|
48
|
+
...comment,
|
|
49
49
|
id: returnComment.id,
|
|
50
50
|
user_name: returnComment.user_name,
|
|
51
51
|
avatar_url: returnComment.avatar_url,
|
|
52
52
|
replies: []
|
|
53
|
-
}
|
|
53
|
+
};
|
|
54
54
|
dispatch({
|
|
55
55
|
type: 'INSERT_COMMENT',
|
|
56
56
|
payload: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
3
2
|
import dayjs from 'dayjs';
|
|
4
3
|
import EventBus from '../../../utils/event-bus';
|
|
@@ -128,12 +127,13 @@ const GlobalComment = _ref => {
|
|
|
128
127
|
const {
|
|
129
128
|
comment: returnComment
|
|
130
129
|
} = res.data;
|
|
131
|
-
const newComment =
|
|
130
|
+
const newComment = {
|
|
131
|
+
...comment,
|
|
132
132
|
id: returnComment.id,
|
|
133
133
|
user_name: returnComment.user_name,
|
|
134
134
|
avatar_url: returnComment.avatar_url,
|
|
135
135
|
replies: []
|
|
136
|
-
}
|
|
136
|
+
};
|
|
137
137
|
dispatch({
|
|
138
138
|
type: 'INSERT_COMMENT',
|
|
139
139
|
payload: {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useReducer } from 'react';
|
|
3
2
|
import { commentReducer, initCommentsInfo } from '../reducer/comment-reducer';
|
|
4
3
|
import { useCommentsMount } from '../hooks/comment-hooks/use-comment-mount';
|
|
@@ -11,7 +10,9 @@ const CommentContextProvider = _ref => {
|
|
|
11
10
|
const [commentsInfo, dispatch] = useReducer(commentReducer, initCommentsInfo);
|
|
12
11
|
useCommentsMount(dispatch);
|
|
13
12
|
useEffect(() => {
|
|
14
|
-
editor.element_comments_map =
|
|
13
|
+
editor.element_comments_map = {
|
|
14
|
+
...commentsInfo.element_comments_map
|
|
15
|
+
};
|
|
15
16
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
17
|
}, [commentsInfo]);
|
|
17
18
|
return /*#__PURE__*/React.createElement(CommentContext.Provider, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useReducer } from 'react';
|
|
3
2
|
import { notificationReducer, initNotificationsInfo } from '../reducer/notification-reducer';
|
|
4
3
|
import { useNotificationsMount, NotificationContext } from '../hooks/notification-hooks';
|
|
@@ -10,7 +9,9 @@ const NotificationContextProvider = _ref => {
|
|
|
10
9
|
const [notificationsInfo, dispatch] = useReducer(notificationReducer, initNotificationsInfo);
|
|
11
10
|
useNotificationsMount(dispatch);
|
|
12
11
|
useEffect(() => {
|
|
13
|
-
editor.notifications_map =
|
|
12
|
+
editor.notifications_map = {
|
|
13
|
+
...notificationsInfo.notifications_map
|
|
14
|
+
};
|
|
14
15
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
15
16
|
}, [notificationsInfo]);
|
|
16
17
|
return /*#__PURE__*/React.createElement(NotificationContext.Provider, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import deepCopy from 'deep-copy';
|
|
3
2
|
export const formatCommentsData = comments => {
|
|
4
3
|
const formatComments = [];
|
|
@@ -116,10 +115,13 @@ export const commentReducer = (state, action) => {
|
|
|
116
115
|
}
|
|
117
116
|
element_comments_map[element_id] = [...element_comments_map[element_id], comment];
|
|
118
117
|
const commentList = [deepCopy(comment), ...comment_list];
|
|
119
|
-
return
|
|
120
|
-
|
|
118
|
+
return {
|
|
119
|
+
...state,
|
|
120
|
+
element_comments_map: {
|
|
121
|
+
...element_comments_map
|
|
122
|
+
},
|
|
121
123
|
comment_list: commentList
|
|
122
|
-
}
|
|
124
|
+
};
|
|
123
125
|
}
|
|
124
126
|
case 'DELETE_COMMENT':
|
|
125
127
|
{
|
|
@@ -135,10 +137,13 @@ export const commentReducer = (state, action) => {
|
|
|
135
137
|
element_comments_map[element_id] = element_comments_map[element_id].filter(item => item.id !== comment_id);
|
|
136
138
|
}
|
|
137
139
|
const commentList = comment_list.filter(item => item.id !== comment_id);
|
|
138
|
-
return
|
|
139
|
-
|
|
140
|
+
return {
|
|
141
|
+
...state,
|
|
142
|
+
element_comments_map: {
|
|
143
|
+
...element_comments_map
|
|
144
|
+
},
|
|
140
145
|
comment_list: commentList
|
|
141
|
-
}
|
|
146
|
+
};
|
|
142
147
|
}
|
|
143
148
|
case 'UPDATE_COMMENT':
|
|
144
149
|
{
|
|
@@ -169,10 +174,13 @@ export const commentReducer = (state, action) => {
|
|
|
169
174
|
}
|
|
170
175
|
return item;
|
|
171
176
|
});
|
|
172
|
-
return
|
|
173
|
-
|
|
177
|
+
return {
|
|
178
|
+
...state,
|
|
179
|
+
element_comments_map: {
|
|
180
|
+
...element_comments_map
|
|
181
|
+
},
|
|
174
182
|
comment_list: commentList
|
|
175
|
-
}
|
|
183
|
+
};
|
|
176
184
|
}
|
|
177
185
|
case 'UPDATE_COMMENT_STATE':
|
|
178
186
|
{
|
|
@@ -201,10 +209,13 @@ export const commentReducer = (state, action) => {
|
|
|
201
209
|
}
|
|
202
210
|
return item;
|
|
203
211
|
});
|
|
204
|
-
return
|
|
205
|
-
|
|
212
|
+
return {
|
|
213
|
+
...state,
|
|
214
|
+
element_comments_map: {
|
|
215
|
+
...element_comments_map
|
|
216
|
+
},
|
|
206
217
|
comment_list: sortCommentList(commentList)
|
|
207
|
-
}
|
|
218
|
+
};
|
|
208
219
|
}
|
|
209
220
|
case 'INSERT_REPLY':
|
|
210
221
|
{
|
|
@@ -231,10 +242,13 @@ export const commentReducer = (state, action) => {
|
|
|
231
242
|
}
|
|
232
243
|
return item;
|
|
233
244
|
});
|
|
234
|
-
return
|
|
235
|
-
|
|
245
|
+
return {
|
|
246
|
+
...state,
|
|
247
|
+
element_comments_map: {
|
|
248
|
+
...element_comments_map
|
|
249
|
+
},
|
|
236
250
|
comment_list: commentList
|
|
237
|
-
}
|
|
251
|
+
};
|
|
238
252
|
}
|
|
239
253
|
case 'DELETE_REPLY':
|
|
240
254
|
{
|
|
@@ -261,10 +275,13 @@ export const commentReducer = (state, action) => {
|
|
|
261
275
|
}
|
|
262
276
|
return item;
|
|
263
277
|
});
|
|
264
|
-
return
|
|
265
|
-
|
|
278
|
+
return {
|
|
279
|
+
...state,
|
|
280
|
+
element_comments_map: {
|
|
281
|
+
...element_comments_map
|
|
282
|
+
},
|
|
266
283
|
comment_list: commentList
|
|
267
|
-
}
|
|
284
|
+
};
|
|
268
285
|
}
|
|
269
286
|
case 'UPDATE_REPLY':
|
|
270
287
|
{
|
|
@@ -283,7 +300,10 @@ export const commentReducer = (state, action) => {
|
|
|
283
300
|
item.replies = item.replies.map(replyItem => {
|
|
284
301
|
if (replyItem.id === reply_id) {
|
|
285
302
|
// need update replay updated_at
|
|
286
|
-
return
|
|
303
|
+
return {
|
|
304
|
+
...replyItem,
|
|
305
|
+
...reply
|
|
306
|
+
};
|
|
287
307
|
}
|
|
288
308
|
return replyItem;
|
|
289
309
|
});
|
|
@@ -296,7 +316,10 @@ export const commentReducer = (state, action) => {
|
|
|
296
316
|
item.replies = item.replies.map(replyItem => {
|
|
297
317
|
if (replyItem.id === reply_id) {
|
|
298
318
|
// need update replay updated_at
|
|
299
|
-
return
|
|
319
|
+
return {
|
|
320
|
+
...replyItem,
|
|
321
|
+
...reply
|
|
322
|
+
};
|
|
300
323
|
}
|
|
301
324
|
return replyItem;
|
|
302
325
|
});
|
|
@@ -304,10 +327,13 @@ export const commentReducer = (state, action) => {
|
|
|
304
327
|
}
|
|
305
328
|
return item;
|
|
306
329
|
});
|
|
307
|
-
return
|
|
308
|
-
|
|
330
|
+
return {
|
|
331
|
+
...state,
|
|
332
|
+
element_comments_map: {
|
|
333
|
+
...element_comments_map
|
|
334
|
+
},
|
|
309
335
|
comment_list: commentList
|
|
310
|
-
}
|
|
336
|
+
};
|
|
311
337
|
}
|
|
312
338
|
default:
|
|
313
339
|
return state;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { DOC_NOTIFICATION_REDUCER_TYPE } from '../constants';
|
|
3
2
|
import { Notification } from '../../../model';
|
|
4
3
|
import { EventBus } from '../../';
|
|
@@ -42,11 +41,13 @@ export const notificationReducer = (state, action) => {
|
|
|
42
41
|
notification
|
|
43
42
|
} = action.payload;
|
|
44
43
|
const newNotification = new Notification(notification);
|
|
45
|
-
return
|
|
46
|
-
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
notifications_map: {
|
|
47
|
+
...state.notifications_map,
|
|
47
48
|
[newNotification.key]: newNotification
|
|
48
|
-
}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
|
+
};
|
|
50
51
|
}
|
|
51
52
|
case DOC_NOTIFICATION_REDUCER_TYPE.DEL:
|
|
52
53
|
{
|
|
@@ -63,9 +64,10 @@ export const notificationReducer = (state, action) => {
|
|
|
63
64
|
}
|
|
64
65
|
const eventBus = EventBus.getInstance();
|
|
65
66
|
eventBus.dispatch(INTERNAL_EVENT.UNSEEN_NOTIFICATIONS_COUNT, Object.keys(notifications_map).length);
|
|
66
|
-
return
|
|
67
|
+
return {
|
|
68
|
+
...state,
|
|
67
69
|
notifications_map
|
|
68
|
-
}
|
|
70
|
+
};
|
|
69
71
|
}
|
|
70
72
|
default:
|
|
71
73
|
{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import randomColor from 'randomcolor';
|
|
3
2
|
|
|
4
3
|
// selection: { anchor, focus }
|
|
@@ -11,17 +10,25 @@ export const setCursor = (editor, user, location, cursorData) => {
|
|
|
11
10
|
if (!editor.cursors) editor.cursors = {};
|
|
12
11
|
if (location) {
|
|
13
12
|
const oldCursor = editor.cursors[clientId] ? editor.cursors[clientId] : {};
|
|
14
|
-
const newCursorData =
|
|
13
|
+
const newCursorData = {
|
|
14
|
+
...oldCursor,
|
|
15
|
+
...location,
|
|
16
|
+
...cursorData
|
|
17
|
+
};
|
|
15
18
|
editor.cursors[clientId] = newCursorData;
|
|
16
19
|
} else {
|
|
17
20
|
delete editor.cursors[clientId];
|
|
18
21
|
}
|
|
19
|
-
editor.cursors =
|
|
22
|
+
editor.cursors = {
|
|
23
|
+
...editor.cursors
|
|
24
|
+
};
|
|
20
25
|
return editor;
|
|
21
26
|
};
|
|
22
27
|
export const deleteCursor = (editor, username) => {
|
|
23
28
|
delete editor.cursors[username];
|
|
24
|
-
editor.cursors =
|
|
29
|
+
editor.cursors = {
|
|
30
|
+
...editor.cursors
|
|
31
|
+
};
|
|
25
32
|
return editor;
|
|
26
33
|
};
|
|
27
34
|
export const generateCursorData = config => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useMemo } from 'react';
|
|
3
2
|
import { Editable, ReactEditor, Slate } from '@seafile/slate-react';
|
|
4
3
|
import { Editor, Node } from '@seafile/slate';
|
|
@@ -73,9 +72,10 @@ const CommentArticle = _ref => {
|
|
|
73
72
|
id: "sdoc-editor",
|
|
74
73
|
scrollSelectionIntoView: handleScrollIntoView,
|
|
75
74
|
cursors: cursors,
|
|
76
|
-
renderElement: props => RenderCommentEditorCustomRenderElement(
|
|
75
|
+
renderElement: props => RenderCommentEditorCustomRenderElement({
|
|
76
|
+
...props,
|
|
77
77
|
commentType: type
|
|
78
|
-
})
|
|
78
|
+
}),
|
|
79
79
|
renderLeaf: renderLeaf,
|
|
80
80
|
onMouseDown: onMouseDown,
|
|
81
81
|
decorate: decorate,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useState, useImperativeHandle, forwardRef, useMemo, useCallback, useRef } from 'react';
|
|
3
2
|
import { Editor } from '@seafile/slate';
|
|
4
3
|
import deepCopy from 'deep-copy';
|
|
@@ -28,7 +27,8 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
|
28
27
|
} = _ref;
|
|
29
28
|
const [slateValue, setSlateValue] = useState(document.children);
|
|
30
29
|
const commentEditorContainerRef = useRef(null);
|
|
31
|
-
const validEditor =
|
|
30
|
+
const validEditor = useMemo(() => {
|
|
31
|
+
if (propsEditor) return propsEditor;
|
|
32
32
|
const defaultEditor = createCommentEditor();
|
|
33
33
|
const editorConfig = context.getEditorConfig();
|
|
34
34
|
const newEditor = withNodeId(withSocketIO(defaultEditor, {
|
|
@@ -85,9 +85,10 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
|
85
85
|
},
|
|
86
86
|
// get value
|
|
87
87
|
getSlateValue: () => {
|
|
88
|
-
return deepCopy(
|
|
88
|
+
return deepCopy({
|
|
89
|
+
...document,
|
|
89
90
|
children: slateValue
|
|
90
|
-
})
|
|
91
|
+
});
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useState, useImperativeHandle, forwardRef, useMemo, useCallback, Fragment } from 'react';
|
|
3
2
|
import { Editor } from '@seafile/slate';
|
|
4
3
|
import deepCopy from 'deep-copy';
|
|
@@ -27,7 +26,8 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
27
26
|
isShowHeaderToolbar = true,
|
|
28
27
|
showOutline = true
|
|
29
28
|
} = _ref;
|
|
30
|
-
const validEditor =
|
|
29
|
+
const validEditor = useMemo(() => {
|
|
30
|
+
if (propsEditor) return propsEditor;
|
|
31
31
|
const defaultEditor = createDefaultEditor();
|
|
32
32
|
const editorConfig = context.getEditorConfig();
|
|
33
33
|
const newEditor = withNodeId(withSocketIO(defaultEditor, {
|
|
@@ -111,9 +111,10 @@ const SdocEditor = forwardRef((_ref, ref) => {
|
|
|
111
111
|
},
|
|
112
112
|
// get value
|
|
113
113
|
getSlateValue: () => {
|
|
114
|
-
return deepCopy(
|
|
114
|
+
return deepCopy({
|
|
115
|
+
...document,
|
|
115
116
|
children: slateValue
|
|
116
|
-
})
|
|
117
|
+
});
|
|
117
118
|
}
|
|
118
119
|
|
|
119
120
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useEffect, useState, useImperativeHandle, forwardRef, useMemo, useCallback } from 'react';
|
|
3
2
|
import { Editor } from '@seafile/slate';
|
|
4
3
|
import deepCopy from 'deep-copy';
|
|
@@ -27,7 +26,8 @@ const WikiEditor = forwardRef((_ref, ref) => {
|
|
|
27
26
|
isWikiReadOnly,
|
|
28
27
|
scrollRef
|
|
29
28
|
} = _ref;
|
|
30
|
-
const validEditor =
|
|
29
|
+
const validEditor = useMemo(() => {
|
|
30
|
+
if (propsEditor) return propsEditor;
|
|
31
31
|
const defaultEditor = createDefaultEditor();
|
|
32
32
|
const editorConfig = context.getEditorConfig();
|
|
33
33
|
const newEditor = withNodeId(withSocketIO(defaultEditor, {
|
|
@@ -116,9 +116,10 @@ const WikiEditor = forwardRef((_ref, ref) => {
|
|
|
116
116
|
},
|
|
117
117
|
// get value
|
|
118
118
|
getSlateValue: () => {
|
|
119
|
-
return deepCopy(
|
|
119
|
+
return deepCopy({
|
|
120
|
+
...document,
|
|
120
121
|
children: slateValue
|
|
121
|
-
})
|
|
122
|
+
});
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
2
|
import { ReactEditor } from '@seafile/slate-react';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -212,9 +211,10 @@ const FileLinkInsertDialog = _ref => {
|
|
|
212
211
|
editor
|
|
213
212
|
};
|
|
214
213
|
}
|
|
215
|
-
eventBus.dispatch(dispatchEventKey,
|
|
216
|
-
newFileName: newFileName.trim()
|
|
217
|
-
|
|
214
|
+
eventBus.dispatch(dispatchEventKey, {
|
|
215
|
+
newFileName: newFileName.trim(),
|
|
216
|
+
...external_props
|
|
217
|
+
});
|
|
218
218
|
}, [editor, element, newFileName]);
|
|
219
219
|
const createFileTipDefault = useMemo(() => {
|
|
220
220
|
return editor.editorType === WIKI_EDITOR ? 'New_page' : 'Create_a_new_sdoc_file';
|
|
@@ -224,9 +224,10 @@ const FileLinkInsertDialog = _ref => {
|
|
|
224
224
|
}, [editor.editorType, newFileName]);
|
|
225
225
|
return /*#__PURE__*/React.createElement("div", {
|
|
226
226
|
className: "sdoc-history-files-content popover",
|
|
227
|
-
style:
|
|
227
|
+
style: {
|
|
228
|
+
...position,
|
|
228
229
|
position: 'absolute'
|
|
229
|
-
}
|
|
230
|
+
}
|
|
230
231
|
}, header.length !== 0 && /*#__PURE__*/React.createElement("div", {
|
|
231
232
|
className: "sdoc-history-files-header"
|
|
232
233
|
}, header), /*#__PURE__*/React.createElement("div", {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { withTranslation } from 'react-i18next';
|
|
@@ -32,9 +31,10 @@ class FieldSetting extends React.Component {
|
|
|
32
31
|
const {
|
|
33
32
|
option
|
|
34
33
|
} = this.props;
|
|
35
|
-
const newOption =
|
|
34
|
+
const newOption = {
|
|
35
|
+
...option,
|
|
36
36
|
bold: !option.bold
|
|
37
|
-
}
|
|
37
|
+
};
|
|
38
38
|
this.props.onUpdateOption(newOption);
|
|
39
39
|
});
|
|
40
40
|
_defineProperty(this, "onItalicClick", event => {
|
|
@@ -42,9 +42,10 @@ class FieldSetting extends React.Component {
|
|
|
42
42
|
const {
|
|
43
43
|
option
|
|
44
44
|
} = this.props;
|
|
45
|
-
const newOption =
|
|
45
|
+
const newOption = {
|
|
46
|
+
...option,
|
|
46
47
|
italic: !option.italic
|
|
47
|
-
}
|
|
48
|
+
};
|
|
48
49
|
this.props.onUpdateOption(newOption);
|
|
49
50
|
});
|
|
50
51
|
_defineProperty(this, "setSettingRef", ref => {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import React, { useCallback, useState } from 'react';
|
|
3
2
|
import { Button, Modal, ModalHeader, ModalBody } from 'reactstrap';
|
|
4
3
|
import { useTranslation } from 'react-i18next';
|
|
@@ -39,14 +38,17 @@ const SelectSdocFileDialog = _ref => {
|
|
|
39
38
|
const {
|
|
40
39
|
file_uuid
|
|
41
40
|
} = currentSelectedFile;
|
|
42
|
-
let fileInfo =
|
|
41
|
+
let fileInfo = {
|
|
42
|
+
...currentSelectedFile
|
|
43
|
+
};
|
|
43
44
|
// File has no id
|
|
44
45
|
if (!file_uuid || file_uuid === '') {
|
|
45
46
|
context.getSdocLocalFileId(currentSelectedFile.path).then(res => {
|
|
46
47
|
if (res.status === 200) {
|
|
47
|
-
fileInfo =
|
|
48
|
+
fileInfo = {
|
|
49
|
+
...currentSelectedFile,
|
|
48
50
|
file_uuid: res.data.file_uuid
|
|
49
|
-
}
|
|
51
|
+
};
|
|
50
52
|
}
|
|
51
53
|
insertFile(fileInfo);
|
|
52
54
|
closeDialog();
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
-
const _excluded = ["at"];
|
|
4
1
|
import { Editor, Text, Path, Span, Element, Node, Range } from '@seafile/slate';
|
|
5
2
|
import { ReactEditor } from '@seafile/slate-react';
|
|
6
3
|
import { match } from '../utils';
|
|
@@ -17,9 +14,10 @@ export const getQueryOptions = (editor, options) => {
|
|
|
17
14
|
if (_match || block) {
|
|
18
15
|
newMatch = (n, path) => match(n, path, _match) && (!block || Editor.isBlock(editor, n));
|
|
19
16
|
}
|
|
20
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
...options,
|
|
21
19
|
match: newMatch
|
|
22
|
-
}
|
|
20
|
+
};
|
|
23
21
|
};
|
|
24
22
|
export const findPath = (editor, node, defaultPath) => {
|
|
25
23
|
try {
|
|
@@ -213,9 +211,10 @@ export const getAboveNode = (editor, options) => {
|
|
|
213
211
|
return Editor.above(editor, getQueryOptions(editor, options));
|
|
214
212
|
};
|
|
215
213
|
export const getAboveBlockNode = (editor, options) => {
|
|
216
|
-
return getAboveNode(editor,
|
|
214
|
+
return getAboveNode(editor, {
|
|
215
|
+
...options,
|
|
217
216
|
block: true
|
|
218
|
-
})
|
|
217
|
+
});
|
|
219
218
|
};
|
|
220
219
|
export const getTopLevelBlockNode = editor => {
|
|
221
220
|
return getAboveBlockNode(editor, {
|
|
@@ -297,9 +296,10 @@ export const getNextNode = editor => {
|
|
|
297
296
|
|
|
298
297
|
// find node
|
|
299
298
|
export const findNode = (editor, options) => {
|
|
300
|
-
const nodeEntries = Editor.nodes(editor,
|
|
301
|
-
at: editor.selection || []
|
|
302
|
-
|
|
299
|
+
const nodeEntries = Editor.nodes(editor, {
|
|
300
|
+
at: editor.selection || [],
|
|
301
|
+
...getQueryOptions(editor, options)
|
|
302
|
+
});
|
|
303
303
|
const _nodeEntries = Array.from(nodeEntries);
|
|
304
304
|
if (_nodeEntries[0]) {
|
|
305
305
|
return _nodeEntries[0];
|
|
@@ -377,20 +377,21 @@ export const isBlockTextEmptyAfterSelection = editor => {
|
|
|
377
377
|
return true;
|
|
378
378
|
};
|
|
379
379
|
export const isRangeAcrossBlocks = function (editor) {
|
|
380
|
-
let _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
381
380
|
let {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
at,
|
|
382
|
+
...options
|
|
383
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
385
384
|
if (!at) at = editor.selection;
|
|
386
385
|
if (!at) return;
|
|
387
386
|
const [start, end] = Range.edges(at);
|
|
388
|
-
const startBlock = getAboveBlockNode(editor,
|
|
389
|
-
at: start
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
387
|
+
const startBlock = getAboveBlockNode(editor, {
|
|
388
|
+
at: start,
|
|
389
|
+
...options
|
|
390
|
+
});
|
|
391
|
+
const endBlock = getAboveBlockNode(editor, {
|
|
392
|
+
at: end,
|
|
393
|
+
...options
|
|
394
|
+
});
|
|
394
395
|
if (!startBlock && !endBlock) return;
|
|
395
396
|
if (!startBlock || !endBlock) return true;
|
|
396
397
|
return !Path.equals(startBlock[1], endBlock[1]);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
1
|
import { Transforms, Node } from '@seafile/slate';
|
|
3
2
|
export const removeNodeChildren = (editor, path, options) => {
|
|
4
3
|
const nodeChildren = Node.children(editor, path, {
|
|
5
4
|
reverse: true
|
|
6
5
|
});
|
|
7
6
|
for (const [, childPath] of nodeChildren) {
|
|
8
|
-
Transforms.removeNodes(editor,
|
|
7
|
+
Transforms.removeNodes(editor, {
|
|
8
|
+
...options,
|
|
9
9
|
at: childPath
|
|
10
|
-
})
|
|
10
|
+
});
|
|
11
11
|
}
|
|
12
12
|
};
|