@seafile/sdoc-editor 0.5.7 → 0.5.8

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.
@@ -26,7 +26,8 @@ export const TABLE_ELEMENT_POSITION = {
26
26
  export const SELECTED_TABLE_CELL_BACKGROUND_COLOR = '#dee8fe';
27
27
  export const TABLE_CELL_STYLE = {
28
28
  TEXT_ALIGN: 'text_align',
29
- BACKGROUND_COLOR: 'background_color'
29
+ BACKGROUND_COLOR: 'background_color',
30
+ ALIGN_ITEMS: 'align_items'
30
31
  };
31
32
  export const TABLE_ROW_STYLE = {
32
33
  MIN_HEIGHT: 'min_height'
@@ -0,0 +1,46 @@
1
+ import React, { useCallback, useRef } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import CommonMenu from './common-menu';
4
+ import { setCellStyle } from '../../helpers';
5
+ import { TABLE_CELL_STYLE } from '../../constants';
6
+ import KebabToCamel from '../../../../../utils/Kebab-to-camel';
7
+ const ColumnVerticalAlignmentMenu = _ref => {
8
+ let {
9
+ editor,
10
+ readonly
11
+ } = _ref;
12
+ const textAlignRef = useRef(null);
13
+ const {
14
+ t
15
+ } = useTranslation();
16
+ const setVerticalAlignStyle = useCallback(position => {
17
+ if (readonly) return;
18
+ const alignItems = KebabToCamel(TABLE_CELL_STYLE.ALIGN_ITEMS);
19
+ setCellStyle(editor, {
20
+ [alignItems]: position
21
+ });
22
+ textAlignRef.current && textAlignRef.current.hidePopover();
23
+ }, [editor, readonly]);
24
+ return /*#__PURE__*/React.createElement(CommonMenu, {
25
+ id: "vertical-align",
26
+ iconClass: "sdocfont sdoc-top-alignment",
27
+ ref: textAlignRef,
28
+ disabled: readonly
29
+ }, /*#__PURE__*/React.createElement("div", {
30
+ className: "sdoc-dropdown-menu-item",
31
+ onClick: () => setVerticalAlignStyle('flex-start')
32
+ }, /*#__PURE__*/React.createElement("i", {
33
+ className: "sdocfont sdoc-top-alignment mr-2"
34
+ }), t('Top_align')), /*#__PURE__*/React.createElement("div", {
35
+ className: "sdoc-dropdown-menu-item",
36
+ onClick: () => setVerticalAlignStyle('center')
37
+ }, /*#__PURE__*/React.createElement("i", {
38
+ className: "sdocfont sdoc-center-alignment mr-2"
39
+ }), t('Center_align')), /*#__PURE__*/React.createElement("div", {
40
+ className: "sdoc-dropdown-menu-item",
41
+ onClick: () => setVerticalAlignStyle('flex-end')
42
+ }, /*#__PURE__*/React.createElement("i", {
43
+ className: "sdocfont sdoc-bottom-alignment mr-2"
44
+ }), t('Bottom_align')));
45
+ };
46
+ export default ColumnVerticalAlignmentMenu;
@@ -8,6 +8,7 @@ import CombineCells from './combine-cells';
8
8
  import RemoveTable from './remove-table-menu';
9
9
  import TableColumnMenu from './table-column-menu';
10
10
  import TableRowMenu from './table-row-menu';
11
+ import ColumnVerticalAlignmentMenu from './column-vertical-alignment-menu';
11
12
  import './index.css';
12
13
  const ActiveTableMenu = _ref => {
13
14
  let {
@@ -22,6 +23,9 @@ const ActiveTableMenu = _ref => {
22
23
  }, /*#__PURE__*/React.createElement(CellTextAlignMenu, {
23
24
  editor: editor,
24
25
  readonly: readonly
26
+ }), /*#__PURE__*/React.createElement(ColumnVerticalAlignmentMenu, {
27
+ editor: editor,
28
+ readonly: readonly
25
29
  }), /*#__PURE__*/React.createElement(TableColumnMenu, {
26
30
  editor: editor,
27
31
  readonly: readonly
@@ -50,11 +50,17 @@
50
50
  }
51
51
 
52
52
  .sdoc-table-wrapper .table-cell {
53
+ display: flex;
53
54
  padding: 10px 10px;
54
55
  border-right: 1px solid #ccc;
55
56
  border-bottom: 1px solid #ccc;
56
57
  line-height: 1.5;
57
- vertical-align: top;
58
+ align-items: flex-start;
59
+
60
+ }
61
+
62
+ .table-cell>span {
63
+ min-width: 1px;
58
64
  }
59
65
 
60
66
  .sdoc-table-wrapper .cell-selected {
@@ -0,0 +1,4 @@
1
+ const KebabToCamel = str => {
2
+ return str.replace(/(_[a-z])/g, match => "".concat(match.slice(1).toUpperCase()));
3
+ };
4
+ export default KebabToCamel;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.5.7",
3
+ "version": "0.5.8",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Vytvořit"
448
+ "Create": "Vytvořit",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Erstellen"
448
+ "Create": "Erstellen",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Create"
448
+ "Create": "Create",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Crear"
448
+ "Create": "Crear",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Créer"
448
+ "Create": "Créer",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Recent visited",
446
446
  "The_document_does_not_exist": "The document does not exist",
447
447
  "Create_a_new_sdoc_file": "Create a new sdoc file",
448
- "Create": "Crea"
448
+ "Create": "Crea",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -418,7 +418,7 @@
418
418
  "Freezed": "Заморожено",
419
419
  "Callout": "Выноска",
420
420
  "The_current_location_does_not_support_pasting": "Текущее местоположение не поддерживает вставку ",
421
- "Please_enter": "Please enter",
421
+ "Please_enter": "Пожалуйста, введите",
422
422
  "Combine_cell": "Объединить ячейки",
423
423
  "Split_cell": "Разделить ячейку",
424
424
  "Row_number": "Номер строки",
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "Недавно посещенные",
446
446
  "The_document_does_not_exist": "Документ не существует",
447
447
  "Create_a_new_sdoc_file": "Создать новый файл sdoc",
448
- "Create": "Создать"
448
+ "Create": "Создать",
449
+ "Top_align": "Top",
450
+ "Center_align": "Middle",
451
+ "Bottom_align": "Bottom"
449
452
  }
@@ -445,5 +445,8 @@
445
445
  "Recent_visited": "最近浏览",
446
446
  "The_document_does_not_exist": "不存在该文档",
447
447
  "Create_a_new_sdoc_file": "新建 sdoc 文件",
448
- "Create": "创建"
448
+ "Create": "创建",
449
+ "Top_align": "顶端对齐",
450
+ "Center_align": "剧中对齐",
451
+ "Bottom_align": "底端对齐"
449
452
  }
@@ -14,6 +14,16 @@
14
14
  />
15
15
  <missing-glyph />
16
16
 
17
+ <glyph glyph-name="sdoc-center-alignment" unicode="&#58984;" d="M560 896v-160H832v-320h-272v-96H928v-320H560v-128h-96v128H96V320h368v96H192V736h272V896h96zM832 224H192v-128h640v128zM736 640H288v-128h448V640z" horiz-adv-x="1024" />
18
+
19
+ <glyph glyph-name="sdoc-bottom-alignment" unicode="&#58985;" d="M0-64v96h1024v-96H0z m448 192V832H128v-704h320z m-96 96H224V736h128v-512z m544-96V640H576v-512h320z m-96 96h-128V544h128v-320z" horiz-adv-x="1024" />
20
+
21
+ <glyph glyph-name="sdoc-top-alignment" unicode="&#58986;" d="M0 832v-96h1024V832H0z m448-192v-704H128V640h320z m-96-96H224v-512h128V544z m544 96v-512H576V640h320z m-96-96h-128v-320h128V544z" horiz-adv-x="1024" />
22
+
23
+ <glyph glyph-name="sdoc-all-read" unicode="&#58973;" d="M883.2 768h121.6c9.6 0 19.2-9.6 19.2-19.2v-60.8c0-6.4-9.6-16-19.2-16h-121.6c-9.6 0-19.2 9.6-19.2 19.2V748.8c0 9.6 9.6 19.2 19.2 19.2z m-284.8-704h406.4c12.8 0 22.4-9.6 22.4-19.2v-60.8c0-9.6-9.6-19.2-22.4-19.2H598.4c-12.8 0-22.4 9.6-22.4 19.2v60.8c0 9.6 9.6 19.2 22.4 19.2z m403.2 352c12.8 0 22.4-9.6 22.4-19.2v-60.8c0-9.6-9.6-19.2-22.4-19.2h-246.4c-12.8 0-22.4 9.6-22.4 19.2v60.8c0 9.6 9.6 19.2 22.4 19.2h246.4zM761.6 860.8c-3.2 3.2-9.6 3.2-12.8 3.2-6.4 0-9.6-3.2-12.8-9.6L304 70.4 67.2 256c-9.6 6.4-22.4 3.2-28.8-6.4L0 188.8c-3.2-9.6 0-22.4 9.6-28.8l336-256L819.2 803.2c6.4 9.6 3.2 22.4-6.4 28.8l-51.2 28.8z" horiz-adv-x="1027" />
24
+
25
+ <glyph glyph-name="sdoc-freezed" unicode="&#58983;" d="M512 384m-512 0a512 512 0 1 1 1024 0 512 512 0 1 1-1024 0ZM316.8 716.8c118.4 70.4 265.6 70.4 384 3.2s192-195.2 192-332.8c0-137.6-73.6-265.6-195.2-332.8-182.4-105.6-416-41.6-521.6 140.8S134.4 608 316.8 716.8z m348.8-604.8c137.6 80 195.2 249.6 131.2 396.8L259.2 195.20000000000005c92.8-124.8 268.8-163.2 406.4-83.2zM352 652.8c-137.6-80-192-249.6-128-393.6l537.6 310.4c-96 128-272 163.2-409.6 83.2z" horiz-adv-x="1024" />
26
+
17
27
  <glyph glyph-name="sdoc-callout-color" unicode="&#58982;" d="M819.2 777.6c147.2-121.6 195.2-291.2 195.2-300.8v-3.2c22.4-118.4 3.2-208-51.2-262.4-86.4-83.2-227.2-57.6-249.6-54.4-25.6 3.2-44.8-6.4-60.8-22.4-16-19.2-19.2-44.8-12.8-60.8 12.8-44.8 16-76.8 6.4-102.4-28.8-67.2-89.6-99.2-182.4-99.2-22.4 0-44.8 3.2-67.2 6.4h-6.4C217.6-96 96 76.8 92.8 86.4-76.8 348.8 9.6 611.2 166.4 758.4c160 147.2 422.4 208 652.8 19.2zM230.4 688c-118.4-112-198.4-352-54.4-544C224 80 288 32 352 0s144-32 176 0 16 64 16 112 16 80 48 112 99.2 38.4 144 32 99.2-28.8 160 32c38.4 38.4 41.6 80 25.6 169.6-3.2 12.8-44.8 150.4-163.2 246.4-185.6 153.6-396.8 102.4-528-16z m-9.6-259.2c35.2 0 60.8-28.8 60.8-64s-28.8-64-60.8-64-60.8 28.8-60.8 64 25.6 64 60.8 64z m563.2 73.6c35.2 0 60.8-28.8 60.8-64s-28.8-64-60.8-64c-35.2 0-60.8 28.8-60.8 64s25.6 64 60.8 64zM291.2 614.4c35.2 0 60.8-28.8 60.8-64 0-22.4-12.8-41.6-32-54.4-19.2-12.8-41.6-12.8-60.8 0-19.2 12.8-32 32-32 54.4 3.2 38.4 32 64 64 64z m390.4 54.4c35.2 0 60.8-28.8 60.8-64s-28.8-64-60.8-64-60.8 28.8-60.8 64 25.6 64 60.8 64z m-204.8 51.2c35.2 0 60.8-28.8 60.8-64s-28.8-64-60.8-64-60.8 32-60.8 67.2 25.6 60.8 60.8 60.8z" horiz-adv-x="1024" />
18
28
 
19
29
  <glyph glyph-name="sdoc-callout-icon" unicode="&#58981;" d="M512-32c230.4 0 416 185.6 416 416S742.4 800 512 800 96 614.4 96 384s185.6-416 416-416z m0-96C230.4-128 0 102.4 0 384S230.4 896 512 896s512-230.4 512-512-230.4-512-512-512z m-160 528c44.8 0 80 35.2 80 80s-35.2 80-80 80-80-35.2-80-80 35.2-80 80-80z m320 0c44.8 0 80 35.2 80 80s-35.2 80-80 80-80-35.2-80-80 35.2-80 80-80z m-160-246.4c-80 0-153.6 51.2-188.8 128 0 0-3.2 32-38.4 32-35.2 0-32-32-32-32 35.2-108.8 137.6-192 256-192s227.2 83.2 256 192c0 0 0 32-32 32s-35.2-32-35.2-32c-25.6-73.6-102.4-128-185.6-128z" horiz-adv-x="1024" />
@@ -34,8 +44,6 @@
34
44
 
35
45
  <glyph glyph-name="sdoc-find-replace" unicode="&#58975;" d="M468.66016 896C260.66016 896 81.46016 761.6 20.66016 566.4s16-409.6 185.6-521.6 396.8-102.4 553.6 25.6l185.6-185.6c19.2-16 48-16 64 0 19.2 19.2 19.2 48 0 64l-185.6 185.6c115.2 140.8 137.6 332.8 60.8 492.8S647.86016 896 468.66016 896zM97.46016 432C97.46016 636.8 260.66016 800 465.46016 800S833.46016 636.8 833.46016 432 670.26016 64 465.46016 64 97.46016 227.2 97.46016 432z" horiz-adv-x="1025" />
36
46
 
37
- <glyph glyph-name="sdoc-freezed" unicode="&#58973;" d="M512 384m-512 0a512 512 0 1 1 1024 0 512 512 0 1 1-1024 0ZM316.8 716.8c118.4 70.4 265.6 70.4 384 3.2s192-195.2 192-332.8c0-137.6-73.6-265.6-195.2-332.8-182.4-105.6-416-41.6-521.6 140.8S134.4 608 316.8 716.8z m348.8-604.8c137.6 80 195.2 249.6 131.2 396.8L259.2 195.2c92.8-124.8 268.8-163.2 406.4-83.2zM352 652.8c-137.6-80-192-249.6-128-393.6l537.6 310.4c-96 128-272 163.2-409.6 83.2z" horiz-adv-x="1024" />
38
-
39
47
  <glyph glyph-name="sdoc-jump-to" unicode="&#58970;" d="M361.6 896c32 0 54.4-16 54.4-48S393.6 800 361.6 800H96v-832h832v262.4c0 32 16 57.6 48 57.6s48-25.6 48-57.6v-300.8c0-32-28.8-57.6-60.8-57.6H60.8c-32 0-60.8 25.6-60.8 57.6V835.2C0 870.4 25.6 896 60.8 896h300.8zM992 896c19.2 0 32-12.8 32-32v-332.8c0-28.8-19.2-51.2-48-51.2s-48 22.4-48 51.2V729.6L531.2 336c-6.4-9.6-19.2-16-35.2-16-12.8 0-25.6 6.4-35.2 16-19.2 19.2-19.2 51.2 0 70.4L857.6 800h-198.4c-28.8 0-51.2 19.2-51.2 48S630.4 896 656 896H992z" horiz-adv-x="1024" />
40
48
 
41
49
  <glyph glyph-name="sdoc-callout" unicode="&#58972;" d="M992 352H32c-19.2 0-32 12.8-32 32V832c0 19.2 12.8 32 32 32h960c19.2 0 32-12.8 32-32v-448c0-19.2-12.8-32-32-32zM96 448h832V768H96v-320z m-96-224v-96h1024v96H0z m0-224v-96h576v96H0z" horiz-adv-x="1024" />
@@ -16,6 +16,26 @@
16
16
  -moz-osx-font-smoothing: grayscale;
17
17
  }
18
18
 
19
+ .sdoc-center-alignment:before {
20
+ content: "\e668";
21
+ }
22
+
23
+ .sdoc-bottom-alignment:before {
24
+ content: "\e669";
25
+ }
26
+
27
+ .sdoc-top-alignment:before {
28
+ content: "\e66a";
29
+ }
30
+
31
+ .sdoc-all-read:before {
32
+ content: "\e65d";
33
+ }
34
+
35
+ .sdoc-freezed:before {
36
+ content: "\e667";
37
+ }
38
+
19
39
  .sdoc-callout-color:before {
20
40
  content: "\e666";
21
41
  }
@@ -56,10 +76,6 @@
56
76
  content: "\e65f";
57
77
  }
58
78
 
59
- .sdoc-freezed:before {
60
- content: "\e65d";
61
- }
62
-
63
79
  .sdoc-jump-to:before {
64
80
  content: "\e65a";
65
81
  }