@seafile/sdoc-editor 0.1.83 → 0.1.84

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.
Files changed (31) hide show
  1. package/dist/basic-sdk/comment/color-menu/color-item.js +22 -0
  2. package/dist/basic-sdk/comment/color-menu/index.css +109 -0
  3. package/dist/basic-sdk/comment/color-menu/index.js +199 -0
  4. package/dist/basic-sdk/constants/index.js +1 -0
  5. package/dist/basic-sdk/editor.js +3 -1
  6. package/dist/basic-sdk/extension/constants/color.js +265 -0
  7. package/dist/basic-sdk/extension/constants/index.js +9 -2
  8. package/dist/basic-sdk/extension/plugins/header/plugin.js +2 -1
  9. package/dist/basic-sdk/extension/plugins/table/helpers.js +386 -49
  10. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/common-menu.js +4 -0
  11. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +40 -13
  12. package/dist/basic-sdk/extension/plugins/table/plugin.js +138 -214
  13. package/dist/basic-sdk/extension/plugins/table/render/index.js +38 -8
  14. package/dist/basic-sdk/extension/plugins/table/render/render-cell.js +16 -7
  15. package/dist/basic-sdk/extension/plugins/table/render/table-header/rows-header/row-header.js +2 -2
  16. package/dist/basic-sdk/node-id/helpers.js +18 -0
  17. package/dist/basic-sdk/node-id/index.js +3 -3
  18. package/dist/basic-sdk/utils/event-handler.js +5 -1
  19. package/dist/basic-sdk/utils/object-utils.js +3 -0
  20. package/dist/constants/index.js +2 -1
  21. package/dist/utils/index.js +2 -1
  22. package/dist/utils/local-storage-utils.js +49 -0
  23. package/package.json +2 -1
  24. package/public/locales/en/sdoc-editor.json +44 -1
  25. package/public/locales/zh-CN/sdoc-editor.json +44 -1
  26. package/public/media/sdoc-editor-font/iconfont.eot +0 -0
  27. package/public/media/sdoc-editor-font/iconfont.svg +4 -0
  28. package/public/media/sdoc-editor-font/iconfont.ttf +0 -0
  29. package/public/media/sdoc-editor-font/iconfont.woff +0 -0
  30. package/public/media/sdoc-editor-font/iconfont.woff2 +0 -0
  31. package/public/media/sdoc-editor-font.css +14 -6
@@ -2,6 +2,7 @@ export var EXTERNAL_EVENT = {
2
2
  INTERNAL_LINK_CLICK: 'internal_link_click',
3
3
  TOGGLE_STAR: 'toggle_star',
4
4
  UNMARK_AS_DRAFT: 'unmark_as_draft',
5
- CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range'
5
+ CANCEL_TABLE_SELECT_RANGE: 'cancel_table_select_range',
6
+ SET_TABLE_SELECT_RANGE: 'set_table_select_range'
6
7
  };
7
8
  export var PAGE_EDIT_AREA_WIDTH = 672; // 672 = 794 - 2[borderLeft + borderRight] - 120[paddingLeft + paddingRight]
@@ -1,4 +1,5 @@
1
1
  import DateUtils from './date-utils';
