@seafile/sdoc-editor 0.1.149-beta3 → 0.1.149-beta5
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.
|
@@ -28,10 +28,7 @@ var TipContent = function TipContent(_ref) {
|
|
|
28
28
|
}, [tipType]);
|
|
29
29
|
useEffect(function () {
|
|
30
30
|
if (time === 0) {
|
|
31
|
-
var
|
|
32
|
-
var siteRoot = context.getSetting('siteRoot');
|
|
33
|
-
var originFilePath = context.getSetting('originFilePath');
|
|
34
|
-
var originFileURL = "".concat(siteRoot, "lib/").concat(repoID, "/file").concat(originFilePath);
|
|
31
|
+
var originFileURL = context.getSetting('originFileURL');
|
|
35
32
|
window.location.href = originFileURL;
|
|
36
33
|
}
|
|
37
34
|
}, [time]);
|
package/dist/context.js
CHANGED
|
@@ -9,6 +9,13 @@ var Context = /*#__PURE__*/function () {
|
|
|
9
9
|
_classCallCheck(this, Context);
|
|
10
10
|
this.initSettings = function () {
|
|
11
11
|
_this.settings = window.seafile ? window.seafile : window.seafileConfig;
|
|
12
|
+
if (_this.settings['isSdocRevision']) {
|
|
13
|
+
var repoID = _this.getSetting('repoID');
|
|
14
|
+
var siteRoot = _this.getSetting('siteRoot');
|
|
15
|
+
var originFilePath = _this.getSetting('originFilePath');
|
|
16
|
+
var originFileURL = "".concat(siteRoot, "lib/").concat(repoID, "/file").concat(originFilePath);
|
|
17
|
+
_this.settings['originFileURL'] = originFileURL;
|
|
18
|
+
}
|
|
12
19
|
};
|
|
13
20
|
// saveDocContentByRebase(content) {
|
|
14
21
|
// return this.sdocServerApi.saveDocContentByRebase(content);
|
|
@@ -21,13 +21,6 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
21
21
|
isDraft = _ref.isDraft,
|
|
22
22
|
t = _ref.t;
|
|
23
23
|
context.initApi();
|
|
24
|
-
var repoID = context.getSetting('repoID');
|
|
25
|
-
var siteRoot = context.getSetting('siteRoot');
|
|
26
|
-
var originFilePath = context.getSetting('originFilePath');
|
|
27
|
-
var isRevision = context.getSetting('isSdocRevision');
|
|
28
|
-
var originFileURL = isRevision ? "".concat(siteRoot, "lib/").concat(repoID, "/file").concat(originFilePath) : '';
|
|
29
|
-
var originDocName = isRevision ? context.getSetting('originFilename') : '';
|
|
30
|
-
var originDocUuid = isRevision ? context.getSetting('originDocUuid') : '';
|
|
31
24
|
var editorRef = useRef(null);
|
|
32
25
|
var _useState = useState(true),
|
|
33
26
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -209,6 +202,9 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
209
202
|
return;
|
|
210
203
|
}
|
|
211
204
|
var originFileVersion = context.getSetting('originFileVersion'); // changing
|
|
205
|
+
var originFilePath = context.getSetting('originFilePath');
|
|
206
|
+
var originDocName = context.getSetting('originFilename');
|
|
207
|
+
var originDocUuid = context.getSetting('originDocUuid');
|
|
212
208
|
var revisionMasterContent;
|
|
213
209
|
var masterContent;
|
|
214
210
|
context.getFileHistoryVersion(originFileVersion, originFilePath).then(function (res) {
|
|
@@ -258,7 +254,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
258
254
|
return _context.stop();
|
|
259
255
|
}
|
|
260
256
|
}, _callee);
|
|
261
|
-
})), [isShowChanges, mode
|
|
257
|
+
})), [isShowChanges, mode]);
|
|
262
258
|
var setDiffChanges = useCallback(function (diff) {
|
|
263
259
|
setChanges(diff.changes);
|
|
264
260
|
|
|
@@ -274,6 +270,9 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
274
270
|
}, [tipType]);
|
|
275
271
|
var tipSubmit = useCallback(function () {
|
|
276
272
|
if (tipType === TIP_TYPE.DELETE_NO_CHANGES_REVISION) {
|
|
273
|
+
var originFileURL = context.getSetting('originFileURL');
|
|
274
|
+
var originDocName = context.getSetting('originFilename');
|
|
275
|
+
var originDocUuid = context.getSetting('originDocUuid');
|
|
277
276
|
editorRef.current.publishDocument(originDocUuid, originDocName, false, function (success) {
|
|
278
277
|
if (success) {
|
|
279
278
|
setShowTip(false);
|
|
@@ -305,7 +304,7 @@ var SimpleEditor = function SimpleEditor(_ref) {
|
|
|
305
304
|
setShowTip(false);
|
|
306
305
|
|
|
307
306
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
308
|
-
}, [tipType,
|
|
307
|
+
}, [tipType, mergeValue, editorRef.current]);
|
|
309
308
|
if (isLoadingSdoc) {
|
|
310
309
|
return /*#__PURE__*/React.createElement(Loading, null);
|
|
311
310
|
}
|