@seafile/comment-editor 1.0.32-beta.1 → 1.0.32-beta.3
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.
|
@@ -12,6 +12,7 @@ var _reactI18next = require("react-i18next");
|
|
|
12
12
|
var _slate = require("@seafile/slate");
|
|
13
13
|
var _slateReact = require("@seafile/slate-react");
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
16
|
var _imagePlaceholder = _interopRequireDefault(require("../../../assets/images/image-placeholder.png"));
|
|
16
17
|
var _constants = require("../../../constants");
|
|
17
18
|
var _useComment = require("../../../hooks/use-comment");
|
|
@@ -54,8 +55,11 @@ const Image = _ref => {
|
|
|
54
55
|
};
|
|
55
56
|
const readOnly = (0, _slateReact.useReadOnly)();
|
|
56
57
|
const {
|
|
57
|
-
|
|
58
|
+
imageConfig = {}
|
|
58
59
|
} = (0, _useComment.useComment)();
|
|
60
|
+
const {
|
|
61
|
+
disableHoverMenu = false
|
|
62
|
+
} = imageConfig;
|
|
59
63
|
const imageRef = (0, _react.useRef)(null);
|
|
60
64
|
const resizerRef = (0, _react.useRef)(null);
|
|
61
65
|
const imageCaptionInputRef = (0, _react.useRef)(null);
|
|
@@ -211,12 +215,11 @@ const Image = _ref => {
|
|
|
211
215
|
});
|
|
212
216
|
}
|
|
213
217
|
}, []);
|
|
214
|
-
const onClickImage = (0, _react.useCallback)(
|
|
215
|
-
console.log('onClickImage!!!!!!', pluginName);
|
|
216
|
-
if (pluginName === 'dtable') return;
|
|
218
|
+
const onClickImage = (0, _react.useCallback)(() => {
|
|
217
219
|
setPosition();
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
console.log('!!!!!');
|
|
221
|
+
if (!disableHoverMenu) setIsShowImageHoverMenu(true);
|
|
222
|
+
}, [disableHoverMenu, setPosition]);
|
|
220
223
|
const reloadImage = (0, _react.useCallback)(() => {
|
|
221
224
|
if (imageRef.current) {
|
|
222
225
|
imageRef.current['src'] = (0, _helpers.getImageURL)(data, editor);
|
|
@@ -357,6 +360,15 @@ const Image = _ref => {
|
|
|
357
360
|
})));
|
|
358
361
|
};
|
|
359
362
|
const SdocImage = Image;
|
|
363
|
+
SdocImage.propTypes = {
|
|
364
|
+
element: _propTypes.default.object,
|
|
365
|
+
editor: _propTypes.default.object,
|
|
366
|
+
style: _propTypes.default.object,
|
|
367
|
+
className: _propTypes.default.string,
|
|
368
|
+
attributes: _propTypes.default.object,
|
|
369
|
+
children: _propTypes.default.node,
|
|
370
|
+
isSelected: _propTypes.default.bool
|
|
371
|
+
};
|
|
360
372
|
function renderImage(props, editor) {
|
|
361
373
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
362
374
|
const isSelected = (0, _slateReact.useSelected)();
|
|
@@ -28,7 +28,8 @@ const CommentProvider = _ref => {
|
|
|
28
28
|
pluginEvent,
|
|
29
29
|
collaborators = [],
|
|
30
30
|
participants = [],
|
|
31
|
-
addParticipants
|
|
31
|
+
addParticipants,
|
|
32
|
+
imageConfig = {}
|
|
32
33
|
} = _ref;
|
|
33
34
|
const getCollaborators = (0, _react.useCallback)(() => {
|
|
34
35
|
const newCollaborators = collaborators.map(user => new _model.User(user));
|
|
@@ -46,6 +47,7 @@ const CommentProvider = _ref => {
|
|
|
46
47
|
pluginName,
|
|
47
48
|
pluginEventBus,
|
|
48
49
|
pluginEvent,
|
|
50
|
+
imageConfig,
|
|
49
51
|
collaborators: getCollaborators(),
|
|
50
52
|
participants: getParticipants(),
|
|
51
53
|
addParticipants
|
|
@@ -18,6 +18,7 @@ const SeafileCommentEditor = _ref => {
|
|
|
18
18
|
// sdoc or dtable or txt or py ...
|
|
19
19
|
pluginEventBus,
|
|
20
20
|
pluginEvent,
|
|
21
|
+
imageConfig,
|
|
21
22
|
// Comment editor
|
|
22
23
|
content,
|
|
23
24
|
insertContent,
|
|
@@ -45,6 +46,7 @@ const SeafileCommentEditor = _ref => {
|
|
|
45
46
|
pluginName: pluginName,
|
|
46
47
|
pluginEventBus: pluginEventBus,
|
|
47
48
|
pluginEvent: pluginEvent,
|
|
49
|
+
imageConfig: imageConfig,
|
|
48
50
|
collaborators: collaborators,
|
|
49
51
|
participants: participants,
|
|
50
52
|
addParticipants: addParticipants
|