@seafile/sdoc-editor 0.5.38 → 0.5.39
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/global-comment/index.css +2 -0
- package/dist/basic-sdk/editor/sdoc-comment-editor.js +6 -1
- package/dist/basic-sdk/extension/commons/insert-element-dialog/index.js +3 -2
- package/dist/basic-sdk/extension/plugins/sdoc-link/helpers.js +5 -3
- package/dist/basic-sdk/extension/plugins/table/render/resize-mask/index.js +7 -16
- package/package.json +1 -1
|
@@ -15,6 +15,7 @@ import { EventBus } from '../../basic-sdk';
|
|
|
15
15
|
import { EXTERNAL_EVENT } from '../../constants';
|
|
16
16
|
import CommentEditorToolbar from '../extension/toolbar/comment-editor-toolbar';
|
|
17
17
|
import CommentArticle from './comment-article';
|
|
18
|
+
import { ScrollContext } from '../hooks/use-scroll-context';
|
|
18
19
|
const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
19
20
|
let {
|
|
20
21
|
editor: propsEditor,
|
|
@@ -110,12 +111,16 @@ const SdocCommentEditor = forwardRef((_ref, ref) => {
|
|
|
110
111
|
ref: commentEditorContainerRef,
|
|
111
112
|
className: "article sdoc-comment-editor",
|
|
112
113
|
onClick: handleFocusEditor
|
|
114
|
+
}, /*#__PURE__*/React.createElement(ScrollContext.Provider, {
|
|
115
|
+
value: {
|
|
116
|
+
scrollRef: commentEditorContainerRef
|
|
117
|
+
}
|
|
113
118
|
}, /*#__PURE__*/React.createElement(CommentArticle, {
|
|
114
119
|
type: type,
|
|
115
120
|
editor: validEditor,
|
|
116
121
|
slateValue: slateValue,
|
|
117
122
|
updateSlateValue: setSlateValue
|
|
118
|
-
})), /*#__PURE__*/React.createElement(CommentEditorToolbar, {
|
|
123
|
+
}))), /*#__PURE__*/React.createElement(CommentEditorToolbar, {
|
|
119
124
|
editor: validEditor,
|
|
120
125
|
onSubmit: onSubmit,
|
|
121
126
|
submitBtnText: submitBtnText,
|
|
@@ -46,7 +46,8 @@ const InsertElementDialog = _ref => {
|
|
|
46
46
|
slateNode,
|
|
47
47
|
insertFileLinkCallback,
|
|
48
48
|
insertSdocFileLinkCallback,
|
|
49
|
-
isShowHistoryFiles
|
|
49
|
+
isShowHistoryFiles,
|
|
50
|
+
editor: paramEditor
|
|
50
51
|
} = _ref2;
|
|
51
52
|
setInsertPosition(insertPosition);
|
|
52
53
|
setSlateNode(slateNode);
|
|
@@ -58,7 +59,7 @@ const InsertElementDialog = _ref => {
|
|
|
58
59
|
});
|
|
59
60
|
setIsShowHistoryFiles(isShowHistoryFiles);
|
|
60
61
|
// Apply for comment editor, as it has a different editor instance
|
|
61
|
-
setValidEditor(editor);
|
|
62
|
+
setValidEditor(paramEditor || editor);
|
|
62
63
|
if (type === LOCAL_IMAGE) {
|
|
63
64
|
setTimeout(() => {
|
|
64
65
|
uploadLocalImageInputRef.current && uploadLocalImageInputRef.current.click();
|
|
@@ -22,16 +22,18 @@ export const isMenuDisabled = (editor, readonly) => {
|
|
|
22
22
|
return false; // enable
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
export const generateSdocFileNode = (uuid
|
|
25
|
+
export const generateSdocFileNode = function (uuid) {
|
|
26
|
+
let text = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
27
|
+
const sdocFileName = text.replace(/\.sdoc$/, '');
|
|
26
28
|
const sdocFileNode = {
|
|
27
29
|
id: slugid.nice(),
|
|
28
30
|
type: SDOC_LINK,
|
|
29
31
|
doc_uuid: uuid,
|
|
30
|
-
title:
|
|
32
|
+
title: sdocFileName,
|
|
31
33
|
display_type: INSERT_FILE_DISPLAY_TYPE[1],
|
|
32
34
|
children: [{
|
|
33
35
|
id: slugid.nice(),
|
|
34
|
-
text:
|
|
36
|
+
text: sdocFileName
|
|
35
37
|
}]
|
|
36
38
|
};
|
|
37
39
|
return sdocFileNode;
|
|
@@ -87,18 +87,13 @@ const ResizeMask = _ref => {
|
|
|
87
87
|
}
|
|
88
88
|
return resizeHandlerInfo;
|
|
89
89
|
}, [cellInfo, editor, maskStyle, table]);
|
|
90
|
-
const
|
|
90
|
+
const handleMouseDown = useCallback((event, mode) => {
|
|
91
91
|
event.stopPropagation();
|
|
92
92
|
event.preventDefault();
|
|
93
|
-
|
|
93
|
+
handlerStartDragging();
|
|
94
94
|
const handlerInfo = getHandlerDisplayInfo(mode);
|
|
95
95
|
handleShowResizeHandler(handlerInfo);
|
|
96
|
-
}, [getHandlerDisplayInfo, handleShowResizeHandler,
|
|
97
|
-
const handleMouseDown = useCallback(event => {
|
|
98
|
-
event.stopPropagation();
|
|
99
|
-
event.preventDefault();
|
|
100
|
-
handlerStartDragging();
|
|
101
|
-
}, [handlerStartDragging]);
|
|
96
|
+
}, [getHandlerDisplayInfo, handleShowResizeHandler, handlerStartDragging]);
|
|
102
97
|
const handleMouseOut = useCallback(event => {
|
|
103
98
|
event.stopPropagation();
|
|
104
99
|
event.preventDefault();
|
|
@@ -110,23 +105,19 @@ const ResizeMask = _ref => {
|
|
|
110
105
|
style: maskStyle
|
|
111
106
|
}, cellInfo.rowIndex !== 0 && /*#__PURE__*/React.createElement("div", {
|
|
112
107
|
onMouseOut: handleMouseOut,
|
|
113
|
-
onMouseDown: handleMouseDown,
|
|
114
|
-
onMouseOver: e => handleMouseOver(e, RESIZE_MASK_TOP),
|
|
108
|
+
onMouseDown: e => handleMouseDown(e, RESIZE_MASK_TOP),
|
|
115
109
|
className: "sdoc-table-resize-top"
|
|
116
110
|
}), /*#__PURE__*/React.createElement("div", {
|
|
117
111
|
onMouseOut: handleMouseOut,
|
|
118
|
-
onMouseDown: handleMouseDown,
|
|
119
|
-
onMouseOver: e => handleMouseOver(e, RESIZE_MASK_RIGHT),
|
|
112
|
+
onMouseDown: e => handleMouseDown(e, RESIZE_MASK_RIGHT),
|
|
120
113
|
className: "sdoc-table-resize-right"
|
|
121
114
|
}), /*#__PURE__*/React.createElement("div", {
|
|
122
115
|
onMouseOut: handleMouseOut,
|
|
123
|
-
onMouseDown: handleMouseDown,
|
|
124
|
-
onMouseOver: e => handleMouseOver(e, RESIZE_MASK_BOTTOM),
|
|
116
|
+
onMouseDown: e => handleMouseDown(e, RESIZE_MASK_BOTTOM),
|
|
125
117
|
className: "sdoc-table-resize-bottom"
|
|
126
118
|
}), /*#__PURE__*/React.createElement("div", {
|
|
127
119
|
onMouseOut: handleMouseOut,
|
|
128
|
-
onMouseDown: handleMouseDown,
|
|
129
|
-
onMouseOver: e => handleMouseOver(e, RESIZE_MASK_LEFT),
|
|
120
|
+
onMouseDown: e => handleMouseDown(e, RESIZE_MASK_LEFT),
|
|
130
121
|
className: "sdoc-table-resize-left"
|
|
131
122
|
}));
|
|
132
123
|
};
|