2
+ import LocalStorage from './local-storage-utils';
2
3
  export var getDirPath = function getDirPath(path) {
3
4
  var dir = path.slice(0, path.lastIndexOf('/'));
4
5
  if (dir === '') {
@@ -39,4 +40,4 @@ export var getErrorMsg = function getErrorMsg(error) {
39
40
  }
40
41
  return errorMsg;
41
42
  };
42
- export { DateUtils };
43
+ export { DateUtils, LocalStorage };
@@ -0,0 +1,49 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
3
+ var LocalStorage = /*#__PURE__*/function () {
4
+ function LocalStorage() {
5
+ _classCallCheck(this, LocalStorage);
6
+ }
7
+ _createClass(LocalStorage, null, [{
8
+ key: "setItem",
9
+ value: function setItem(key, value) {
10
+ return window.localStorage.setItem(key, JSON.stringify(value));
11
+ }
12
+ }, {
13
+ key: "getItem",
14
+ value: function getItem(key, defaultValue) {
15
+ return JSON.parse(window.localStorage.getItem(key)) || defaultValue;
16
+ }
17
+ }, {
18
+ key: "removeItem",
19
+ value: function removeItem(key) {
20
+ return window.localStorage.removeItem(key);
21
+ }
22
+
23
+ //The setExpire and getExpire methods used to satisfy some cases that need to be updated regularly
24
+ }, {
25
+ key: "setExpire",
26
+ value: function setExpire(key, value, expire) {
27
+ var obj = {
28
+ data: value,
29
+ time: Date.now(),
30
+ expire: expire
31
+ };
32
+ this.setItem(key, JSON.stringify(obj));
33
+ }
34
+ }, {
35
+ key: "getExpire",
36
+ value: function getExpire(key) {
37
+ var val = this.getItem(key);
38
+ if (!val) return val;
39
+ val = JSON.parse(val);
40
+ if (Date.now() - val.time > val.expire) {
41
+ this.removeItem(key);
42
+ return null;
43
+ }
44
+ return val.data;
45
+ }
46
+ }]);
47
+ return LocalStorage;
48
+ }();
49
+ export default LocalStorage;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.83",
3
+ "version": "0.1.84",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -19,6 +19,7 @@
19
19
  "lodash.throttle": "4.1.1",
20
20
  "randomcolor": "0.6.2",
21
21
  "prismjs": "^1.29.0",
22
+ "react-color": "2.19.3",
22
23
  "react-cookies": "0.1.1",
23
24
  "reactstrap": "8.9.0",
24
25
  "slugid": "3.2.0",
@@ -262,5 +262,48 @@
262
262
  "Start_revise_tip": "Create a temporary document and modify on it, merge it back after reviewing changes",
263
263
  "Load_doc_content_error": "Load doc content error",
264
264
  "Draft": "Draft",
265
- "Unmark_as_draft": "Unmark as draft"
265
+ "Unmark_as_draft": "Unmark as draft",
266
+ "Background_color": "Background color",
267
+ "No_color": "No color",
268
+ "Standard_color": "Standard color",
269
+ "Recently_used": "Recently used",
270
+ "More_color": "More color",
271
+ "White": "White",
272
+ "Black": "Black",
273
+ "Blue_grey": "Blue_grey",
274
+ "Blue": "Blue",
275
+ "Sky_blue": "Sky_blue",
276
+ "Green": "Green",
277
+ "Red": "Red",
278
+ "Orange": "Orange",
279
+ "Yellow": "Yellow",
280
+ "Purple": "Purple",
281
+ "Light_grey_x": "Light grey {{value}}",
282
+ "Dark_grey_x": "Dark grey {{value}}",
283
+ "Light_blue_grey_x": "Light blue grey {{value}}",
284
+ "Light_blue_x": "Light blue {{value}}",
285
+ "Light_sky_blue_x": "Light sky blue {{value}}",
286
+ "Light_green_x": "Light green {{value}}",
287
+ "Light_red_x": "Light red {{value}}",
288
+ "Light_orange_x": "Light orange {{value}}",
289
+ "Light_yellow_x": "Light yellow {{value}}",
290
+ "Light_purple_x": "Light purple {{value}}",
291
+ "Dark_blue_grey_x": "Dark blue grey {{value}}",
292
+ "Dark_blue_x": "Dark blue {{value}}",
293
+ "Dark_sky_blue_x": "Dark sky blue {{value}}",
294
+ "Dark_green_x": "Dark green {{value}}",
295
+ "Dark_red_x": "Dark red {{value}}",
296
+ "Dark_orange_x": "Dark orange {{value}}",
297
+ "Dark_yellow_x": "Dark yellow {{value}}",
298
+ "Dark_purple_x": "Dark purple {{value}}",
299
+ "Standard_dark_red": "Standard dark red",
300
+ "Standard_red": "Standard red",
301
+ "Standard_orange": "Standard orange",
302
+ "Standard_yellow": "Standard yellow",
303
+ "Standard_light_green": "Standard light green",
304
+ "Standard_green": "Standard green",
305
+ "Standard_light_blue": "Standard light blue",
306
+ "Standard_blue": "Standard blue",
307
+ "Standard_dark_blue": "Standard dark blue",
308
+ "Standard_purple": "Standard purple"
266
309
  }
@@ -262,5 +262,48 @@
262
262
  "Start_revise_tip": "创建一个临时文档并对其进行修订,检查更改后将其合并回来",
263
263
  "Load_doc_content_error": "加载文档内容错误",
264
264
  "Draft": "草稿",
