@seafile/sdoc-editor 3.0.40 → 3.0.42
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/comment/components/comment-image-previewer.js +2 -4
- package/dist/extension/commons/select-file-dialog/tree-view/index.css +1 -1
- package/dist/extension/plugins/ai/ai-module/index.js +6 -3
- package/dist/extension/plugins/ai/ai-module/style.css +11 -12
- package/dist/extension/plugins/callout/render-elem/callout-hover-menu/style.css +1 -1
- package/dist/extension/plugins/code-block/hover-menu/index.css +3 -3
- package/dist/extension/plugins/file-link/hover-menu/index.css +2 -2
- package/dist/extension/plugins/file-link/plugin.js +9 -21
- package/dist/extension/plugins/file-link/render-elem.css +2 -0
- package/dist/extension/plugins/file-link/render-elem.js +1 -1
- package/dist/extension/plugins/image/dialogs/image-previewer.js +2 -4
- package/dist/extension/plugins/image/hover-menu/index.css +2 -2
- package/dist/extension/plugins/link/hover/index.css +2 -2
- package/dist/extension/plugins/sdoc-link/hover-menu/index.css +2 -2
- package/dist/extension/plugins/sdoc-link/plugin.js +9 -20
- package/dist/extension/plugins/sdoc-link/render/render-elem.css +2 -0
- package/dist/extension/plugins/sdoc-link/render/render-elem.js +1 -1
- package/dist/extension/plugins/video/hover-menu/index.css +2 -2
- package/dist/extension/plugins/whiteboard/hover-menu/index.css +2 -2
- package/package.json +4 -4
|
@@ -8,13 +8,11 @@ exports["default"] = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactI18next = require("react-i18next");
|
|
10
10
|
var _reactImageLightbox = _interopRequireDefault(require("@seafile/react-image-lightbox"));
|
|
11
|
-
var _commonUtils = require("../../utils/common-utils");
|
|
12
11
|
require("@seafile/react-image-lightbox/style.css");
|
|
13
12
|
function CommentImagePreviewer(props) {
|
|
14
13
|
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
15
14
|
t = _useTranslation.t;
|
|
16
15
|
var mainSrc = props.imageUrl;
|
|
17
|
-
var shortcutMain = (0, _commonUtils.isMac)() ? '⌘' : 'Ctrl';
|
|
18
16
|
var imageTitle = '';
|
|
19
17
|
try {
|
|
20
18
|
imageTitle = mainSrc ? decodeURI(mainSrc.slice(mainSrc.lastIndexOf('/') + 1)) : '';
|
|
@@ -39,8 +37,8 @@ function CommentImagePreviewer(props) {
|
|
|
39
37
|
reactModalProps: {
|
|
40
38
|
shouldReturnFocusAfterClose: false
|
|
41
39
|
},
|
|
42
|
-
zoomInTip: t('
|
|
43
|
-
zoomOutTip: t('
|
|
40
|
+
zoomInTip: t('Zoom_in'),
|
|
41
|
+
zoomOutTip: t('Zoom_out')
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
var _default = exports["default"] = CommentImagePreviewer;
|
|
@@ -264,6 +264,9 @@ function AIModule(_ref) {
|
|
|
264
264
|
var value = event.target.value;
|
|
265
265
|
if (value === searchValue) return;
|
|
266
266
|
setSearchValue(value);
|
|
267
|
+
var el = event.target;
|
|
268
|
+
el.style.height = 'auto';
|
|
269
|
+
el.style.height = el.scrollHeight + 'px';
|
|
267
270
|
}, [searchValue]);
|
|
268
271
|
var transferHtml = /*#__PURE__*/function () {
|
|
269
272
|
var _ref2 = (0, _asyncToGenerator2["default"])(/*#__PURE__*/(0, _regenerator2["default"])().m(function _callee(mdString) {
|
|
@@ -555,14 +558,14 @@ function AIModule(_ref) {
|
|
|
555
558
|
className: "sdoc-ai-content"
|
|
556
559
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
557
560
|
className: "sdoc-ai-search"
|
|
558
|
-
}, /*#__PURE__*/_react["default"].createElement(_aiIcon["default"], null), /*#__PURE__*/_react["default"].createElement("
|
|
559
|
-
type: "text",
|
|
561
|
+
}, /*#__PURE__*/_react["default"].createElement(_aiIcon["default"], null), /*#__PURE__*/_react["default"].createElement("textarea", {
|
|
560
562
|
ref: inputRef,
|
|
561
563
|
autoFocus: true,
|
|
562
564
|
placeholder: t('Ask_AI_anything'),
|
|
563
565
|
value: inputValue,
|
|
564
566
|
onKeyDown: onKeyDown,
|
|
565
|
-
onChange: onSearchValueChanged
|
|
567
|
+
onChange: onSearchValueChanged,
|
|
568
|
+
rows: 1
|
|
566
569
|
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
567
570
|
className: "sdocfont sdoc-send-arrow ".concat(!searchValue ? 'disable' : ''),
|
|
568
571
|
onClick: onEnter
|
|
@@ -16,26 +16,25 @@
|
|
|
16
16
|
|
|
17
17
|
.sdoc-ai-content .sdoc-ai-search {
|
|
18
18
|
position: relative;
|
|
19
|
-
height:
|
|
19
|
+
height: fit-content;
|
|
20
20
|
line-height: 50px;
|
|
21
21
|
display: flex;
|
|
22
22
|
align-items: center;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.sdoc-ai-content .sdoc-ai-search
|
|
26
|
-
border: none;
|
|
27
|
-
padding: 0 44px;
|
|
28
|
-
border-radius: 10px;
|
|
29
|
-
width: 100%;
|
|
30
|
-
outline: none;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.sdoc-ai-content .sdoc-ai-search input {
|
|
25
|
+
.sdoc-ai-content .sdoc-ai-search textarea {
|
|
34
26
|
border: none;
|
|
35
|
-
padding:
|
|
36
|
-
border-radius: 10px;
|
|
27
|
+
padding: 10px 44px;
|
|
37
28
|
width: 100%;
|
|
38
29
|
pointer-events: all;
|
|
30
|
+
flex: 1;
|
|
31
|
+
outline: none;
|
|
32
|
+
resize: none;
|
|
33
|
+
background: transparent;
|
|
34
|
+
font: inherit;
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
white-space: pre-wrap;
|
|
37
|
+
word-break: break-word;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
.sdoc-ai-content .sdoc-ai-search .sdoc-send-arrow {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
.sdoc-code-block-hover-menu-container .hover-menu-container .active {
|
|
23
|
-
color: #
|
|
23
|
+
color: #444444;
|
|
24
24
|
text-decoration: none;
|
|
25
25
|
background: #f2f2f2;
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
height: 100%;
|
|
31
31
|
width: 100%;
|
|
32
32
|
font-size: 12px;
|
|
33
|
-
color: #
|
|
33
|
+
color: #444444;
|
|
34
34
|
border-radius: 2px;
|
|
35
35
|
text-align: center;
|
|
36
36
|
line-height: 20px;
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
.sdoc-code-block-hover-menu-container .hover-menu-container .op-item:hover {
|
|
73
|
-
color: #
|
|
73
|
+
color: #444444;
|
|
74
74
|
text-decoration: none;
|
|
75
75
|
background: #f2f2f2;
|
|
76
76
|
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.sdoc-file-link-hover-menu-container .hover-menu-container .op-item {
|
|
26
26
|
position: relative;
|
|
27
27
|
font-size: 12px;
|
|
28
|
-
color: #
|
|
28
|
+
color: #444444;
|
|
29
29
|
padding: 0 5px;
|
|
30
30
|
border-radius: 2px;
|
|
31
31
|
min-width: 24px;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.sdoc-file-link-hover-menu-container .hover-menu-container .op-item:hover {
|
|
39
|
-
color: #
|
|
39
|
+
color: #444444;
|
|
40
40
|
text-decoration: none;
|
|
41
41
|
background: #f1f1f1;
|
|
42
42
|
}
|
|
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports["default"] = void 0;
|
|
7
7
|
var _slate = require("@seafile/slate");
|
|
8
8
|
var _constants = require("../../constants");
|
|
9
|
-
var _helpers = require("./helpers");
|
|
10
9
|
var withFileLink = function withFileLink(editor) {
|
|
11
10
|
var isInline = editor.isInline,
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
isVoid = editor.isVoid,
|
|
12
|
+
deleteBackward = editor.deleteBackward;
|
|
14
13
|
var newEditor = editor;
|
|
15
14
|
|
|
16
15
|
// Rewrite isInline
|
|
@@ -21,6 +20,13 @@ var withFileLink = function withFileLink(editor) {
|
|
|
21
20
|
}
|
|
22
21
|
return isInline(elem);
|
|
23
22
|
};
|
|
23
|
+
newEditor.isVoid = function (elem) {
|
|
24
|
+
var type = elem.type;
|
|
25
|
+
if (type === _constants.FILE_LINK) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return isVoid(elem);
|
|
29
|
+
};
|
|
24
30
|
newEditor.deleteBackward = function (unit) {
|
|
25
31
|
var selection = newEditor.selection;
|
|
26
32
|
if (selection === null) {
|
|
@@ -43,24 +49,6 @@ var withFileLink = function withFileLink(editor) {
|
|
|
43
49
|
}
|
|
44
50
|
return deleteBackward(unit);
|
|
45
51
|
};
|
|
46
|
-
newEditor.onHotKeyDown = function (e) {
|
|
47
|
-
var fileLinkEntry = (0, _helpers.getFileLinkEntry)(editor);
|
|
48
|
-
if (fileLinkEntry) {
|
|
49
|
-
if (e.key === 'ArrowLeft') {
|
|
50
|
-
var beforePointFileLink = _slate.Editor.before(newEditor, fileLinkEntry[1]);
|
|
51
|
-
_slate.Transforms.select(newEditor, beforePointFileLink);
|
|
52
|
-
e.preventDefault();
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (e.key === 'ArrowRight') {
|
|
56
|
-
var afterPointFileLink = _slate.Editor.after(newEditor, fileLinkEntry[1]);
|
|
57
|
-
_slate.Transforms.select(newEditor, afterPointFileLink);
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return onHotKeyDown && onHotKeyDown(e);
|
|
63
|
-
};
|
|
64
52
|
return newEditor;
|
|
65
53
|
};
|
|
66
54
|
var _default = exports["default"] = withFileLink;
|
|
@@ -175,7 +175,7 @@ var FileLink = function FileLink(_ref) {
|
|
|
175
175
|
return e.preventDefault();
|
|
176
176
|
},
|
|
177
177
|
title: element.title
|
|
178
|
-
},
|
|
178
|
+
}, element.title))), children, isShowInsertHoverMenu && /*#__PURE__*/_react["default"].createElement(_hoverMenu["default"], {
|
|
179
179
|
editor: editor,
|
|
180
180
|
menuPosition: menuPosition,
|
|
181
181
|
element: element,
|
|
@@ -13,7 +13,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/inhe
|
|
|
13
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _reactImageLightbox = _interopRequireDefault(require("@seafile/react-image-lightbox"));
|
|
16
|
-
var _commonUtils = require("../../../../utils/common-utils");
|
|
17
16
|
var _helpers = require("../helpers");
|
|
18
17
|
require("@seafile/react-image-lightbox/style.css");
|
|
19
18
|
var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
|
|
@@ -74,7 +73,6 @@ var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
|
|
|
74
73
|
var imageIndex = this.state.imageIndex;
|
|
75
74
|
var imageItemsLength = this.images.length;
|
|
76
75
|
var mainSrc = this.images[imageIndex] || '';
|
|
77
|
-
var shortcutMain = (0, _commonUtils.isMac)() ? '⌘' : 'Ctrl';
|
|
78
76
|
var imageTitle = '';
|
|
79
77
|
try {
|
|
80
78
|
imageTitle = mainSrc ? decodeURI(mainSrc.slice(mainSrc.lastIndexOf('/') + 1)) : '';
|
|
@@ -107,8 +105,8 @@ var ImagePreviewer = /*#__PURE__*/function (_React$Component) {
|
|
|
107
105
|
reactModalProps: {
|
|
108
106
|
shouldReturnFocusAfterClose: false
|
|
109
107
|
},
|
|
110
|
-
zoomInTip: this.props.t('
|
|
111
|
-
zoomOutTip: this.props.t('
|
|
108
|
+
zoomInTip: this.props.t('Zoom_in'),
|
|
109
|
+
zoomOutTip: this.props.t('Zoom_out')
|
|
112
110
|
});
|
|
113
111
|
}
|
|
114
112
|
}]);
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.sdoc-image-hover-menu-container .hover-menu-container .op-item {
|
|
29
29
|
position: relative;
|
|
30
30
|
font-size: 12px;
|
|
31
|
-
color: #
|
|
31
|
+
color: #444444;
|
|
32
32
|
padding: 0 5px;
|
|
33
33
|
border-radius: 2px;
|
|
34
34
|
min-width: 24px;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.sdoc-image-hover-menu-container .hover-menu-container .op-item:hover {
|
|
42
|
-
color: #
|
|
42
|
+
color: #444444;
|
|
43
43
|
text-decoration: none;
|
|
44
44
|
background: #f1f1f1;
|
|
45
45
|
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
.link-op-menu-link {
|
|
27
27
|
font-size: 12px;
|
|
28
|
-
color: #
|
|
28
|
+
color: #444444;
|
|
29
29
|
padding: 0 5px;
|
|
30
30
|
border-radius: 2px;
|
|
31
31
|
line-height: 20px;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
.link-op-menu-link:hover {
|
|
36
|
-
color: #
|
|
36
|
+
color: #444444;
|
|
37
37
|
text-decoration: none;
|
|
38
38
|
background: #f1f1f1;
|
|
39
39
|
}
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.sdoc-link-hover-menu-container .hover-menu-container .op-item {
|
|
26
26
|
position: relative;
|
|
27
27
|
font-size: 12px;
|
|
28
|
-
color: #
|
|
28
|
+
color: #444444;
|
|
29
29
|
padding: 0 5px;
|
|
30
30
|
border-radius: 2px;
|
|
31
31
|
min-width: 24px;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.sdoc-link-hover-menu-container .hover-menu-container .op-item:hover {
|
|
39
|
-
color: #
|
|
39
|
+
color: #444444;
|
|
40
40
|
text-decoration: none;
|
|
41
41
|
background: #f1f1f1;
|
|
42
42
|
}
|
|
@@ -12,10 +12,10 @@ var _core = require("../../core");
|
|
|
12
12
|
var _helpers = require("./helpers");
|
|
13
13
|
var withSdocLink = function withSdocLink(editor) {
|
|
14
14
|
var isInline = editor.isInline,
|
|
15
|
+
isVoid = editor.isVoid,
|
|
15
16
|
deleteBackward = editor.deleteBackward,
|
|
16
17
|
insertText = editor.insertText,
|
|
17
|
-
onCompositionStart = editor.onCompositionStart
|
|
18
|
-
onHotKeyDown = editor.onHotKeyDown;
|
|
18
|
+
onCompositionStart = editor.onCompositionStart;
|
|
19
19
|
var newEditor = editor;
|
|
20
20
|
|
|
21
21
|
// Rewrite isInline
|
|
@@ -25,6 +25,13 @@ var withSdocLink = function withSdocLink(editor) {
|
|
|
25
25
|
if (isInlineElem) return true;
|
|
26
26
|
return isInline(elem);
|
|
27
27
|
};
|
|
28
|
+
newEditor.isVoid = function (elem) {
|
|
29
|
+
var type = elem.type;
|
|
30
|
+
if (type === _constants.SDOC_LINK) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
return isVoid(elem);
|
|
34
|
+
};
|
|
28
35
|
newEditor.deleteBackward = function (unit) {
|
|
29
36
|
var selection = newEditor.selection;
|
|
30
37
|
if (selection === null) {
|
|
@@ -75,24 +82,6 @@ var withSdocLink = function withSdocLink(editor) {
|
|
|
75
82
|
}
|
|
76
83
|
return onCompositionStart && onCompositionStart(event);
|
|
77
84
|
};
|
|
78
|
-
newEditor.onHotKeyDown = function (e) {
|
|
79
|
-
var sdocLinkEntry = (0, _helpers.getSdocLinkEntry)(editor);
|
|
80
|
-
if (sdocLinkEntry) {
|
|
81
|
-
if (e.key === 'ArrowLeft') {
|
|
82
|
-
var beforePointSdocLink = _slate.Editor.before(newEditor, sdocLinkEntry[1]);
|
|
83
|
-
_slate.Transforms.select(newEditor, beforePointSdocLink);
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
if (e.key === 'ArrowRight') {
|
|
88
|
-
var afterPointSdocLink = _slate.Editor.after(newEditor, sdocLinkEntry[1]);
|
|
89
|
-
_slate.Transforms.select(newEditor, afterPointSdocLink);
|
|
90
|
-
e.preventDefault();
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return onHotKeyDown && onHotKeyDown(e);
|
|
95
|
-
};
|
|
96
85
|
return newEditor;
|
|
97
86
|
};
|
|
98
87
|
var _default = exports["default"] = withSdocLink;
|
|
@@ -210,7 +210,7 @@ var SdocFileLink = function SdocFileLink(_ref) {
|
|
|
210
210
|
return e.preventDefault();
|
|
211
211
|
},
|
|
212
212
|
title: element.title
|
|
213
|
-
},
|
|
213
|
+
}, element.title))), children, isShowInsertHoverMenu && !readOnly && editor.selection && _slate.Range.isCollapsed(editor.selection) && /*#__PURE__*/_react["default"].createElement(_hoverMenu["default"], {
|
|
214
214
|
url: url,
|
|
215
215
|
editor: editor,
|
|
216
216
|
menuPosition: menuPosition,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.video-hover-menu-container .hover-menu-container .op-item {
|
|
26
26
|
position: relative;
|
|
27
27
|
font-size: 12px;
|
|
28
|
-
color: #
|
|
28
|
+
color: #444444;
|
|
29
29
|
padding: 0 5px;
|
|
30
30
|
border-radius: 2px;
|
|
31
31
|
min-width: 24px;
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.video-hover-menu-container .hover-menu-container .op-item:hover {
|
|
39
|
-
color: #
|
|
39
|
+
color: #444444;
|
|
40
40
|
text-decoration: none;
|
|
41
41
|
background: #f1f1f1;
|
|
42
42
|
}
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
.sdoc-whiteboard-hover-menu-container .hover-menu-container .op-item {
|
|
29
29
|
position: relative;
|
|
30
30
|
font-size: 12px;
|
|
31
|
-
color: #
|
|
31
|
+
color: #444444;
|
|
32
32
|
padding: 0 5px;
|
|
33
33
|
border-radius: 2px;
|
|
34
34
|
min-width: 24px;
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
.sdoc-whiteboard-hover-menu-container .hover-menu-container .op-item:hover {
|
|
42
|
-
color: #
|
|
42
|
+
color: #444444;
|
|
43
43
|
text-decoration: none;
|
|
44
44
|
background: #f1f1f1;
|
|
45
45
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.42",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "jest",
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"description": "",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@seafile/comment-editor": "1.0.
|
|
20
|
+
"@seafile/comment-editor": "1.0.5",
|
|
21
21
|
"@seafile/print-js": "1.6.6",
|
|
22
22
|
"@seafile/react-image-lightbox": "^5.0.2",
|
|
23
|
-
"@seafile/seafile-database": "0.0.
|
|
23
|
+
"@seafile/seafile-database": "0.0.16",
|
|
24
24
|
"@seafile/slate": "0.91.8",
|
|
25
25
|
"@seafile/slate-history": "0.86.2",
|
|
26
26
|
"@seafile/slate-hyperscript": "0.81.7",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "0f50f22dab8ea9e6c40ddd95e0c925b2ca23d10b"
|
|
76
76
|
}
|