@seafile/sdoc-editor 0.1.90 → 0.1.91

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.
@@ -16,6 +16,8 @@ import CommentWrapper from './comment';
16
16
  import { usePipDecorate } from './decorates';
17
17
  import { getCursorPosition, getDomHeight, getDomMarginTop } from './utils/dom-utils';
18
18
  import EventBus from './utils/event-bus';
19
+ import { FontColorProvider } from './hooks/use-font-color-context';
20
+ import { HighlightColorProvider } from './hooks/use-highlight-color-context';
19
21
  import './assets/css/layout.css';
20
22
  import './assets/css/sdoc-editor-plugins.css';
21
23
  import './assets/css/dropdown-menu.css';
@@ -87,6 +89,7 @@ var SDocEditor = function SDocEditor(_ref) {
87
89
  var _scrollRef$current = scrollRef.current,
88
90
  scrollTop = _scrollRef$current.scrollTop,
89
91
  clientHeight = _scrollRef$current.clientHeight;
92
+ eventProxy.onKeyDown(event);
90
93
  if (event.key === 'ArrowLeft') {
91
94
  if (!isSelectionAtBlockStart(editor)) return;
92
95
  }
@@ -170,7 +173,7 @@ var SDocEditor = function SDocEditor(_ref) {
170
173
  return;
171
174
  }
172
175
  }
173
- eventProxy.onKeyDown(event);
176
+
174
177
  // eslint-disable-next-line react-hooks/exhaustive-deps
175
178
  }, []);
176
179
  var _useState3 = useState({}),
@@ -205,7 +208,7 @@ var SDocEditor = function SDocEditor(_ref) {
205
208
  }, []);
206
209
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
207
210
  className: "sdoc-editor-container"
208
- }, /*#__PURE__*/React.createElement(Toolbar, {
211
+ }, /*#__PURE__*/React.createElement(FontColorProvider, null, /*#__PURE__*/React.createElement(HighlightColorProvider, null, /*#__PURE__*/React.createElement(Toolbar, {
209
212
  editor: editor
210
213
  }), /*#__PURE__*/React.createElement("div", {
211
214
  className: "sdoc-editor-content"
@@ -243,6 +246,6 @@ var SDocEditor = function SDocEditor(_ref) {
243
246
  onMouseDown: onMouseDown,
244
247
  decorate: decorate,
245
248
  onCut: eventProxy.onCut
246
- })), /*#__PURE__*/React.createElement(CommentWrapper, null))))))))));
249
+ })), /*#__PURE__*/React.createElement(CommentWrapper, null))))))))))));
247
250
  };
248
251
  export default SDocEditor;
@@ -47,7 +47,7 @@
47
47
  }
48
48
 
49
49
  .sdoc-color-menu-popover .popover {
50
- left: -30px !important;
50
+ left: -24px !important;
51
51
  }
52
52
 
