@seafile/sdoc-editor 2.0.39 → 2.0.41
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.
- package/dist/basic-sdk/constants/index.js +2 -1
- package/dist/basic-sdk/editor/wiki-editor.js +1 -1
- package/dist/basic-sdk/extension/constants/index.js +7 -1
- package/dist/basic-sdk/extension/plugins/chart/chart-edit-dialog/index.js +8 -1
- package/dist/basic-sdk/extension/plugins/chart/render-elem.js +5 -1
- package/dist/basic-sdk/extension/plugins/image/helpers.js +4 -4
- package/dist/basic-sdk/extension/plugins/image/image-loader/index.css +7 -5
- package/dist/basic-sdk/extension/plugins/image/render-elem.js +5 -5
- package/dist/basic-sdk/extension/plugins/image/use-upload-image.js +2 -2
- package/dist/pages/sdoc-wiki-editor.js +1 -1
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ Object.defineProperty(exports, "PLUGIN_DISPLAY_TYPE", {
|
|
|
17
17
|
return _plugin.PLUGIN_DISPLAY_TYPE;
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
exports.Z_INDEX = exports.WIKI_OUTLINE = exports.WIKI_EDITOR = exports.SDOC_STORAGE = exports.REVISION_DIFF_VALUE = exports.REVISION_DIFF_KEY = exports.REBASE_TYPES = exports.REBASE_TYPE = exports.REBASE_ORIGIN = exports.REBASE_MARK_KEY = exports.REBASE_MARKS = void 0;
|
|
20
|
+
exports.Z_INDEX = exports.WIKI_OUTLINE = exports.WIKI_EDITOR_EDIT_AREA_WIDTH = exports.WIKI_EDITOR = exports.SDOC_STORAGE = exports.REVISION_DIFF_VALUE = exports.REVISION_DIFF_KEY = exports.REBASE_TYPES = exports.REBASE_TYPE = exports.REBASE_ORIGIN = exports.REBASE_MARK_KEY = exports.REBASE_MARKS = void 0;
|
|
21
21
|
var Z_INDEX = _interopRequireWildcard(require("./z-index"));
|
|
22
22
|
exports.Z_INDEX = Z_INDEX;
|
|
23
23
|
var _plugin = require("./plugin");
|
|
@@ -55,6 +55,7 @@ const REVISION_DIFF_KEY = exports.REVISION_DIFF_KEY = 'diff';
|
|
|
55
55
|
const REVISION_DIFF_VALUE = exports.REVISION_DIFF_VALUE = '1';
|
|
56
56
|
const PAGE_EDIT_AREA_WIDTH = exports.PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
|
|
57
57
|
const COMMENT_EDITOR_EDIT_AREA_WIDTH = exports.COMMENT_EDITOR_EDIT_AREA_WIDTH = 364;
|
|
58
|
+
const WIKI_EDITOR_EDIT_AREA_WIDTH = exports.WIKI_EDITOR_EDIT_AREA_WIDTH = 714;
|
|
58
59
|
const COMMENT_EDITOR = exports.COMMENT_EDITOR = 'comment_editor';
|
|
59
60
|
const WIKI_EDITOR = exports.WIKI_EDITOR = 'wiki_editor';
|
|
60
61
|
const DOCUMENT_PLUGIN_EDITOR = exports.DOCUMENT_PLUGIN_EDITOR = 'document_plugin_editor';
|
|
@@ -47,7 +47,7 @@ const WikiEditor = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
|
47
47
|
cursors
|
|
48
48
|
} = document;
|
|
49
49
|
newEditor.cursors = cursors || {};
|
|
50
|
-
newEditor.width = _constants.
|
|
50
|
+
newEditor.width = _constants.WIKI_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
51
51
|
return newEditor;
|
|
52
52
|
|
|
53
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -29,6 +29,7 @@ Object.defineProperty(exports, "CHART", {
|
|
|
29
29
|
return _elementType.CHART;
|
|
30
30
|
}
|
|
31
31
|
});
|
|
32
|
+
exports.CHART_PREVIEW_TYPE = void 0;
|
|
32
33
|
Object.defineProperty(exports, "CHECK_LIST_ITEM", {
|
|
33
34
|
enumerable: true,
|
|
34
35
|
get: function () {
|
|
@@ -567,4 +568,9 @@ const MOUSE_ENTER_EVENT_DISABLED_MAP = exports.MOUSE_ENTER_EVENT_DISABLED_MAP =
|
|
|
567
568
|
[_elementType.HEADER6]: [_elementType.CALL_OUT],
|
|
568
569
|
[_elementType.CALL_OUT]: [_elementType.CALL_OUT]
|
|
569
570
|
};
|
|
570
|
-
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK, _elementType.VIDEO, _elementType.SEATABLE_TABLE, _elementType.SEATABLE_ROW, _elementType.CHART];
|
|
571
|
+
const ROOT_ELEMENT_TYPES = exports.ROOT_ELEMENT_TYPES = [_elementType.PARAGRAPH, _elementType.TITLE, _elementType.SUBTITLE, _elementType.CHECK_LIST_ITEM, _elementType.ORDERED_LIST, _elementType.UNORDERED_LIST, _elementType.BLOCKQUOTE, _elementType.HEADER1, _elementType.HEADER2, _elementType.HEADER3, _elementType.HEADER4, _elementType.HEADER5, _elementType.HEADER6, _elementType.CALL_OUT, _elementType.TABLE, _elementType.CODE_BLOCK, _elementType.IMAGE_BLOCK, _elementType.VIDEO, _elementType.SEATABLE_TABLE, _elementType.SEATABLE_ROW, _elementType.CHART];
|
|
572
|
+
const CHART_PREVIEW_TYPE = exports.CHART_PREVIEW_TYPE = {
|
|
573
|
+
VIEW: 'view',
|
|
574
|
+
EDITOR: 'editor',
|
|
575
|
+
FULL_SCREEN: 'fullScreen'
|
|
576
|
+
};
|
|
@@ -13,6 +13,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
|
13
13
|
var _reactI18next = require("react-i18next");
|
|
14
14
|
var _seaChart = require("sea-chart");
|
|
15
15
|
var _context = _interopRequireDefault(require("../../../../../context"));
|
|
16
|
+
var _constants = require("../../../constants");
|
|
16
17
|
require("./index.css");
|
|
17
18
|
const ChartEditDialog = _ref => {
|
|
18
19
|
var _window, _window$app, _window$app$state, _window2, _window2$app, _window2$app$state;
|
|
@@ -50,6 +51,9 @@ const ChartEditDialog = _ref => {
|
|
|
50
51
|
collaborators: editor.collaborators || [],
|
|
51
52
|
departments: ((_window = window) === null || _window === void 0 ? void 0 : (_window$app = _window.app) === null || _window$app === void 0 ? void 0 : (_window$app$state = _window$app.state) === null || _window$app$state === void 0 ? void 0 : _window$app$state.departments) || [],
|
|
52
53
|
hideTypeToggle: true,
|
|
54
|
+
canvasStyle: {
|
|
55
|
+
previewType: _constants.CHART_PREVIEW_TYPE.EDITOR
|
|
56
|
+
},
|
|
53
57
|
onChange: onSettingChange
|
|
54
58
|
}), isFullScreen && /*#__PURE__*/_react.default.createElement(_seaChart.View, {
|
|
55
59
|
chart: statItemData,
|
|
@@ -57,7 +61,10 @@ const ChartEditDialog = _ref => {
|
|
|
57
61
|
config: _context.default.getSettings(),
|
|
58
62
|
tables: editor.tables,
|
|
59
63
|
collaborators: editor.collaborators || [],
|
|
60
|
-
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || []
|
|
64
|
+
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || [],
|
|
65
|
+
canvasStyle: {
|
|
66
|
+
previewType: _constants.CHART_PREVIEW_TYPE.FULL_SCREEN
|
|
67
|
+
}
|
|
61
68
|
})));
|
|
62
69
|
};
|
|
63
70
|
var _default = exports.default = (0, _reactI18next.withTranslation)('sdoc-editor')(ChartEditDialog);
|
|
@@ -17,6 +17,7 @@ var _chartEditDialog = _interopRequireDefault(require("./chart-edit-dialog"));
|
|
|
17
17
|
var _context = _interopRequireDefault(require("../../../../context"));
|
|
18
18
|
var _useScrollContext = require("../../../hooks/use-scroll-context");
|
|
19
19
|
var _helpers = require("./helpers");
|
|
20
|
+
var _constants = require("../../constants");
|
|
20
21
|
require("./render-elem.css");
|
|
21
22
|
const Chart = _ref => {
|
|
22
23
|
var _window, _window$app, _window2, _window2$app, _window2$app$state;
|
|
@@ -115,7 +116,10 @@ const Chart = _ref => {
|
|
|
115
116
|
config: _context.default.getSettings(),
|
|
116
117
|
tables: editor.tables,
|
|
117
118
|
collaborators: editor.collaborators || [],
|
|
118
|
-
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || []
|
|
119
|
+
departments: ((_window2 = window) === null || _window2 === void 0 ? void 0 : (_window2$app = _window2.app) === null || _window2$app === void 0 ? void 0 : (_window2$app$state = _window2$app.state) === null || _window2$app$state === void 0 ? void 0 : _window2$app$state.departments) || [],
|
|
120
|
+
canvasStyle: {
|
|
121
|
+
previewType: _constants.CHART_PREVIEW_TYPE.VIEW
|
|
122
|
+
}
|
|
119
123
|
})), /*#__PURE__*/_react.default.createElement("span", {
|
|
120
124
|
className: "sdoc-chart-view-rect sdoc-chart-view-rect-lt"
|
|
121
125
|
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.updateImage = exports.selectImageWhenSelectPartial = exports.resetCursor = exports.removeImageBlockNode = exports.queryCopyMoveProgressView = exports.isInsertImageMenuDisabled = exports.
|
|
7
|
+
exports.updateImage = exports.selectImageWhenSelectPartial = exports.resetCursor = exports.removeImageBlockNode = exports.queryCopyMoveProgressView = exports.isInsertImageMenuDisabled = exports.isImageUrlIsFromCopy = exports.insertImageFiles = exports.insertImage = exports.hasSdocImages = exports.handleBase64Image = exports.getSingleImageFromFragment = exports.getImageURL = exports.getImageData = exports.generateImageNode = void 0;
|
|
8
8
|
var _urlJoin = _interopRequireDefault(require("url-join"));
|
|
9
9
|
var _slate = require("@seafile/slate");
|
|
10
10
|
var _slateReact = require("@seafile/slate-react");
|
|
@@ -153,7 +153,7 @@ const getImageURL = (data, editor) => {
|
|
|
153
153
|
return imgUrl;
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
156
|
+
if (isImageUrlIsFromCopy(url)) return url;
|
|
157
157
|
const serviceUrl = _context.default.getSetting('serviceUrl');
|
|
158
158
|
const assetsUrl = _context.default.getSetting('assetsUrl');
|
|
159
159
|
return (0, _urlJoin.default)(serviceUrl, assetsUrl, url);
|
|
@@ -278,12 +278,12 @@ const handleBase64Image = (editor, path, imgData) => {
|
|
|
278
278
|
});
|
|
279
279
|
};
|
|
280
280
|
exports.handleBase64Image = handleBase64Image;
|
|
281
|
-
const
|
|
281
|
+
const isImageUrlIsFromCopy = url => {
|
|
282
282
|
if (url && url.startsWith('http')) return true;
|
|
283
283
|
if (url && url.startsWith('attachment')) return true; // from yuque
|
|
284
284
|
return false;
|
|
285
285
|
};
|
|
286
|
-
exports.
|
|
286
|
+
exports.isImageUrlIsFromCopy = isImageUrlIsFromCopy;
|
|
287
287
|
const removeImageBlockNode = (editor, path) => {
|
|
288
288
|
_slate.Transforms.removeNodes(editor, {
|
|
289
289
|
at: path
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
.sdoc-image-process-container {
|
|
2
|
+
position: absolute;
|
|
2
3
|
width: 100%;
|
|
3
4
|
height: 100%;
|
|
4
5
|
display: flex;
|
|
5
|
-
flex-direction:
|
|
6
|
+
flex-direction: column;
|
|
6
7
|
align-items: center;
|
|
7
8
|
justify-content: center;
|
|
9
|
+
top: 0;
|
|
10
|
+
left: 0;
|
|
11
|
+
bottom: 0;
|
|
12
|
+
left: 0;
|
|
8
13
|
background-color: rgba(0, 0, 0, 0.5);
|
|
9
|
-
min-height: 28px;
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
@keyframes spin {
|
|
@@ -32,7 +36,5 @@
|
|
|
32
36
|
}
|
|
33
37
|
|
|
34
38
|
.sdoc-image-process-container .copyright {
|
|
35
|
-
margin:
|
|
36
|
-
display: inline-block;
|
|
37
|
-
white-space: nowrap;
|
|
39
|
+
margin-top: 4px;
|
|
38
40
|
}
|
|
@@ -209,8 +209,8 @@ const Image = _ref => {
|
|
|
209
209
|
}
|
|
210
210
|
}, [data, editor]);
|
|
211
211
|
const onImageLoaded = (0, _react.useCallback)(() => {
|
|
212
|
-
if (
|
|
213
|
-
setCopyImageLoading(
|
|
212
|
+
if ((0, _helpers.isImageUrlIsFromCopy)(data.src)) {
|
|
213
|
+
setCopyImageLoading(true);
|
|
214
214
|
}
|
|
215
215
|
}, [data.src, setCopyImageLoading]);
|
|
216
216
|
const onImageLoadError = (0, _react.useCallback)(() => {
|
|
@@ -286,9 +286,7 @@ const Image = _ref => {
|
|
|
286
286
|
className: "sdoc-image-content"
|
|
287
287
|
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
288
288
|
style: imageStyle
|
|
289
|
-
},
|
|
290
|
-
copyright: t('Image_is_uploading')
|
|
291
|
-
}), /*#__PURE__*/_react.default.createElement("img", {
|
|
289
|
+
}, /*#__PURE__*/_react.default.createElement("img", {
|
|
292
290
|
ref: imageRef,
|
|
293
291
|
className: (0, _classnames.default)({
|
|
294
292
|
'image-selected': isSelected
|
|
@@ -300,6 +298,8 @@ const Image = _ref => {
|
|
|
300
298
|
onLoad: onImageLoaded,
|
|
301
299
|
onError: onImageLoadError,
|
|
302
300
|
alt: ""
|
|
301
|
+
}), isCopyImageLoading && /*#__PURE__*/_react.default.createElement(_imageLoader.default, {
|
|
302
|
+
copyright: t('Image_is_uploading')
|
|
303
303
|
}), isSelected && /*#__PURE__*/_react.default.createElement("span", {
|
|
304
304
|
className: "image-resizer",
|
|
305
305
|
ref: resizerRef,
|
|
@@ -35,14 +35,14 @@ const useImageUpload = _ref => {
|
|
|
35
35
|
const {
|
|
36
36
|
is_copy_error = false
|
|
37
37
|
} = data;
|
|
38
|
-
const [isLoading, setIsLoading] = (0, _react.useState)(
|
|
38
|
+
const [isLoading, setIsLoading] = (0, _react.useState)();
|
|
39
39
|
const [isCopyError, setIsCopyError] = (0, _react.useState)(is_copy_error);
|
|
40
40
|
(0, _react.useEffect)(() => {
|
|
41
41
|
const {
|
|
42
42
|
src: url
|
|
43
43
|
} = data;
|
|
44
44
|
if (isCopyError) return;
|
|
45
|
-
if (!(0, _helpers.
|
|
45
|
+
if (!(0, _helpers.isImageUrlIsFromCopy)(url)) return;
|
|
46
46
|
const downloadAndUploadImages = async url => {
|
|
47
47
|
try {
|
|
48
48
|
const response = await fetch(url);
|
|
@@ -42,7 +42,7 @@ const SdocWikiEditor = _ref => {
|
|
|
42
42
|
cursors
|
|
43
43
|
} = document;
|
|
44
44
|
newEditor.cursors = cursors || {};
|
|
45
|
-
newEditor.width = _constants.
|
|
45
|
+
newEditor.width = _constants.WIKI_EDITOR_EDIT_AREA_WIDTH; // default width
|
|
46
46
|
newEditor.editorType = _constants.WIKI_EDITOR;
|
|
47
47
|
return newEditor;
|
|
48
48
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.41",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"remark-parse": "11.0.0",
|
|
39
39
|
"remark-rehype": "11.0.0",
|
|
40
40
|
"remark-stringify": "11.0.0",
|
|
41
|
-
"sea-chart": "2.0.
|
|
41
|
+
"sea-chart": "2.0.8",
|
|
42
42
|
"slugid": "3.2.0",
|
|
43
43
|
"socket.io-client": "4.8.1",
|
|
44
44
|
"type-of": "2.0.1",
|