@seafile/sdoc-editor 1.0.3 → 1.0.5

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 (29) hide show
  1. package/dist/basic-sdk/extension/plugins/seatable-tables/op-menu/index.js +17 -4
  2. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/custom-switch/index.css +28 -0
  3. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/custom-switch/index.js +18 -0
  4. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/filter-setter/index.js +8 -0
  5. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/hide-column-setter/index.js +8 -0
  6. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.css +66 -0
  7. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/index.js +73 -0
  8. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/sort-setter/index.js +8 -0
  9. package/dist/basic-sdk/extension/plugins/seatable-tables/seatable-settings/table-setting/index.js +40 -0
  10. package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/color-item.js +24 -0
  11. package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/index.js +171 -0
  12. package/dist/basic-sdk/extension/plugins/table/menu/color-selector-popover/style.css +169 -0
  13. package/dist/basic-sdk/extension/plugins/table/menu/index.js +1 -2
  14. package/dist/basic-sdk/extension/plugins/table/menu/table-context-menu/index.js +11 -0
  15. package/dist/basic-sdk/extension/toolbar/header-toolbar/index.js +1 -5
  16. package/package.json +1 -1
  17. package/public/locales/cs/sdoc-editor.json +4 -1
  18. package/public/locales/de/sdoc-editor.json +4 -1
  19. package/public/locales/en/sdoc-editor.json +4 -1
  20. package/public/locales/es/sdoc-editor.json +4 -1
  21. package/public/locales/es_AR/sdoc-editor.json +4 -1
  22. package/public/locales/es_MX/sdoc-editor.json +4 -1
  23. package/public/locales/fr/sdoc-editor.json +4 -1
  24. package/public/locales/it/sdoc-editor.json +4 -1
  25. package/public/locales/ru/sdoc-editor.json +5 -2
  26. package/public/locales/zh_CN/sdoc-editor.json +4 -1
  27. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/cell-bg-color-menu.js +0 -42
  28. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.css +0 -15
  29. package/dist/basic-sdk/extension/plugins/table/menu/active-table-menu/index.js +0 -24
@@ -1,5 +1,6 @@
1
- import React, { useState } from 'react';
1
+ import React, { useCallback, useState } from 'react';
2
2
  import { ElementPopover } from '../../../commons';
3
+ import TableSettings from '../seatable-settings';
3
4
  import './index.css';
4
5
  export default function OpMenu(_ref) {
5
6
  let {
@@ -7,11 +8,23 @@ export default function OpMenu(_ref) {
7
8
  element,
8
9
  menuPosition
9
10
  } = _ref;
10
- const [isShowSettingPanel, setIsShowSettingPanel] = useState(false);
11
+ const [isShowSeaTableSetting, setIsShowSeaTableSetting] = useState(false);
12
+ const onShowSettings = useCallback(() => {
13
+ setIsShowSeaTableSetting(true);
14
+ }, []);
15
+ const onHideSettings = useCallback(() => {
16
+ setIsShowSeaTableSetting(false);
17
+ }, []);
18
+ console.log(isShowSeaTableSetting);
11
19
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ElementPopover, null, /*#__PURE__*/React.createElement("div", {
12
20
  className: "seatable-op-menu",
13
21
  style: menuPosition
14
22
  }, /*#__PURE__*/React.createElement("span", {
15
- className: "sdocfont sdoc-settings"
16
- }))));
23
+ className: "sdocfont sdoc-settings",
24
+ onClick: onShowSettings
25
+ }))), isShowSeaTableSetting && /*#__PURE__*/React.createElement(TableSettings, {
26
+ editor: editor,
27
+ element: element,
28
+ onHideSettings: onHideSettings
29
+ }));
17
30
  }
