@seafile/sdoc-editor 1.0.139 → 1.0.141-alpha2
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/api/seafile-api.js +24 -0
- package/dist/basic-sdk/assets/css/sdoc-editor-plugins.css +4 -0
- package/dist/basic-sdk/comment/components/comment-item-collapse-wrapper.js +4 -4
- package/dist/basic-sdk/comment/components/comment-list.css +29 -23
- package/dist/basic-sdk/comment/components/global-comment/index.css +6 -6
- package/dist/basic-sdk/constants/index.js +2 -1
- package/dist/basic-sdk/editor/wiki-editor.js +3 -1
- package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +53 -0
- package/dist/basic-sdk/extension/constants/element-type.js +3 -1
- package/dist/basic-sdk/extension/constants/index.js +16 -3
- package/dist/basic-sdk/extension/constants/menus-config.js +12 -0
- package/dist/basic-sdk/extension/plugins/image/plugin.js +6 -0
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +5 -0
- package/dist/basic-sdk/extension/plugins/index.js +8 -1
- package/dist/basic-sdk/extension/plugins/paragraph/render-elem.js +3 -3
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +2 -0
- package/dist/basic-sdk/extension/plugins/table/plugin.js +3 -0
- package/dist/basic-sdk/extension/plugins/video/helpers.js +144 -0
- package/dist/basic-sdk/extension/plugins/video/hover-menu/index.css +89 -0
- package/dist/basic-sdk/extension/plugins/video/hover-menu/index.js +84 -0
- package/dist/basic-sdk/extension/plugins/video/index.css +73 -0
- package/dist/basic-sdk/extension/plugins/video/index.js +20 -0
- package/dist/basic-sdk/extension/plugins/video/menu/index.js +55 -0
- package/dist/basic-sdk/extension/plugins/video/plugin.js +47 -0
- package/dist/basic-sdk/extension/plugins/video/render-elem.js +305 -0
- package/dist/basic-sdk/extension/render/custom-element.js +8 -1
- package/dist/basic-sdk/extension/render/render-comment-editor-element.js +7 -0
- package/dist/basic-sdk/extension/toolbar/header-toolbar/insert-toolbar/index.js +9 -8
- package/dist/basic-sdk/extension/toolbar/insert-element-toolbar/index.js +28 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/helpers.js +2 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/insert-block-menu.js +19 -0
- package/dist/basic-sdk/utils/event-handler.js +1 -1
- package/dist/components/toast/toast.js +4 -0
- package/dist/components/toast/toaster.js +1 -0
- package/dist/context.js +9 -0
- package/package.json +2 -2
- package/public/media/sdoc-editor-font/iconfont.eot +0 -0
- package/public/media/sdoc-editor-font/iconfont.svg +4 -0
- package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff +0 -0
- package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
- package/public/media/sdoc-editor-font.css +15 -10
package/dist/api/seafile-api.js
CHANGED
|
@@ -38,6 +38,7 @@ class SeafileAPI {
|
|
|
38
38
|
return 'image-' + _slugid.default.nice() + file.name.slice(file.name.lastIndexOf('.'));
|
|
39
39
|
}
|
|
40
40
|
uploadSdocImage(docUuid, imageFiles) {
|
|
41
|
+
console.log(123);
|
|
41
42
|
const url = '/api/v2.1/seadoc/upload-image/' + docUuid + '/';
|
|
42
43
|
const form = new FormData();
|
|
43
44
|
for (const fileItem of imageFiles) {
|
|
@@ -52,9 +53,32 @@ class SeafileAPI {
|
|
|
52
53
|
return this.req.post(url, form);
|
|
53
54
|
}
|
|
54
55
|
getSdocDownloadImageUrl(docUuid, imageName) {
|
|
56
|
+
console.log(3333);
|
|
55
57
|
const url = '/api/v2.1/seadoc/download-image/' + docUuid + '/' + encodeURIComponent(imageName);
|
|
56
58
|
return this.req.get(url);
|
|
57
59
|
}
|
|
60
|
+
getVideoFileNameWithUuid(file) {
|
|
61
|
+
return 'video-' + _slugid.default.nice() + file.name.slice(file.name.lastIndexOf('.'));
|
|
62
|
+
}
|
|
63
|
+
uploadSdocVideo(docUuid, videoFiles) {
|
|
64
|
+
const url = '/api/v2.1/seadoc/upload-video/' + docUuid + '/';
|
|
65
|
+
const form = new FormData();
|
|
66
|
+
for (const fileItem of videoFiles) {
|
|
67
|
+
console.log('fileItem', fileItem);
|
|
68
|
+
if (fileItem.type.startsWith('video/')) {
|
|
69
|
+
const fileName = this.getVideoFileNameWithUuid(fileItem);
|
|
70
|
+
const file = new File([fileItem], fileName, {
|
|
71
|
+
type: fileItem.type
|
|
72
|
+
});
|
|
73
|
+
form.append('file', file);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return this.req.post(url, form);
|
|
77
|
+
}
|
|
78
|
+
getSdocDownloadVideoUrl(docUuid, videoName) {
|
|
79
|
+
const url = '/api/v2.1/seadoc/download-video/' + docUuid + '/' + encodeURIComponent(videoName);
|
|
80
|
+
return this.req.get(url);
|
|
81
|
+
}
|
|
58
82
|
|
|
59
83
|
// revision
|
|
60
84
|
startRevise(repoID, fileUuid, path) {
|
|
@@ -108,13 +108,13 @@ const CommentItemCollapseWrapper = _ref => {
|
|
|
108
108
|
className: "name"
|
|
109
109
|
}, topLevelComment.user_name), /*#__PURE__*/_react.default.createElement("span", {
|
|
110
110
|
className: "time"
|
|
111
|
-
}, (0, _dayjs.default)(topLevelComment.updated_at).format('MM-DD HH:mm')
|
|
111
|
+
}, (0, _dayjs.default)(topLevelComment.updated_at).format('MM-DD HH:mm'), (topLevelComment === null || topLevelComment === void 0 ? void 0 : topLevelComment.resolved) && /*#__PURE__*/_react.default.createElement("span", {
|
|
112
|
+
className: "comment-success-resolved sdocfont sdoc-mark-as-resolved"
|
|
113
|
+
})))), (isUnseen || isReplayUnseen) && /*#__PURE__*/_react.default.createElement("div", {
|
|
112
114
|
className: "sdoc-unread-message-tip"
|
|
113
115
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
114
116
|
className: "comment-content"
|
|
115
|
-
},
|
|
116
|
-
className: "comment-success-resolved sdocfont sdoc-mark-as-resolved"
|
|
117
|
-
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
117
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
118
118
|
dangerouslySetInnerHTML: {
|
|
119
119
|
__html: commentContent
|
|
120
120
|
}
|
|
@@ -147,15 +147,6 @@
|
|
|
147
147
|
align-items: initial;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
.comment-item .comment-footer .comment-author__avatar {
|
|
151
|
-
width: 16px;
|
|
152
|
-
height: 16px;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.comment-item .comment-footer .comment-author__avatar img {
|
|
156
|
-
border-radius: 50%;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
150
|
.comment-item .comment-footer .comment-author__latest-reply {
|
|
160
151
|
margin-left: 8px;
|
|
161
152
|
}
|
|
@@ -168,19 +159,6 @@
|
|
|
168
159
|
width: 220px;
|
|
169
160
|
}
|
|
170
161
|
|
|
171
|
-
/* header */
|
|
172
|
-
.sdoc-comment-list-container .comment-header .comment-author__avatar {
|
|
173
|
-
display: flex;
|
|
174
|
-
align-items: center;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
178
|
-
margin-top: 3px;
|
|
179
|
-
width: 24px;
|
|
180
|
-
height: 24px;
|
|
181
|
-
border-radius: 50%;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
162
|
.sdoc-comment-list-container .comment-header .comment-author__info {
|
|
185
163
|
display: flex;
|
|
186
164
|
flex-direction: column;
|
|
@@ -208,6 +186,12 @@
|
|
|
208
186
|
align-items: center;
|
|
209
187
|
}
|
|
210
188
|
|
|
189
|
+
.sdoc-comment-list-container .comment-header .comment-author__info .time .comment-success-resolved {
|
|
190
|
+
color: rgb(71, 184, 129);
|
|
191
|
+
margin-left: 6px;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
}
|
|
194
|
+
|
|
211
195
|
.sdoc-comment-list-container .comment-header .sdoc-unread-message-tip {
|
|
212
196
|
display: inline-block;
|
|
213
197
|
height: 6px;
|
|
@@ -361,7 +345,29 @@
|
|
|
361
345
|
padding-right: 10px;
|
|
362
346
|
}
|
|
363
347
|
|
|
364
|
-
/*
|
|
348
|
+
/* Side comment style */
|
|
349
|
+
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar {
|
|
350
|
+
display: flex;
|
|
351
|
+
align-items: center;
|
|
352
|
+
margin-top: 3px;
|
|
353
|
+
width: 24px;
|
|
354
|
+
height: 24px;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
358
|
+
border-radius: 50%;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
|
|
362
|
+
width: 16px;
|
|
363
|
+
height: 16px;
|
|
364
|
+
margin-top: -1px
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
|
|
368
|
+
border-radius: 50%;
|
|
369
|
+
}
|
|
370
|
+
|
|
365
371
|
.sdoc-article-container .sdoc-comment-list-container .comment-item .comment-editor-wrapper.pb-3 {
|
|
366
372
|
padding-bottom: 0 !important;
|
|
367
373
|
}
|
|
@@ -216,23 +216,22 @@
|
|
|
216
216
|
background-color: unset;
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
-
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar
|
|
219
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar {
|
|
220
220
|
width: 24px;
|
|
221
221
|
height: 24px;
|
|
222
222
|
margin-top: -5px;
|
|
223
223
|
}
|
|
224
224
|
|
|
225
|
+
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-header .comment-author__avatar img {
|
|
226
|
+
border-radius: 50%;
|
|
227
|
+
}
|
|
228
|
+
|
|
225
229
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-content {
|
|
226
230
|
margin-left: 35px;
|
|
227
231
|
display: flex;
|
|
228
232
|
align-items: center;
|
|
229
233
|
}
|
|
230
234
|
|
|
231
|
-
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-content .comment-success-resolved {
|
|
232
|
-
color: rgb(71, 184, 129);
|
|
233
|
-
margin-right: 6px;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
235
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comments-count {
|
|
237
236
|
display: flex;
|
|
238
237
|
align-items: center;
|
|
@@ -257,6 +256,7 @@
|
|
|
257
256
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar {
|
|
258
257
|
width: 16px;
|
|
259
258
|
height: 16px;
|
|
259
|
+
margin-top: -1px
|
|
260
260
|
}
|
|
261
261
|
|
|
262
262
|
.sdoc-comment-drawer .sdoc-comment-list-container .comment-item .comment-footer .comment-author__avatar img {
|
|
@@ -46,7 +46,8 @@ const INTERNAL_EVENT = exports.INTERNAL_EVENT = {
|
|
|
46
46
|
ON_PRINT: 'on_print',
|
|
47
47
|
COMMENT_EDITOR_POST_COMMENT: 'comment_editor_post_comment',
|
|
48
48
|
CLOSE_FILE_INSET_DIALOG: 'close_file_insert_dialog',
|
|
49
|
-
RESIZE_ARTICLE: 'resize_article'
|
|
49
|
+
RESIZE_ARTICLE: 'resize_article',
|
|
50
|
+
ON_VIDEO_FILES_UPLOADED: 'on_video_files_uploaded'
|
|
50
51
|
};
|
|
51
52
|
const REVISION_DIFF_KEY = exports.REVISION_DIFF_KEY = 'diff';
|
|
52
53
|
const REVISION_DIFF_VALUE = exports.REVISION_DIFF_VALUE = '1';
|
|
@@ -159,7 +159,9 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
159
159
|
editor: validEditor,
|
|
160
160
|
slateValue: slateValue,
|
|
161
161
|
showComment: false
|
|
162
|
-
}))
|
|
162
|
+
})), !_utils.isMobile && isWikiReadOnly && /*#__PURE__*/_react.default.createElement(_wikiOutline.default, {
|
|
163
|
+
doc: slateValue
|
|
164
|
+
})))));
|
|
163
165
|
}
|
|
164
166
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_layout.EditorContainer, {
|
|
165
167
|
editor: validEditor
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _reactI18next = require("react-i18next");
|
|
10
11
|
var _dialogs = require("../../plugins/table/dialogs");
|
|
11
12
|
var _addLinkDialog = _interopRequireDefault(require("../../plugins/link/dialog/add-link-dialog"));
|
|
12
13
|
var _index = _interopRequireDefault(require("../select-file-dialog/index.js"));
|
|
@@ -14,8 +15,10 @@ var _eventBus = _interopRequireDefault(require("../../../utils/event-bus"));
|
|
|
14
15
|
var _constants = require("../../../constants");
|
|
15
16
|
var _constants2 = require("../../constants");
|
|
16
17
|
var _helpers = require("../../plugins/image/helpers");
|
|
18
|
+
var _helpers2 = require("../../plugins/video/helpers");
|
|
17
19
|
var _context = _interopRequireDefault(require("../../../../context.js"));
|
|
18
20
|
var _index2 = _interopRequireDefault(require("../file-insert-dialog/index.js"));
|
|
21
|
+
var _index3 = _interopRequireDefault(require("../../../../components/toast/index.js"));
|
|
19
22
|
const InsertElementDialog = _ref => {
|
|
20
23
|
let {
|
|
21
24
|
editor
|
|
@@ -28,7 +31,12 @@ const InsertElementDialog = _ref => {
|
|
|
28
31
|
const [validEditor, setValidEditor] = (0, _react.useState)(editor);
|
|
29
32
|
const [linkTitle, setLinkTitle] = (0, _react.useState)('');
|
|
30
33
|
const [handleSubmit, setHandleSubmit] = (0, _react.useState)(() => void 0);
|
|
34
|
+
const [alertShown, setAlertShown] = (0, _react.useState)(false);
|
|
35
|
+
const {
|
|
36
|
+
t
|
|
37
|
+
} = (0, _reactI18next.useTranslation)();
|
|
31
38
|
const uploadLocalImageInputRef = (0, _react.useRef)();
|
|
39
|
+
const uploadLocalVideoInputRef = (0, _react.useRef)();
|
|
32
40
|
const onFileChanged = (0, _react.useCallback)(event => {
|
|
33
41
|
const files = event.target.files;
|
|
34
42
|
_context.default.uploadLocalImage(files).then(fileUrl => {
|
|
@@ -39,6 +47,33 @@ const InsertElementDialog = _ref => {
|
|
|
39
47
|
});
|
|
40
48
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
41
49
|
}, [validEditor, uploadLocalImageInputRef, insertPosition, slateNode]);
|
|
50
|
+
const handleDisplayAlert = (0, _react.useCallback)(() => {
|
|
51
|
+
console.log(11);
|
|
52
|
+
_index3.default.warning(`${t('The_current_version_does_not_support_>5MB_video_file')}`);
|
|
53
|
+
}, [t]);
|
|
54
|
+
const onVideoFileChanged = (0, _react.useCallback)(event => {
|
|
55
|
+
const files = event.target.files;
|
|
56
|
+
const maxSize = 5 * 1024 * 1024;
|
|
57
|
+
|
|
58
|
+
// Show warning and no further insertion if video file is more than 5MB
|
|
59
|
+
if (files[0].size < maxSize) {
|
|
60
|
+
handleDisplayAlert();
|
|
61
|
+
setAlertShown(true);
|
|
62
|
+
// toaster.closeAll();
|
|
63
|
+
event.target.value = null;
|
|
64
|
+
console.log(12);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
console.log(13);
|
|
68
|
+
_context.default.uploadLocalVideo(files).then(fileUrl => {
|
|
69
|
+
(0, _helpers2.insertVideo)(validEditor, files, fileUrl, validEditor.selection, insertPosition);
|
|
70
|
+
if (uploadLocalVideoInputRef.current) {
|
|
71
|
+
uploadLocalVideoInputRef.current.value = '';
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
setAlertShown(false);
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
}, [validEditor, uploadLocalImageInputRef, insertPosition, slateNode]);
|
|
42
77
|
(0, _react.useEffect)(() => {
|
|
43
78
|
const eventBus = _eventBus.default.getInstance();
|
|
44
79
|
const toggleDialogSubscribe = eventBus.subscribe(_constants.INTERNAL_EVENT.INSERT_ELEMENT, toggleDialog);
|
|
@@ -77,6 +112,11 @@ const InsertElementDialog = _ref => {
|
|
|
77
112
|
uploadLocalImageInputRef.current && uploadLocalImageInputRef.current.click();
|
|
78
113
|
}, 0);
|
|
79
114
|
}
|
|
115
|
+
if (type === _constants2.LOCAL_VIDEO) {
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
uploadLocalVideoInputRef.current && uploadLocalVideoInputRef.current.click();
|
|
118
|
+
}, 0);
|
|
119
|
+
}
|
|
80
120
|
}, [editor]);
|
|
81
121
|
const closeDialog = (0, _react.useCallback)(() => {
|
|
82
122
|
setInsertPosition(_constants2.INSERT_POSITION.CURRENT);
|
|
@@ -143,6 +183,19 @@ const InsertElementDialog = _ref => {
|
|
|
143
183
|
onChange: onFileChanged
|
|
144
184
|
});
|
|
145
185
|
}
|
|
186
|
+
case _constants2.LOCAL_VIDEO:
|
|
187
|
+
{
|
|
188
|
+
return /*#__PURE__*/_react.default.createElement("input", {
|
|
189
|
+
onClick: e => e.stopPropagation(),
|
|
190
|
+
ref: uploadLocalVideoInputRef,
|
|
191
|
+
type: "file",
|
|
192
|
+
accept: "video/*",
|
|
193
|
+
style: {
|
|
194
|
+
display: 'none'
|
|
195
|
+
},
|
|
196
|
+
onChange: onVideoFileChanged
|
|
197
|
+
});
|
|
198
|
+
}
|
|
146
199
|
case _constants2.ELEMENT_TYPE.FILE_LINK_INSET_INPUT_TEMP:
|
|
147
200
|
{
|
|
148
201
|
return /*#__PURE__*/_react.default.createElement(_index2.default, {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WIKI_LINK = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CALL_OUT = exports.BLOCKQUOTE = void 0;
|
|
6
|
+
exports.WIKI_LINK = exports.VIDEO_BLOCK = exports.VIDEO = exports.UNORDERED_LIST = exports.TWO_COLUMN = exports.TOP_LEVEL_TYPES = exports.TITLE = exports.THREE_COLUMN = exports.TABLE_ROW = exports.TABLE_CELL = exports.TABLE = exports.SUBTITLE = exports.SEATABLE_TABLE = exports.SEATABLE_COLUMN = exports.SDOC_LINK = exports.QUICK_INSERT = exports.PARAGRAPH = exports.ORDERED_LIST = exports.MULTI_COLUMN = exports.MENTION_TEMP = exports.MENTION = exports.LIST_ITEM = exports.LINK = exports.INLINE_LEVEL_TYPES = exports.IMAGE_BLOCK = exports.IMAGE = exports.HEADER6 = exports.HEADER5 = exports.HEADER4 = exports.HEADER3 = exports.HEADER2 = exports.HEADER1 = exports.HEADER = exports.FOUR_COLUMN = exports.FONT_SIZE_REDUCE = exports.FONT_SIZE_INCREASE = exports.FONT_SIZE = exports.FIVE_COLUMN = exports.FILE_LINK_INSET_INPUT_TEMP = exports.FILE_LINK = exports.COLUMN = exports.CODE_LINE = exports.CODE_BLOCK = exports.CHECK_LIST_ITEM = exports.CALL_OUT = exports.BLOCKQUOTE = void 0;
|
|
7
7
|
const BLOCKQUOTE = exports.BLOCKQUOTE = 'blockquote';
|
|
8
8
|
const TITLE = exports.TITLE = 'title';
|
|
9
9
|
const SUBTITLE = exports.SUBTITLE = 'subtitle';
|
|
@@ -36,6 +36,8 @@ const WIKI_LINK = exports.WIKI_LINK = 'wiki_link';
|
|
|
36
36
|
const FILE_LINK = exports.FILE_LINK = 'file_link';
|
|
37
37
|
const IMAGE = exports.IMAGE = 'image';
|
|
38
38
|
const IMAGE_BLOCK = exports.IMAGE_BLOCK = 'image_block';
|
|
39
|
+
const VIDEO = exports.VIDEO = 'video';
|
|
40
|
+
const VIDEO_BLOCK = exports.VIDEO_BLOCK = 'video_block';
|
|
39
41
|
const CALL_OUT = exports.CALL_OUT = 'callout';
|
|
40
42
|
const MENTION = exports.MENTION = 'mention';
|
|
41
43
|
const MENTION_TEMP = exports.MENTION_TEMP = 'mention_temp';
|
|
@@ -238,7 +238,7 @@ Object.defineProperty(exports, "LIST_ITEM", {
|
|
|
238
238
|
return _elementType.LIST_ITEM;
|
|
239
239
|
}
|
|
240
240
|
});
|
|
241
|
-
exports.LOCAL_IMAGE = exports.LIST_TYPE_ARRAY = exports.LIST_ITEM_SUPPORTED_TRANSFORMATION = exports.LIST_ITEM_CORRELATION_TYPE = void 0;
|
|
241
|
+
exports.LOCAL_VIDEO = exports.LOCAL_IMAGE = exports.LIST_TYPE_ARRAY = exports.LIST_ITEM_SUPPORTED_TRANSFORMATION = exports.LIST_ITEM_CORRELATION_TYPE = void 0;
|
|
242
242
|
Object.defineProperty(exports, "MAC_HOTKEYS", {
|
|
243
243
|
enumerable: true,
|
|
244
244
|
get: function () {
|
|
@@ -466,6 +466,18 @@ Object.defineProperty(exports, "UNORDERED_LIST", {
|
|
|
466
466
|
return _elementType.UNORDERED_LIST;
|
|
467
467
|
}
|
|
468
468
|
});
|
|
469
|
+
Object.defineProperty(exports, "VIDEO", {
|
|
470
|
+
enumerable: true,
|
|
471
|
+
get: function () {
|
|
472
|
+
return _elementType.VIDEO;
|
|
473
|
+
}
|
|
474
|
+
});
|
|
475
|
+
Object.defineProperty(exports, "VIDEO_BLOCK", {
|
|
476
|
+
enumerable: true,
|
|
477
|
+
get: function () {
|
|
478
|
+
return _elementType.VIDEO_BLOCK;
|
|
479
|
+
}
|
|
480
|
+
});
|
|
469
481
|
Object.defineProperty(exports, "WIN_HOTKEYS", {
|
|
470
482
|
enumerable: true,
|
|
471
483
|
get: function () {
|
|
@@ -507,6 +519,7 @@ const INSERT_POSITION = exports.INSERT_POSITION = {
|
|
|
507
519
|
AFTER: 'after'
|
|
508
520
|
};
|
|
509
521
|
const LOCAL_IMAGE = exports.LOCAL_IMAGE = 'local-image';
|
|
522
|
+
const LOCAL_VIDEO = exports.LOCAL_VIDEO = 'local-video';
|
|
510
523
|
const LIST_TYPE_ARRAY = exports.LIST_TYPE_ARRAY = [_elementType.UNORDERED_LIST, _elementType.ORDERED_LIST];
|
|
511
524
|
const LIST_ITEM_CORRELATION_TYPE = exports.LIST_ITEM_CORRELATION_TYPE = [_elementType.UNORDERED_LIST, _elementType.ORDERED_LIST, _elementType.LIST_ITEM];
|
|
512
525
|
const LIST_ITEM_SUPPORTED_TRANSFORMATION = exports.LIST_ITEM_SUPPORTED_TRANSFORMATION = [_elementType.UNORDERED_LIST, _elementType.ORDERED_LIST, 'left', 'center', 'right', _elementType.BLOCKQUOTE];
|
|
@@ -515,7 +528,7 @@ const FILE_TYPE = exports.FILE_TYPE = {
|
|
|
515
528
|
[_elementType.FILE_LINK]: 'file',
|
|
516
529
|
[_elementType.SDOC_LINK]: 'sdoc'
|
|
517
530
|
};
|
|
518
|
-
const SUPPORTED_SIDE_OPERATION_TYPE = exports.SUPPORTED_SIDE_OPERATION_TYPE = [_elementType.PARAGRAPH, _elementType.SUBTITLE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CHECK_LIST_ITEM, _elementType.CODE_BLOCK, _elementType.TABLE, _elementType.BLOCKQUOTE, _elementType.CALL_OUT, _elementType.IMAGE_BLOCK, _elementType.SEATABLE_COLUMN];
|
|
531
|
+
const SUPPORTED_SIDE_OPERATION_TYPE = exports.SUPPORTED_SIDE_OPERATION_TYPE = [_elementType.PARAGRAPH, _elementType.SUBTITLE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CHECK_LIST_ITEM, _elementType.CODE_BLOCK, _elementType.TABLE, _elementType.BLOCKQUOTE, _elementType.CALL_OUT, _elementType.IMAGE_BLOCK, _elementType.VIDEO_BLOCK, _elementType.SEATABLE_COLUMN];
|
|
519
532
|
const MOUSE_ENTER_EVENT_DISABLED_MAP = exports.MOUSE_ENTER_EVENT_DISABLED_MAP = {
|
|
520
533
|
[_elementType.PARAGRAPH]: [_elementType.CALL_OUT],
|
|
521
534
|
[_elementType.TITLE]: [_elementType.CALL_OUT],
|
|
@@ -533,4 +546,4 @@ const MOUSE_ENTER_EVENT_DISABLED_MAP = exports.MOUSE_ENTER_EVENT_DISABLED_MAP =
|
|
|
533
546
|
[_elementType.HEADER6]: [_elementType.CALL_OUT],
|
|
534
547
|
[_elementType.CALL_OUT]: [_elementType.CALL_OUT]
|
|
535
548
|
};
|
|
536
|
-
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK];
|
|
549
|
+
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK, _elementType.VIDEO_BLOCK];
|
|
@@ -88,6 +88,11 @@ const MENUS_CONFIG_MAP = exports.MENUS_CONFIG_MAP = {
|
|
|
88
88
|
iconClass: 'sdocfont sdoc-image',
|
|
89
89
|
text: 'Image'
|
|
90
90
|
},
|
|
91
|
+
[_elementType.VIDEO]: {
|
|
92
|
+
id: `sdoc_${_elementType.VIDEO}`,
|
|
93
|
+
iconClass: 'sdocfont sdoc-video',
|
|
94
|
+
text: 'Video'
|
|
95
|
+
},
|
|
91
96
|
[_elementType.TABLE]: {
|
|
92
97
|
id: `sdoc_${_elementType.TABLE}`,
|
|
93
98
|
iconClass: 'sdocfont sdoc-table',
|
|
@@ -308,6 +313,12 @@ const SIDE_INSERT_MENUS_CONFIG = exports.SIDE_INSERT_MENUS_CONFIG = {
|
|
|
308
313
|
type: _elementType.IMAGE,
|
|
309
314
|
text: 'Image'
|
|
310
315
|
},
|
|
316
|
+
[_elementType.VIDEO]: {
|
|
317
|
+
id: '',
|
|
318
|
+
iconClass: 'sdocfont sdoc-video',
|
|
319
|
+
type: _elementType.VIDEO,
|
|
320
|
+
text: 'Video'
|
|
321
|
+
},
|
|
311
322
|
[_elementType.TABLE]: {
|
|
312
323
|
id: 'sdoc-side-menu-item-table',
|
|
313
324
|
iconClass: 'sdocfont sdoc-table',
|
|
@@ -401,6 +412,7 @@ const SIDE_INSERT_MENUS_CONFIG = exports.SIDE_INSERT_MENUS_CONFIG = {
|
|
|
401
412
|
};
|
|
402
413
|
const SIDE_INSERT_MENUS_SEARCH_MAP = exports.SIDE_INSERT_MENUS_SEARCH_MAP = {
|
|
403
414
|
[_elementType.IMAGE]: 'Image',
|
|
415
|
+
[_elementType.VIDEO]: 'Video',
|
|
404
416
|
[_elementType.TABLE]: 'Table',
|
|
405
417
|
[_elementType.MULTI_COLUMN]: 'Multi_column',
|
|
406
418
|
[_elementType.COLUMN]: 'Column',
|
|
@@ -48,6 +48,7 @@ const withImage = editor => {
|
|
|
48
48
|
return isVoid(elem);
|
|
49
49
|
};
|
|
50
50
|
newEditor.insertData = data => {
|
|
51
|
+
console.log(10, data);
|
|
51
52
|
const fragment = data.getData(`application/${_constants.CLIPBOARD_FORMAT_KEY}`) || (0, _documentUtils.getSlateFragmentAttribute)(data);
|
|
52
53
|
const originSdocUuid = data.getData(`text/${_constants.CLIPBOARD_ORIGIN_SDOC_KEY}`);
|
|
53
54
|
if (fragment && originSdocUuid) {
|
|
@@ -55,6 +56,7 @@ const withImage = editor => {
|
|
|
55
56
|
const fragmentData = JSON.parse(decoded);
|
|
56
57
|
if ((0, _helpers.hasSdocImages)(originSdocUuid, fragmentData)) {
|
|
57
58
|
const imageData = (0, _helpers.getImageData)(fragmentData);
|
|
59
|
+
console.log(9, fragmentData, imageData);
|
|
58
60
|
_context.default.copyImage(originSdocUuid, imageData).then(res => {
|
|
59
61
|
if (res.status === 200) {
|
|
60
62
|
// Task_id is an empty character and is copied from the same database.
|
|
@@ -83,6 +85,7 @@ const withImage = editor => {
|
|
|
83
85
|
insertData(data);
|
|
84
86
|
};
|
|
85
87
|
newEditor.insertFragment = data => {
|
|
88
|
+
console.log(11, data);
|
|
86
89
|
const singleImage = (0, _helpers.getSingleImageFromFragment)(data);
|
|
87
90
|
if (singleImage && (0, _helpers.isInsertImageMenuDisabled)(editor)) {
|
|
88
91
|
const path = _slate.Editor.path(editor, editor.selection);
|
|
@@ -146,6 +149,7 @@ const withImage = editor => {
|
|
|
146
149
|
}
|
|
147
150
|
};
|
|
148
151
|
newEditor.deleteBackward = unit => {
|
|
152
|
+
console.log('image');
|
|
149
153
|
const {
|
|
150
154
|
selection
|
|
151
155
|
} = editor;
|
|
@@ -186,7 +190,9 @@ const withImage = editor => {
|
|
|
186
190
|
(0, _core.focusEditor)(editor, range);
|
|
187
191
|
return;
|
|
188
192
|
}
|
|
193
|
+
console.log(10);
|
|
189
194
|
deleteBackward(unit);
|
|
195
|
+
console.log(11);
|
|
190
196
|
};
|
|
191
197
|
newEditor.insertBreak = () => {
|
|
192
198
|
const {
|
|
@@ -37,6 +37,7 @@ const Image = _ref => {
|
|
|
37
37
|
data,
|
|
38
38
|
border_type = _constants2.IMAGE_BORDER_TYPE[0].type
|
|
39
39
|
} = element;
|
|
40
|
+
// console.log(1, data);
|
|
40
41
|
const {
|
|
41
42
|
show_caption = false,
|
|
42
43
|
column_key
|
|
@@ -304,6 +305,10 @@ const Image = _ref => {
|
|
|
304
305
|
};
|
|
305
306
|
const SdocImage = (0, _reactI18next.withTranslation)('sdoc-editor')(Image);
|
|
306
307
|
function renderImage(props, editor) {
|
|
308
|
+
const nodeEntries = _slate.Editor.node(editor, {
|
|
309
|
+
match: n => n === 'paragraph',
|
|
310
|
+
universal: true
|
|
311
|
+
});
|
|
307
312
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
308
313
|
const isSelected = (0, _slateReact.useSelected)();
|
|
309
314
|
|
|
@@ -143,6 +143,12 @@ Object.defineProperty(exports, "TextPlugin", {
|
|
|
143
143
|
return _textStyle.default;
|
|
144
144
|
}
|
|
145
145
|
});
|
|
146
|
+
Object.defineProperty(exports, "VideoPlugin", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: function () {
|
|
149
|
+
return _video.default;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
146
152
|
Object.defineProperty(exports, "WikiLinkPlugin", {
|
|
147
153
|
enumerable: true,
|
|
148
154
|
get: function () {
|
|
@@ -159,6 +165,7 @@ var _checkList = _interopRequireDefault(require("./check-list"));
|
|
|
159
165
|
var _textStyle = _interopRequireDefault(require("./text-style"));
|
|
160
166
|
var _codeBlock = _interopRequireDefault(require("./code-block"));
|
|
161
167
|
var _image = _interopRequireDefault(require("./image"));
|
|
168
|
+
var _video = _interopRequireDefault(require("./video"));
|
|
162
169
|
var _table = _interopRequireDefault(require("./table"));
|
|
163
170
|
var _multiColumn = _interopRequireDefault(require("./multi-column"));
|
|
164
171
|
var _html = _interopRequireDefault(require("./html"));
|
|
@@ -174,7 +181,7 @@ var _quickInsert = _interopRequireDefault(require("./quick-insert"));
|
|
|
174
181
|
var _wikiLink = _interopRequireDefault(require("./wiki-link"));
|
|
175
182
|
var _seatableColumn = _interopRequireDefault(require("./seatable-column"));
|
|
176
183
|
var _seatableTables = _interopRequireDefault(require("./seatable-tables"));
|
|
177
|
-
const Plugins = [_markdown.default, _html.default, _header.default, _link.default, _blockquote.default, _list.default, _checkList.default, _codeBlock.default, _image.default, _table.default, _multiColumn.default, _textStyle.default, _textAlign.default, _font.default, _sdocLink.default, _paragraph.default, _fileLink.default, _callout.default, _searchReplace.default, _quickInsert.default];
|
|
184
|
+
const Plugins = [_markdown.default, _html.default, _header.default, _link.default, _blockquote.default, _list.default, _checkList.default, _codeBlock.default, _image.default, _video.default, _table.default, _multiColumn.default, _textStyle.default, _textAlign.default, _font.default, _sdocLink.default, _paragraph.default, _fileLink.default, _callout.default, _searchReplace.default, _quickInsert.default];
|
|
178
185
|
const WikiPlugins = exports.WikiPlugins = [...Plugins, _wikiLink.default];
|
|
179
186
|
const CommentPlugins = exports.CommentPlugins = [_markdown.default, _html.default, _paragraph.default, _textStyle.default, _list.default, _image.default, _link.default, _mention.default, _blockquote.default];
|
|
180
187
|
var _default = exports.default = Plugins;
|
|
@@ -27,7 +27,6 @@ const Paragraph = _ref => {
|
|
|
27
27
|
} = element;
|
|
28
28
|
const editor = (0, _slateReact.useSlateStatic)();
|
|
29
29
|
const isSelected = (0, _slateReact.useSelected)();
|
|
30
|
-
const isCommentEditor = editor.editorType === _constants.COMMENT_EDITOR;
|
|
31
30
|
let isShowPlaceHolder = false;
|
|
32
31
|
if (editor.children.length === 1) {
|
|
33
32
|
const node = editor.children[0];
|
|
@@ -39,13 +38,14 @@ const Paragraph = _ref => {
|
|
|
39
38
|
const node = editor.children[1];
|
|
40
39
|
isShowPlaceHolder = _slate.Node.string(element) === '' && (node === null || node === void 0 ? void 0 : node.id) === (element === null || element === void 0 ? void 0 : element.id) && !isComposing;
|
|
41
40
|
}
|
|
41
|
+
const isCommentEditor = editor.editorType === _constants.COMMENT_EDITOR;
|
|
42
42
|
if (!isCommentEditor && isSelected && _slate.Range.isCollapsed(editor.selection) && (0, _helper.isEmptyNode)(element) && _slateReact.ReactEditor.findPath(editor, element).length === 1 && !isComposing) {
|
|
43
43
|
isShowPlaceHolder = true;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
// Distinguish whether paragraph node is in multi_column node
|
|
47
|
-
const
|
|
48
|
-
if (!isComposing &&
|
|
47
|
+
const aboveNodeEntry = isSelected && (0, _core.getTopLevelBlockNode)(editor);
|
|
48
|
+
if (!isComposing && aboveNodeEntry && aboveNodeEntry[0].type === _constants2.ELEMENT_TYPE.MULTI_COLUMN && isSelected && (0, _helper.isEmptyNode)(element) && _slate.Range.isCollapsed(editor.selection)) {
|
|
49
49
|
isShowPlaceHolder = true;
|
|
50
50
|
}
|
|
51
51
|
const style = {
|
|
@@ -117,7 +117,9 @@ const onCopySdocLinkNode = (editor, element) => {
|
|
|
117
117
|
if (editor.selection == null || _slate.Range.isExpanded(editor.selection)) return;
|
|
118
118
|
const p = _slateReact.ReactEditor.findPath(editor, element);
|
|
119
119
|
_slate.Transforms.select(editor, p);
|
|
120
|
+
console.log('selection1111', editor.selection);
|
|
120
121
|
const newData = editor.setFragmentData(new DataTransfer());
|
|
122
|
+
console.log('newData', newData);
|
|
121
123
|
(0, _copyToClipboard.default)('copy', {
|
|
122
124
|
onCopy: clipboardData => {
|
|
123
125
|
newData.types.forEach(type => {
|
|
@@ -81,6 +81,7 @@ const withTable = editor => {
|
|
|
81
81
|
insertBreak();
|
|
82
82
|
};
|
|
83
83
|
newEditor.deleteBackward = unit => {
|
|
84
|
+
console.log('table');
|
|
84
85
|
const deleteType = (0, _helpers.deleteHandler)(newEditor);
|
|
85
86
|
if (deleteType === 'table') {
|
|
86
87
|
const {
|
|
@@ -159,6 +160,7 @@ const withTable = editor => {
|
|
|
159
160
|
deleteBackward(unit);
|
|
160
161
|
};
|
|
161
162
|
newEditor.deleteFragment = unit => {
|
|
163
|
+
console.log('table');
|
|
162
164
|
const {
|
|
163
165
|
selection
|
|
164
166
|
} = editor;
|
|
@@ -349,6 +351,7 @@ const withTable = editor => {
|
|
|
349
351
|
newEditor.setFragmentData = dataTransfer => {
|
|
350
352
|
const selectedNode = (0, _core.getSelectedNodeByType)(newEditor, _constants.ELEMENT_TYPE.TABLE);
|
|
351
353
|
if (!selectedNode) {
|
|
354
|
+
console.log('setFragmentData33333', setFragmentData);
|
|
352
355
|
return setFragmentData(dataTransfer);
|
|
353
356
|
}
|
|
354
357
|
const {
|