@seafile/sdoc-editor 1.0.63 → 1.0.65

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,6 +86,7 @@
86
86
  overflow: hidden;
87
87
  text-overflow: ellipsis;
88
88
  white-space: nowrap;
89
+ caret-color: blue;
89
90
  }
90
91
 
91
92
  .sdoc-editor__article .sdoc-image-content .sdoc-image-caption-input-wrapper::placeholder {
@@ -225,7 +225,7 @@ const ImageHoverMenu = _ref => {
225
225
  target: "sdoc_image_caption",
226
226
  placement: "top",
227
227
  fade: true
228
- }, t('Insert_caption')))), /*#__PURE__*/_react.default.createElement("span", {
228
+ }, t('Caption')))), /*#__PURE__*/_react.default.createElement("span", {
229
229
  className: "op-group-item"
230
230
  }, /*#__PURE__*/_react.default.createElement("span", {
231
231
  id: "sdoc_image_full_screen_mode",
@@ -261,7 +261,7 @@ const Image = _ref => {
261
261
  style: {
262
262
  width: (data === null || data === void 0 ? void 0 : data.width) || ((_imageRef$current2 = imageRef.current) === null || _imageRef$current2 === void 0 ? void 0 : _imageRef$current2.clientWidth)
263
263
  },
264
- placeholder: t('Insert_caption'),
264
+ placeholder: t('Caption'),
265
265
  autoComplete: "off",
266
266
  value: caption,
267
267
  onBlur: onSetCaption,
@@ -72,116 +72,119 @@ function SeaTableTable(_ref) {
72
72
  // eslint-disable-next-line react-hooks/exhaustive-deps
73
73
  }, [column_width]);
74
74
  (0, _react.useEffect)(() => {
75
- const {
76
- table_id
77
- } = element;
78
- const table = editor.getTableById(table_id);
79
- if (!tableInfoRef.current) {
80
- tableInfoRef.current = {};
81
- }
82
- if (!tableInfoRef.current[table_id]) {
83
- tableInfoRef.current[table_id] = {
84
- formulaRows: editor.getTableFormulaResults(table, table.rows),
85
- idRowMap: table.rows.reduce((result, item) => {
86
- result[item._id] = item;
87
- return result;
88
- }, {})
89
- };
90
- }
91
-
92
- // filter rows
93
- let validRecords = table.rows;
94
- const {
95
- idRowMap,
96
- formulaRows
97
- } = tableInfoRef.current[table_id];
98
- if (element.filters && Array.isArray(element.filters) && element.filters.length > 0) {
99
- const {
100
- filter_conjunction,
101
- filters
102
- } = element;
103
- const {
104
- username,
105
- userId,
106
- userDepartmentIdsMap
107
- } = window.seafile || window.seafileConfig;
108
- const optionalParams = {
109
- formulaRows,
110
- username,
111
- userId,
112
- userDepartmentIdsMap
113
- };
114
- const {
115
- row_ids
116
- } = (0, _dtableUtils.getFilteredRowsWithoutFormulaCalculation)(filter_conjunction, filters, validRecords, table, optionalParams);
117
- validRecords = row_ids.map(rowId => {
118
- const row = idRowMap[rowId];
119
- return row;
120
- });
121
- }
122
-
123
- // sort rows
124
- if (element.sorts && Array.isArray(element.sorts) && element.sorts.length > 0) {
75
+ async function initTableData() {
125
76
  const {
126
- sorts
77
+ table_id
127
78
  } = element;
128
- const value = {
129
- collaborators: editor.collaborators
130
- };
131
- const row_ids = (0, _dtableUtils.sortTableRows)(sorts, validRecords, table.columns, {
132
- formulaRows,
133
- value
134
- });
135
- validRecords = row_ids.map(rowId => {
136
- const row = idRowMap[rowId];
137
- return row;
138
- });
139
- }
140
- const isShowTipMessage = readOnly ? validRecords.length > 200 : validRecords.length > 10;
141
- const shownRecords = readOnly ? validRecords.slice(0, 200) : validRecords.slice(0, 10);
142
- setIsShowTipMessage(isShowTipMessage);
143
- setRecords(validRecords);
144
- setShownRecords(shownRecords);
79
+ const table = await editor.getTableById(table_id);
80
+ if (!tableInfoRef.current) {
81
+ tableInfoRef.current = {};
82
+ }
83
+ if (!tableInfoRef.current[table_id]) {
84
+ tableInfoRef.current[table_id] = {
85
+ formulaRows: editor.getTableFormulaResults(table, table.rows),
86
+ idRowMap: table.rows.reduce((result, item) => {
87
+ result[item._id] = item;
88
+ return result;
89
+ }, {})
90
+ };
91
+ }
145
92
 
146
- // filter columns
147
- let validColumns = table.columns;
148
- if (element.shown_column_keys && Array.isArray(element.shown_column_keys) && element.shown_column_keys.length > 0) {
93
+ // filter rows
94
+ let validRecords = table.rows;
149
95
  const {
150
- shown_column_keys
151
- } = element;
152
- validColumns = table.columns.filter(item => shown_column_keys.includes(item.key));
153
- }
154
- // formatted columns
155
- validColumns = validColumns.map(column => {
156
- const {
157
- type
158
- } = column;
159
- if (type === _dtableUtils.CellType.LINK) {
96
+ idRowMap,
97
+ formulaRows
98
+ } = tableInfoRef.current[table_id];
99
+ if (element.filters && Array.isArray(element.filters) && element.filters.length > 0) {
160
100
  const {
161
- data
162
- } = column;
101
+ filter_conjunction,
102
+ filters
103
+ } = element;
163
104
  const {
164
- display_column_key,
165
- array_type,
166
- array_data
167
- } = data;
168
- const display_column = {
169
- key: display_column_key || '0000',
170
- type: array_type || _dtableUtils.CellType.TEXT,
171
- data: array_data || null
105
+ username,
106
+ userId,
107
+ userDepartmentIdsMap
108
+ } = window.seafile || window.seafileConfig;
109
+ const optionalParams = {
110
+ formulaRows,
111
+ username,
112
+ userId,
113
+ userDepartmentIdsMap
172
114
  };
173
- return {
174
- ...column,
175
- data: {
176
- ...data,
177
- display_column
178
- }
115
+ const {
116
+ row_ids
117
+ } = (0, _dtableUtils.getFilteredRowsWithoutFormulaCalculation)(filter_conjunction, filters, validRecords, table, optionalParams);
118
+ validRecords = row_ids.map(rowId => {
119
+ const row = idRowMap[rowId];
120
+ return row;
121
+ });
122
+ }
123
+
124
+ // sort rows
125
+ if (element.sorts && Array.isArray(element.sorts) && element.sorts.length > 0) {
126
+ const {
127
+ sorts
128
+ } = element;
129
+ const value = {
130
+ collaborators: editor.collaborators
179
131
  };
132
+ const row_ids = (0, _dtableUtils.sortTableRows)(sorts, validRecords, table.columns, {
133
+ formulaRows,
134
+ value
135
+ });
136
+ validRecords = row_ids.map(rowId => {
137
+ const row = idRowMap[rowId];
138
+ return row;
139
+ });
140
+ }
141
+ const isShowTipMessage = readOnly ? validRecords.length > 200 : validRecords.length > 10;
142
+ const shownRecords = readOnly ? validRecords.slice(0, 200) : validRecords.slice(0, 10);
143
+ setIsShowTipMessage(isShowTipMessage);
144
+ setRecords(validRecords);
145
+ setShownRecords(shownRecords);
146
+
147
+ // filter columns
148
+ let validColumns = table.columns;
149
+ if (element.shown_column_keys && Array.isArray(element.shown_column_keys) && element.shown_column_keys.length > 0) {
150
+ const {
151
+ shown_column_keys
152
+ } = element;
153
+ validColumns = table.columns.filter(item => shown_column_keys.includes(item.key));
180
154
  }
181
- return column;
182
- });
183
- setColumns(validColumns);
184
- setIsLoading(false);
155
+ // formatted columns
156
+ validColumns = validColumns.map(column => {
157
+ const {
158
+ type
159
+ } = column;
160
+ if (type === _dtableUtils.CellType.LINK) {
161
+ const {
162
+ data
163
+ } = column;
164
+ const {
165
+ display_column_key,
166
+ array_type,
167
+ array_data
168
+ } = data;
169
+ const display_column = {
170
+ key: display_column_key || '0000',
171
+ type: array_type || _dtableUtils.CellType.TEXT,
172
+ data: array_data || null
173
+ };
174
+ return {
175
+ ...column,
176
+ data: {
177
+ ...data,
178
+ display_column
179
+ }
180
+ };
181
+ }
182
+ return column;
183
+ });
184
+ setColumns(validColumns);
185
+ setIsLoading(false);
186
+ }
187
+ initTableData();
185
188
  // eslint-disable-next-line react-hooks/exhaustive-deps
186
189
  }, [element, readOnly]);
187
190
  const handleScroll = (0, _react.useCallback)(e => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.63",
3
+ "version": "1.0.65",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -397,7 +397,7 @@
397
397
  "Published": "Zveřejněné",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Smazání se nezdařilo",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Veröffentlicht",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Löschen fehlgeschlagen",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Published",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Delete failed",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Publicado",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Eliminar falló",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Publicado",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Eliminar falló",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Publicado",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Eliminar falló",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Publié",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Échec de la suppression",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Pubblicato",
398
398
  "Delete_Successfully": "Delete Successfully",
399
399
  "Delete_failed": "Rimozione fallita",
400
- "Insert_caption": "Insert caption",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "No_collaborators_available",
402
402
  "Search_collaborator": "Search collaborator",
403
403
  "Doc_comments": "Document comments",
@@ -397,7 +397,7 @@
397
397
  "Published": "Опубликовано",
398
398
  "Delete_Successfully": "Удалено",
399
399
  "Delete_failed": "Не удалось удалить",
400
- "Insert_caption": "Вставить подпись",
400
+ "Caption": "Caption",
401
401
  "No_collaborators_available": "Нет доступных соавторов",
402
402
  "Search_collaborator": "Поиск соавтора",
403
403
  "Doc_comments": "Комментарии к документу",
@@ -562,5 +562,5 @@
562
562
  "the_past_year": "в прошлом году",
563
563
  "the_next_numbers_of_days": "ближайшее количество дней",
564
564
  "the_past_numbers_of_days": "прошедшее количество дней",
565
- "Double_click_to_enter_edit_mode_and_adjust_field_width" : "Double click to enter edit mode and adjust field width"
565
+ "Double_click_to_enter_edit_mode_and_adjust_field_width" : "Дважды щелкните, чтобы войти в режим редактирования и отрегулировать ширину поля"
566
566
  }
@@ -397,7 +397,7 @@
397
397
  "Published": "已发布",
398
398
  "Delete_Successfully": "删除成功",
399
399
  "Delete_failed": "删除失败",
400
- "Insert_caption": "插入标题",
400
+ "Caption": "标题",
401
401
  "No_collaborators_available": "没有找到协作人",
402
402
  "Search_collaborator": "查找协作人",
403
403
  "Doc_comments": "文档评论",