@@ -0,0 +1,28 @@
1
+ .document-plugin .widget-table-switch-properties .custom-switch-description {
2
+ margin-left: 0;
3
+ white-space: normal;
4
+ flex: 1;
5
+ margin-right: .5rem;
6
+ }
7
+
8
+ .document-plugin .widget-table-switch-properties .custom-switch {
9
+ width: 100%;
10
+ justify-content: space-between;
11
+ cursor: pointer;
12
+ padding-left: 0;
13
+ }
14
+
15
+ .document-plugin .widget-table-switch-properties .custom-switch-indicator {
16
+ width: 22px;
17
+ height: 12px;
18
+ flex-shrink: 0;
19
+ }
20
+
21
+ .document-plugin .widget-table-switch-properties .custom-switch-indicator:before {
22
+ height: 8px;
23
+ width: 8px;
24
+ }
25
+
26
+ .document-plugin .widget-table-switch-properties .custom-switch-input:checked~.custom-switch-indicator:before {
27
+ left: 12px;
28
+ }
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { DTableSwitch } from 'dtable-ui-component';
3
+ import './index.css';
4
+ function CustomSwitch(props) {
5
+ const {
6
+ isLocked,
7
+ checked,
8
+ title
9
+ } = props;
10
+ return /*#__PURE__*/React.createElement(DTableSwitch, {
11
+ checked: checked,
12
+ disabled: isLocked,
13
+ switchClassName: "widget-table-switch-properties w-100",
14
+ placeholder: title,
15
+ onChange: () => props.onPropertiesChanged(!checked)
16
+ });
17
+ }
18
+ export default CustomSwitch;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function FilterSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn filters-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-filter mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "FilterSetter"));
8
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function HideColumnSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn columns-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-hide mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "Hide column setter"));
8
+ }
@@ -0,0 +1,66 @@
1
+ .document-seatable-settings-wrapper {
2
+ position: fixed;
3
+ right: 0;
4
+ top: 200px;
5
+ width: 300px;
6
+ bottom: 0;
7
+ background-color: #fff;
8
+ border-left: 1px solid #e4e4e4;
9
+ transition: width .25s ease-in-out 0s;
10
+ z-index: 4;
11
+ display: flex;
12
+ }
13
+
14
+ .document-seatable-settings-container {
15
+ display: flex;
16
+ flex: 1 1;
17
+ flex-direction: column;
18
+ min-height: 0;
19
+ min-width: 0;
20
+ }
21
+
22
+ .document-seatable-settings-container .document-seatable-settings-header {
23
+ height: 48px;
24
+ line-height: 48px;
25
+ padding: 0 16px;
26
+ display: flex;
27
+ justify-content: space-between;
28
+ border-bottom: 1px solid #e4e4e4;
29
+ }
30
+
31
+ .document-seatable-settings-container .document-seatable-settings-content {
32
+ height: calc(100% - 49px);
33
+ overflow: auto;
34
+ width: 100%;
35
+ display: flex;
36
+ flex-direction: column;
37
+ padding: 16px 16px 50px;
38
+ }
39
+
40
+ .document-plugin .document-seatable-settings-container .setting-item {
41
+ margin: 0;
42
+ margin-bottom: 1rem;
43
+ }
44
+
45
+ .document-plugin .document-seatable-settings-container .setting-divide-line {
46
+ border-bottom: 1px solid #e2e2e2;
47
+ margin: 14px 0;
48
+ }
49
+
50
+ .document-plugin .document-seatable-settings-container .setting-item.table-setting {
51
+ margin-bottom: 0;
52
+ }
53
+
54
+ .document-plugin .document-seatable-settings-container .setting-item-btn {
55
+ display: flex;
56
+ border-radius: 4px;
57
+ cursor: pointer;
58
+ line-height: 22px;
59
+ padding: 3px 4px;
60
+ width: 100%;
61
+ }
62
+
63
+ .document-plugin .document-seatable-settings-container .setting-item-btn .dtable-font {
64
+ color: #666;
65
+ font-size: 14px;
66
+ }
@@ -0,0 +1,73 @@
1
+ import React, { useCallback, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import CustomSwitch from './custom-switch';
4
+ import './index.css';
5
+ import TableSetting from './table-setting';
6
+ import FilterSetter from './filter-setter';
7
+ import SortSetter from './sort-setter';
8
+ import HideColumnSetter from './hide-column-setter';
9
+ export default function TableSettings(_ref) {
10
+ let {
11
+ editor,
12
+ element,
13
+ onHideSettings
14
+ } = _ref;
15
+ const [settings, updateSettings] = useState(element);
16
+ const {
17
+ t
18
+ } = useTranslation();
19
+ const onTableChange = useCallback(option => {
20
+ console.log(option);
21
+ }, []);
22
+ return /*#__PURE__*/React.createElement("div", {
23
+ className: "document-seatable-settings-wrapper"
24
+ }, /*#__PURE__*/React.createElement("div", {
25
+ className: "document-seatable-settings-container"
26
+ }, /*#__PURE__*/React.createElement("div", {
27
+ className: "document-seatable-settings-header"
28
+ }, /*#__PURE__*/React.createElement("span", null, t('SeaTable_settings')), /*#__PURE__*/React.createElement("span", {
29
+ className: "dtable-font dtable-icon-x",
30
+ onClick: onHideSettings
31
+ })), /*#__PURE__*/React.createElement("div", {
32
+ className: "document-seatable-settings-content"
33
+ }, /*#__PURE__*/React.createElement(TableSetting, {
34
+ tables: editor.tables,
35
+ element: settings,
36
+ onTableChange: onTableChange
37
+ }), /*#__PURE__*/React.createElement("div", {
38
+ class: "setting-divide-line"
39
+ }), /*#__PURE__*/React.createElement("div", {
40
+ className: "setting-item"
41
+ }, "Data settings"), /*#__PURE__*/React.createElement("div", {
42
+ className: "setting-item filter-setter"
43
+ }, /*#__PURE__*/React.createElement(FilterSetter, null)), /*#__PURE__*/React.createElement("div", {
44
+ className: "setting-item sort-setter"
45
+ }, /*#__PURE__*/React.createElement(SortSetter, null)), /*#__PURE__*/React.createElement("div", {
46
+ className: "setting-item hide-column-setter"
47
+ }, /*#__PURE__*/React.createElement(HideColumnSetter, null)), /*#__PURE__*/React.createElement("div", {
48
+ class: "setting-divide-line"
49
+ }), /*#__PURE__*/React.createElement("div", {
50
+ className: "setting-item"
51
+ }, "Style Settings"), /*#__PURE__*/React.createElement("div", {
52
+ className: "setting-item"
53
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
54
+ checked: settings['show_record_numbers'],
55
+ isLocked: false,
56
+ title: t('Show_record_numbers'),
57
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('showRowNumber', value)
58
+ })), /*#__PURE__*/React.createElement("div", {
59
+ className: "setting-item"
60
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
61
+ checked: settings['alternate_color'],
62
+ isLocked: false,
63
+ title: t('Alternate_color'),
64
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('applyBandedTableDesign', value)
65
+ })), /*#__PURE__*/React.createElement("div", {
66
+ className: "setting-item"
67
+ }, /*#__PURE__*/React.createElement(CustomSwitch, {
68
+ checked: settings['select_column_display_option_color'] === false ? false : true,
69
+ isLocked: false,
70
+ title: t('Select_column_display_option_color_tip'),
71
+ onPropertiesChanged: value => this.onSwitchPropertiesChanged('select_column_display_option_color', value)
72
+ })))));
73
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export default function SortSetter() {
3
+ return /*#__PURE__*/React.createElement("div", {
4
+ className: "setting-item-btn sorts-setting"
5
+ }, /*#__PURE__*/React.createElement("i", {
6
+ className: "dtable-font dtable-icon-sort mr-2"
7
+ }), /*#__PURE__*/React.createElement("div", null, "Sort setter"));
8
+ }
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { withTranslation } from 'react-i18next';
3
+ import { Label } from 'reactstrap';
4
+ import { DTableSelect } from 'dtable-ui-component';
5
+ class TableSetting extends React.Component {
6
+ render() {
7
+ const {
8
+ tables,
9
+ element,
10
+ t
11
+ } = this.props;
12
+ const {
13
+ table_id
14
+ } = element;
15
+ const options = tables.map(item => {
16
+ let value = item._id;
17
+ let label = item.name;
18
+ return {
19
+ value,
20
+ label
21
+ };
22
+ });
23
+ let selectedOption;
24
+ if (table_id) {
25
+ selectedOption = options.find(option => option.value === table_id);
26
+ }
27
+ if (!selectedOption) {
28
+ selectedOption = options[0];
29
+ }
30
+ return /*#__PURE__*/React.createElement("div", {
31
+ className: "setting-item table-setting"
32
+ }, /*#__PURE__*/React.createElement(Label, null, t('Table')), /*#__PURE__*/React.createElement(DTableSelect, {
33
+ value: selectedOption,
34
+ options: options,
35
+ onChange: this.props.onTableChange,
36
+ menuPortalTarget: "element-settings"
37
+ }));
38
+ }
39
+ }
40
+ export default withTranslation('sdoc-editor')(TableSetting);
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { withTranslation } from 'react-i18next';
3
+ import classnames from 'classnames';
4
+ const ColorItem = _ref => {
5
+ let {
6
+ t,
7
+ color,
8
+ lastUsedColor
9
+ } = _ref;
10
+ return /*#__PURE__*/React.createElement("div", {
11
+ className: classnames('sdoc-color-item', {
12
+ 'selected': lastUsedColor === color.value
13
+ }),
14
+ style: {
15
+ backgroundColor: color.value
16
+ },
17
+ color: color.value,
18
+ "data-color": color.value,
19
+ title: color.index ? t(color.name, {
20
+ value: color.index
21
+ }) : t(color.name)
22
+ });
23
+ };
24
+ export default withTranslation('sdoc-editor')(ColorItem);
@@ -0,0 +1,171 @@
1
+ import React, { useCallback, useRef, useState } from 'react';
2
+ import { useTranslation } from 'react-i18next';
3
+ import { UncontrolledPopover } from 'reactstrap';
4
+ import classnames from 'classnames';
5
+ import { ChromePicker } from 'react-color';
6
+ import { LocalStorage } from '../../../../../../utils';
7
+ import { DEFAULT_COLORS, DEFAULT_RECENT_USED_LIST, RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY, STANDARD_COLORS } from '../../../../constants';
8
+ import ColorItem from './color-item';
9
+ import { eventStopPropagation } from '../../../../../utils/mouse-event';
10
+ import { setCellStyle } from '../../helpers';
11
+ import { useColorContext } from '../../../../../hooks/use-color-context';
12
+ import './style.css';
13
+ const recentUsedColorsKey = RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY;
14
+ const ColorSelectorPopover = _ref => {
15
+ let {
16
+ target,
17
+ editor,
18
+ readonly,
19
+ isRichEditor = true
20
+ } = _ref;
21
+ const {
22
+ t
23
+ } = useTranslation();
24
+ const {
25
+ lastUsedTableCellBackgroundColor: lastUsedColor,
26
+ updateLastUsedTableCellBackgroundColor: updateLastUsedColor
27
+ } = useColorContext();
28
+ const popoverRef = useRef(null);
29
+ const moreColorsPopoverRef = useRef(null);
30
+ const [recentUsedColors, setRecentUsedColors] = useState(LocalStorage.getItem(recentUsedColorsKey, DEFAULT_RECENT_USED_LIST));
31
+ const [isShowMenu, setMenuShow] = useState(false);
32
+ const [isPickerShow, setPickerShow] = useState(false);
33
+ const setColor = useCallback(color => {
34
+ setCellStyle(editor, {
35
+ background_color: color
36
+ });
37
+ }, [editor]);
38
+ const onSetColor = useCallback(function (color) {
39
+ let shouldClose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
40
+ if (readonly) return;
41
+ const validColor = color || '';
42
+ setColor(validColor);
43
+ if (validColor !== '' && recentUsedColors[0] !== validColor) {
44
+ let newRecentUsedColors = recentUsedColors.slice(0, 9);
45
+ newRecentUsedColors.unshift(validColor);
46
+ LocalStorage.setItem(recentUsedColorsKey, newRecentUsedColors);
47
+ setRecentUsedColors(newRecentUsedColors);
48
+ }
49
+ updateLastUsedColor && updateLastUsedColor(validColor);
50
+ if (shouldClose) {
51
+ popoverRef.current.toggle();
52
+ setMenuShow(!isShowMenu);
53
+ }
54
+
55
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56
+ }, [recentUsedColors, recentUsedColorsKey, isShowMenu, isPickerShow, readonly]);
57
+ const setColorProxy = useCallback(event => {
58
+ if (event.target.className.includes('sdoc-color-item')) {
59
+ const color = event.target.dataset.color;
60
+ onSetColor(color);
61
+ }
62
+
63
+ // eslint-disable-next-line react-hooks/exhaustive-deps
64
+ }, [recentUsedColors, recentUsedColorsKey, isShowMenu, isPickerShow]);
65
+ const toggle = useCallback(() => {
66
+ if (isPickerShow) return;
67
+ popoverRef.current.toggle();
68
+ setMenuShow(!isShowMenu);
69
+
70
+ // eslint-disable-next-line react-hooks/exhaustive-deps
71
+ }, [isShowMenu, isPickerShow]);
72
+ const moreColorsPopoverToggle = useCallback(() => {
73
+ moreColorsPopoverRef.current.toggle();
74
+ setPickerShow(!isPickerShow);
75
+
76
+ // eslint-disable-next-line react-hooks/exhaustive-deps
77
+ }, [moreColorsPopoverRef, isPickerShow]);
78
+ const onMouseDown = useCallback(event => {
79
+ eventStopPropagation(event);
80
+
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, []);
83
+ const onChange = useCallback(color => {
84
+ const validColor = color.hex;
85
+ onSetColor(validColor, false);
86
+
87
+ // eslint-disable-next-line react-hooks/exhaustive-deps
88
+ }, [readonly]);
89
+ return /*#__PURE__*/React.createElement(UncontrolledPopover, {
90
+ target: target,
91
+ trigger: "hover",
92
+ placement: "right-start",
93
+ hideArrow: true,
94
+ fade: false,
95
+ className: "sdoc-color-menu-popover sdoc-table-cell-bg-colors-popover",
96
+ toggle: toggle,
97
+ ref: popoverRef
98
+ }, /*#__PURE__*/React.createElement("div", {
99
+ className: "sdoc-dropdown-menu sdoc-color-dropdown-menu"
100
+ }, /*#__PURE__*/React.createElement("div", {
101
+ className: "p-3 d-flex flex-column"
102
+ }, /*#__PURE__*/React.createElement("div", {
103
+ className: "sdoc-color-no-color-container"
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ className: "sdoc-color-no-color-content",
106
+ onMouseDown: () => onSetColor()
107
+ }, t('No_color'))), /*#__PURE__*/React.createElement("div", {
108
+ className: "sdoc-color-default-colors-container",
109
+ onMouseDown: setColorProxy
110
+ }, DEFAULT_COLORS.map((color, index) => {
111
+ return /*#__PURE__*/React.createElement(ColorItem, {
112
+ key: "default-color-".concat(index),
113
+ color: color,
114
+ lastUsedColor: lastUsedColor
115
+ });
116
+ })), /*#__PURE__*/React.createElement("div", {
117
+ className: "sdoc-color-standard-colors-container"
118
+ }, /*#__PURE__*/React.createElement("div", {
119
+ className: "sdoc-color-sub-title"
120
+ }, t('Standard_color')), /*#__PURE__*/React.createElement("div", {
121
+ className: "d-flex",
122
+ onMouseDown: setColorProxy
123
+ }, STANDARD_COLORS.map((color, index) => {
124
+ return /*#__PURE__*/React.createElement(ColorItem, {
125
+ key: "standard-color-".concat(index),
126
+ color: color,
127
+ lastUsedColor: lastUsedColor
128
+ });
129
+ }))), /*#__PURE__*/React.createElement("div", {
130
+ className: "sdoc-color-recent-used-colors-container"
131
+ }, /*#__PURE__*/React.createElement("div", {
132
+ className: "sdoc-color-sub-title"
133
+ }, t('Recently_used')), /*#__PURE__*/React.createElement("div", {
134
+ className: "d-flex",
135
+ onMouseDown: setColorProxy
136
+ }, recentUsedColors.map((color, index) => {
137
+ return /*#__PURE__*/React.createElement(ColorItem, {
138
+ key: "standard-color-".concat(index),
139
+ color: {
140
+ value: color,
141
+ name: color
142
+ }
143
+ });
144
+ })))), /*#__PURE__*/React.createElement("div", {
145
+ className: "sdoc-colors-divider"
146
+ }), /*#__PURE__*/React.createElement("div", {
147
+ className: classnames('sdoc-more-colors pr-2', {
148
+ 'show-pick': isPickerShow
149
+ }),
150
+ id: "sdoc-more-colors"
151
+ }, /*#__PURE__*/React.createElement("span", null, t('More_color')), /*#__PURE__*/React.createElement("i", {
152
+ className: "sdocfont sdoc-right-slide"
153
+ })), /*#__PURE__*/React.createElement(UncontrolledPopover, {
154
+ target: "sdoc-more-colors",
155
+ className: "sdoc-more-colors-popover sdoc-table-more-colors",
156
+ trigger: "hover",
157
+ placement: "right-end",
158
+ hideArrow: true,
159
+ fade: false,
160
+ toggle: moreColorsPopoverToggle,
161
+ ref: moreColorsPopoverRef
162
+ }, /*#__PURE__*/React.createElement("div", {
163
+ className: "sdoc-more-colors-container",
164
+ onMouseDown: onMouseDown
165
+ }, /*#__PURE__*/React.createElement(ChromePicker, {
166
+ disableAlpha: true,
167
+ color: lastUsedColor || '',
168
+ onChange: onChange
169
+ })))));
170
+ };
171
+ export default ColorSelectorPopover;
@@ -0,0 +1,169 @@
1
+ .menu-group .sdoc-color-menu.menu-show {
2
+ background: #e5e5e5;
3
+ border-radius: 2px;
4
+ }
5
+
6
+ .menu-group .sdoc-color-menu .last-used-color-container {
7
+ height: 100%;
8
+ display: flex;
9
+ flex-direction: column;
10
+ justify-content: center;
11
+ align-items: center;
12
+ }
13
+
14
+ .menu-group .sdoc-color-menu .last-used-color-container.disabled {
15
+ padding-right: 0;
16
+ }
17
+
18
+ .menu-group .sdoc-color-menu .sdoc-color-toggle {
19
+ height: 100%;
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ }
24
+
25
+ .menu-group .sdoc-color-menu .sdoc-color-toggle:hover,
26
+ .menu-group .sdoc-color-menu .last-used-color-container:not(.disabled):hover {
27
+ background-color: #E5E5E5;
28
+ }
29
+
30
+ .menu-group .sdoc-color-menu.disabled .sdoc-color-toggle {
31
+ display: none;
32
+ }
33
+
34
+ .sdoc-color-menu .sdoc-color-icon {
35
+ height: 12px;
36
+ width: 12px;
37
+ transform: scale(.85);
38
+ line-height: 12px;
39
+ }
40
+
41
+ .sdoc-color-menu .last-used-color {
42
+ width: 14px;
43
+ height: 3px;
44
+ border-radius: 1px;
45
+ margin-top: 1px;
46
+ border: 1px solid rgba(0, 0, 0, .08);
47
+ }
48
+
49
+ .sdoc-color-menu-popover .popover {
50
+ left: -24px !important;
51
+ }
52
+
53
+ .sdoc-color-menu-popover .sdoc-color-dropdown-menu {
54
+ width: 251px;
55
+ padding: 0 0 12px 0;
56
+ }
57
+
58
+ .sdoc-color-menu-popover .sdoc-color-no-color-container {
59
+ width: 100%;
60
+ height: 24px;
61
+ margin-bottom: 5px;
62
+ }
63
+
64
+ .sdoc-color-menu-popover .sdoc-color-no-color-content {
65
+ height: 100%;
66
+ width: 100%;
67
+ text-align: center;
68
+ border: 1px solid rgba(0, 0, 0, .12);
69
+ border-radius: 2px;
70
+ font-size: 12px;
71
+ line-height: 22px;
72
+ cursor: pointer;
73
+ }
74
+
75
+ .sdoc-color-menu-popover .sdoc-color-default-colors-container {
76
+ display: flex;
77
+ flex-wrap: wrap;
78
+ }
79
+
80
+ .sdoc-color-menu-popover .sdoc-color-item {
81
+ position: relative;
82
+ height: 20px;
83
+ width: 20px;
84
+ margin-right: 3px;
85
+ margin-bottom: 3px;
86
+ border: 0.5px solid rgba(0, 0, 0, .08);
87
+ }
88
+
89
+ .sdoc-color-menu-popover .sdoc-color-item:not(.selected):hover::before {
90
+ content: '';
91
+ position: absolute;
92
+ width: calc(100% + 5px);
93
+ height: calc((100% + 5px));
94
+ top: -2.5px;
95
+ left: -2.5px;
96
+ pointer-events: none;
97
+ border: 1px solid rgba(0, 0, 0, .24);
98
+ }
99
+
100
+ .sdoc-color-menu-popover .sdoc-color-item.selected::after {
101
+ content: '';
102
+ position: absolute;
103
+ width: calc(100% + 5px);
104
+ height: calc((100% + 5px));
105
+ top: -2.5px;
106
+ left: -2.5px;
107
+ pointer-events: none;
108
+ border: 1px solid rgba(0, 0, 0, .88);
109
+ }
110
+
111
+ .sdoc-color-menu-popover .sdoc-color-item:hover {
112
+ cursor: pointer;
113
+ }
114
+
115
+ .sdoc-color-menu-popover .sdoc-color-item:nth-child(10n) {
116
+ margin-right: 0px;
117
+ }
118
+
119
+ .sdoc-color-menu-popover .sdoc-color-sub-title {
120
+ font-size: 11px;
121
+ line-height: 16px;
122
+ margin: 7px 0;
123
+ color: rgba(0, 0, 0, 0.4);
124
+ }
125
+
126
+ .sdoc-color-menu-popover .sdoc-colors-divider {
127
+ width: 100%;
128
+ height: 1px;
129
+ border-bottom: 1px solid rgba(0, 0, 0, 0.08);
130
+ margin: 0px 0 8px 0;
131
+ }
132
+
133
+ .sdoc-color-menu-popover .sdoc-more-colors {
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: space-between;
137
+ height: 30px;
138
+ font-size: 12px;
139
+ padding: 0 12px;
140
+ }
141
+
142
+ .sdoc-color-menu-popover .sdoc-more-colors .sdocfont {
143
+ font-size: 12px;
144
+ transform: scale(.6);
145
+ color: #888;
146
+ }
147
+
148
+ .sdoc-color-menu-popover .sdoc-more-colors.show-pick {
149
+ cursor: pointer;
150
+ background-color: rgba(51, 77, 102, .06);
151
+ }
152
+
153
+ .sdoc-more-colors-popover .popover {
154
+ left: 10px !important;
155
+ }
156
+
157
+ /* commission */
158
+ .menu-group #button-sdoc-highlight-color .sdoc-color-icon {
159
+ position: relative;
160
+ left: 1px;
161
+ }
162
+
163
+ .sdoc-table-cell-bg-colors-popover .popover {
164
+ margin-left: 30px;
165
+ }
166
+
167
+ .sdoc-table-more-colors.sdoc-more-colors-popover .popover {
168
+ margin-left: -8px;
169
+ }
@@ -1,4 +1,3 @@
1
1
  import TableMenu from './table-menu';
