@seafile/sdoc-editor 1.0.190 → 1.0.192
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.
|
@@ -86,8 +86,13 @@ const SdocFileLink = _ref => {
|
|
|
86
86
|
}, [isShowInsertHoverMenu]);
|
|
87
87
|
const onClickFile = (0, _react.useCallback)(e => {
|
|
88
88
|
if (readOnly) {
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
if (element.type === _elementType.WIKI_LINK) {
|
|
90
|
+
window.open((0, _helpers2.getWikiUrl)(element.wiki_repo_id, element.page_id, readOnly));
|
|
91
|
+
return;
|
|
92
|
+
} else {
|
|
93
|
+
window.open((0, _helpers.getUrl)(element.doc_uuid));
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
91
96
|
}
|
|
92
97
|
if (isShowInsertHoverMenu) {
|
|
93
98
|
e.stopPropagation();
|
|
@@ -126,8 +131,8 @@ const SdocFileLink = _ref => {
|
|
|
126
131
|
style['backgroundColor'] = style.computed_background_color;
|
|
127
132
|
}
|
|
128
133
|
const url = (0, _react.useMemo)(() => {
|
|
129
|
-
return element.type === _elementType.WIKI_LINK ? (0, _helpers2.getWikiUrl)(element.wiki_repo_id, element.page_id) : (0, _helpers.getUrl)(element.doc_uuid);
|
|
130
|
-
}, [element.doc_uuid, element.page_id, element.type, element.wiki_repo_id]);
|
|
134
|
+
return element.type === _elementType.WIKI_LINK ? (0, _helpers2.getWikiUrl)(element.wiki_repo_id, element.page_id, readOnly) : (0, _helpers.getUrl)(element.doc_uuid);
|
|
135
|
+
}, [element.doc_uuid, element.page_id, element.type, element.wiki_repo_id, readOnly]);
|
|
131
136
|
return /*#__PURE__*/_react.default.createElement("span", Object.assign({}, attributes, {
|
|
132
137
|
"data-id": element.id,
|
|
133
138
|
contentEditable: false,
|
|
@@ -10,6 +10,7 @@ var _slugid = _interopRequireDefault(require("slugid"));
|
|
|
10
10
|
var _constants = require("../../constants");
|
|
11
11
|
var _helpers = require("../sdoc-link/helpers");
|
|
12
12
|
var _elementType = require("../../constants/element-type");
|
|
13
|
+
var _context = _interopRequireDefault(require("../../../../context"));
|
|
13
14
|
const insertWikiPageLink = (editor, text, wikiRepoId, pageId, icon, isDir) => {
|
|
14
15
|
if ((0, _helpers.isMenuDisabled)(editor)) return;
|
|
15
16
|
// Selection folded or not
|
|
@@ -63,10 +64,14 @@ const generateWikiFileNode = function (wikiRepoId, pageId) {
|
|
|
63
64
|
return wikiPageLinkNode;
|
|
64
65
|
};
|
|
65
66
|
exports.generateWikiFileNode = generateWikiFileNode;
|
|
66
|
-
const getWikiUrl = (wikiRepoId, pageId) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
const getWikiUrl = (wikiRepoId, pageId, readOnly) => {
|
|
68
|
+
if (readOnly) {
|
|
69
|
+
const siteRoot = _context.default.getSetting('siteRoot');
|
|
70
|
+
const publishUrl = _context.default.getSetting('publishUrl');
|
|
71
|
+
const DEFAULT_URL = 'wiki/publish';
|
|
72
|
+
return `${siteRoot}${DEFAULT_URL}/${publishUrl}/${pageId}/`;
|
|
73
|
+
}
|
|
74
|
+
const siteRoot = _context.default.getSetting('siteRoot');
|
|
75
|
+
return `${siteRoot}wikis/${wikiRepoId}/${pageId}/`;
|
|
71
76
|
};
|
|
72
77
|
exports.getWikiUrl = getWikiUrl;
|