@seafile/sdoc-editor 3.0.257-alpha.1 → 3.0.257-alpha.3
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.
- package/dist/assets/css/layout.css +5 -1
- package/dist/assets/css/sdoc-editor-article.css +10 -2
- package/dist/assets/css/sdoc-editor-plugins.css +17 -0
- package/dist/comment/components/comment-all-participants/index.css +9 -4
- package/dist/comment/components/comment-list.css +128 -13
- package/dist/comment/components/comment-participants-editor/index.css +8 -8
- package/dist/comment/components/elements-comment-count/index.css +8 -0
- package/dist/comment/components/global-comment/index.css +60 -12
- package/dist/comment/components/style.css +10 -2
- package/dist/extension/commons/color-menu/index.js +10 -3
- package/dist/extension/plugins/code-block/element.css +25 -5
- package/dist/extension/plugins/file-link/render-elem.css +26 -5
- package/dist/extension/plugins/sdoc-link/render/render-elem.css +24 -4
- package/dist/extension/plugins/table/render/index.css +10 -2
- package/dist/extension/plugins/table/render/render-cell.js +4 -4
- package/dist/extension/plugins/table/render/table-header/index.css +17 -0
- package/dist/extension/plugins/text-style/helpers.js +8 -1
- package/dist/extension/plugins/text-style/menu/index.js +4 -3
- package/dist/extension/plugins/text-style/render-elem.js +1 -4
- package/dist/extension/toolbar/side-toolbar/helpers.js +1 -0
- package/dist/extension/toolbar/side-toolbar/index.css +15 -3
- package/dist/extension/toolbar/side-toolbar/side-menu.js +11 -10
- package/dist/outline/style.css +59 -13
- package/dist/right-panel/index.css +5 -1
- package/dist/wiki-outline/style.css +15 -3
- package/package.json +1 -1
- package/dist/extension/commons/search-list/index.css +0 -28
- package/dist/extension/commons/search-list/index.js +0 -154
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
.sdoc-search-list {
|
|
2
|
-
display: flex;
|
|
3
|
-
height: 100%;
|
|
4
|
-
width: 100%;
|
|
5
|
-
flex-direction: column;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.sdoc-search-list .sdoc-search-list-wrapper {
|
|
9
|
-
padding: 12px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.sdoc-search-list .sdoc-search-list-wrapper>input {
|
|
13
|
-
font-size: 12px;
|
|
14
|
-
max-height: 30px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.sdoc-search-list .sdoc-search-list-content-wrapper {
|
|
18
|
-
min-height: 0;
|
|
19
|
-
min-width: 0;
|
|
20
|
-
flex: 1;
|
|
21
|
-
overflow: auto;
|
|
22
|
-
max-height: 300px;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.sdoc-search-list .sdoc-search-list-with-no-results {
|
|
26
|
-
font-size: 12px;
|
|
27
|
-
padding: 4px 16px;
|
|
28
|
-
}
|
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard")["default"];
|
|
4
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault")["default"];
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = SearchList;
|
|
9
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _reactI18next = require("react-i18next");
|
|
12
|
-
var _reactstrap = require("reactstrap");
|
|
13
|
-
var _constants = require("../../../constants");
|
|
14
|
-
require("./index.css");
|
|
15
|
-
function SearchList(_ref) {
|
|
16
|
-
var originalList = _ref.list,
|
|
17
|
-
ListItem = _ref.listItem,
|
|
18
|
-
onListItemClick = _ref.onListItemClick,
|
|
19
|
-
onEscClick = _ref.onEscClick;
|
|
20
|
-
var _useTranslation = (0, _reactI18next.useTranslation)('sdoc-editor'),
|
|
21
|
-
t = _useTranslation.t;
|
|
22
|
-
var inputWrapperRef = (0, _react.useRef)(null);
|
|
23
|
-
var isComposingRef = (0, _react.useRef)(null);
|
|
24
|
-
var listRefs = (0, _react.useRef)([]);
|
|
25
|
-
var _useState = (0, _react.useState)(originalList),
|
|
26
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
27
|
-
searchedList = _useState2[0],
|
|
28
|
-
setSearchedList = _useState2[1];
|
|
29
|
-
var _useState3 = (0, _react.useState)(-1),
|
|
30
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
31
|
-
currentSelectIndex = _useState4[0],
|
|
32
|
-
setCurrentSelectIndex = _useState4[1];
|
|
33
|
-
|
|
34
|
-
// search input
|
|
35
|
-
var onChange = (0, _react.useCallback)(function (event) {
|
|
36
|
-
if (isComposingRef.current) return;
|
|
37
|
-
var value = event.target.value.trim();
|
|
38
|
-
if (value) {
|
|
39
|
-
var list = originalList.filter(function (item) {
|
|
40
|
-
return item.label.indexOf(value) > -1;
|
|
41
|
-
});
|
|
42
|
-
setSearchedList(list);
|
|
43
|
-
} else {
|
|
44
|
-
setSearchedList(originalList);
|
|
45
|
-
}
|
|
46
|
-
}, [originalList]);
|
|
47
|
-
var onCompositionStart = (0, _react.useCallback)(function () {
|
|
48
|
-
isComposingRef.current = true;
|
|
49
|
-
}, []);
|
|
50
|
-
var onCompositionEnd = (0, _react.useCallback)(function (e) {
|
|
51
|
-
isComposingRef.current = false;
|
|
52
|
-
onChange(e);
|
|
53
|
-
}, [onChange]);
|
|
54
|
-
|
|
55
|
-
// search content list
|
|
56
|
-
var onItemClick = (0, _react.useCallback)(function (item) {
|
|
57
|
-
onListItemClick && onListItemClick(item);
|
|
58
|
-
}, [onListItemClick]);
|
|
59
|
-
var onHandleInputFocus = (0, _react.useCallback)(function (isFocus) {
|
|
60
|
-
if (inputWrapperRef.current) {
|
|
61
|
-
queueMicrotask(function () {
|
|
62
|
-
isFocus ? inputWrapperRef.current.focus() : inputWrapperRef.current.blur();
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
}, []);
|
|
66
|
-
(0, _react.useEffect)(function () {
|
|
67
|
-
if (currentSelectIndex === -1) {
|
|
68
|
-
onHandleInputFocus(true);
|
|
69
|
-
} else {
|
|
70
|
-
onHandleInputFocus(false);
|
|
71
|
-
}
|
|
72
|
-
}, [currentSelectIndex, onHandleInputFocus]);
|
|
73
|
-
var handleClick = (0, _react.useCallback)(function (event) {
|
|
74
|
-
var _inputWrapperRef$curr;
|
|
75
|
-
if (inputWrapperRef !== null && inputWrapperRef !== void 0 && (_inputWrapperRef$curr = inputWrapperRef.current) !== null && _inputWrapperRef$curr !== void 0 && _inputWrapperRef$curr.contains(event.target) || inputWrapperRef.current === event.target) {
|
|
76
|
-
event.stopPropagation();
|
|
77
|
-
event.nativeEvent && event.nativeEvent.stopImmediatePropagation && event.nativeEvent.stopImmediatePropagation();
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}, []);
|
|
81
|
-
var scrollIntoView = (0, _react.useCallback)(function (index) {
|
|
82
|
-
if (index === -1) return;
|
|
83
|
-
listRefs.current[index].scrollIntoView({
|
|
84
|
-
behavior: 'smooth',
|
|
85
|
-
block: 'center',
|
|
86
|
-
inline: 'nearest'
|
|
87
|
-
});
|
|
88
|
-
}, []);
|
|
89
|
-
var handleKeyDown = (0, _react.useCallback)(function (e) {
|
|
90
|
-
var UpArrow = _constants.KeyCodes.UpArrow,
|
|
91
|
-
DownArrow = _constants.KeyCodes.DownArrow,
|
|
92
|
-
Enter = _constants.KeyCodes.Enter,
|
|
93
|
-
Esc = _constants.KeyCodes.Esc;
|
|
94
|
-
var keyCode = e.keyCode;
|
|
95
|
-
if (keyCode === UpArrow) {
|
|
96
|
-
e.preventDefault();
|
|
97
|
-
if (currentSelectIndex > -1) {
|
|
98
|
-
setCurrentSelectIndex(currentSelectIndex - 1);
|
|
99
|
-
scrollIntoView(currentSelectIndex - 1);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
if (keyCode === DownArrow) {
|
|
103
|
-
e.preventDefault();
|
|
104
|
-
if (currentSelectIndex === searchedList.length - 1) return;
|
|
105
|
-
if (currentSelectIndex < searchedList.length - 1) {
|
|
106
|
-
setCurrentSelectIndex(currentSelectIndex + 1);
|
|
107
|
-
scrollIntoView(currentSelectIndex + 1);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (keyCode === Enter) {
|
|
111
|
-
e.preventDefault();
|
|
112
|
-
var item = searchedList[currentSelectIndex];
|
|
113
|
-
onItemClick(item);
|
|
114
|
-
}
|
|
115
|
-
if (keyCode === Esc) {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
onEscClick && onEscClick();
|
|
118
|
-
}
|
|
119
|
-
}, [currentSelectIndex, onEscClick, onItemClick, scrollIntoView, searchedList]);
|
|
120
|
-
(0, _react.useEffect)(function () {
|
|
121
|
-
document.addEventListener('mousedown', handleClick);
|
|
122
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
123
|
-
return function () {
|
|
124
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
125
|
-
document.removeEventListener('click', handleClick);
|
|
126
|
-
};
|
|
127
|
-
}, [handleClick, handleKeyDown]);
|
|
128
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
129
|
-
className: "sdoc-search-list"
|
|
130
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
131
|
-
className: "sdoc-search-list-wrapper"
|
|
132
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactstrap.Input, {
|
|
133
|
-
innerRef: inputWrapperRef,
|
|
134
|
-
placeholder: t('Search_1'),
|
|
135
|
-
onChange: onChange,
|
|
136
|
-
onCompositionStart: onCompositionStart,
|
|
137
|
-
onCompositionEnd: onCompositionEnd
|
|
138
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
139
|
-
className: "sdoc-search-list-content-wrapper"
|
|
140
|
-
}, searchedList.length === 0 && /*#__PURE__*/_react["default"].createElement("div", {
|
|
141
|
-
className: "sdoc-search-list-with-no-results"
|
|
142
|
-
}, t('No_results')), searchedList.map(function (item, index) {
|
|
143
|
-
var isSelected = index === currentSelectIndex;
|
|
144
|
-
return /*#__PURE__*/_react["default"].createElement(ListItem, {
|
|
145
|
-
innerRef: function innerRef(el) {
|
|
146
|
-
return listRefs.current[index] = el;
|
|
147
|
-
},
|
|
148
|
-
key: index,
|
|
149
|
-
item: item,
|
|
150
|
-
onItemClick: onItemClick,
|
|
151
|
-
isSelected: isSelected
|
|
152
|
-
});
|
|
153
|
-
})));
|
|
154
|
-
}
|