@seafile/sdoc-editor 1.0.190-alpha1 → 1.0.190-alpha2
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.
|
@@ -18,6 +18,7 @@ var _constants2 = require("../constants");
|
|
|
18
18
|
var _core = require("../../../core");
|
|
19
19
|
var _elementType = require("../../../constants/element-type");
|
|
20
20
|
var _helpers2 = require("../../wiki-link/helpers");
|
|
21
|
+
var _context = _interopRequireDefault(require("../../../../context"));
|
|
21
22
|
require("./render-elem.css");
|
|
22
23
|
const SdocFileLink = _ref => {
|
|
23
24
|
let {
|
|
@@ -85,6 +86,11 @@ const SdocFileLink = _ref => {
|
|
|
85
86
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
87
|
}, [isShowInsertHoverMenu]);
|
|
87
88
|
const onClickFile = (0, _react.useCallback)(e => {
|
|
89
|
+
if (_context.default.getSetting('isWikiReadOnly')) {
|
|
90
|
+
console.log('wiki readonly', element.doc_uuid);
|
|
91
|
+
window.open(element.doc_uuid);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
88
94
|
if (readOnly) {
|
|
89
95
|
window.open((0, _helpers.getUrl)(element.doc_uuid));
|
|
90
96
|
return;
|
package/dist/context.js
CHANGED
|
@@ -56,7 +56,7 @@ class Context {
|
|
|
56
56
|
this.api = null;
|
|
57
57
|
this.config = null;
|
|
58
58
|
}
|
|
59
|
-
initApi() {
|
|
59
|
+
initApi(customKeys) {
|
|
60
60
|
this.initSettings(); // lazy init context class
|
|
61
61
|
const server = this.getSetting('serviceUrl');
|
|
62
62
|
const token = this.getSetting('accessToken');
|
|
@@ -65,6 +65,11 @@ class Context {
|
|
|
65
65
|
if (isOpenSocket) {
|
|
66
66
|
this.sdocServerApi = new _sdocServerApi.default(this.settings);
|
|
67
67
|
}
|
|
68
|
+
if (customKeys) {
|
|
69
|
+
for (let key in customKeys) {
|
|
70
|
+
this.settings[key] = customKeys[key];
|
|
71
|
+
}
|
|
72
|
+
}
|
|
68
73
|
}
|
|
69
74
|
getSettings() {
|
|
70
75
|
return this.settings;
|
|
@@ -23,7 +23,9 @@ const SdocWikiEditor = _ref => {
|
|
|
23
23
|
isWikiReadOnly,
|
|
24
24
|
scrollRef
|
|
25
25
|
} = _ref;
|
|
26
|
-
_context.default.initApi(
|
|
26
|
+
_context.default.initApi({
|
|
27
|
+
isWikiReadOnly
|
|
28
|
+
});
|
|
27
29
|
const validEditor = (0, _react.useMemo)(() => {
|
|
28
30
|
const defaultEditor = (0, _extension.createWikiEditor)();
|
|
29
31
|
// getEditorConfig cashe the config, so we need to update the uuid,for wiki editor
|