265
- "Unmark_as_draft": "取消草稿标记"
265
+ "Unmark_as_draft": "取消草稿标记",
266
+ "Background_color": "背景色",
267
+ "No_color": "无颜色",
268
+ "Standard_color": "标准色",
269
+ "Recently_used": "最近使用",
270
+ "More_color": "更多颜色",
271
+ "White": "白",
272
+ "Black": "黑",
273
+ "Blue_grey": "蓝灰",
274
+ "Blue": "蓝",
275
+ "Sky_blue": "天蓝",
276
+ "Green": "绿",
277
+ "Red": "红",
278
+ "Orange": "橙",
279
+ "Yellow": "黄",
280
+ "Purple": "紫",
281
+ "Light_grey_x": "浅灰 {{value}}",
282
+ "Dark_grey_x": "深灰 {{value}}",
283
+ "Light_blue_grey_x": "浅蓝灰 {{value}}",
284
+ "Light_blue_x": "浅蓝 {{value}}",
285
+ "Light_sky_blue_x": "浅天蓝 {{value}}",
286
+ "Light_green_x": "浅绿 {{value}}",
287
+ "Light_red_x": "浅红 {{value}}",
288
+ "Light_orange_x": "浅橙 {{value}}",
289
+ "Light_yellow_x": "浅黄 {{value}}",
290
+ "Light_purple_x": "浅紫 {{value}}",
291
+ "Dark_blue_grey_x": "深蓝灰 {{value}}",
292
+ "Dark_blue_x": "深蓝 {{value}}",
293
+ "Dark_sky_blue_x": "深天蓝 {{value}}",
294
+ "Dark_green_x": "深绿 {{value}}",
295
+ "Dark_red_x": "深红 {{value}}",
296
+ "Dark_orange_x": "深橙 {{value}}",
297
+ "Dark_yellow_x": "深黄 {{value}}",
298
+ "Dark_purple_x": "深紫 {{value}}",
299
+ "Standard_dark_red": "标准深红",
300
+ "Standard_red": "标准红",
301
+ "Standard_orange": "标准橙",
302
+ "Standard_yellow": "标准黄",
303
+ "Standard_light_green": "标准浅绿",
304
+ "Standard_green": "标准绿",
305
+ "Standard_light_blue": "标准浅蓝",
306
+ "Standard_blue": "标准蓝",
307
+ "Standard_dark_blue": "标准深蓝",
308
+ "Standard_purple": "标准紫"
266
309
  }
@@ -14,6 +14,10 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="sdoc-bg-color" unicode="&#58884;" d="M906.4-64c60.8 0 105.6 48 105.6 105.6 0 38.4-35.2 124.8-105.6 246.4C836 160 800.8 80 800.8 41.6c0-60.8 48-105.6 105.6-105.6zM512.8 761.6l358.4-352c35.2-35.2 35.2-92.8 0-128l-358.4-352c-35.2-35.2-92.8-35.2-131.2 0l-355.2 352c-35.2 35.2-35.2 92.8 0 128L356 736l-19.2 19.2c-25.6 22.4-25.6 64 0 89.6s64 22.4 89.6 0l86.4-83.2z m-368-400h614.4L452 649.6c0-3.2-307.2-288-307.2-288z" horiz-adv-x="1024" />
18
+
19
+ <glyph glyph-name="sdoc-right-slide" unicode="&#58882;" d="M806.4 438.4L336 812.8c-54.4 44.8-144 9.6-144-54.4v-748.8c0-64 86.4-99.2 144-54.4l470.4 374.4c35.2 28.8 35.2 80 0 108.8z" horiz-adv-x="1024" />
20
+
17
21
  <glyph glyph-name="sdoc-superscript" unicode="&#58936;" d="M659.62016 812.8c22.4 22.4 57.6 25.6 83.2 6.4l6.4-6.4 3.2-3.2c22.4-22.4 25.6-57.6 9.6-83.2l-6.4-6.4L474.02016 384l281.6-336c22.4-25.6 22.4-67.2-3.2-92.8l-3.2-3.2c-12.8-9.6-28.8-16-44.8-16-16 0-32 6.4-44.8 19.2l-3.2 3.2L384.42016 281.6 112.42016-44.8l-3.2-3.2c-22.4-22.4-57.6-25.6-80-6.4l-6.4 6.4-3.2 3.2c-22.4 22.4-25.6 57.6-9.6 83.2l6.4 6.4L298.02016 384 16.42016 720c-22.4 25.6-22.4 67.2 3.2 92.8l3.2 3.2c12.8 9.6 28.8 16 44.8 16s32-6.4 44.8-19.2l3.2-3.2 272-320 272 323.2z m259.2 19.2c28.8 0 54.4-9.6 73.6-25.6 22.4-19.2 32-41.6 32-70.4 0-28.8-9.6-51.2-32-73.6-9.6-12.8-28.8-25.6-54.4-41.6l-9.6-9.6c-32-22.4-51.2-38.4-57.6-54.4H1024.42016V512h-217.6c0 32 9.6 60.8 32 83.2 9.6 12.8 28.8 28.8 57.6 51.2l12.8 9.6c19.2 12.8 35.2 25.6 41.6 35.2 12.8 16 19.2 32 19.2 51.2 0 16-6.4 28.8-12.8 38.4-9.6 9.6-22.4 12.8-41.6 12.8-19.2 0-35.2-6.4-44.8-19.2-9.6-12.8-16-32-16-54.4h-51.2c0 35.2 9.6 64 32 86.4 22.4 12.8 51.2 25.6 83.2 25.6z" horiz-adv-x="1024" />
