@seafile/sdoc-editor 2.0.57 → 2.0.59

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 _dropdownMenuItem = _interopRequireDefault(require("../../../commons/dropdow
12
12
  const AdjustSubMenu = _ref => {
13
13
  let {
14
14
  target,
15
+ onMoreFluentClick,
15
16
  onMoreDetailsClick,
16
17
  onMoreConciseClick,
17
18
  onMoreVividClick
@@ -27,6 +28,9 @@ const AdjustSubMenu = _ref => {
27
28
  }, /*#__PURE__*/_react.default.createElement("div", {
28
29
  className: "sdoc-dropdown-menu-container"
29
30
  }, /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
31
+ menuConfig: _constants.OPERATION_MENUS_CONFIG.MORE_FLUENT,
32
+ onClick: onMoreFluentClick
33
+ }), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
30
34
  menuConfig: _constants.OPERATION_MENUS_CONFIG.MORE_DETAILS,
31
35
  onClick: onMoreDetailsClick
32
36
  }), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
@@ -291,6 +291,25 @@ function AIModule(_ref) {
291
291
  _toast.default.danger('AI_error_message');
292
292
  });
293
293
  }, [selectedValue, t]);
294
+ const onMoreFluentClick = (0, _react.useCallback)(() => {
295
+ setOpType(_constants.OPERATION_TYPES.MORE_FLUENT);
296
+ setIsGenerating(true);
297
+ const defaultContent = selectedValue;
298
+ if (!defaultContent) {
299
+ _toast.default.danger(t('Processing_content_cannot_be_empty'));
300
+ return;
301
+ }
302
+ _context.default.writingAssistant(defaultContent, _constants.OPERATION_TYPES.MORE_FLUENT).then(res => {
303
+ const {
304
+ content
305
+ } = res.data;
306
+ setSearchResult(content);
307
+ setIsGenerating(false);
308
+ }).catch(err => {
309
+ setIsGenerating(false);
310
+ _toast.default.danger('AI_error_message');
311
+ });
312
+ }, [selectedValue, t]);
294
313
  const onMoreConciseClick = (0, _react.useCallback)(() => {
295
314
  setOpType(_constants.OPERATION_TYPES.MORE_CONCISE);
296
315
  setIsGenerating(true);
@@ -498,6 +517,9 @@ function AIModule(_ref) {
498
517
  }), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
499
518
  className: "op-type"
500
519
  }, t('Edit')), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
520
+ menuConfig: _constants.OPERATION_MENUS_CONFIG.MORE_FLUENT,
521
+ onClick: onMoreFluentClick
522
+ }), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
501
523
  menuConfig: _constants.OPERATION_MENUS_CONFIG.MORE_DETAILS,
502
524
  onClick: onMoreDetailsClick
503
525
  }), /*#__PURE__*/_react.default.createElement(_dropdownMenuItem.default, {
@@ -544,6 +566,7 @@ function AIModule(_ref) {
544
566
  className: "sdocfont sdoc-right-slide sdoc-dropdown-item-right-icon"
545
567
  }), /*#__PURE__*/_react.default.createElement(_adjustSubMenu.default, {
546
568
  target: _constants.OPERATION_MENUS_CONFIG.ADJUSTMENT.id,
569
+ onMoreFluentClick: onMoreFluentClick,
547
570
  onMoreDetailsClick: onMoreDetailsClick,
548
571
  onMoreConciseClick: onMoreConciseClick,
549
572
  onMoreVividClick: onMoreVividClick
@@ -7,6 +7,7 @@ exports.OPERATION_TYPES = exports.OPERATION_MENUS_CONFIG = exports.LANG_MENU_CON
7
7
  const OPERATION_TYPES = exports.OPERATION_TYPES = {
8
8
  DEFAULT: 'default',
9
9
  CONTINUATION: 'continuation',
10
+ MORE_FLUENT: 'more_fluent',
10
11
  MORE_DETAILS: 'more_details',
11
12
  MORE_CONCISE: 'more_concise',
12
13
  MORE_VIVID: 'more_vivid',
@@ -19,6 +20,12 @@ const OPERATION_MENUS_CONFIG = exports.OPERATION_MENUS_CONFIG = {
19
20
  iconClass: 'sdocfont sdoc-continue-writing',
20
21
  type: 'continuation'
21
22
  },
23
+ MORE_FLUENT: {
24
+ id: 'MORE_FLUENT',
25
+ text: 'More_fluent',
26
+ iconClass: 'sdocfont sdoc-adjust',
27
+ type: 'more_fluent'
28
+ },
22
29
  MORE_DETAILS: {
23
30
  id: 'MORE_DETAILS',
24
31
  text: 'More_details',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.57",
3
+ "version": "2.0.59",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -39,7 +39,7 @@
39
39
  "remark-parse": "11.0.0",
40
40
  "remark-rehype": "11.0.0",
41
41
  "remark-stringify": "11.0.0",
42
- "sea-chart": "2.0.11",
42
+ "sea-chart": "2.0.13",
43
43
  "slugid": "3.2.0",
44
44
  "socket.io-client": "4.8.1",
45
45
  "type-of": "2.0.1",
@@ -586,6 +586,7 @@
586
586
  "Create_a_new_file": "Create a new file",
587
587
  "Suggestion": "Suggestion",
588
588
  "Continuation": "Continuation",
589
+ "More_fluent": "More fluent",
589
590
  "More_details": "More details",
590
591
  "More_concise": "More concise",
591
592
  "More_vivid": "More vivid",
@@ -586,6 +586,7 @@
586
586
  "Create_a_new_file": "新建文件",
587
587
  "Suggestion": "建议",
588
588
  "Continuation": "继续写",
589
+ "More_fluent": "更加流畅",
589
590
  "More_details": "更加详细",
590
591
  "More_concise": "更加简单",
591
592
  "More_vivid": "更加生动",