@seafile/sdoc-editor 1.0.76 → 1.0.78

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.
@@ -173,9 +173,10 @@ const ParticipantPopover = _ref => {
173
173
  return;
174
174
  }
175
175
  if (event.keyCode === _constants3.KeyCodes.Enter) {
176
- if (collaboratorsPopoverRef.current) {
176
+ if (searchedCollaborators.length > 0) {
177
177
  handleSelectCollaborator();
178
178
  event.preventDefault();
179
+ event.stopPropagation();
179
180
  } else {
180
181
  (0, _helper.transformToText)(editor);
181
182
  }
@@ -187,6 +188,21 @@ const ParticipantPopover = _ref => {
187
188
  }
188
189
  handleInvolvedKeyUp(event);
189
190
  }, [editor, handleInvolvedKeyUp, handleSelectCollaborator, handleSelectingCollaborator]);
191
+
192
+ //Add the Enter keydown event listener during the capture phase
193
+ (0, _react.useEffect)(() => {
194
+ const handleKeydownCapture = event => {
195
+ if (event.keyCode === _constants3.KeyCodes.Enter) {
196
+ handleMentionChosen({
197
+ event
198
+ });
199
+ }
200
+ };
201
+ document.addEventListener('keydown', handleKeydownCapture, true);
202
+ return () => {
203
+ document.removeEventListener('keydown', handleKeydownCapture, true);
204
+ };
205
+ }, [handleMentionChosen]);
190
206
  const handleSearchTextChange = (0, _react.useCallback)(() => {
191
207
  const newCollaborators = getSearchedCollaborators(searchText);
192
208
  if (newCollaborators.length === 0) {
@@ -47,9 +47,13 @@ const Paragraph = _ref => {
47
47
  paddingBottom: '5px',
48
48
  paddingLeft: indent ? '28px' : ''
49
49
  };
50
+ let customAttributes = attributes;
51
+ if (element.id === 'document-render-complete') {
52
+ customAttributes['id'] = element.id;
53
+ }
50
54
  return /*#__PURE__*/_react.default.createElement("div", Object.assign({
51
55
  "data-id": element.id
52
- }, attributes, {
56
+ }, customAttributes, {
53
57
  style: {
54
58
  position: isShowPlaceHolder ? 'relative' : '',
55
59
  ...style
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "1.0.76",
3
+ "version": "1.0.78",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",