53
53
  .sdoc-color-menu-popover .sdoc-color-dropdown-menu {
@@ -19,30 +19,28 @@ var ColorMenu = function ColorMenu(_ref) {
19
19
  t = _ref.t,
20
20
  setColor = _ref.setColor,
21
21
  recentUsedColorsKey = _ref.recentUsedColorsKey,
22
- lastUsedColorKey = _ref.lastUsedColorKey,
23
22
  text = _ref.text,
24
23
  defaultColorTip = _ref.defaultColorTip,
25
- defaultColor = _ref.defaultColor;
24
+ defaultColor = _ref.defaultColor,
25
+ lastUsedColor = _ref.lastUsedColor,
26
+ updateLastUsedColor = _ref.updateLastUsedColor;
26
27
  var popoverRef = useRef(null);
27
28
  var moreColorsPopoverRef = useRef(null);
28
- var _useState = useState(LocalStorage.getItem(lastUsedColorKey, '')),
29
+ var _useState = useState(LocalStorage.getItem(recentUsedColorsKey, DEFAULT_RECENT_USED_COLORS)),
29
30
  _useState2 = _slicedToArray(_useState, 2),
30
- lastUsedColor = _useState2[0],
31
- setLastUseColor = _useState2[1];
32
- var _useState3 = useState(LocalStorage.getItem(recentUsedColorsKey, DEFAULT_RECENT_USED_COLORS)),
31
+ recentUsedColors = _useState2[0],
32
+ setRecentUsedColors = _useState2[1];
33
+ var _useState3 = useState(false),
33
34
  _useState4 = _slicedToArray(_useState3, 2),
34
- recentUsedColors = _useState4[0],
35
- setRecentUsedColors = _useState4[1];
35
+ isShowMenu = _useState4[0],
36
+ setMenuShow = _useState4[1];
36
37
  var _useState5 = useState(false),
37
38
  _useState6 = _slicedToArray(_useState5, 2),
38
- isShowMenu = _useState6[0],
39
- setMenuShow = _useState6[1];
40
- var _useState7 = useState(false),
41
- _useState8 = _slicedToArray(_useState7, 2),
42
- isPickerShow = _useState8[0],
43
- setPickerShow = _useState8[1];
39
+ isPickerShow = _useState6[0],
40
+ setPickerShow = _useState6[1];
44
41
  var onSetColor = useCallback(function (color) {
45
42
  var shouldClose = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
43
+ if (disabled) return;
46
44
  var validColor = color || '';
47
45
  setColor(validColor);
48
46
  if (validColor !== '' && recentUsedColors[0] !== validColor) {
@@ -51,15 +49,14 @@ var ColorMenu = function ColorMenu(_ref) {
51
49
  LocalStorage.setItem(recentUsedColorsKey, newRecentUsedColors);
52
50
  setRecentUsedColors(newRecentUsedColors);
53
51
  }
54
- LocalStorage.setItem(lastUsedColorKey, validColor);
55
- setLastUseColor(validColor);
52
+ updateLastUsedColor && updateLastUsedColor(validColor);
56
53
  if (shouldClose) {
57
54
  popoverRef.current.toggle();
58
55
  setMenuShow(!isShowMenu);
59
56
  }
60
57
 
61
58
  // eslint-disable-next-line react-hooks/exhaustive-deps
62
- }, [recentUsedColors, recentUsedColorsKey, isShowMenu, isPickerShow]);
59
+ }, [recentUsedColors, recentUsedColorsKey, isShowMenu, isPickerShow, disabled]);
63
60
  var setColorProxy = useCallback(function (event) {
64
61
  if (event.target.className.includes('sdoc-color-item')) {
65
62
  var color = event.target.dataset.color;
@@ -263,4 +263,14 @@ export var STANDARD_COLORS = [{
263
263
 
264
264
  // Initialize the most recently used colors
265
265
  export var DEFAULT_RECENT_USED_COLORS = new Array(10).fill('');
266
- export var DEFAULT_FONT_COLOR = '#333333';
266
+ export var DEFAULT_FONT_COLOR = '#333333';
267
+
268
+ // default last used color
269
+ export var DEFAULT_LAST_USED_FONT_COLOR = '#FFFF00';
270
+ export var DEFAULT_LAST_USED_HIGHLIGHT_COLOR = '#FF0000';
271
+ export var DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR = '#FF0000';
272
+
273
+ // recent used colors key
274
+ export var RECENT_USED_HIGHLIGHT_COLORS_KEY = 'sdoc-recent-used-highlight-colors';
275
+ export var RECENT_USED_FONT_COLORS_KEY = 'sdoc-recent-used-font-colors';
276
+ export var RECENT_USED_TABLE_CELL_BG_COLORS_KEY = 'sdoc-recent-used-bg-colors';
@@ -4,7 +4,7 @@ var _MENUS_CONFIG_MAP, _HEADER_TITLE_MAP;
4
4
  import * as ELEMENT_TYPE from './element-type';
5
5
  import { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, CLEAR_FORMAT, COLOR, HIGHLIGHT_COLOR } from './element-type';
6
6
  import KEYBOARD from './keyboard';
7
- import { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_COLORS, DEFAULT_FONT_COLOR } from './color';
7
+ import { DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_COLORS, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR } from './color';
8
8
 
9
9
  // history
10
10
  export var UNDO = 'undo';
@@ -72,8 +72,8 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
72
72
  text: 'Highlight_color',
73
73
  type: HIGHLIGHT_COLOR,
74
74
  isColor: true,
75
- recentUsedColorsKey: 'sdoc-recent-used-highlight-colors',
76
- lastUsedColorKey: 'sdoc-last-used-highlight-color'
75
+ recentUsedColorsKey: RECENT_USED_HIGHLIGHT_COLORS_KEY,
76
+ defaultLastUsedColor: DEFAULT_LAST_USED_HIGHLIGHT_COLOR
77
77
  }, {
78
78
  id: "sdoc-font-".concat(COLOR),
79
79
  iconClass: 'sdocfont sdoc-font-color',
@@ -81,8 +81,8 @@ export var MENUS_CONFIG_MAP = (_MENUS_CONFIG_MAP = {}, _defineProperty(_MENUS_CO
81
81
  type: COLOR,
82
82
  defaultColor: DEFAULT_FONT_COLOR,
83
83
  isColor: true,
84
- recentUsedColorsKey: 'sdoc-recent-used-font-colors',
85
- lastUsedColorKey: 'sdoc-last-used-font-color'
84
+ recentUsedColorsKey: RECENT_USED_FONT_COLORS_KEY,
85
+ defaultLastUsedColor: DEFAULT_LAST_USED_FONT_COLOR
86
86
  }]), _defineProperty(_MENUS_CONFIG_MAP, TEXT_STYLE_MORE, [{
87
87
  id: STRIKETHROUGH,
88
88
  iconClass: 'sdocfont sdoc-strikethrough',
@@ -152,4 +152,4 @@ export var HEADER_TYPE_ARRAY = ['header1', 'header2', 'header3', 'header4', 'hea
152
152
  export var LIST_TYPE_ARRAY = ['unordered_list', 'ordered_list'];
153
153
  export var TRANSPARENT = 'transparent';
154
154
  export var CLIPBOARD_FORMAT_KEY = 'x-slate-fragment';
155
- export { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ELEMENT_TYPE, KEYBOARD, DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_COLORS, CLEAR_FORMAT, DEFAULT_FONT_COLOR };
155
+ export { BLOCKQUOTE, HEADER, HEADER1, HEADER2, HEADER3, HEADER4, HEADER5, HEADER6, PARAGRAPH, BOLD, ITALIC, UNDERLINE, STRIKETHROUGH, SUPERSCRIPT, SUBSCRIPT, ORDERED_LIST, UNORDERED_LIST, LIST_ITEM, LIST_LIC, CHECK_LIST, CHECK_LIST_ITEM, LINK, HTML, CODE_BLOCK, CODE_LINE, IMAGE, TABLE, TABLE_CELL, TABLE_ROW, FORMULA, COLUMN, TEXT_STYLE, TEXT_STYLE_MORE, BOLD_ITALIC, TEXT_ALIGN, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER, ELEMENT_TYPE, KEYBOARD, DEFAULT_COLORS, STANDARD_COLORS, DEFAULT_RECENT_USED_COLORS, CLEAR_FORMAT, DEFAULT_FONT_COLOR, RECENT_USED_HIGHLIGHT_COLORS_KEY, RECENT_USED_FONT_COLORS_KEY, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_FONT_COLOR, DEFAULT_LAST_USED_HIGHLIGHT_COLOR, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR };
@@ -14,7 +14,3 @@
14
14
  height: 100%;
15
15
  padding-top: 2px;
16
16
  }
17
-
18
- .sdoc-color-menu-popover.sdoc-table-cell-bg-colors-popover .popover {
19
- left: -24px !important;
20
- }
@@ -9,20 +9,23 @@ import { withTranslation } from 'react-i18next';
9
9
  import classnames from 'classnames';
10
10
  import { ColorMenu, MenuGroup, MenuItem } from '../../../../commons';
11
11
  import CommonMenu from './common-menu';
12
- import { MENUS_CONFIG_MAP, REMOVE_TABLE, BG_COLOR } from '../../../../constants';
12
+ import { MENUS_CONFIG_MAP, REMOVE_TABLE, BG_COLOR, RECENT_USED_TABLE_CELL_BG_COLORS_KEY, DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR } from '../../../../constants';
13
13
  import { setCellStyle, insertTableElement, removeTableElement, isAllInTable } from '../../helpers';
14
14
  import { TABLE_ELEMENT } from '../../constants';
15
15
  import './index.css';
16
16
  var ActiveTableMenu = /*#__PURE__*/function (_Component) {
17
17
  _inherits(ActiveTableMenu, _Component);
18
18
  var _super = _createSuper(ActiveTableMenu);
19
- function ActiveTableMenu() {
19
+ function ActiveTableMenu(_props) {
20
20
  var _this;
21
21
  _classCallCheck(this, ActiveTableMenu);
22
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
23
- args[_key] = arguments[_key];
24
- }
25
- _this = _super.call.apply(_super, [this].concat(args));
22
+ _this = _super.call(this, _props);
23
+ _this.updateLastUsedColor = function (color) {
24
+ if (_this.state.lastUsedColor === color) return;
25
+ _this.setState({
26
+ lastUsedColor: color
27
+ });
28
+ };
26
29
  _this.setTextAlignStyle = function (textAlign) {
27
30
  var editor = _this.props.editor;
28
31
  setCellStyle(editor, {
@@ -135,6 +138,7 @@ var ActiveTableMenu = /*#__PURE__*/function (_Component) {
135
138
  isRichEditor = _this$props2.isRichEditor,
136
139
  className = _this$props2.className;
137
140
  var menuConfig = MENUS_CONFIG_MAP[BG_COLOR];
141
+ var lastUsedColor = _this.state.lastUsedColor;
138
142
  var props = _objectSpread(_objectSpread({
139
143
  isRichEditor: isRichEditor,
140
144
  className: className,
@@ -143,12 +147,16 @@ var ActiveTableMenu = /*#__PURE__*/function (_Component) {
143
147
  }, menuConfig), {}, {
144
148
  onMouseDown: function onMouseDown() {},
145
149
  setColor: _this.setColor,
146
- recentUsedColorsKey: 'sdoc-recent-used-bg-colors',
147
- lastUsedColorKey: 'sdoc-last-used-bg-colors',
150
+ recentUsedColorsKey: RECENT_USED_TABLE_CELL_BG_COLORS_KEY,
151
+ lastUsedColor: lastUsedColor,
152
+ updateLastUsedColor: _this.updateLastUsedColor,
148
153
  popoverClassName: 'sdoc-table-cell-bg-colors-popover'
149
154
  });
150
155
  return /*#__PURE__*/React.createElement(ColorMenu, props);
151
156
  };
157
+ _this.state = {
158
+ lastUsedColor: DEFAULT_LAST_USED_TABLE_CELL_BG_COLOR
159
+ };
152
160
  return _this;
153
161
  }
154
162
  _createClass(ActiveTableMenu, [{
@@ -42,7 +42,6 @@ var withTable = function withTable(editor) {
42
42
  eventBus.dispatch(EXTERNAL_EVENT.SET_TABLE_SELECT_RANGE, table, allTableRange);
43
43
  }
44
44
  if (isHotkey(KEYBOARD.UP, event)) {
45
- event.preventDefault();
46
45
  focusCell(newEditor, event, KEYBOARD.UP);
47
46
  }
48
47
  if (isHotkey(KEYBOARD.RIGHT, event)) {
@@ -108,7 +107,14 @@ var withTable = function withTable(editor) {
108
107
  }
109
108
  var tableSelectedRange = newEditor.tableSelectedRange;
110
109
  if (ObjectUtils.isSameObject(tableSelectedRange, EMPTY_SELECTED_RANGE)) {
111
- return getFragment();
110
+ var fragment = getFragment();
111
+
112
+ // When a cell is selected, it should be converted to text
113
+ return [Object.freeze({
114
+ children: fragment[0].children[0].children[0]['children'],
115
+ id: fragment[0]['id'],
116
+ type: ELEMENT_TYPE.PARAGRAPH
117
+ })];
112
118
  }
113
119
  var minColIndex = tableSelectedRange.minColIndex,
114
120
  maxColIndex = tableSelectedRange.maxColIndex,
@@ -134,10 +140,10 @@ var withTable = function withTable(editor) {
134
140
  var _column = columns[_j];
135
141
  selectedColumns.push(_column);
136
142
  }
137
- return _objectSpread(_objectSpread({}, selectedNode), {}, {
143
+ return Object.freeze(_objectSpread(_objectSpread({}, selectedNode), {}, {
138
144
  children: selectedRows,
139
145
  columns: selectedColumns
140
- });
146
+ }));
141
147
  };
142
148
 
143
149
  // copy: mod + c
@@ -6,12 +6,20 @@ import { TEXT_STYLE, TEXT_STYLE_MORE, MENUS_CONFIG_MAP, ELEMENT_TYPE } from '../
6
6
  import { focusEditor } from '../../../core';
7
7
  import { MenuItem, ColorMenu, MoreDropdown } from '../../../commons';
8
8
  import { getValue, isMenuDisabled, addMark, removeMark } from '../helpers';
9
+ import { useFontColorContext } from '../../../../hooks/use-font-color-context';
10
+ import { useHighlightColorContext } from '../../../../hooks/use-highlight-color-context';
9
11
  var TextStyleMenuList = function TextStyleMenuList(_ref) {
10
12
  var editor = _ref.editor,
11
13
  t = _ref.t,
12
14
  isRichEditor = _ref.isRichEditor,
13
15
  className = _ref.className,
14
16
  idPrefix = _ref.idPrefix;
17
+ var _useFontColorContext = useFontColorContext(),
18
+ lastUsedFontColor = _useFontColorContext.color,
19
+ updateLastUsedFontColor = _useFontColorContext.updateColor;
20
+ var _useHighlightColorCon = useHighlightColorContext(),
21
+ lastUsedHighlightColor = _useHighlightColorCon.color,
22
+ updateLastUsedHighlightColor = _useHighlightColorCon.updateColor;
15
23
  var isActive = useCallback(function (type) {
16
24
  var isMark = getValue(editor, type);
17
25
  return !!isMark;
@@ -57,6 +65,8 @@ var TextStyleMenuList = function TextStyleMenuList(_ref) {
57
65
  return setColor(item.type, color);
58
66
  };
59
67
  itemProps['defaultColorTip'] = item.type === ELEMENT_TYPE.COLOR ? t('Default') : '';
68
+ itemProps['lastUsedColor'] = item.type === ELEMENT_TYPE.COLOR ? lastUsedFontColor : lastUsedHighlightColor;
69
+ itemProps['updateLastUsedColor'] = item.type === ELEMENT_TYPE.COLOR ? updateLastUsedFontColor : updateLastUsedHighlightColor;
60
70
  }
61
71
  return _objectSpread(_objectSpread(_objectSpread({}, itemProps), item), {}, {
62
72
  id: idPrefix ? "".concat(idPrefix, "_").concat(item.id) : item.id
@@ -64,7 +74,7 @@ var TextStyleMenuList = function TextStyleMenuList(_ref) {
64
74
  });
65
75
 
66
76
  // eslint-disable-next-line react-hooks/exhaustive-deps
67
- }, [editor]);
77
+ }, [editor, lastUsedFontColor, lastUsedHighlightColor]);
68
78
  var list = getTextStyleList(TEXT_STYLE);
69
79
  var dropdownList = getTextStyleList(TEXT_STYLE_MORE);
70
80
  return /*#__PURE__*/React.createElement(React.Fragment, null, list.map(function (itemProps, index) {
@@ -1,5 +1,6 @@
1
1
  .sdoc-context-toolbar {
2
2
  position: absolute;
3
+ display: none;
3
4
  width: auto;
4
5
  height: 42px;
5
6
  z-index: 101;
@@ -21,6 +21,7 @@ var ContextToolbar = function ContextToolbar() {
21
21
  var rect = domRange.getBoundingClientRect();
22
22
  el.style.top = "".concat(rect.top - el.offsetHeight, "px");
23
23
  el.style.left = "".concat(rect.left, "px");
24
+ el.style.display = 'block';
24
25
  // eslint-disable-next-line react-hooks/exhaustive-deps
25
26
  }, []);
26
27
  var onScroll = useCallback(function (e) {
@@ -0,0 +1,28 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useContext, useState } from 'react';
3
+ import { DEFAULT_LAST_USED_FONT_COLOR } from '../extension/constants';
4
+ export var FontColorContext = React.createContext(null);
5
+ export var FontColorProvider = function FontColorProvider(props) {
6
+ var _useState = useState(DEFAULT_LAST_USED_FONT_COLOR),
7
+ _useState2 = _slicedToArray(_useState, 2),
8
+ color = _useState2[0],
9
+ updateColor = _useState2[1];
10
+ return /*#__PURE__*/React.createElement(FontColorContext.Provider, {
11
+ value: {
12
+ color: color,
13
+ updateColor: updateColor
14
+ }
15
+ }, props.children);
16
+ };
17
+ export var useFontColorContext = function useFontColorContext() {
18
+ var context = useContext(FontColorContext);
19
+ if (!context) {
20
+ throw new Error('\'FontColorContext\' is null');
21
+ }
22
+ var color = context.color,
23
+ updateColor = context.updateColor;
24
+ return {
25
+ color: color,
26
+ updateColor: updateColor
27
+ };
28
+ };
@@ -0,0 +1,28 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { useContext, useState } from 'react';
3
+ import { DEFAULT_LAST_USED_HIGHLIGHT_COLOR } from '../extension/constants';
4
+ export var HighlightColorContext = React.createContext(null);
5
+ export var HighlightColorProvider = function HighlightColorProvider(props) {
6
+ var _useState = useState(DEFAULT_LAST_USED_HIGHLIGHT_COLOR),
7
+ _useState2 = _slicedToArray(_useState, 2),
8
+ color = _useState2[0],
9
+ updateColor = _useState2[1];
10
+ return /*#__PURE__*/React.createElement(HighlightColorContext.Provider, {
11
+ value: {
12
+ color: color,
13
+ updateColor: updateColor
14
+ }
15
+ }, props.children);
16
+ };
17
+ export var useHighlightColorContext = function useHighlightColorContext() {
18
+ var context = useContext(HighlightColorContext);
19
+ if (!context) {
20
+ throw new Error('\'HighlightColorContext\' is null');
21
+ }
22
+ var color = context.color,
23
+ updateColor = context.updateColor;
24
+ return {
25
+ color: color,
26
+ updateColor: updateColor
27
+ };
28
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.1.90",
3
+ "version": "0.1.91",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",