@seafile/sdoc-editor 0.1.159-beta10 → 0.1.159-beta11

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.
@@ -84,7 +84,7 @@ var SeafileAPI = /*#__PURE__*/function () {
84
84
  key: "publishRevision",
85
85
  value: function publishRevision(docUuid) {
86
86
  var url = '/api/v2.1/seadoc/publish-revision/' + docUuid + '/';
87
- return this._sendPostRequest(url);
87
+ return this.req.post(url);
88
88
  }
89
89
  }, {
90
90
  key: "updateSdocRevision",
@@ -93,9 +93,6 @@ var Editor = forwardRef(function (_ref, ref) {
93
93
  children: slateValue
94
94
  }));
95
95
  },
96
- saveDocument: function saveDocument(callback) {
97
- return editor.saveDocument(callback);
98
- },
99
96
  // send message
100
97
  publishDocument: function publishDocument(originDocUuid, originDocName, callback) {
101
98
  editor.publishDocument(originDocUuid, originDocName, callback);
@@ -150,13 +150,6 @@ var SocketClient = /*#__PURE__*/_createClass(function SocketClient(config) {
150
150
  var socketManager = SocketManager.getInstance();
151
151
  socketManager.receiveDocumentReplacedError();
152
152
  };
153
- this.sendSaveDocument = function (callback) {
154
- _this.socket.emit('save-document', _this.getParams({
155
- document: document
156
- }), function (saveFlag) {
157
- callback && callback(saveFlag);
158
- });
159
- };
160
153
  this.receiveRemoveDocument = function () {
161
154
  var socketManager = SocketManager.getInstance();
162
155
  socketManager.receiveRemoveDocument();
@@ -54,9 +54,6 @@ var SocketManager = /*#__PURE__*/_createClass(function SocketManager(editor, _do
54
54
  this.receiveDocumentReplacedError = function () {
55
55
  _this.eventBus.dispatch(EXTERNAL_EVENT.DOCUMENT_REPLACED_ERROR);
56
56
  };
57
- this.sendSaveDocument = function (callback) {
58
- _this.socketClient.sendSaveDocument(callback);
59
- };
60
57
  this.onReceiveLocalOperations = function (operations) {
61
58
  _this.pendingOperationList.push(operations);
62
59
  if (_this.pendingOperationList.length > 5) {
@@ -64,11 +64,6 @@ var withSocketIO = function withSocketIO(editor, options) {
64
64
  var socketManager = SocketManager.getInstance(newEditor, document, config);
65
65
  socketManager.sendReplaceDocument(document);
66
66
  };
67
- newEditor.saveDocument = function (callback) {
68
- var config = options.config;
69
- var socketManager = SocketManager.getInstance(newEditor, document, config);
70
- socketManager.sendSaveDocument(callback);
71
- };
72
67
  return newEditor;
73
68
  };
74
69
  export default withSocketIO;
@@ -4,6 +4,7 @@ import { Modal, ModalHeader, ModalBody, ModalFooter, Button } from 'reactstrap';
4
4
  import classnames from 'classnames';
5
5
  import { TIP_TYPE, TIP_TITLE } from '../../constants';
6
6
  import TipContent from './tip-content';
7
+ var NOT_CLOSE_DIALOG_TIP_TYPE = [TIP_TYPE.HAS_BEEN_REPLACED, TIP_TYPE.HAS_BEEN_PUBLISHED];
7
8
  var TipDialog = function TipDialog(_ref) {
8
9
  var className = _ref.className,
9
10
  tipType = _ref.tipType,
@@ -12,7 +13,8 @@ var TipDialog = function TipDialog(_ref) {
12
13
  var _useTranslation = useTranslation(),
13
14
  t = _useTranslation.t;
14
15
  var closeDialog = useCallback(function () {
15
- toggle && toggle(false);
16
+ if (NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType)) return;
17
+ toggle && toggle();
16
18
 
17
19
  // eslint-disable-next-line react-hooks/exhaustive-deps
18
20
  }, [tipType]);
@@ -30,12 +32,12 @@ var TipDialog = function TipDialog(_ref) {
30
32
  className: classnames('sdoc-tip-dialog', className),
31
33
  contentClassName: "sdoc-tip-modal"
32
34
  }, /*#__PURE__*/React.createElement(ModalHeader, {
33
- toggle: [TIP_TYPE.HAS_BEEN_REPLACED, TIP_TYPE.HAS_BEEN_PUBLISHED].includes(tipType) ? undefined : closeDialog
35
+ toggle: NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) ? undefined : closeDialog
34
36
  }, t(TIP_TITLE[tipType])), /*#__PURE__*/React.createElement(ModalBody, {
35
37
  className: "sdoc-tip-body"
36
38
  }, /*#__PURE__*/React.createElement(TipContent, {
37
39
  tipType: tipType
38
- })), ![TIP_TYPE.HAS_BEEN_REPLACED, TIP_TYPE.HAS_BEEN_PUBLISHED].includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
40
+ })), !NOT_CLOSE_DIALOG_TIP_TYPE.includes(tipType) && /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
39
41
  color: "secondary",
40
42
  className: "mr-2",
41
43
  onClick: closeDialog
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.159beta10",
3
+ "version": "0.1.159beta11",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",