2
- import ActiveTableMenu from './active-table-menu';
3
2
  import TableContextMenu from './table-context-menu';
4
- export { TableMenu, ActiveTableMenu, TableContextMenu };
3
+ export { TableMenu, TableContextMenu };
@@ -13,6 +13,7 @@ import { INTERNAL_EVENT } from '../../../../../constants';
13
13
  import VerticalAlignPopover from '../vertical-align-popover';
14
14
  import HorizontalAlignPopover from '../horizontal-align-popover';
15
15
  import KebabToCamel from '../../../../../utils/Kebab-to-camel';
16
+ import ColorSelectorPopover from '../color-selector-popover';
16
17
  import './index.css';
17
18
  class TableContextMenu extends React.Component {
18
19
  constructor(props) {
@@ -76,6 +77,7 @@ class TableContextMenu extends React.Component {
76
77
  this.eventBus = EventBus.getInstance();
77
78
  this.horizontalAlignRef = React.createRef();
78
79
  this.verticalAlignRef = React.createRef();
80
+ this.colorSelectorRef = React.createRef();
79
81
  }
80
82
  componentDidMount() {
81
83
  this.position = this.props.contextMenuPosition;
@@ -203,6 +205,15 @@ class TableContextMenu extends React.Component {
203
205
  editor: editor,
204
206
  readonly: readonly,
205
207
  verticalAlign: verticalAlign
208
+ }), /*#__PURE__*/React.createElement("button", {
209
+ ref: this.colorSelectorRef,
210
+ className: "dropdown-item side-extendable"
211
+ }, /*#__PURE__*/React.createElement("span", null, t('Background_color')), /*#__PURE__*/React.createElement("i", {
212
+ className: "sdocfont sdoc-right-slide"
213
+ })), /*#__PURE__*/React.createElement(ColorSelectorPopover, {
214
+ target: this.colorSelectorRef,
215
+ editor: editor,
216
+ readonly: readonly
206
217
  }), /*#__PURE__*/React.createElement("div", {
207
218
  className: 'seafile-divider dropdown-divider'
208
219
  }), /*#__PURE__*/React.createElement("button", {
@@ -12,7 +12,6 @@ import ClearFormatMenu from '../../plugins/clear-format/menu';
12
12
  import HistoryMenu from './redo-undo';
13
13
  import Font from '../../plugins/font/menu';
14
14
  import InsertToolbar from './insert-toolbar';
15
- import ActiveTableMenu from '../../plugins/table/menu/active-table-menu';
16
15
  import CalloutMenu from '../../plugins/callout/menu';
17
16
  import SearchReplaceMenu from '../../plugins/search-replace/menu';
18
17
  import { getSelectedNodeByType } from '../../core';
@@ -63,10 +62,7 @@ const HeaderToolbar = _ref => {
63
62
  }), /*#__PURE__*/React.createElement(CalloutMenu, {
64
63
  editor: editor,
65
64
  readonly: readonly
66
- })), /*#__PURE__*/React.createElement(ActiveTableMenu, {
67
- editor: editor,
68
- readonly: readonly
69
- }), /*#__PURE__*/React.createElement(MenuGroup, {
65
+ })), /*#__PURE__*/React.createElement(MenuGroup, {
70
66
  className: "menu-group sdoc-editor-toolbar-right-menu"
71
67
  }, /*#__PURE__*/React.createElement(SearchReplaceMenu, {
72
68
  editor: editor,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable column",
465
465
  "SeaTable_table": "SeaTable table",
466
466
  "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
467
+ "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -463,6 +463,9 @@
463
463
  "Horizontal_align": "Горизонтальное выравнивание",
464
464
  "SeaTable_column": "Столбец SeaTable",
465
465
  "SeaTable_table": "Таблица SeaTable",
466
- "And_x_more_records": "and {{count}} more records",
467
- "Print_limit_exceeded": "Exceeding the print limit, only the first 200 lines will be printed"
466
+ "And_x_more_records": "и ещё {{count}} записей",
467
+ "Print_limit_exceeded": "При превышении лимита печати будут напечатаны только первые 200 строк",
468
+ "Show_record_numbers": "Show record numbers",
469
+ "Alternate_color": "Alternate color",
470
+ "Select_column_display_option_color_tip": "Single-select and multi-select columns display option colors"
468
471
  }
@@ -464,5 +464,8 @@
464
464
  "SeaTable_column": "SeaTable 列",
465
465
  "SeaTable_table": "SeaTable 子表",
466
466
  "And_x_more_records": "以及另外 {{count}} 条记录",
467
- "Print_limit_exceeded": "超过打印限制, 只会打印前 200 行"
467
+ "Print_limit_exceeded": "超过打印限制, 只会打印前 200 行",
468
+ "Show_record_numbers": "显示记录编号",
469
+ "Alternate_color": "单双行不同背景色",
470
+ "Select_column_display_option_color_tip": "单选列和多选列显示选项颜色"
468
471
  }
@@ -1,42 +0,0 @@
1
- import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
- import React, { useCallback } from 'react';
3
- import { ColorMenu } from '../../../../commons';
4
- import { RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY } from '../../../../constants';
5
- import { setCellStyle } from '../../helpers';
6
- import { useColorContext } from '../../../../../hooks/use-color-context';
7
- const menuConfig = {
8
- id: 'sdoc_background_color',
9
- iconClass: 'sdocfont sdoc-bg-color',
10
- text: 'Background_color'
11
- };
12
- const CellBackgroundColorMenu = _ref => {
13
- let {
14
- isRichEditor,
15
- className,
16
- editor
17
- } = _ref;
18
- const {
19
- lastUsedTableCellBackgroundColor,
20
- updateLastUsedTableCellBackgroundColor
21
- } = useColorContext();
22
- const setColor = useCallback(color => {
23
- setCellStyle(editor, {
24
- background_color: color
25
- });
26
- }, [editor]);
27
- const props = _objectSpread(_objectSpread({
28
- isRichEditor,
29
- className,
30
- disabled: false,
31
- isActive: false
32
- }, menuConfig), {}, {
33
- onMouseDown: () => {},
34
- setColor: setColor,
35
- recentUsedColorsKey: RECENT_USED_TABLE_CELL_BACKGROUND_COLORS_KEY,
36
- lastUsedColor: lastUsedTableCellBackgroundColor,
37
- updateLastUsedColor: updateLastUsedTableCellBackgroundColor,
38
- popoverClassName: 'sdoc-table-cell-bg-colors-popover'
39
- });
40
- return /*#__PURE__*/React.createElement(ColorMenu, props);
41
- };
42
- export default CellBackgroundColorMenu;
@@ -1,15 +0,0 @@
1
- .sdoc-table-menu-group .sdoc-menu-with-dropdown .sdoc-menu-with-dropdown-icon {
2
- width: 24px;
3
- }
4
-
5
- .sdoc-table-menu-group .sdoc-menu-with-dropdown .sdoc-menu-with-dropdown-triangle {
6
- width: 12px;
7
- }
8
-
9
- .sdoc-table-menu-group .sdoc-color-menu .last-used-color-container {
10
- height: 100%;
11
- }
12
-
13
- .sdoc-table-menu-popover .sdoc-dropdown-menu-item {
14
- font-size: 14px;
15
- }
@@ -1,24 +0,0 @@
1
- import React from 'react';
2
- import { withTranslation } from 'react-i18next';
3
- import { MenuGroup } from '../../../../commons';
4
- import { isAllInTable } from '../../helpers';
5
- import CellBackgroundColorMenu from './cell-bg-color-menu';
6
- import './index.css';
7
- const ActiveTableMenu = _ref => {
8
- let {
9
- isRichEditor,
10
- className,
11
- editor,
12
- readonly
13
- } = _ref;
14
- if (!isAllInTable(editor)) return null;
15
- return /*#__PURE__*/React.createElement(MenuGroup, {
16
- className: "menu-group sdoc-table-menu-group"
17
- }, /*#__PURE__*/React.createElement(CellBackgroundColorMenu, {
18
- editor: editor,
19
- isRichEditor: isRichEditor,
20
- className: className,
21
- readonly: readonly
22
- }));
23
- };
24
- export default withTranslation('sdoc-editor')(ActiveTableMenu);