@seafile/sdoc-editor 1.0.14 → 1.0.16
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/extension/plugins/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/creator-formatter.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/formatter/index.js +42 -22
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/custom-switch/index.js +2 -2
- package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/table-setting/index.js +2 -2
- package/dist/basic-sdk/utils/dom-utils.js +1 -4
- package/dist/pages/sdoc-wiki-editor.js +2 -0
- package/package.json +2 -1
|
@@ -21,8 +21,8 @@ import QuickInsertPlugin from './quick-insert';
|
|
|
21
21
|
import WikiLinkPlugin from './wiki-link';
|
|
22
22
|
import SeaTableColumnPlugin from './seatable-column';
|
|
23
23
|
import SeaTableViewsPlugin from './seatable-tables';
|
|
24
|
-
const Plugins = [MarkDownPlugin, HtmlPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin
|
|
25
|
-
const WikiPlugins = [...Plugins, WikiLinkPlugin];
|
|
24
|
+
const Plugins = [MarkDownPlugin, HtmlPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin];
|
|
25
|
+
const WikiPlugins = [...Plugins, QuickInsertPlugin, WikiLinkPlugin];
|
|
26
26
|
const CommentPlugins = [MarkDownPlugin, HtmlPlugin, ParagraphPlugin, TextPlugin, ListPlugin, ImagePlugin, LinkPlugin, MentionPlugin, BlockquotePlugin];
|
|
27
27
|
export default Plugins;
|
|
28
28
|
export { MarkDownPlugin, HeaderPlugin, LinkPlugin, BlockquotePlugin, ListPlugin, CheckListPlugin, CodeBlockPlugin, ImagePlugin, TablePlugin, TextPlugin, HtmlPlugin, TextAlignPlugin, FontPlugin, SdocLinkPlugin, ParagraphPlugin, FileLinkPlugin, CalloutPlugin, SearchReplacePlugin, MentionPlugin, QuickInsertPlugin, CommentPlugins, WikiPlugins, WikiLinkPlugin, SeaTableColumnPlugin, SeaTableViewsPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
|
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
3
|
import React, { Component } from 'react';
|
|
3
|
-
import { CreatorFormatter } from 'dtable-ui-component';
|
|
4
4
|
import context from '@/context';
|
|
5
5
|
import { isValidEmail } from '@/utils/common-utils';
|
|
6
6
|
class DtableCreatorFormatter extends Component {
|
|
@@ -112,7 +112,7 @@ class DtableCreatorFormatter extends Component {
|
|
|
112
112
|
} = this.props;
|
|
113
113
|
if (!value || !collaborator) return this.props.renderEmptyFormatter();
|
|
114
114
|
if (isDataLoaded) {
|
|
115
|
-
return /*#__PURE__*/React.createElement(
|
|
115
|
+
return /*#__PURE__*/React.createElement(_CreatorFormatter, {
|
|
116
116
|
collaborators: [collaborator],
|
|
117
117
|
value: value,
|
|
118
118
|
containerClassName: containerClassName
|
|
@@ -1,6 +1,26 @@
|
|
|
1
|
+
import _ButtonFormatter from "dtable-ui-component/lib/ButtonFormatter";
|
|
2
|
+
import _RateFormatter from "dtable-ui-component/lib/RateFormatter";
|
|
3
|
+
import _DurationFormatter from "dtable-ui-component/lib/DurationFormatter";
|
|
4
|
+
import _EmailFormatter from "dtable-ui-component/lib/EmailFormatter";
|
|
5
|
+
import _UrlFormatter from "dtable-ui-component/lib/UrlFormatter";
|
|
6
|
+
import _AutoNumberFormatter from "dtable-ui-component/lib/AutoNumberFormatter";
|
|
7
|
+
import _FormulaFormatter from "dtable-ui-component/lib/FormulaFormatter";
|
|
8
|
+
import _CreatorFormatter from "dtable-ui-component/lib/CreatorFormatter";
|
|
9
|
+
import _MTimeFormatter from "dtable-ui-component/lib/MTimeFormatter";
|
|
10
|
+
import _CTimeFormatter from "dtable-ui-component/lib/CTimeFormatter";
|
|
11
|
+
import _CheckboxFormatter from "dtable-ui-component/lib/CheckboxFormatter";
|
|
12
|
+
import _SingleSelectFormatter from "dtable-ui-component/lib/SingleSelectFormatter";
|
|
13
|
+
import _MultipleSelectFormatter from "dtable-ui-component/lib/MultipleSelectFormatter";
|
|
14
|
+
import _DateFormatter from "dtable-ui-component/lib/DateFormatter";
|
|
15
|
+
import _NumberFormatter from "dtable-ui-component/lib/NumberFormatter";
|
|
16
|
+
import _GeolocationFormatter from "dtable-ui-component/lib/GeolocationFormatter";
|
|
17
|
+
import _FileFormatter from "dtable-ui-component/lib/FileFormatter";
|
|
18
|
+
import _ImageFormatter from "dtable-ui-component/lib/ImageFormatter";
|
|
19
|
+
import _SimpleLongTextFormatter from "dtable-ui-component/lib/SimpleLongTextFormatter";
|
|
20
|
+
import _CollaboratorFormatter from "dtable-ui-component/lib/CollaboratorFormatter";
|
|
21
|
+
import _TextFormatter from "dtable-ui-component/lib/TextFormatter";
|
|
1
22
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
23
|
import React, { Fragment } from 'react';
|
|
3
|
-
import { TextFormatter, NumberFormatter, CheckboxFormatter, DateFormatter, SingleSelectFormatter, MultipleSelectFormatter, CollaboratorFormatter, ImageFormatter, FileFormatter, SimpleLongTextFormatter, GeolocationFormatter, FormulaFormatter, CTimeFormatter, MTimeFormatter, AutoNumberFormatter, UrlFormatter, EmailFormatter, DurationFormatter, RateFormatter, ButtonFormatter, CreatorFormatter } from 'dtable-ui-component';
|
|
4
24
|
import { CellType, SELECT_OPTION_COLORS } from 'dtable-utils';
|
|
5
25
|
class CellFormatter extends React.Component {
|
|
6
26
|
constructor() {
|
|
@@ -35,7 +55,7 @@ class CellFormatter extends React.Component {
|
|
|
35
55
|
case CellType.TEXT:
|
|
36
56
|
{
|
|
37
57
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
38
|
-
return /*#__PURE__*/React.createElement(
|
|
58
|
+
return /*#__PURE__*/React.createElement(_TextFormatter, {
|
|
39
59
|
value: cellValue,
|
|
40
60
|
containerClassName: containerClassName
|
|
41
61
|
});
|
|
@@ -46,7 +66,7 @@ class CellFormatter extends React.Component {
|
|
|
46
66
|
if (!Array.isArray(cellValue) || cellValue.length === 0) return this.renderEmptyFormatter();
|
|
47
67
|
cellValue = cellValue.filter(item => item);
|
|
48
68
|
if (cellValue.length === 0) return this.renderEmptyFormatter();
|
|
49
|
-
return /*#__PURE__*/React.createElement(
|
|
69
|
+
return /*#__PURE__*/React.createElement(_CollaboratorFormatter, {
|
|
50
70
|
value: cellValue,
|
|
51
71
|
collaborators: collaborators,
|
|
52
72
|
containerClassName: containerClassName
|
|
@@ -55,7 +75,7 @@ class CellFormatter extends React.Component {
|
|
|
55
75
|
case CellType.LONG_TEXT:
|
|
56
76
|
{
|
|
57
77
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
58
|
-
return /*#__PURE__*/React.createElement(
|
|
78
|
+
return /*#__PURE__*/React.createElement(_SimpleLongTextFormatter, {
|
|
59
79
|
value: cellValue,
|
|
60
80
|
containerClassName: containerClassName
|
|
61
81
|
});
|
|
@@ -63,7 +83,7 @@ class CellFormatter extends React.Component {
|
|
|
63
83
|
case CellType.IMAGE:
|
|
64
84
|
{
|
|
65
85
|
if (!cellValue || Array.isArray(cellValue) && cellValue.length === 0) return this.renderEmptyFormatter();
|
|
66
|
-
return /*#__PURE__*/React.createElement(
|
|
86
|
+
return /*#__PURE__*/React.createElement(_ImageFormatter, {
|
|
67
87
|
value: cellValue,
|
|
68
88
|
isSample: isSample,
|
|
69
89
|
containerClassName: containerClassName
|
|
@@ -72,7 +92,7 @@ class CellFormatter extends React.Component {
|
|
|
72
92
|
case CellType.FILE:
|
|
73
93
|
{
|
|
74
94
|
if (!cellValue || Array.isArray(cellValue) && cellValue.length === 0) return this.renderEmptyFormatter();
|
|
75
|
-
return /*#__PURE__*/React.createElement(
|
|
95
|
+
return /*#__PURE__*/React.createElement(_FileFormatter, {
|
|
76
96
|
value: cellValue,
|
|
77
97
|
isSample: isSample,
|
|
78
98
|
containerClassName: containerClassName
|
|
@@ -81,7 +101,7 @@ class CellFormatter extends React.Component {
|
|
|
81
101
|
case CellType.GEOLOCATION:
|
|
82
102
|
{
|
|
83
103
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
84
|
-
return /*#__PURE__*/React.createElement(
|
|
104
|
+
return /*#__PURE__*/React.createElement(_GeolocationFormatter, {
|
|
85
105
|
value: cellValue,
|
|
86
106
|
containerClassName: containerClassName
|
|
87
107
|
});
|
|
@@ -89,7 +109,7 @@ class CellFormatter extends React.Component {
|
|
|
89
109
|
case CellType.NUMBER:
|
|
90
110
|
{
|
|
91
111
|
if (!cellValue && cellValue !== 0) return this.renderEmptyFormatter();
|
|
92
|
-
return /*#__PURE__*/React.createElement(
|
|
112
|
+
return /*#__PURE__*/React.createElement(_NumberFormatter, {
|
|
93
113
|
value: cellValue,
|
|
94
114
|
data: column.data,
|
|
95
115
|
containerClassName: containerClassName
|
|
@@ -98,7 +118,7 @@ class CellFormatter extends React.Component {
|
|
|
98
118
|
case CellType.DATE:
|
|
99
119
|
{
|
|
100
120
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
101
|
-
return /*#__PURE__*/React.createElement(
|
|
121
|
+
return /*#__PURE__*/React.createElement(_DateFormatter, {
|
|
102
122
|
value: cellValue,
|
|
103
123
|
format: column.data.format,
|
|
104
124
|
containerClassName: containerClassName
|
|
@@ -108,7 +128,7 @@ class CellFormatter extends React.Component {
|
|
|
108
128
|
{
|
|
109
129
|
if (!cellValue || cellValue.length === 0) return this.renderEmptyFormatter();
|
|
110
130
|
const options = column.data && column.data.options || [];
|
|
111
|
-
return /*#__PURE__*/React.createElement(
|
|
131
|
+
return /*#__PURE__*/React.createElement(_MultipleSelectFormatter, {
|
|
112
132
|
value: cellValue,
|
|
113
133
|
options: options,
|
|
114
134
|
containerClassName: containerClassName
|
|
@@ -119,7 +139,7 @@ class CellFormatter extends React.Component {
|
|
|
119
139
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
120
140
|
const options = this.getSelectColumnOptions(column);
|
|
121
141
|
if (options.length === 0) return this.renderEmptyFormatter();
|
|
122
|
-
return /*#__PURE__*/React.createElement(
|
|
142
|
+
return /*#__PURE__*/React.createElement(_SingleSelectFormatter, {
|
|
123
143
|
value: cellValue,
|
|
124
144
|
options: options,
|
|
125
145
|
containerClassName: containerClassName
|
|
@@ -127,7 +147,7 @@ class CellFormatter extends React.Component {
|
|
|
127
147
|
}
|
|
128
148
|
case CellType.CHECKBOX:
|
|
129
149
|
{
|
|
130
|
-
return /*#__PURE__*/React.createElement(
|
|
150
|
+
return /*#__PURE__*/React.createElement(_CheckboxFormatter, {
|
|
131
151
|
value: cellValue,
|
|
132
152
|
containerClassName: containerClassName
|
|
133
153
|
});
|
|
@@ -135,7 +155,7 @@ class CellFormatter extends React.Component {
|
|
|
135
155
|
case CellType.CTIME:
|
|
136
156
|
{
|
|
137
157
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
138
|
-
return /*#__PURE__*/React.createElement(
|
|
158
|
+
return /*#__PURE__*/React.createElement(_CTimeFormatter, {
|
|
139
159
|
value: cellValue,
|
|
140
160
|
containerClassName: containerClassName
|
|
141
161
|
});
|
|
@@ -143,7 +163,7 @@ class CellFormatter extends React.Component {
|
|
|
143
163
|
case CellType.MTIME:
|
|
144
164
|
{
|
|
145
165
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
146
|
-
return /*#__PURE__*/React.createElement(
|
|
166
|
+
return /*#__PURE__*/React.createElement(_MTimeFormatter, {
|
|
147
167
|
value: cellValue,
|
|
148
168
|
containerClassName: containerClassName
|
|
149
169
|
});
|
|
@@ -152,7 +172,7 @@ class CellFormatter extends React.Component {
|
|
|
152
172
|
case CellType.LAST_MODIFIER:
|
|
153
173
|
{
|
|
154
174
|
// TODO
|
|
155
|
-
return /*#__PURE__*/React.createElement(
|
|
175
|
+
return /*#__PURE__*/React.createElement(_CreatorFormatter, {
|
|
156
176
|
value: cellValue,
|
|
157
177
|
collaborators: collaborators,
|
|
158
178
|
containerClassName: containerClassName,
|
|
@@ -163,7 +183,7 @@ class CellFormatter extends React.Component {
|
|
|
163
183
|
case CellType.LINK_FORMULA:
|
|
164
184
|
{
|
|
165
185
|
if (!cellValue && cellValue !== 0 && cellValue !== false) return this.renderEmptyFormatter();
|
|
166
|
-
return /*#__PURE__*/React.createElement(
|
|
186
|
+
return /*#__PURE__*/React.createElement(_FormulaFormatter, {
|
|
167
187
|
value: cellValue,
|
|
168
188
|
column: column,
|
|
169
189
|
collaborators: collaborators,
|
|
@@ -178,7 +198,7 @@ class CellFormatter extends React.Component {
|
|
|
178
198
|
case CellType.AUTO_NUMBER:
|
|
179
199
|
{
|
|
180
200
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
181
|
-
return /*#__PURE__*/React.createElement(
|
|
201
|
+
return /*#__PURE__*/React.createElement(_AutoNumberFormatter, {
|
|
182
202
|
value: cellValue,
|
|
183
203
|
containerClassName: containerClassName
|
|
184
204
|
});
|
|
@@ -186,7 +206,7 @@ class CellFormatter extends React.Component {
|
|
|
186
206
|
case CellType.URL:
|
|
187
207
|
{
|
|
188
208
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
189
|
-
return /*#__PURE__*/React.createElement(
|
|
209
|
+
return /*#__PURE__*/React.createElement(_UrlFormatter, {
|
|
190
210
|
value: cellValue,
|
|
191
211
|
containerClassName: containerClassName
|
|
192
212
|
});
|
|
@@ -194,7 +214,7 @@ class CellFormatter extends React.Component {
|
|
|
194
214
|
case CellType.EMAIL:
|
|
195
215
|
{
|
|
196
216
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
197
|
-
return /*#__PURE__*/React.createElement(
|
|
217
|
+
return /*#__PURE__*/React.createElement(_EmailFormatter, {
|
|
198
218
|
value: cellValue,
|
|
199
219
|
containerClassName: containerClassName
|
|
200
220
|
});
|
|
@@ -203,7 +223,7 @@ class CellFormatter extends React.Component {
|
|
|
203
223
|
{
|
|
204
224
|
var _column$data;
|
|
205
225
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
206
|
-
return /*#__PURE__*/React.createElement(
|
|
226
|
+
return /*#__PURE__*/React.createElement(_DurationFormatter, {
|
|
207
227
|
value: cellValue,
|
|
208
228
|
format: column === null || column === void 0 ? void 0 : (_column$data = column.data) === null || _column$data === void 0 ? void 0 : _column$data.duration_format,
|
|
209
229
|
containerClassName: containerClassName
|
|
@@ -212,7 +232,7 @@ class CellFormatter extends React.Component {
|
|
|
212
232
|
case CellType.RATE:
|
|
213
233
|
{
|
|
214
234
|
if (!cellValue) return this.renderEmptyFormatter();
|
|
215
|
-
return /*#__PURE__*/React.createElement(
|
|
235
|
+
return /*#__PURE__*/React.createElement(_RateFormatter, {
|
|
216
236
|
value: cellValue,
|
|
217
237
|
data: column.data || {},
|
|
218
238
|
containerClassName: containerClassName
|
|
@@ -220,7 +240,7 @@ class CellFormatter extends React.Component {
|
|
|
220
240
|
}
|
|
221
241
|
case CellType.BUTTON:
|
|
222
242
|
{
|
|
223
|
-
return /*#__PURE__*/React.createElement(
|
|
243
|
+
return /*#__PURE__*/React.createElement(_ButtonFormatter, {
|
|
224
244
|
data: column.data || {},
|
|
225
245
|
containerClassName: containerClassName,
|
|
226
246
|
optionColors: SELECT_OPTION_COLORS
|
package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/custom-switch/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import _DTableSwitch from "dtable-ui-component/lib/DTableSwitch";
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { DTableSwitch } from 'dtable-ui-component';
|
|
3
3
|
import './index.css';
|
|
4
4
|
function CustomSwitch(props) {
|
|
5
5
|
const {
|
|
@@ -7,7 +7,7 @@ function CustomSwitch(props) {
|
|
|
7
7
|
checked,
|
|
8
8
|
title
|
|
9
9
|
} = props;
|
|
10
|
-
return /*#__PURE__*/React.createElement(
|
|
10
|
+
return /*#__PURE__*/React.createElement(_DTableSwitch, {
|
|
11
11
|
checked: checked,
|
|
12
12
|
disabled: isLocked,
|
|
13
13
|
switchClassName: "widget-table-switch-properties w-100",
|
package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/table-setting/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import _DTableSelect from "dtable-ui-component/lib/DTableSelect";
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { withTranslation } from 'react-i18next';
|
|
3
4
|
import { Label } from 'reactstrap';
|
|
4
|
-
import { DTableSelect } from 'dtable-ui-component';
|
|
5
5
|
class TableSetting extends React.Component {
|
|
6
6
|
render() {
|
|
7
7
|
const {
|
|
@@ -29,7 +29,7 @@ class TableSetting extends React.Component {
|
|
|
29
29
|
}
|
|
30
30
|
return /*#__PURE__*/React.createElement("div", {
|
|
31
31
|
className: "setting-item table-setting"
|
|
32
|
-
}, /*#__PURE__*/React.createElement(Label, null, t('Table')), /*#__PURE__*/React.createElement(
|
|
32
|
+
}, /*#__PURE__*/React.createElement(Label, null, t('Table')), /*#__PURE__*/React.createElement(_DTableSelect, {
|
|
33
33
|
value: selectedOption,
|
|
34
34
|
options: options,
|
|
35
35
|
onChange: this.props.onTableChange,
|
|
@@ -58,10 +58,7 @@ export const getHeaderHeight = editor => {
|
|
|
58
58
|
} = editor;
|
|
59
59
|
switch (editorType) {
|
|
60
60
|
case WIKI_EDITOR:
|
|
61
|
-
|
|
62
|
-
const headerTop = document.querySelector('.wiki-page-header-wrapper').offsetHeight;
|
|
63
|
-
// top nav is 44px
|
|
64
|
-
return headerTop + 44;
|
|
61
|
+
return (editor === null || editor === void 0 ? void 0 : editor.getHeaderHeight()) || 0;
|
|
65
62
|
case DOCUMENT_PLUGIN_EDITOR:
|
|
66
63
|
return 67 + 48 + 49 + 37;
|
|
67
64
|
default:
|
|
@@ -15,6 +15,7 @@ const SdocWikiEditor = _ref => {
|
|
|
15
15
|
document,
|
|
16
16
|
docUuid,
|
|
17
17
|
isWikiReadOnly,
|
|
18
|
+
getHeaderHeight,
|
|
18
19
|
scrollRef
|
|
19
20
|
} = _ref;
|
|
20
21
|
context.initApi();
|
|
@@ -37,6 +38,7 @@ const SdocWikiEditor = _ref => {
|
|
|
37
38
|
newEditor.cursors = cursors || {};
|
|
38
39
|
newEditor.width = PAGE_EDIT_AREA_WIDTH; // default width
|
|
39
40
|
newEditor.editorType = WIKI_EDITOR;
|
|
41
|
+
newEditor.getHeaderHeight = getHeaderHeight;
|
|
40
42
|
return newEditor;
|
|
41
43
|
|
|
42
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seafile/sdoc-editor",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "This is a sdoc editor",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"babel-eslint": "10.0.3",
|
|
87
87
|
"babel-jest": "29.7.0",
|
|
88
88
|
"babel-loader": "9.1.3",
|
|
89
|
+
"babel-plugin-import": "^1.13.8",
|
|
89
90
|
"babel-plugin-named-asset-import": "^0.3.4",
|
|
90
91
|
"babel-preset-react-app": "^9.0.2",
|
|
91
92
|
"browserslist": "^4.8.0",
|