18
22
 
19
23
  <glyph glyph-name="sdoc-subscript" unicode="&#58937;" d="M659.62016 812.8c22.4 22.4 57.6 25.6 83.2 6.4l6.4-6.4 3.2-3.2c22.4-22.4 25.6-57.6 9.6-83.2l-6.4-6.4L474.02016 384l281.6-336c22.4-25.6 22.4-67.2-3.2-92.8l-3.2-3.2c-12.8-9.6-28.8-16-44.8-16-16 0-32 6.4-44.8 19.2l-3.2 3.2L384.42016 281.6 112.42016-44.8l-3.2-3.2c-22.4-22.4-57.6-25.6-80-6.4l-6.4 6.4-3.2 3.2c-22.4 22.4-25.6 57.6-9.6 83.2l6.4 6.4L298.02016 384 16.42016 720c-22.4 25.6-22.4 67.2 3.2 92.8l3.2 3.2c12.8 9.6 28.8 16 44.8 16s32-6.4 44.8-19.2l3.2-3.2 272-320 272 323.2zM918.82016 288c28.8 0 54.4-9.6 73.6-25.6 19.2-16 28.8-38.4 28.8-67.2 0-28.8-9.6-51.2-32-73.6-9.6-12.8-28.8-25.6-54.4-41.6l-6.4-12.8c-32-22.4-51.2-38.4-57.6-54.4H1024.42016V-32h-217.6c0 32 9.6 60.8 32 83.2 9.6 12.8 28.8 28.8 60.8 48l12.8 9.6c19.2 12.8 35.2 25.6 41.6 35.2 12.8 16 19.2 32 19.2 51.2 0 16-6.4 28.8-12.8 38.4-9.6 9.6-22.4 12.8-41.6 12.8-19.2 0-35.2-6.4-44.8-19.2-9.6-12.8-16-32-16-54.4h-51.2c0 35.2 9.6 64 32 86.4 19.2 16 48 28.8 80 28.8z" horiz-adv-x="1024" />
@@ -1,11 +1,11 @@
1
1
  @font-face {
2
2
  font-family: "sdocfont"; /* Project id 4097705 */
3
- src: url('./sdoc-editor-font/iconfont.eot?t=1689461796012'); /* IE9 */
4
- src: url('./sdoc-editor-font/iconfont.eot?t=1689461796012#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
- url('./sdoc-editor-font/iconfont.woff2?t=1689461796012') format('woff2'),
6
- url('./sdoc-editor-font/iconfont.woff?t=1689461796012') format('woff'),
7
- url('iconfont.ttf?t=1689461796012') format('truetype'),
8
- url('./sdoc-editor-font/iconfont.svg?t=1689461796012#sdocfont') format('svg');
3
+ src: url('./sdoc-editor-font/iconfont.eot?t=1689838000925'); /* IE9 */
4
+ src: url('./sdoc-editor-font/iconfont.eot?t=1689838000925#iefix') format('embedded-opentype'), /* IE6-IE8 */
5
+ url('./sdoc-editor-font/iconfont.woff2?t=1689838000925') format('woff2'),
6
+ url('./sdoc-editor-font/iconfont.woff?t=1689838000925') format('woff'),
7
+ url('./sdoc-editor-font/iconfont.ttf?t=1689838000925') format('truetype'),
8
+ url('./sdoc-editor-font/iconfont.svg?t=1689838000925#sdocfont') format('svg');
9
9
  }
10
10
 
11
11
  .sdocfont {
@@ -16,6 +16,14 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .sdoc-bg-color:before {
20
+ content: "\e604";
21
+ }
22
+
23
+ .sdoc-right-slide:before {
24
+ content: "\e602";
25
+ }
26
+
19
27
  .sdoc-superscript:before {
20
28
  content: "\e638";
21
29
  }