@seafile/sdoc-editor 1.0.192 → 1.0.194
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 +0 -8
- package/dist/basic-sdk/extension/plugins/check-list/render-elem.js +8 -3
- package/dist/basic-sdk/extension/plugins/text-style/menu/index.js +3 -1
- package/dist/basic-sdk/extension/toolbar/side-toolbar/side-menu.js +2 -1
- package/dist/pages/sdoc-wiki-editor.js +11 -5
- package/package.json +1 -1
|
@@ -124,20 +124,12 @@
|
|
|
124
124
|
margin-top: 0px;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.sdoc-resolved {
|
|
128
|
-
background: #f5f5f5;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
127
|
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active {
|
|
132
128
|
left: 0;
|
|
133
129
|
background: #fff;
|
|
134
130
|
box-shadow: unset;
|
|
135
131
|
}
|
|
136
132
|
|
|
137
|
-
.sdoc-comment-drawer .comments-panel-body__content .comment-ui-container.active.sdoc-resolved {
|
|
138
|
-
background: #f5f5f5;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
133
|
.sdoc-dropdown-menu .dropdown-item {
|
|
142
134
|
font-size: 14px;
|
|
143
135
|
color: #212529;
|
|
@@ -13,11 +13,13 @@ class CheckListItem extends _react.default.PureComponent {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
super(...arguments);
|
|
15
15
|
(0, _defineProperty2.default)(this, "onChange", event => {
|
|
16
|
-
const checked = event.target.checked;
|
|
17
16
|
const {
|
|
18
17
|
editor,
|
|
19
|
-
element
|
|
18
|
+
element,
|
|
19
|
+
readOnly
|
|
20
20
|
} = this.props;
|
|
21
|
+
if (readOnly) return;
|
|
22
|
+
const checked = event.target.checked;
|
|
21
23
|
const path = _slateReact.ReactEditor.findPath(editor, element);
|
|
22
24
|
_slate.Transforms.setNodes(editor, {
|
|
23
25
|
checked
|
|
@@ -58,8 +60,11 @@ class CheckListItem extends _react.default.PureComponent {
|
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
const renderCheckListItem = (props, editor) => {
|
|
63
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
64
|
+
const readOnly = (0, _slateReact.useReadOnly)();
|
|
61
65
|
return /*#__PURE__*/_react.default.createElement(CheckListItem, Object.assign({}, props, {
|
|
62
|
-
editor: editor
|
|
66
|
+
editor: editor,
|
|
67
|
+
readOnly: readOnly
|
|
63
68
|
}));
|
|
64
69
|
};
|
|
65
70
|
exports.renderCheckListItem = renderCheckListItem;
|
|
@@ -21,6 +21,7 @@ var _helpers3 = require("../../link/helpers");
|
|
|
21
21
|
var _useColorContext = require("../../../../hooks/use-color-context");
|
|
22
22
|
var _constants = require("../../../constants");
|
|
23
23
|
var _constants2 = require("../../../../../basic-sdk/constants");
|
|
24
|
+
var _context = _interopRequireDefault(require("../../../../../context"));
|
|
24
25
|
const TextStyleMenuList = _ref => {
|
|
25
26
|
let {
|
|
26
27
|
editor,
|
|
@@ -32,6 +33,7 @@ const TextStyleMenuList = _ref => {
|
|
|
32
33
|
} = _ref;
|
|
33
34
|
let selectedFontSize = (0, _helpers.getFontSize)(editor);
|
|
34
35
|
let selectedFontSizeValue = selectedFontSize;
|
|
36
|
+
const enableSeafileAI = _context.default.getSetting('enableSeafileAI');
|
|
35
37
|
const {
|
|
36
38
|
lastUsedFontColor,
|
|
37
39
|
updateLastUsedFontColor,
|
|
@@ -143,7 +145,7 @@ const TextStyleMenuList = _ref => {
|
|
|
143
145
|
tipMessage: t('Reduce_font_size')
|
|
144
146
|
}, /*#__PURE__*/_react.default.createElement("i", {
|
|
145
147
|
className: "sdocfont sdoc-reduce-font-size"
|
|
146
|
-
}))), idPrefix && /*#__PURE__*/_react.default.createElement(_aiMenu.AIContextMenu, {
|
|
148
|
+
}))), idPrefix && enableSeafileAI && /*#__PURE__*/_react.default.createElement(_aiMenu.AIContextMenu, {
|
|
147
149
|
isRichEditor: isRichEditor
|
|
148
150
|
}));
|
|
149
151
|
};
|
|
@@ -38,6 +38,7 @@ const SideMenu = (_ref, ref) => {
|
|
|
38
38
|
const [insertBelowMenuSearchMap, setInsertBelowMenuSearchMap] = (0, _react.useState)(_constants.SIDE_INSERT_MENUS_SEARCH_MAP);
|
|
39
39
|
const [otherOperatonsMenuSearchMap, setOtherOperatonsMenuSearchMap] = (0, _react.useState)(_constants.SIDE_OTHER_OPERATIONS_MENUS_SEARCH_MAP);
|
|
40
40
|
const editor = (0, _slateReact.useSlateStatic)();
|
|
41
|
+
const enableSeafileAI = _context.default.getSetting('enableSeafileAI');
|
|
41
42
|
(0, _react.useEffect)(() => {
|
|
42
43
|
const eventBus = _eventBus.default.getInstance();
|
|
43
44
|
const unsubscribeChange = eventBus.subscribe('change', onReset);
|
|
@@ -212,7 +213,7 @@ const SideMenu = (_ref, ref) => {
|
|
|
212
213
|
isHidden: !otherOperatonsMenuSearchMap['COPY_LINK_OF_SECTION']
|
|
213
214
|
}), !otherOperatonsMenuSearchMap['searching'] && /*#__PURE__*/_react.default.createElement("div", {
|
|
214
215
|
className: "sdoc-dropdown-menu-divider"
|
|
215
|
-
})), /*#__PURE__*/_react.default.createElement(_aiMenu.AIDropdownMenu, {
|
|
216
|
+
})), enableSeafileAI && /*#__PURE__*/_react.default.createElement(_aiMenu.AIDropdownMenu, {
|
|
216
217
|
slateNode: slateNode
|
|
217
218
|
}), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
|
|
218
219
|
menuConfig: {
|
|
@@ -29,10 +29,15 @@ const SdocWikiEditor = _ref => {
|
|
|
29
29
|
// getEditorConfig cashe the config, so we need to update the uuid,for wiki editor
|
|
30
30
|
docUuid && _context.default.updateConfigUuid(docUuid);
|
|
31
31
|
const editorConfig = _context.default.getEditorConfig();
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
let newEditor = null;
|
|
33
|
+
if (!isWikiReadOnly) {
|
|
34
|
+
newEditor = (0, _nodeId.default)((0, _socket.withSocketIO)(defaultEditor, {
|
|
35
|
+
document,
|
|
36
|
+
config: editorConfig
|
|
37
|
+
}));
|
|
38
|
+
} else {
|
|
39
|
+
newEditor = (0, _nodeId.default)(defaultEditor);
|
|
40
|
+
}
|
|
36
41
|
const {
|
|
37
42
|
cursors
|
|
38
43
|
} = document;
|
|
@@ -44,11 +49,12 @@ const SdocWikiEditor = _ref => {
|
|
|
44
49
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
50
|
}, [docUuid]);
|
|
46
51
|
(0, _react.useEffect)(() => {
|
|
52
|
+
if (isWikiReadOnly) return;
|
|
47
53
|
validEditor.openConnection();
|
|
48
54
|
return () => {
|
|
49
55
|
validEditor.closeConnection();
|
|
50
56
|
};
|
|
51
|
-
}, [validEditor]);
|
|
57
|
+
}, [isWikiReadOnly, validEditor]);
|
|
52
58
|
return /*#__PURE__*/_react.default.createElement(_errorBoundary.default, null, /*#__PURE__*/_react.default.createElement(_wikiEditor.default, {
|
|
53
59
|
document: document,
|
|
54
60
|
docUuid: docUuid,
|